v1.2.10.2
This commit is contained in:
@@ -202,7 +202,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
String methodValue = ContactMethod[idx];
|
||||
String value = ContactValue[idx];
|
||||
if (methodValue == null & value == null) continue;
|
||||
if (methodValue == null && value == null) continue;
|
||||
Sax.ContactMethod method = EnumUtil.ParseEnum(methodValue, Sax.ContactMethod.Unknown);
|
||||
if (method > 0 && !value.IsEmpty() && SaxContactMethodHelper.IsValidContactMethodValue(method, value))
|
||||
ContactData.SetContactMethodValue(method, value);
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
"Location": "MsSql:.\\SQLExpress2012.Saxonite_Core_Demo",
|
||||
"User": "sax-demo-user",
|
||||
"Password": "sax-demo-202105"
|
||||
},
|
||||
"Support": {
|
||||
"Location": "MsSql:.\\SQLExpress2012.Saxonite_Support_Demo",
|
||||
"User": "sax-demo-user",
|
||||
"Password": "sax-demo-202105"
|
||||
}
|
||||
},
|
||||
"Security": {
|
||||
|
||||
@@ -15,6 +15,8 @@ using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using static Saxonite.Net.Standard.Base.App.Sax.Config;
|
||||
using static Saxonite.Net.Standard.Base.Bus.SaxArticle;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
@@ -37,10 +39,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
private class ProfileSportResponseItemData : ProfileSportResponseListData
|
||||
{
|
||||
public String SportAbout { get; set; }
|
||||
public List<SportContactData> Contacts { get; set; }
|
||||
public String SportParticipatingCode { get; set; }
|
||||
public String SportPreparingCode { get; set; }
|
||||
public String SportOfficiatingCode { get; set; }
|
||||
}
|
||||
public class SportContactData
|
||||
{
|
||||
public String ContactType { get; set; }
|
||||
public String ContactTypeDesc { get; set; }
|
||||
public String Title { get; set; }
|
||||
public String FirstName { get; set; }
|
||||
public String LastName { get; set; }
|
||||
public String EmailAddress { get; set; }
|
||||
public String Phone { get; set; }
|
||||
}
|
||||
private void PopulateProfileSportResponseListData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseListData data)
|
||||
{
|
||||
data.Id = model.EncryptId(userSport.Id);
|
||||
@@ -55,6 +68,24 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
PopulateProfileSportResponseListData(model, userSport, sport, data);
|
||||
data.SportAbout = userSport.About;
|
||||
// Sport Contacts.
|
||||
SaxSportContactsData sportContacts = new SaxSportContactsData(userSport.ContactsData);
|
||||
foreach (Sax.SportContactType contactType in sportContacts.ContactTypes)
|
||||
{
|
||||
if (data.Contacts == null) data.Contacts = new List<SportContactData>();
|
||||
SportContactData sportContact =
|
||||
new SportContactData()
|
||||
{
|
||||
ContactType = SportContactTypeCodes.GetCodeForType(contactType),
|
||||
ContactTypeDesc = Localiser.GetSportContactTypeCaption(contactType),
|
||||
Title = sportContacts.GetContactTitle(contactType),
|
||||
FirstName = sportContacts.GetContactFirstName(contactType),
|
||||
LastName = sportContacts.GetContactLastName(contactType),
|
||||
EmailAddress = sportContacts.GetContactEmailAddress(contactType),
|
||||
Phone = sportContacts.GetContactPhone(contactType),
|
||||
};
|
||||
data.Contacts.Add(sportContact);
|
||||
}
|
||||
data.SportParticipatingCode = SportParticipatingCodes.GetCodeForType(userSport.Participating);
|
||||
data.SportPreparingCode = SportPreparingCodes.GetCodeForType(userSport.Preparing);
|
||||
data.SportOfficiatingCode = SportOfficiatingCodes.GetCodeForType(userSport.Officiating);
|
||||
@@ -352,6 +383,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Populate item properties.
|
||||
if (model.ProfileSportAbout != null)
|
||||
userSport.About = model.ProfileSportAbout;
|
||||
if (model.Contacts.ContactsData != null)
|
||||
userSport.ContactsData = model.Contacts.ContactsData.ToXml();
|
||||
if (model.ProfileSportParticipatingCode != null)
|
||||
userSport.Participating = model.ProfileSportParticipating;
|
||||
if (model.ProfileSportPreparingCode != null)
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
String methodValue = ContactMethod[idx];
|
||||
String value = ContactValue[idx];
|
||||
if (methodValue == null & value == null) continue;
|
||||
if (methodValue == null && value == null) continue;
|
||||
Sax.ContactMethod method = EnumUtil.ParseEnum(methodValue, Sax.ContactMethod.Unknown);
|
||||
if (method > 0 && !value.IsEmpty() && SaxContactMethodHelper.IsValidContactMethodValue(method, value))
|
||||
ContactData.SetContactMethodValue(method, value);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -8,10 +9,13 @@ using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Core.Web.Base.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static Saxonite.Net.Standard.Base.App.Sax;
|
||||
using static Saxonite.Net.Standard.Base.Bus.SaxArticle;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
@@ -87,11 +91,13 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public String Count { get; set; }
|
||||
public String[] ContactType { get; set; }
|
||||
public String[] UserAccountId { get; set; }
|
||||
public String[] ContactName { get; set; }
|
||||
public String[] ContactPhone { get; set; }
|
||||
public String[] ContactEmail { get; set; }
|
||||
public String[] Title { get; set; }
|
||||
public String[] FirstName { get; set; }
|
||||
public String[] LastName { get; set; }
|
||||
public String[] EmailAddress { get; set; }
|
||||
public String[] Phone { get; set; }
|
||||
/// <summary>Sport Contacts to be populated during validation.</summary>
|
||||
public SaxSportContactsData SportContactsData { get; set; }
|
||||
public SaxSportContactsData ContactsData { get; set; }
|
||||
}
|
||||
public SportsContactsData Contacts {get; } = new SportsContactsData();
|
||||
|
||||
@@ -197,6 +203,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Validate Sport data.
|
||||
public bool ValidateProfileSportData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
String fn = GetType().Name + ".ValidateProfileSportData";
|
||||
|
||||
// Sport.
|
||||
if (ProfileSportId != null)
|
||||
{
|
||||
@@ -216,6 +224,40 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
}
|
||||
}
|
||||
|
||||
// Sport Contacts.
|
||||
if (Contacts != null)
|
||||
{
|
||||
Contacts.ContactsData = new SaxSportContactsData("");
|
||||
Contacts.ContactType= Contacts.ContactType ?? new String[0];
|
||||
Contacts.Title= Contacts.Title ?? new String[0];
|
||||
Contacts.FirstName = Contacts.FirstName ?? new String[0];
|
||||
Contacts.LastName = Contacts.LastName ?? new String[0];
|
||||
Contacts.EmailAddress = Contacts.EmailAddress ?? new String[0];
|
||||
for (int idx = 0; idx < Contacts.ContactType.Length; idx++)
|
||||
{
|
||||
String contactTypeValue = Contacts.ContactType[idx];
|
||||
String title = idx < Contacts.Title.Length ? Contacts.Title[idx] : null;
|
||||
String firstName = idx < Contacts.FirstName.Length ? Contacts.FirstName[idx] : null;
|
||||
String lastName = idx < Contacts.LastName.Length ? Contacts.LastName[idx] : null;
|
||||
String emailAddress = idx < Contacts.EmailAddress.Length ? Contacts.EmailAddress[idx] : null;
|
||||
String phone = idx < Contacts.Phone.Length ? Contacts.Phone[idx] : null;
|
||||
if (StringUtil.IsBlank(contactTypeValue) && StringUtil.IsBlank(lastName)) continue;
|
||||
Sax.SportContactType contactType= (Sax.SportContactType)SportContactTypeCodes.GetTypeForCode(contactTypeValue);
|
||||
if (contactType > 0)
|
||||
{
|
||||
Contacts.ContactsData.SetContactName(contactType, title, firstName, lastName);
|
||||
Contacts.ContactsData.SetContactEmailAddress(contactType, emailAddress);
|
||||
Contacts.ContactsData.SetContactPhone(contactType, phone);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Invalid Sport Contact data. Type: " + contactTypeValue + ". Last name: " + lastName);
|
||||
}
|
||||
if (Contacts.ContactsData.ContactTypes.Count != Contacts.Count.ToInt())
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent Contact Methods received. Expected: " + Contacts.Count + ". Received: " + Contacts.ContactsData.ContactTypes.Count);
|
||||
responseData.SetMessage("caption.contact.method", "System error");
|
||||
}
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
@* Sport Contacts *@
|
||||
<div class="sax-form-control SportContacts">
|
||||
<input type="hidden" name="Sport.Contacts" value="0" />
|
||||
<input type="hidden" name="Contacts.Count" value="0" />
|
||||
<div class="row">
|
||||
<div class="col-sm-3 row">
|
||||
<div class="col">
|
||||
@@ -56,13 +56,15 @@
|
||||
<table class="sax-panel-item-template">
|
||||
<tr class="Contact">
|
||||
<td style="width:20px;"><div class="sax-label nowrap"></div></td>
|
||||
<td class="sax-name" style="width:70%;word-break: break-all;"></td>
|
||||
<td class="sax-details" style="width:70%;word-break: break-all;"></td>
|
||||
<td class="sax-value Name" style="width:40%;word-break: break-all;"></td>
|
||||
<td class="sax-value Details" style="width:40%;overflow-x:hidden;"></td>
|
||||
<td class="sax-actions right nowrap" style="min-width:10px;">
|
||||
<input type="hidden" name="Contacts.ContactType" />
|
||||
<input type="hidden" name="Contacts.ContactName" />
|
||||
<input type="hidden" name="Contacts.ContactPhone" />
|
||||
<input type="hidden" name="Contacts.ContactEmail" />
|
||||
<input type="hidden" name="Contacts.Title" />
|
||||
<input type="hidden" name="Contacts.FirstName" />
|
||||
<input type="hidden" name="Contacts.LastName" />
|
||||
<input type="hidden" name="Contacts.Phone" />
|
||||
<input type="hidden" name="Contacts.EmailAddress" />
|
||||
<div class="nowrap">
|
||||
<div class="inlineb sax-action sax-edit"><img src="~/img/action/edit16.png" alt="@(Localiser["label.edit"])" title="@(Localiser["label.edit"])" /></div>
|
||||
<div class="inlineb sax-action sax-remove"><img src="~/img/action/delete16.png" alt="@(Localiser["label.remove"])" title="@(Localiser["label.remove"])" /></div>
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"Location": "MsSql:.\\SQLExpress2012.Saxonite_Core_Demo",
|
||||
"User": "sax-demo-user",
|
||||
"Password": "sax-demo-202105"
|
||||
},
|
||||
"Support": {
|
||||
"Location": "MsSql:.\\SQLExpress2012.Saxonite_Support_Demo",
|
||||
"User": "sax-demo-user",
|
||||
"Password": "sax-demo-202105"
|
||||
}
|
||||
},
|
||||
"Security": {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@@ -174,8 +174,7 @@
|
||||
//--------------------------------------------------------------
|
||||
po.getConMthCfg = function (usedMths, mth, val)
|
||||
{
|
||||
let cfg = { fnCallback: po.applyConMth, methods: po.data.contactMethods, methodsUsed: usedMths, method: mth, value: val };
|
||||
return cfg;
|
||||
return { fnCallback: po.applyConMth, methods: po.data.contactMethods, methodsUsed: usedMths, method: mth, value: val };
|
||||
}
|
||||
po.getUsedMths = function ()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
"use strict";
|
||||
let ps = sax.mdl.profileSports = { ajax: {}, data: {}, $pnl: {}, $dlg: {}, $frm: {} };
|
||||
let ps = sax.mdl.profileSports = { ajax: {}, data: {}, $pnl: {}, $tmpl: {}, $dlg: {}, $frm: {} };
|
||||
let $pnl = ps.$pnl, $dlg = ps.$dlg, $frm = ps.$frm;
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileSportsInfo = function (delay)
|
||||
@@ -78,6 +78,7 @@
|
||||
let dlg = $dlg.spt;
|
||||
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,textarea.sax-textarea,select.sax-select', dlg).val('');
|
||||
$('.SelectSport', dlg).show();
|
||||
$pnl.sptConTbl.empty();
|
||||
sax.clearControlErrors(dlg);
|
||||
}
|
||||
ps.updateProfileSport = function (item)
|
||||
@@ -99,6 +100,13 @@
|
||||
$('#ifProfileSportId', frm).val(item.sportId);
|
||||
$('#ifProfileSport', frm).val(item.sportName);
|
||||
$('#ifProfileSportAbout', frm).val(item.sportAbout);
|
||||
let contacts = item.contacts || [];
|
||||
for (let idx = 0; idx < contacts.length; idx++)
|
||||
{
|
||||
let contact = contacts[idx];
|
||||
$pnl.sptConTbl.append(ps.populateSportContact(ps.$tmpl.sptCon.clone(), contact));
|
||||
}
|
||||
ps.sortSptCons();
|
||||
$('#cbProfileSportParticipating', frm).val(item.sportParticipatingCode);
|
||||
$('#cbProfileSportPreparing', frm).val(item.sportPreparingCode);
|
||||
$('#cbProfileSportOfficiating', frm).val(item.sportOfficiatingCode);
|
||||
@@ -121,34 +129,60 @@
|
||||
//--------------------------------------------------------------
|
||||
ps.getSportContactCfg = function (contact)
|
||||
{
|
||||
let cfg = { fnCallback: ps.applySportContact, contactTypes: ps.data.contactTypes, titles: ps.data.titles, typesUsed: ps.getUsedContactTypes(), contact: contact};
|
||||
return cfg;
|
||||
return { fnCallback: ps.applySportContact, contactTypes: ps.data.contactTypes, titles: ps.data.titles, contactTypesUsed: !contact ? ps.getUsedContactTypes() : [], contact: contact };
|
||||
}
|
||||
ps.getUsedContactTypes = function ()
|
||||
{
|
||||
return $('input[name="Contacts.ContactTypes"]', $frm.org).map(function () { return $(this).val(); }).get();
|
||||
return $('.SportContacts input[name="Contacts.ContactType"]', $frm.org).map(function () { return $(this).val(); }).get();
|
||||
}
|
||||
ps.addSportContact = function ()
|
||||
{
|
||||
//sax.debug('addSportContact');
|
||||
ps.showSportContact(ps.getSportContactCfg());
|
||||
ps.editSportContact();
|
||||
}
|
||||
ps.editSportContact= function (contact)
|
||||
ps.editSportContact = function (contact)
|
||||
{
|
||||
//sax.debug('editSportContact');
|
||||
ps.showSportContact(ps.getSportContactCfg(contact));
|
||||
sax.mdl.sportContact.showSportContact(ps.getSportContactCfg(contact));
|
||||
}
|
||||
ps.showSportContact=function(cfg)
|
||||
ps.clearSportContact = function (contact)
|
||||
{
|
||||
sax.mdl.sportContact.showSportContact(cfg);
|
||||
$('#' + po.getSptConId(contact), $pnl.sptConTbl).remove();
|
||||
po.sortSptCons();
|
||||
}
|
||||
ps.getConId = function (contact)
|
||||
ps.getSptConId = function (contact)
|
||||
{
|
||||
return 'SptCon_' + contact.type;
|
||||
return 'SptCon_' + contact.contactType;
|
||||
}
|
||||
ps.applySportContact = function (contact)
|
||||
{
|
||||
//sax.debug('applySportContact', contact);
|
||||
let $sptCon = $('#' + ps.getSptConId(contact));
|
||||
if (!$sptCon.length) $pnl.sptConTbl.append($sptCon = ps.$tmpl.sptCon.clone());
|
||||
ps.populateSportContact($sptCon, contact);
|
||||
ps.sortSptCons();
|
||||
}
|
||||
ps.populateSportContact = function ($sptCon, contact)
|
||||
{
|
||||
$sptCon.prop('id', ps.getSptConId(contact));
|
||||
$('.sax-label', $sptCon).text(contact.contactTypeDesc);
|
||||
$('.sax-value.Name', $sptCon).text((contact.title + " " + contact.firstName + " " + contact.lastName).trim());
|
||||
$('.sax-value.Details', $sptCon).text(contact.emailAddress);
|
||||
$('input[name="Contacts.ContactType"]', $sptCon).val(contact.contactType);
|
||||
$('input[name="Contacts.Title"]', $sptCon).val(contact.title);
|
||||
$('input[name="Contacts.FirstName"]', $sptCon).val(contact.firstName);
|
||||
$('input[name="Contacts.LastName"]', $sptCon).val(contact.lastName);
|
||||
$('input[name="Contacts.EmailAddress"]', $sptCon).val(contact.emailAddress);
|
||||
$('input[name="Contacts.Phone"]', $sptCon).val(contact.phone);
|
||||
$sptCon.on('click', '.sax-action.sax-edit', function () { ps.editSportContact(contact); });
|
||||
$sptCon.on('click', '.sax-action.sax-remove', function () { ps.clearSportContact(contact); });
|
||||
return $sptCon;
|
||||
}
|
||||
ps.sortSptCons = function ()
|
||||
{
|
||||
let $rows = $pnl.sptConTbl.find('tr').detach().sort(function (a, b)
|
||||
{
|
||||
return $('.sax-label', a).text().localeCompare($('.sax-label', b).text());
|
||||
}).appendTo($pnl.sptConTbl);
|
||||
$('input[name="Contacts.Count"]', $pnl.sptCons).val($rows.length);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
ps.storeProfileSport = function ()
|
||||
@@ -179,6 +213,9 @@
|
||||
$frm.spt.on('dblclick', '.ProfileSport.sax-input', ps.selectUserSport);
|
||||
$frm.spt.on('click', '.SelectSport.sax-button', ps.selectUserSport);
|
||||
$frm.spt.on('click', '.SportContacts .sax-action.sax-add', ps.addSportContact);
|
||||
$pnl.sptCons = $('.SportContacts', $dlg.spt);
|
||||
$pnl.sptConTbl = $('.Contacts table.sax-data', $pnl.sptCons);
|
||||
ps.$tmpl.sptCon = $('.sax-panel-item-template .Contact', $pnl.sptCons).detach();
|
||||
});
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
@@ -22,17 +22,18 @@
|
||||
{
|
||||
//sax.debug('showSportContact', cfg);
|
||||
sc.fn.cleanUp();
|
||||
cfg.contact = cfg.contact || {};
|
||||
sc.data.cfg = cfg;
|
||||
sc.populateContactTypes(cfg);
|
||||
sc.populateTitles(cfg);
|
||||
sc.fn.displaySportContact(cfg.contact || {});
|
||||
sc.fn.displaySportContact(cfg.contact);
|
||||
sax.clearControlErrors(sc.$dlg.sptCnt);
|
||||
sax.openDialog(sc.$dlg.sptCnt.dialog('option', { title: sc.data.cfg.caption || 'Sport Contact' }), sc.data.cfg.width || 640, sc.data.cfg.height || 320);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
sc.populateContactTypes = function (cfg)
|
||||
{
|
||||
let contact = cfg.contact || {};
|
||||
let contact = cfg.contact;
|
||||
sc.$ctrl.contactType.empty();
|
||||
if (!contact.contactType)
|
||||
sc.$ctrl.contactType.append($('<option>').prop('selected', true));
|
||||
@@ -41,11 +42,10 @@
|
||||
if (typ.code && typ.code == cfg.contactType || !(cfg.contactTypesUsed || []).includes(typ.code))
|
||||
sc.$ctrl.contactType.append($('<option>').prop('value', typ.code).text(typ.desc));
|
||||
}
|
||||
//sc.$ctrl.contactType.val(contact.contactType).attr('disabled', contact.contactType && sc.$ctrl.contactType.val() == contact.contactType ? true : null);
|
||||
sc.$ctrl.contactType.val(contact.contactType).attr('disabled', contact.contactType && sc.$ctrl.contactType.val() == contact.contactType ? true : null);
|
||||
}
|
||||
sc.populateTitles = function (cfg)
|
||||
{
|
||||
let contact = cfg.contact || {};
|
||||
sc.$ctrl.title.empty();
|
||||
sc.$ctrl.title.append($('<option>').prop('selected', true));
|
||||
for (let typ of cfg.titles || [])
|
||||
@@ -56,7 +56,11 @@
|
||||
}
|
||||
sc.fn.displaySportContact = function (contact)
|
||||
{
|
||||
sc.$ctrl.emailAddress.val(contact.email);
|
||||
sc.$ctrl.contactType.val(contact.contactType);
|
||||
sc.$ctrl.emailAddress.val(contact.emailAddress);
|
||||
sc.$ctrl.title.val(contact.title);
|
||||
sc.$ctrl.firstName.val(contact.firstName);
|
||||
sc.$ctrl.lastName.val(contact.lastName);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
sc.fn.storeSportContact = function ()
|
||||
@@ -69,7 +73,7 @@
|
||||
//sax.debug('storeSportContact handle response', response);
|
||||
sax.refreshControlValues(response.controlValues, sc.$dlg.sptCnt);
|
||||
if (!response.success || sax.hasControlErrors(sc.$dlg.sptCnt)) return;
|
||||
let contact = { contactType: sc.$ctrl.contactType.val(), email: sc.$ctrl.emailAddress.val(), title: sc.$ctrl.title.val(), firstName: sc.$ctrl.firstName.val(), lastName: sc.$ctrl.lastName.val() };
|
||||
let contact = { contactType: sc.$ctrl.contactType.val(), contactTypeDesc: $('option:selected', sc.$ctrl.contactType).text(), emailAddress: sc.$ctrl.emailAddress.val(), title: sc.$ctrl.title.val(), firstName: sc.$ctrl.firstName.val(), lastName: sc.$ctrl.lastName.val() };
|
||||
if (cfg.fnCallback) cfg.fnCallback(contact);
|
||||
sc.$dlg.sptCnt.dialog('close');
|
||||
sc.fn.cleanUp();
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.10.1";
|
||||
private static String version { get; } = "1.2.10.2";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
|
||||
@@ -6,6 +6,7 @@ using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
@@ -23,9 +24,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
private static readonly String AttributeName_Type = "Type";
|
||||
private static readonly String ElementName_Type = "Type";
|
||||
private static readonly String ElementName_UserAccountId = "UserAccountId";
|
||||
private static readonly String ElementName_Name = "Name";
|
||||
private static readonly String ElementName_Title = "Title";
|
||||
private static readonly String ElementName_FirstName = "FirstName";
|
||||
private static readonly String ElementName_LastName = "LastName";
|
||||
private static readonly String ElementName_Phone = "Phone";
|
||||
private static readonly String ElementName_Email = "Email";
|
||||
private static readonly String ElementName_EmailAddress = "EmailAddress";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -33,9 +36,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
public Sax.SportContactType ContactType { get; set; }
|
||||
public SysId UserAccountId { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String Title { get; set; }
|
||||
public String FirstName { get; set; }
|
||||
public String LastName { get; set; }
|
||||
public String EmailAddress { get; set; }
|
||||
public String Phone { get; set; }
|
||||
public String Email { get; set; }
|
||||
}
|
||||
private Dictionary<Sax.SportContactType, ContactData> contacts { get; } = new Dictionary<Sax.SportContactType, ContactData>();
|
||||
|
||||
@@ -66,10 +71,28 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
// Contacts.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Extract the name associated with the specified type.</summary>
|
||||
public String GetContactName(Sax.SportContactType contactType)
|
||||
/// <summary>Extract the title associated with the specified type.</summary>
|
||||
public String GetContactTitle(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Name;
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Title;
|
||||
}
|
||||
|
||||
/// <summary>Extract the first name associated with the specified type.</summary>
|
||||
public String GetContactFirstName(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).FirstName;
|
||||
}
|
||||
|
||||
/// <summary>Extract the last name associated with the specified type.</summary>
|
||||
public String GetContactLastName(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).LastName;
|
||||
}
|
||||
|
||||
/// <summary>Extract the email address associated with the specified type.</summary>
|
||||
public String GetContactEmailAddress(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).EmailAddress;
|
||||
}
|
||||
|
||||
/// <summary>Extract the phone associated with the specified type.</summary>
|
||||
@@ -78,19 +101,25 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Phone;
|
||||
}
|
||||
|
||||
/// <summary>Extract the email associated with the specified type.</summary>
|
||||
public String GetContactEmail(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Email;
|
||||
}
|
||||
|
||||
/// <summary>Set the name associated with the specified contact.</summary>
|
||||
public bool SetContactName(Sax.SportContactType contactType, String name)
|
||||
public bool SetContactName(Sax.SportContactType contactType, String title, String firstName, String lastName)
|
||||
{
|
||||
if ((int)contactType < 1 || name.IsEmpty()) return false;
|
||||
if ((int)contactType < 1 || lastName.IsEmpty()) return false;
|
||||
ContactData contact = GetContactData(contactType);
|
||||
if (contact == null) return false;
|
||||
contact.Name = name;
|
||||
contact.Title = title;
|
||||
contact.FirstName = firstName;
|
||||
contact.LastName = lastName;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Set the email address associated with the specified contact.</summary>
|
||||
public bool SetContactEmailAddress(Sax.SportContactType contactType, String emailAddress)
|
||||
{
|
||||
if ((int)contactType < 1 || emailAddress.IsEmpty()) return false;
|
||||
ContactData contact = GetContactData(contactType);
|
||||
if (contact == null) return false;
|
||||
contact.EmailAddress = emailAddress;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -104,16 +133,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Set the email associated with the specified contact.</summary>
|
||||
public bool SetContactEmail(Sax.SportContactType contactType, String email)
|
||||
{
|
||||
if ((int)contactType < 1 || email.IsEmpty()) return false;
|
||||
ContactData contact = GetContactData(contactType);
|
||||
if (contact == null) return false;
|
||||
contact.Email = email;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Clear the value associated with the specified method.</summary>
|
||||
public bool ClearContact(Sax.SportContactType contactType)
|
||||
@@ -140,16 +159,20 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
XElement contactsElement = doc.AppendElement(ElementName_Contacts);
|
||||
foreach (ContactData contactData in contacts.Values)
|
||||
{
|
||||
if ((int)contactData.ContactType < 1 || (!SysId.IsValid(contactData.UserAccountId) && contactData.Name.IsEmpty())) continue;
|
||||
if ((int)contactData.ContactType < 1 || (!SysId.IsValid(contactData.UserAccountId) && StringUtil.IsBlank(contactData.LastName))) continue;
|
||||
XElement contactElement = contactsElement.AppendElement(ElementName_Contact);
|
||||
contactElement.SetAttribute(AttributeName_Type, ((int)contactData.ContactType).ToString());
|
||||
contactElement.AppendElement(ElementName_Type, contactData.ContactType.ToString());
|
||||
if (!StringUtil.IsBlank(contactData.Name))
|
||||
contactElement.AppendElement(ElementName_Name, contactData.Name);
|
||||
if (!StringUtil.IsBlank(contactData.Title))
|
||||
contactElement.AppendElement(ElementName_Title, contactData.Title);
|
||||
if (!StringUtil.IsBlank(contactData.FirstName))
|
||||
contactElement.AppendElement(ElementName_FirstName, contactData.FirstName);
|
||||
if (!StringUtil.IsBlank(contactData.LastName))
|
||||
contactElement.AppendElement(ElementName_LastName, contactData.LastName);
|
||||
if (!StringUtil.IsBlank(contactData.EmailAddress))
|
||||
contactElement.AppendElement(ElementName_EmailAddress, contactData.EmailAddress);
|
||||
if (!StringUtil.IsBlank(contactData.Phone))
|
||||
contactElement.AppendElement(ElementName_Phone, contactData.Phone);
|
||||
if (!StringUtil.IsBlank(contactData.Email))
|
||||
contactElement.AppendElement(ElementName_Email, contactData.Email);
|
||||
}
|
||||
return doc.GetXml();
|
||||
}
|
||||
@@ -187,9 +210,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
ContactType = contactType,
|
||||
UserAccountId = rootChildElement.GetChildText(ElementName_UserAccountId).ToSysId(),
|
||||
Name = rootChildElement.GetChildText(ElementName_Name),
|
||||
Title = rootChildElement.GetChildText(ElementName_Title),
|
||||
FirstName = rootChildElement.GetChildText(ElementName_FirstName),
|
||||
LastName = rootChildElement.GetChildText(ElementName_LastName),
|
||||
EmailAddress = rootChildElement.GetChildText(ElementName_EmailAddress),
|
||||
Phone = rootChildElement.GetChildText(ElementName_Phone),
|
||||
Email = rootChildElement.GetChildText(ElementName_Email),
|
||||
};
|
||||
contacts.Add(contactType, contactData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user