/trunk/src/mail139inport/ImportContact/AddressInput139Standard.cs
https://bitbucket.org/coudly/77fashion.com · C# · 958 lines · 837 code · 35 blank · 86 comment · 95 complexity · d5b4a07b8075f17b01166f88b543578a MD5 · raw file
- using System;
- using System.Collections;
- using System.Data;
- using System.IO;
- using System.Text;
- using System.Text.RegularExpressions;
- using Richinfo.Model.ADDR;
- using Richinfo.Business.ADDR.Logging;
-
- namespace Richinfo.Business.ADDR.Input
- {
- /// <summary>
- /// ?????
- /// ??????
- /// </summary>
- public class AddressInput139Standard
- {
-
- /// <summary>
- /// ???????
- /// </summary>
- private static DataTable DTAddressInputConfig = new DataTable();
-
- public AddressInput139Standard()
- {
- if (DTAddressInputConfig.Rows == null || DTAddressInputConfig.Rows.Count == 0)
- {
- string inputconfig = File.ReadAllText(Environment.CurrentDirectory + "\\InputConfig.xml");
-
- DTAddressInputConfig = Richinfo.Business.ADDR.XmlManager.XmlToData.CXmlToDatatTable(inputconfig);
- if (DTAddressInputConfig.Rows == null || DTAddressInputConfig.Rows.Count == 0)
- {
- Logger.Error("AddressInput139Standard Can't read rules for import contacts");
- }
- }
- }
-
- /// <summary>
- /// ??????addressDetail???????
- /// </summary>
- /// <param name="addressDetail"></param>
- private void DealAddressDetail(ContactsEntity addressDetail)
- {
- // ??? and ??? and ???
- if (string.IsNullOrEmpty(addressDetail.Addrfirstname)
- && !string.IsNullOrEmpty(addressDetail.Addrnickname)
- && string.IsNullOrEmpty(addressDetail.Addrsecondname))
- {
- addressDetail.Addrfirstname = addressDetail.Addrnickname;
- addressDetail.Addrnickname = string.Empty;
- addressDetail.Addrsecondname = string.Empty;
- }
- if (string.IsNullOrEmpty(addressDetail.Addrfirstname)
- && !string.IsNullOrEmpty(addressDetail.Addrsecondname))
- {
- addressDetail.Addrfirstname = addressDetail.Addrsecondname;
- addressDetail.Addrsecondname = string.Empty;
- }
- if (string.IsNullOrEmpty(addressDetail.Addrfirstname + addressDetail.Addrsecondname))
- {
- if (!string.IsNullOrEmpty(addressDetail.Addrnickname))
- {
- addressDetail.Addrfirstname = addressDetail.Addrnickname;
- addressDetail.Addrnickname = "";
- goto OtherDeal;
- }
- if (!string.IsNullOrEmpty(addressDetail.Mobilephone))
- {
- addressDetail.Addrfirstname = addressDetail.Mobilephone;
- goto OtherDeal;
- }
- if (!string.IsNullOrEmpty(addressDetail.Businessmobile))
- {
- addressDetail.Addrfirstname = addressDetail.Businessmobile;
- goto OtherDeal;
- }
- if (!string.IsNullOrEmpty(addressDetail.Othermobilephone))
- {
- addressDetail.Addrfirstname = addressDetail.Othermobilephone;
- goto OtherDeal;
- }
-
- if (!string.IsNullOrEmpty(addressDetail.Familyemail)
- && addressDetail.Familyemail.IndexOf("@") > -1
- )
- {
- addressDetail.Addrfirstname = addressDetail.Familyemail.Substring(
- 0,
- addressDetail.Familyemail.IndexOf("@") - 1);
- goto OtherDeal;
- }
- if (!string.IsNullOrEmpty(addressDetail.Businessemail))
- {
- addressDetail.Addrfirstname = addressDetail.Businessemail.Substring(
- 0,
- addressDetail.Businessemail.IndexOf("@") - 1);
- goto OtherDeal;
- }
- if (!string.IsNullOrEmpty(addressDetail.Otheremail))
- {
- addressDetail.Addrfirstname = addressDetail.Otheremail.Substring(
- 0,
- addressDetail.Otheremail.IndexOf("@") - 1);
- goto OtherDeal;
- }
- }
- OtherDeal:
- {
- //?????????(??)???(??)???(??)????
- addressDetail.Homeaddress =
- addressDetail.Countrycode +
- addressDetail.Provcode +
- addressDetail.Areacode +
- addressDetail.Citycode +
- addressDetail.Streetcode +
- addressDetail.Homeaddress;
-
- //?????????(??)???(??)???(??)????
- addressDetail.Cpaddress =
- addressDetail.Cpcountrycode +
- addressDetail.Cpprovcode +
- addressDetail.Cpareacode +
- addressDetail.Cpcitycode +
- addressDetail.Cpstreetcode +
- addressDetail.Cpaddress;
-
- //????????????????
- addressDetail.Userjob = addressDetail.Cpdepartname + addressDetail.Userjob;
- addressDetail.Cpdepartname = "";
- }
- }
-
- /// <summary>
- /// ?????
- /// </summary>
- /// <param name="userNumber"></param>
- /// <param name="serverFilePath"></param>
- /// <param name="existAdd"></param>
- /// <param name="groupName"></param>
- /// <returns></returns>
- public string InputData(string userNumber, string[] contacts,
- string groupName, out int rowCount)
- {
- string resultCode = "999";
- string strLine;
- string[] aryLine = new string[] { }, firstAryLine = new string[] { };
- int i = 0, lineCount = 0;
- rowCount = 0;
-
- try
- {
- if (contacts.Length < 1)
- {
- rowCount = 0;
- return AddressInput.ERR_NOTFOUND;
- }
-
- StringBuilder buff = new StringBuilder();
- buff.Append("<AddBatchContacts>");
- buff.Append("<UserNumber>");
- buff.Append(userNumber);
- buff.Append("</UserNumber>");
- buff.Append("<ImportType>3</ImportType>");
-
- firstAryLine = contacts[0].Split(new char[] { ',' });
- for (int j = 1; j < contacts.Length; j++)
- {
- strLine = contacts[j].Trim();
- if (string.IsNullOrEmpty(strLine))
- {
- continue;
- }
-
- Richinfo.Model.ADDR.ContactsEntity addressDetail = new Richinfo.Model.ADDR.ContactsEntity();
- aryLine = strLine.Split(new char[] { ',' });
- if (firstAryLine.Length < aryLine.Length)
- {
- lineCount = firstAryLine.Length;
- }
- else
- {
- lineCount = aryLine.Length;
- }
-
- if (groupName.Length > 0)
- {
- addressDetail.Addgroupname = groupName;
- addressDetail.Addnewgroup = "true";
- }
-
- for (i = 0; i < lineCount; i++)
- {
- SetData(firstAryLine[i], aryLine[i], addressDetail);
- }
-
-
- addressDetail.Usernumber = userNumber;
- addressDetail.ExistAdd = "3";
- addressDetail.Firstnameword = Richinfo.ToolKit.WebUtility.LetterHelper.GetFirstLetter(addressDetail.Addrfirstname + addressDetail.Addrsecondname, 1);
-
- DealAddressDetail(addressDetail);
- if (!checkEmail(addressDetail)) {
- continue;
- }
-
- AddressInput ado = new AddressInput();
- string dbrs = ado.InsertContact(addressDetail);
- buff.Append(dbrs);
-
- //?????????
- if (!string.IsNullOrEmpty(addressDetail.Addrfirstname + addressDetail.Addrsecondname))
- {
- rowCount++;
- }
- }
- buff.Append(string.Format("<Count>{0}</Count></AddBatchContacts>", rowCount));
-
- if (rowCount == 0)
- {
- return AddressInput.ERR_NOTFOUND;
- }
- else if (rowCount > 1000)
- {
- return AddressInput.ERR_MAX_IMPORT;
- }
-
- IAddrWork iaddrWork = new AddrAPIBLL(userNumber, AddrAPIType.AddBatchContacts, buff.ToString());
-
- if (!iaddrWork.IsValidMsg())
- {
- resultCode = AddressInput.ERR_BAD_REQUEST;
- }
- else
- {
- string apimsg = iaddrWork.GetAPIMsg();
- resultCode = AddressInput.DoneApiMsg(apimsg);
- if (resultCode == "33") {
- string reg = @"<RejectTime>(\d+)</RejectTime>";
- if (Regex.IsMatch(apimsg, reg)) {
- string val = Regex.Match(apimsg, reg).Groups[1].Value; //????????
- }
- }
- }
- }
- catch (Exception ex)
- {
- Logger.Error("AddressInput139Standard Input contacts fail|{0}", userNumber);
- Logger.Fail("AddressInput139Standard Input contacts fail", ex);
- resultCode = AddressInput.ERR_OTHER;
- }
- finally
- {
-
- }
-
- return resultCode;
- }
-
- private bool checkEmail(ContactsEntity e)
- {
- bool isFine = true;
- if (!string.IsNullOrEmpty(e.Familyemail)){
- return checkEmail(e.Familyemail);
- }
- if (!string.IsNullOrEmpty(e.Businessemail)){
- return checkEmail(e.Businessemail);
- }
- if (!string.IsNullOrEmpty(e.Otheremail)){
- return checkEmail(e.Otheremail);
- }
- return isFine;
- }
-
- private bool checkEmail(string e)
- {
- return !string.IsNullOrEmpty(e) && Regex.IsMatch(e, @"\w+([-+.]\w|\.+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
- }
-
-
-
- /// <summary>
- /// ??????
- /// </summary>
- /// <param name="dataKey"></param>
- /// <param name="dataValue"></param>
- /// <param name="targetValue"></param>
- /// <returns></returns>
- private string AssignmentData(
- string dataKey,
- string dataValue,
- string targetValue)
- {
- string result = string.Empty;
- if (string.IsNullOrEmpty(targetValue))
- {
- result = dataValue;
- }
- else
- {
- if (targetValue.IndexOf(dataValue) == -1)
- {
- result = targetValue + "?" + dataValue;
- }
- }
- return result;
- }
- /// <summary>
- /// ??????
- /// </summary>
- /// <param name="dataKey"></param>
- /// <param name="dataValue"></param>
- /// <param name="targetValue"></param>
- /// <param name="targetValueSecond"></param>
- /// <param name="targetValueThird"></param>
- /// <returns></returns>
- private string[] AssignmentData(
- string dataKey,
- string dataValue,
- string targetValue,
- string targetValueSecond,
- string targetValueThird)
- {
- string[] result = { "", "" };
- if (targetValueThird.IndexOf(dataValue) != -1)
- {
- return result;
- }
-
- if (string.IsNullOrEmpty(targetValue))
- {
- result[0] = "0";
- result[1] = dataValue;
- }
- else
- {
- if (string.IsNullOrEmpty(targetValueSecond))
- {
- result[0] = "1";
- result[1] = dataValue;
- }
- else
- {
- result[0] = "1";
- result[1] = targetValueSecond + "?" + dataValue;
- }
- }
- return result;
- }
- private string AssignmentOtherData(
- string dataKey,
- string dataValue,
- string targetValue,
- string targetValueThird)
- {
- if (targetValueThird.ToLower().IndexOf(dataValue.ToLower()) != -1)
- {
- return targetValue;
- }
- string result = string.Empty;
- if (string.IsNullOrEmpty(targetValue))
- {
- result = dataValue;
- }
- else
- {
- if (targetValue.IndexOf(dataValue) == -1)
- {
- result = targetValue + "?" + dataValue;
- }
- }
- return result;
- }
- /// <summary>
- /// ?memo????
- /// </summary>
- /// <param name="dataKey"></param>
- /// <param name="dataValue"></param>
- /// <param name="targetValue"></param>
- /// <returns></returns>
- private string AssignmentMemoData(
- string dataKey,
- string dataValue,
- string targetValue)
- {
- string result = string.Empty;
- if (string.IsNullOrEmpty(targetValue))
- {
- result = dataKey.Replace("?", "") + "?" + dataValue;
- }
- else
- {
- if (targetValue.IndexOf(dataValue) == -1)
- {
- result = targetValue + "?" + dataKey.Replace("?", "") + "?" + dataValue;
- }
- }
- return result;
- }
- /// <summary>
- /// ????addressDetail??mobile???
- /// </summary>
- /// <param name="addressDetail"></param>
- /// <returns></returns>
- private string GetMobile(ContactsEntity addressDetail)
- {
- return addressDetail.Mobilephone + addressDetail.Businessmobile + addressDetail.Othermobilephone;
- }
- /// <summary>
- /// ????addressDetail??email???
- /// </summary>
- /// <param name="addressDetail"></param>
- /// <returns></returns>
- private string GetEmail(ContactsEntity addressDetail)
- {
- return addressDetail.Familyemail + addressDetail.Businessemail + addressDetail.Otheremail;
- }
- /// <summary>
- /// ????addressDetail??phone???
- /// </summary>
- /// <param name="addressDetail"></param>
- /// <returns></returns>
- private string GetPhone(ContactsEntity addressDetail)
- {
- return addressDetail.Familyphone + addressDetail.Businessphone + addressDetail.Otherphone;
- }
- /// <summary>
- /// ????addressDetail??fax???
- /// </summary>
- /// <param name="addressDetail"></param>
- /// <returns></returns>
- private string GetFax(ContactsEntity addressDetail)
- {
- return addressDetail.Familyfax + addressDetail.Businessfax + addressDetail.Otherfax;
- }
- /// <summary>
- /// ????addressDetail??im???
- /// </summary>
- /// <param name="addressDetail"></param>
- /// <returns></returns>
- private string GetIm(ContactsEntity addressDetail)
- {
- return addressDetail.Oicq + addressDetail.Msn + addressDetail.Otherim;
- }
- /// <summary>
- /// ????addressDetail??web???
- /// </summary>
- /// <param name="addressDetail"></param>
- /// <returns></returns>
- private string GetWeb(ContactsEntity addressDetail)
- {
- return addressDetail.Personalweb + addressDetail.Companyweb + addressDetail.Otherweb;
- }
- /// <summary>
- /// ???addressDetail??
- /// </summary>
- /// <param name="dataKey"></param>
- /// <param name="dataValue"></param>
- /// <param name="addressDetail"></param>
- private void SetData(
- string dataKey,
- string dataValue,
- ContactsEntity addressDetail)
- {
- string otherName = string.Empty;
- //?? " , ' , < , > , , &
- dataKey = dataKey.Replace("\"", "")
- .Replace("\'", "")
- .Replace("<", "")
- .Replace(">", "")
- .Replace(" ", "")
- .Replace("&", "")
- .Replace("?", "(")
- .Replace("?", ")");
- dataValue = dataValue.Replace("\"", "")
- .Replace("\'", "")
- .Replace("<", "")
- .Replace(">", "")
- .Replace(" ", "")
- .Replace("&", "");
- dataKey = dataKey.Trim();
- dataKey = dataKey.ToLower();
- dataKey = "?" + dataKey + "?";
- dataValue = dataValue.Trim();
-
- if (string.IsNullOrEmpty(dataValue))
- {
- return;
- }
-
- foreach (DataRow dr in DTAddressInputConfig.Rows)
- {
- otherName = dr["on"].ToString();
- otherName = otherName.ToLower();
- if (otherName.IndexOf(dataKey) != -1)
- {
- switch (dr["en"].ToString())
- {
- #region 1-5
- case "Addrfirstname":
- {
- if (!string.IsNullOrEmpty(dataValue) && dataValue.StartsWith(";"))
- {
- dataValue = dataValue.TrimStart(';'); //??tom?????;???
- }
- addressDetail.Addrfirstname = AssignmentData(dataKey, dataValue, addressDetail.Addrfirstname);
- break;
- }
- case "Addrsecondname":
- {
- addressDetail.Addrsecondname = AssignmentData(dataKey, dataValue, addressDetail.Addrsecondname);
- break;
- }
- case "Addrnickname":
- {
- addressDetail.Addrnickname = AssignmentData(dataKey, dataValue, addressDetail.Addrnickname);
- break;
- }
- case "Usersex":
- {
- string val = ContactsEntity.SECRET;
- if (!string.IsNullOrEmpty(dataValue))
- {
- if (dataValue.Equals("?") || dataValue.ToLower().Equals("male")) {
- val = ContactsEntity.MALE;
- } else if (dataValue.Equals("?") || dataValue.ToLower().Equals("female")) {
- val = ContactsEntity.FEMALE;
- } else {
- val = ContactsEntity.SECRET;
- }
-
- }
- else
- {
- val = ContactsEntity.SECRET;
- }
- addressDetail.Usersex = val;
- break;
- }
- case "Countrycode":
- {
- addressDetail.Countrycode = AssignmentData(dataKey, dataValue, addressDetail.Countrycode);
- break;
- }
- #endregion
- #region 6-10
- case "Provcode":
- {
- addressDetail.Provcode = AssignmentData(dataKey, dataValue, addressDetail.Provcode);
- break;
- }
- case "Areacode":
- {
- addressDetail.Areacode = AssignmentData(dataKey, dataValue, addressDetail.Areacode);
- break;
- }
- case "Citycode":
- {
- addressDetail.Citycode = AssignmentData(dataKey, dataValue, addressDetail.Citycode);
- break;
- }
- case "Streetcode":
- {
- addressDetail.Streetcode = AssignmentData(dataKey, dataValue, addressDetail.Streetcode);
- break;
- }
- case "Zipcode":
- {
- addressDetail.Zipcode = AssignmentData(dataKey, dataValue, addressDetail.Zipcode);
- break;
- }
- #endregion
- #region 11-15
- case "Homeaddress":
- {
- if (dataValue.IndexOf("????;") == 0)
- {
- dataValue = dataValue.Substring(5);
- dataValue = dataValue.Substring(0, dataValue.Length - 3);
- dataValue = dataValue.Replace(";", string.Empty);
- //???????163??????????????
- }
- addressDetail.Homeaddress = AssignmentData(dataKey, dataValue, addressDetail.Homeaddress);
- break;
- }
- case "Mobilephonetype":
- {
- addressDetail.Mobilephonetype = AssignmentData(dataKey, dataValue, addressDetail.Mobilephonetype);
- break;
- }
- case "Birday":
- {
- if (Regex.IsMatch(dataValue, "\\d{8}"))
- {// for match 20101007
- dataValue = String.Join("-",
- new string[]{dataValue.Substring(0,4),
- dataValue.Substring(4,2),
- dataValue.Substring(6)});
- }
- DateTime birday = DateTime.MinValue;
- if (DateTime.TryParse(dataValue, out birday))
- {
- addressDetail.Birday = birday.ToString("yyyy-M-d");
- }
- break;
- }
- case "Mobilephone":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Mobilephone,
- addressDetail.Othermobilephone,
- GetMobile(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Mobilephone = result[1]; break; }
- case "1": { addressDetail.Othermobilephone = result[1]; break; }
- }
- break;
- }
- case "Businessmobile":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Businessmobile,
- addressDetail.Othermobilephone,
- GetMobile(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Businessmobile = result[1]; break; }
- case "1": { addressDetail.Othermobilephone = result[1]; break; }
- }
- break;
- }
- #endregion
- #region 16-20
- case "Businessphone":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Businessphone,
- addressDetail.Otherphone,
- GetPhone(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Businessphone = result[1]; break; }
- case "1": { addressDetail.Otherphone = result[1]; break; }
- }
- break;
- }
- case "Familyphone":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.
- Familyphone,
- addressDetail.Otherphone,
- GetPhone(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Familyphone = result[1]; break; }
- case "1": { addressDetail.Otherphone = result[1]; break; }
- }
- break;
- }
- case "Businessfax":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Businessfax,
- addressDetail.Otherfax,
- GetFax(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Businessfax = result[1]; break; }
- case "1": { addressDetail.Otherfax = result[1]; break; }
- }
- break;
- }
- case "Familyfax":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Familyfax,
- addressDetail.Otherfax,
- GetFax(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Familyfax = result[1]; break; }
- case "1": { addressDetail.Otherfax = result[1]; break; }
- }
- break;
- }
- case "Otherphone":
- {
- addressDetail.Otherphone = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherphone, GetPhone(addressDetail));
- break;
- }
- #endregion
- #region 21-25
- case "Othermobilephone":
- {
- addressDetail.Othermobilephone = AssignmentOtherData(dataKey, dataValue, addressDetail.Othermobilephone, GetMobile(addressDetail));
- break;
- }
- case "Otherfax":
- {
- addressDetail.Otherfax = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherfax, GetFax(addressDetail));
- break;
- }
- case "Familyemail":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Familyemail,
- addressDetail.Otheremail,
- GetEmail(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Familyemail = result[1]; break; }
- case "1": { addressDetail.Otheremail = result[1]; break; }
- }
- break;
- }
- case "Businessemail":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Businessemail,
- addressDetail.Otheremail,
- GetEmail(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Businessemail = result[1]; break; }
- case "1": { addressDetail.Otheremail = result[1]; break; }
- }
- break;
- }
- case "Otheremail":
- {
- addressDetail.Otheremail = AssignmentOtherData(dataKey, dataValue, addressDetail.Otheremail, GetEmail(addressDetail));
- break;
- }
- #endregion
- #region 26-30
- case "Personalweb":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Personalweb,
- addressDetail.Otherweb,
- GetWeb(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Personalweb = result[1]; break; }
- case "1": { addressDetail.Otherweb = result[1]; break; }
- }
- break;
- }
- case "Companyweb":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Companyweb,
- addressDetail.Otherweb,
- GetWeb(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Companyweb = result[1]; break; }
- case "1": { addressDetail.Otherweb = result[1]; break; }
- }
- break;
- }
- case "Otherweb":
- {
- addressDetail.Otherweb = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherweb, GetWeb(addressDetail));
- break;
- }
- case "Oicq":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Oicq,
- addressDetail.Otherim,
- GetIm(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Oicq = result[1]; break; }
- case "1": { addressDetail.Otherim = result[1]; break; }
- }
- break;
- }
- case "Msn":
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Msn,
- addressDetail.Otherim,
- GetIm(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Msn = result[1]; break; }
- case "1": { addressDetail.Otherim = result[1]; break; }
- }
- break;
- }
- #endregion
- #region 31-35
- case "Otherim":
- {
- addressDetail.Otherim = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherim, GetIm(addressDetail));
- break;
- }
- case "Cpcountrycode":
- {
- addressDetail.Cpcountrycode = AssignmentData(dataKey, dataValue, addressDetail.Cpcountrycode);
- break;
- }
- case "Cpprovcode":
- {
- addressDetail.Cpprovcode = AssignmentData(dataKey, dataValue, addressDetail.Cpprovcode);
- break;
- }
- case "Cpareacode":
- {
- addressDetail.Cpareacode = AssignmentData(dataKey, dataValue, addressDetail.Cpareacode);
- break;
- }
- case "Cpcitycode":
- {
- addressDetail.Cpcitycode = AssignmentData(dataKey, dataValue, addressDetail.Cpcitycode);
- break;
- }
- #endregion
- #region 36-40
- case "Cpstreetcode":
- {
- addressDetail.Cpstreetcode = AssignmentData(dataKey, dataValue, addressDetail.Cpstreetcode);
- break;
- }
- case "Cpzipcode":
- {
- addressDetail.Cpzipcode = AssignmentData(dataKey, dataValue, addressDetail.Cpzipcode);
- break;
- }
- case "Cpaddress":
- {
- addressDetail.Cpaddress = AssignmentData(dataKey, dataValue, addressDetail.Cpaddress);
- break;
- }
- case "Cpname":
- {
- addressDetail.Cpname = AssignmentData(dataKey, dataValue, addressDetail.Cpname);
- break;
- }
- case "Cpdepartname":
- {
- addressDetail.Cpdepartname = AssignmentData(dataKey, dataValue, addressDetail.Cpdepartname);
- break;
- }
- #endregion
- #region 41-45
- case "Memo":
- {
- addressDetail.Memo = AssignmentMemoData(dataKey, dataValue, addressDetail.Memo);
- break;
- }
- case "Startcode":
- {
- addressDetail.Startcode = AssignmentData(dataKey, dataValue, addressDetail.Startcode);
- break;
- }
- case "Bloodcode":
- {
- addressDetail.Bloodcode = AssignmentData(dataKey, dataValue, addressDetail.Bloodcode);
- break;
- }
- case "Schoolname":
- {
- addressDetail.Schoolname = AssignmentData(dataKey, dataValue, addressDetail.Schoolname);
- break;
- }
- case "Bokeurl":
- {
- addressDetail.Bokeurl = AssignmentData(dataKey, dataValue, addressDetail.Bokeurl);
- break;
- }
- #endregion
- #region 46
- case "Userjob":
- {
- addressDetail.Userjob = AssignmentData(dataKey, dataValue, addressDetail.Userjob);
- break;
- }
- case "Groupname":
- {
- //????????????????????????????
- if (string.IsNullOrEmpty(addressDetail.Addgroupname) && addressDetail.Addgroupname != "?????") {
- addressDetail.Addgroupname = AssignmentData(dataKey, dataValue, addressDetail.Addgroupname);
- addressDetail.Addnewgroup = "true";
- }
-
- if (addressDetail.Addgroupname == "?????") {
- addressDetail.Addgroupname = string.Empty;
- addressDetail.Addnewgroup = "false";
- }
- break;
- }
- #endregion
- default:
- {
- if (Richinfo.ToolKit.WebUtility.MobileHelper.IsMobile(dataValue))
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Mobilephone,
- addressDetail.Othermobilephone,
- GetMobile(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Mobilephone = result[1]; break; }
- case "1": { addressDetail.Othermobilephone = result[1]; break; }
- }
- }
- if (Richinfo.ToolKit.WebUtility.EMailHelper.CheckEmail(dataValue))
- {
- string[] result = AssignmentData(
- dataKey,
- dataValue,
- addressDetail.Familyemail,
- addressDetail.Otheremail,
- GetEmail(addressDetail));
- switch (result[0])
- {
- case "0": { addressDetail.Familyemail = result[1]; break; }
- case "1": { addressDetail.Otheremail = result[1]; break; }
- }
- }
- break;
- }
- }
- }
- }
- }
- }
- }