/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

  1. using System;
  2. using System.Collections;
  3. using System.Data;
  4. using System.IO;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using Richinfo.Model.ADDR;
  8. using Richinfo.Business.ADDR.Logging;
  9. namespace Richinfo.Business.ADDR.Input
  10. {
  11. /// <summary>
  12. /// ?????
  13. /// ??????
  14. /// </summary>
  15. public class AddressInput139Standard
  16. {
  17. /// <summary>
  18. /// ???????
  19. /// </summary>
  20. private static DataTable DTAddressInputConfig = new DataTable();
  21. public AddressInput139Standard()
  22. {
  23. if (DTAddressInputConfig.Rows == null || DTAddressInputConfig.Rows.Count == 0)
  24. {
  25. string inputconfig = File.ReadAllText(Environment.CurrentDirectory + "\\InputConfig.xml");
  26. DTAddressInputConfig = Richinfo.Business.ADDR.XmlManager.XmlToData.CXmlToDatatTable(inputconfig);
  27. if (DTAddressInputConfig.Rows == null || DTAddressInputConfig.Rows.Count == 0)
  28. {
  29. Logger.Error("AddressInput139Standard Can't read rules for import contacts");
  30. }
  31. }
  32. }
  33. /// <summary>
  34. /// ??????addressDetail???????
  35. /// </summary>
  36. /// <param name="addressDetail"></param>
  37. private void DealAddressDetail(ContactsEntity addressDetail)
  38. {
  39. // ??? and ??? and ???
  40. if (string.IsNullOrEmpty(addressDetail.Addrfirstname)
  41. && !string.IsNullOrEmpty(addressDetail.Addrnickname)
  42. && string.IsNullOrEmpty(addressDetail.Addrsecondname))
  43. {
  44. addressDetail.Addrfirstname = addressDetail.Addrnickname;
  45. addressDetail.Addrnickname = string.Empty;
  46. addressDetail.Addrsecondname = string.Empty;
  47. }
  48. if (string.IsNullOrEmpty(addressDetail.Addrfirstname)
  49. && !string.IsNullOrEmpty(addressDetail.Addrsecondname))
  50. {
  51. addressDetail.Addrfirstname = addressDetail.Addrsecondname;
  52. addressDetail.Addrsecondname = string.Empty;
  53. }
  54. if (string.IsNullOrEmpty(addressDetail.Addrfirstname + addressDetail.Addrsecondname))
  55. {
  56. if (!string.IsNullOrEmpty(addressDetail.Addrnickname))
  57. {
  58. addressDetail.Addrfirstname = addressDetail.Addrnickname;
  59. addressDetail.Addrnickname = "";
  60. goto OtherDeal;
  61. }
  62. if (!string.IsNullOrEmpty(addressDetail.Mobilephone))
  63. {
  64. addressDetail.Addrfirstname = addressDetail.Mobilephone;
  65. goto OtherDeal;
  66. }
  67. if (!string.IsNullOrEmpty(addressDetail.Businessmobile))
  68. {
  69. addressDetail.Addrfirstname = addressDetail.Businessmobile;
  70. goto OtherDeal;
  71. }
  72. if (!string.IsNullOrEmpty(addressDetail.Othermobilephone))
  73. {
  74. addressDetail.Addrfirstname = addressDetail.Othermobilephone;
  75. goto OtherDeal;
  76. }
  77. if (!string.IsNullOrEmpty(addressDetail.Familyemail)
  78. && addressDetail.Familyemail.IndexOf("@") > -1
  79. )
  80. {
  81. addressDetail.Addrfirstname = addressDetail.Familyemail.Substring(
  82. 0,
  83. addressDetail.Familyemail.IndexOf("@") - 1);
  84. goto OtherDeal;
  85. }
  86. if (!string.IsNullOrEmpty(addressDetail.Businessemail))
  87. {
  88. addressDetail.Addrfirstname = addressDetail.Businessemail.Substring(
  89. 0,
  90. addressDetail.Businessemail.IndexOf("@") - 1);
  91. goto OtherDeal;
  92. }
  93. if (!string.IsNullOrEmpty(addressDetail.Otheremail))
  94. {
  95. addressDetail.Addrfirstname = addressDetail.Otheremail.Substring(
  96. 0,
  97. addressDetail.Otheremail.IndexOf("@") - 1);
  98. goto OtherDeal;
  99. }
  100. }
  101. OtherDeal:
  102. {
  103. //?????????(??)???(??)???(??)????
  104. addressDetail.Homeaddress =
  105. addressDetail.Countrycode +
  106. addressDetail.Provcode +
  107. addressDetail.Areacode +
  108. addressDetail.Citycode +
  109. addressDetail.Streetcode +
  110. addressDetail.Homeaddress;
  111. //?????????(??)???(??)???(??)????
  112. addressDetail.Cpaddress =
  113. addressDetail.Cpcountrycode +
  114. addressDetail.Cpprovcode +
  115. addressDetail.Cpareacode +
  116. addressDetail.Cpcitycode +
  117. addressDetail.Cpstreetcode +
  118. addressDetail.Cpaddress;
  119. //????????????????
  120. addressDetail.Userjob = addressDetail.Cpdepartname + addressDetail.Userjob;
  121. addressDetail.Cpdepartname = "";
  122. }
  123. }
  124. /// <summary>
  125. /// ?????
  126. /// </summary>
  127. /// <param name="userNumber"></param>
  128. /// <param name="serverFilePath"></param>
  129. /// <param name="existAdd"></param>
  130. /// <param name="groupName"></param>
  131. /// <returns></returns>
  132. public string InputData(string userNumber, string[] contacts,
  133. string groupName, out int rowCount)
  134. {
  135. string resultCode = "999";
  136. string strLine;
  137. string[] aryLine = new string[] { }, firstAryLine = new string[] { };
  138. int i = 0, lineCount = 0;
  139. rowCount = 0;
  140. try
  141. {
  142. if (contacts.Length < 1)
  143. {
  144. rowCount = 0;
  145. return AddressInput.ERR_NOTFOUND;
  146. }
  147. StringBuilder buff = new StringBuilder();
  148. buff.Append("<AddBatchContacts>");
  149. buff.Append("<UserNumber>");
  150. buff.Append(userNumber);
  151. buff.Append("</UserNumber>");
  152. buff.Append("<ImportType>3</ImportType>");
  153. firstAryLine = contacts[0].Split(new char[] { ',' });
  154. for (int j = 1; j < contacts.Length; j++)
  155. {
  156. strLine = contacts[j].Trim();
  157. if (string.IsNullOrEmpty(strLine))
  158. {
  159. continue;
  160. }
  161. Richinfo.Model.ADDR.ContactsEntity addressDetail = new Richinfo.Model.ADDR.ContactsEntity();
  162. aryLine = strLine.Split(new char[] { ',' });
  163. if (firstAryLine.Length < aryLine.Length)
  164. {
  165. lineCount = firstAryLine.Length;
  166. }
  167. else
  168. {
  169. lineCount = aryLine.Length;
  170. }
  171. if (groupName.Length > 0)
  172. {
  173. addressDetail.Addgroupname = groupName;
  174. addressDetail.Addnewgroup = "true";
  175. }
  176. for (i = 0; i < lineCount; i++)
  177. {
  178. SetData(firstAryLine[i], aryLine[i], addressDetail);
  179. }
  180. addressDetail.Usernumber = userNumber;
  181. addressDetail.ExistAdd = "3";
  182. addressDetail.Firstnameword = Richinfo.ToolKit.WebUtility.LetterHelper.GetFirstLetter(addressDetail.Addrfirstname + addressDetail.Addrsecondname, 1);
  183. DealAddressDetail(addressDetail);
  184. if (!checkEmail(addressDetail)) {
  185. continue;
  186. }
  187. AddressInput ado = new AddressInput();
  188. string dbrs = ado.InsertContact(addressDetail);
  189. buff.Append(dbrs);
  190. //?????????
  191. if (!string.IsNullOrEmpty(addressDetail.Addrfirstname + addressDetail.Addrsecondname))
  192. {
  193. rowCount++;
  194. }
  195. }
  196. buff.Append(string.Format("<Count>{0}</Count></AddBatchContacts>", rowCount));
  197. if (rowCount == 0)
  198. {
  199. return AddressInput.ERR_NOTFOUND;
  200. }
  201. else if (rowCount > 1000)
  202. {
  203. return AddressInput.ERR_MAX_IMPORT;
  204. }
  205. IAddrWork iaddrWork = new AddrAPIBLL(userNumber, AddrAPIType.AddBatchContacts, buff.ToString());
  206. if (!iaddrWork.IsValidMsg())
  207. {
  208. resultCode = AddressInput.ERR_BAD_REQUEST;
  209. }
  210. else
  211. {
  212. string apimsg = iaddrWork.GetAPIMsg();
  213. resultCode = AddressInput.DoneApiMsg(apimsg);
  214. if (resultCode == "33") {
  215. string reg = @"<RejectTime>(\d+)</RejectTime>";
  216. if (Regex.IsMatch(apimsg, reg)) {
  217. string val = Regex.Match(apimsg, reg).Groups[1].Value; //????????
  218. }
  219. }
  220. }
  221. }
  222. catch (Exception ex)
  223. {
  224. Logger.Error("AddressInput139Standard Input contacts fail|{0}", userNumber);
  225. Logger.Fail("AddressInput139Standard Input contacts fail", ex);
  226. resultCode = AddressInput.ERR_OTHER;
  227. }
  228. finally
  229. {
  230. }
  231. return resultCode;
  232. }
  233. private bool checkEmail(ContactsEntity e)
  234. {
  235. bool isFine = true;
  236. if (!string.IsNullOrEmpty(e.Familyemail)){
  237. return checkEmail(e.Familyemail);
  238. }
  239. if (!string.IsNullOrEmpty(e.Businessemail)){
  240. return checkEmail(e.Businessemail);
  241. }
  242. if (!string.IsNullOrEmpty(e.Otheremail)){
  243. return checkEmail(e.Otheremail);
  244. }
  245. return isFine;
  246. }
  247. private bool checkEmail(string e)
  248. {
  249. return !string.IsNullOrEmpty(e) && Regex.IsMatch(e, @"\w+([-+.]\w|\.+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
  250. }
  251. /// <summary>
  252. /// ??????
  253. /// </summary>
  254. /// <param name="dataKey"></param>
  255. /// <param name="dataValue"></param>
  256. /// <param name="targetValue"></param>
  257. /// <returns></returns>
  258. private string AssignmentData(
  259. string dataKey,
  260. string dataValue,
  261. string targetValue)
  262. {
  263. string result = string.Empty;
  264. if (string.IsNullOrEmpty(targetValue))
  265. {
  266. result = dataValue;
  267. }
  268. else
  269. {
  270. if (targetValue.IndexOf(dataValue) == -1)
  271. {
  272. result = targetValue + "?" + dataValue;
  273. }
  274. }
  275. return result;
  276. }
  277. /// <summary>
  278. /// ??????
  279. /// </summary>
  280. /// <param name="dataKey"></param>
  281. /// <param name="dataValue"></param>
  282. /// <param name="targetValue"></param>
  283. /// <param name="targetValueSecond"></param>
  284. /// <param name="targetValueThird"></param>
  285. /// <returns></returns>
  286. private string[] AssignmentData(
  287. string dataKey,
  288. string dataValue,
  289. string targetValue,
  290. string targetValueSecond,
  291. string targetValueThird)
  292. {
  293. string[] result = { "", "" };
  294. if (targetValueThird.IndexOf(dataValue) != -1)
  295. {
  296. return result;
  297. }
  298. if (string.IsNullOrEmpty(targetValue))
  299. {
  300. result[0] = "0";
  301. result[1] = dataValue;
  302. }
  303. else
  304. {
  305. if (string.IsNullOrEmpty(targetValueSecond))
  306. {
  307. result[0] = "1";
  308. result[1] = dataValue;
  309. }
  310. else
  311. {
  312. result[0] = "1";
  313. result[1] = targetValueSecond + "?" + dataValue;
  314. }
  315. }
  316. return result;
  317. }
  318. private string AssignmentOtherData(
  319. string dataKey,
  320. string dataValue,
  321. string targetValue,
  322. string targetValueThird)
  323. {
  324. if (targetValueThird.ToLower().IndexOf(dataValue.ToLower()) != -1)
  325. {
  326. return targetValue;
  327. }
  328. string result = string.Empty;
  329. if (string.IsNullOrEmpty(targetValue))
  330. {
  331. result = dataValue;
  332. }
  333. else
  334. {
  335. if (targetValue.IndexOf(dataValue) == -1)
  336. {
  337. result = targetValue + "?" + dataValue;
  338. }
  339. }
  340. return result;
  341. }
  342. /// <summary>
  343. /// ?memo????
  344. /// </summary>
  345. /// <param name="dataKey"></param>
  346. /// <param name="dataValue"></param>
  347. /// <param name="targetValue"></param>
  348. /// <returns></returns>
  349. private string AssignmentMemoData(
  350. string dataKey,
  351. string dataValue,
  352. string targetValue)
  353. {
  354. string result = string.Empty;
  355. if (string.IsNullOrEmpty(targetValue))
  356. {
  357. result = dataKey.Replace("?", "") + "?" + dataValue;
  358. }
  359. else
  360. {
  361. if (targetValue.IndexOf(dataValue) == -1)
  362. {
  363. result = targetValue + "?" + dataKey.Replace("?", "") + "?" + dataValue;
  364. }
  365. }
  366. return result;
  367. }
  368. /// <summary>
  369. /// ????addressDetail??mobile???
  370. /// </summary>
  371. /// <param name="addressDetail"></param>
  372. /// <returns></returns>
  373. private string GetMobile(ContactsEntity addressDetail)
  374. {
  375. return addressDetail.Mobilephone + addressDetail.Businessmobile + addressDetail.Othermobilephone;
  376. }
  377. /// <summary>
  378. /// ????addressDetail??email???
  379. /// </summary>
  380. /// <param name="addressDetail"></param>
  381. /// <returns></returns>
  382. private string GetEmail(ContactsEntity addressDetail)
  383. {
  384. return addressDetail.Familyemail + addressDetail.Businessemail + addressDetail.Otheremail;
  385. }
  386. /// <summary>
  387. /// ????addressDetail??phone???
  388. /// </summary>
  389. /// <param name="addressDetail"></param>
  390. /// <returns></returns>
  391. private string GetPhone(ContactsEntity addressDetail)
  392. {
  393. return addressDetail.Familyphone + addressDetail.Businessphone + addressDetail.Otherphone;
  394. }
  395. /// <summary>
  396. /// ????addressDetail??fax???
  397. /// </summary>
  398. /// <param name="addressDetail"></param>
  399. /// <returns></returns>
  400. private string GetFax(ContactsEntity addressDetail)
  401. {
  402. return addressDetail.Familyfax + addressDetail.Businessfax + addressDetail.Otherfax;
  403. }
  404. /// <summary>
  405. /// ????addressDetail??im???
  406. /// </summary>
  407. /// <param name="addressDetail"></param>
  408. /// <returns></returns>
  409. private string GetIm(ContactsEntity addressDetail)
  410. {
  411. return addressDetail.Oicq + addressDetail.Msn + addressDetail.Otherim;
  412. }
  413. /// <summary>
  414. /// ????addressDetail??web???
  415. /// </summary>
  416. /// <param name="addressDetail"></param>
  417. /// <returns></returns>
  418. private string GetWeb(ContactsEntity addressDetail)
  419. {
  420. return addressDetail.Personalweb + addressDetail.Companyweb + addressDetail.Otherweb;
  421. }
  422. /// <summary>
  423. /// ???addressDetail??
  424. /// </summary>
  425. /// <param name="dataKey"></param>
  426. /// <param name="dataValue"></param>
  427. /// <param name="addressDetail"></param>
  428. private void SetData(
  429. string dataKey,
  430. string dataValue,
  431. ContactsEntity addressDetail)
  432. {
  433. string otherName = string.Empty;
  434. //?? " , ' , < , > , &nbsp; , &
  435. dataKey = dataKey.Replace("\"", "")
  436. .Replace("\'", "")
  437. .Replace("<", "")
  438. .Replace(">", "")
  439. .Replace("&nbsp;", "")
  440. .Replace("&", "")
  441. .Replace("?", "(")
  442. .Replace("?", ")");
  443. dataValue = dataValue.Replace("\"", "")
  444. .Replace("\'", "")
  445. .Replace("<", "")
  446. .Replace(">", "")
  447. .Replace("&nbsp;", "")
  448. .Replace("&", "");
  449. dataKey = dataKey.Trim();
  450. dataKey = dataKey.ToLower();
  451. dataKey = "?" + dataKey + "?";
  452. dataValue = dataValue.Trim();
  453. if (string.IsNullOrEmpty(dataValue))
  454. {
  455. return;
  456. }
  457. foreach (DataRow dr in DTAddressInputConfig.Rows)
  458. {
  459. otherName = dr["on"].ToString();
  460. otherName = otherName.ToLower();
  461. if (otherName.IndexOf(dataKey) != -1)
  462. {
  463. switch (dr["en"].ToString())
  464. {
  465. #region 1-5
  466. case "Addrfirstname":
  467. {
  468. if (!string.IsNullOrEmpty(dataValue) && dataValue.StartsWith(";"))
  469. {
  470. dataValue = dataValue.TrimStart(';'); //??tom?????;???
  471. }
  472. addressDetail.Addrfirstname = AssignmentData(dataKey, dataValue, addressDetail.Addrfirstname);
  473. break;
  474. }
  475. case "Addrsecondname":
  476. {
  477. addressDetail.Addrsecondname = AssignmentData(dataKey, dataValue, addressDetail.Addrsecondname);
  478. break;
  479. }
  480. case "Addrnickname":
  481. {
  482. addressDetail.Addrnickname = AssignmentData(dataKey, dataValue, addressDetail.Addrnickname);
  483. break;
  484. }
  485. case "Usersex":
  486. {
  487. string val = ContactsEntity.SECRET;
  488. if (!string.IsNullOrEmpty(dataValue))
  489. {
  490. if (dataValue.Equals("?") || dataValue.ToLower().Equals("male")) {
  491. val = ContactsEntity.MALE;
  492. } else if (dataValue.Equals("?") || dataValue.ToLower().Equals("female")) {
  493. val = ContactsEntity.FEMALE;
  494. } else {
  495. val = ContactsEntity.SECRET;
  496. }
  497. }
  498. else
  499. {
  500. val = ContactsEntity.SECRET;
  501. }
  502. addressDetail.Usersex = val;
  503. break;
  504. }
  505. case "Countrycode":
  506. {
  507. addressDetail.Countrycode = AssignmentData(dataKey, dataValue, addressDetail.Countrycode);
  508. break;
  509. }
  510. #endregion
  511. #region 6-10
  512. case "Provcode":
  513. {
  514. addressDetail.Provcode = AssignmentData(dataKey, dataValue, addressDetail.Provcode);
  515. break;
  516. }
  517. case "Areacode":
  518. {
  519. addressDetail.Areacode = AssignmentData(dataKey, dataValue, addressDetail.Areacode);
  520. break;
  521. }
  522. case "Citycode":
  523. {
  524. addressDetail.Citycode = AssignmentData(dataKey, dataValue, addressDetail.Citycode);
  525. break;
  526. }
  527. case "Streetcode":
  528. {
  529. addressDetail.Streetcode = AssignmentData(dataKey, dataValue, addressDetail.Streetcode);
  530. break;
  531. }
  532. case "Zipcode":
  533. {
  534. addressDetail.Zipcode = AssignmentData(dataKey, dataValue, addressDetail.Zipcode);
  535. break;
  536. }
  537. #endregion
  538. #region 11-15
  539. case "Homeaddress":
  540. {
  541. if (dataValue.IndexOf("????;") == 0)
  542. {
  543. dataValue = dataValue.Substring(5);
  544. dataValue = dataValue.Substring(0, dataValue.Length - 3);
  545. dataValue = dataValue.Replace(";", string.Empty);
  546. //???????163??????????????
  547. }
  548. addressDetail.Homeaddress = AssignmentData(dataKey, dataValue, addressDetail.Homeaddress);
  549. break;
  550. }
  551. case "Mobilephonetype":
  552. {
  553. addressDetail.Mobilephonetype = AssignmentData(dataKey, dataValue, addressDetail.Mobilephonetype);
  554. break;
  555. }
  556. case "Birday":
  557. {
  558. if (Regex.IsMatch(dataValue, "\\d{8}"))
  559. {// for match 20101007
  560. dataValue = String.Join("-",
  561. new string[]{dataValue.Substring(0,4),
  562. dataValue.Substring(4,2),
  563. dataValue.Substring(6)});
  564. }
  565. DateTime birday = DateTime.MinValue;
  566. if (DateTime.TryParse(dataValue, out birday))
  567. {
  568. addressDetail.Birday = birday.ToString("yyyy-M-d");
  569. }
  570. break;
  571. }
  572. case "Mobilephone":
  573. {
  574. string[] result = AssignmentData(
  575. dataKey,
  576. dataValue,
  577. addressDetail.Mobilephone,
  578. addressDetail.Othermobilephone,
  579. GetMobile(addressDetail));
  580. switch (result[0])
  581. {
  582. case "0": { addressDetail.Mobilephone = result[1]; break; }
  583. case "1": { addressDetail.Othermobilephone = result[1]; break; }
  584. }
  585. break;
  586. }
  587. case "Businessmobile":
  588. {
  589. string[] result = AssignmentData(
  590. dataKey,
  591. dataValue,
  592. addressDetail.Businessmobile,
  593. addressDetail.Othermobilephone,
  594. GetMobile(addressDetail));
  595. switch (result[0])
  596. {
  597. case "0": { addressDetail.Businessmobile = result[1]; break; }
  598. case "1": { addressDetail.Othermobilephone = result[1]; break; }
  599. }
  600. break;
  601. }
  602. #endregion
  603. #region 16-20
  604. case "Businessphone":
  605. {
  606. string[] result = AssignmentData(
  607. dataKey,
  608. dataValue,
  609. addressDetail.Businessphone,
  610. addressDetail.Otherphone,
  611. GetPhone(addressDetail));
  612. switch (result[0])
  613. {
  614. case "0": { addressDetail.Businessphone = result[1]; break; }
  615. case "1": { addressDetail.Otherphone = result[1]; break; }
  616. }
  617. break;
  618. }
  619. case "Familyphone":
  620. {
  621. string[] result = AssignmentData(
  622. dataKey,
  623. dataValue,
  624. addressDetail.
  625. Familyphone,
  626. addressDetail.Otherphone,
  627. GetPhone(addressDetail));
  628. switch (result[0])
  629. {
  630. case "0": { addressDetail.Familyphone = result[1]; break; }
  631. case "1": { addressDetail.Otherphone = result[1]; break; }
  632. }
  633. break;
  634. }
  635. case "Businessfax":
  636. {
  637. string[] result = AssignmentData(
  638. dataKey,
  639. dataValue,
  640. addressDetail.Businessfax,
  641. addressDetail.Otherfax,
  642. GetFax(addressDetail));
  643. switch (result[0])
  644. {
  645. case "0": { addressDetail.Businessfax = result[1]; break; }
  646. case "1": { addressDetail.Otherfax = result[1]; break; }
  647. }
  648. break;
  649. }
  650. case "Familyfax":
  651. {
  652. string[] result = AssignmentData(
  653. dataKey,
  654. dataValue,
  655. addressDetail.Familyfax,
  656. addressDetail.Otherfax,
  657. GetFax(addressDetail));
  658. switch (result[0])
  659. {
  660. case "0": { addressDetail.Familyfax = result[1]; break; }
  661. case "1": { addressDetail.Otherfax = result[1]; break; }
  662. }
  663. break;
  664. }
  665. case "Otherphone":
  666. {
  667. addressDetail.Otherphone = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherphone, GetPhone(addressDetail));
  668. break;
  669. }
  670. #endregion
  671. #region 21-25
  672. case "Othermobilephone":
  673. {
  674. addressDetail.Othermobilephone = AssignmentOtherData(dataKey, dataValue, addressDetail.Othermobilephone, GetMobile(addressDetail));
  675. break;
  676. }
  677. case "Otherfax":
  678. {
  679. addressDetail.Otherfax = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherfax, GetFax(addressDetail));
  680. break;
  681. }
  682. case "Familyemail":
  683. {
  684. string[] result = AssignmentData(
  685. dataKey,
  686. dataValue,
  687. addressDetail.Familyemail,
  688. addressDetail.Otheremail,
  689. GetEmail(addressDetail));
  690. switch (result[0])
  691. {
  692. case "0": { addressDetail.Familyemail = result[1]; break; }
  693. case "1": { addressDetail.Otheremail = result[1]; break; }
  694. }
  695. break;
  696. }
  697. case "Businessemail":
  698. {
  699. string[] result = AssignmentData(
  700. dataKey,
  701. dataValue,
  702. addressDetail.Businessemail,
  703. addressDetail.Otheremail,
  704. GetEmail(addressDetail));
  705. switch (result[0])
  706. {
  707. case "0": { addressDetail.Businessemail = result[1]; break; }
  708. case "1": { addressDetail.Otheremail = result[1]; break; }
  709. }
  710. break;
  711. }
  712. case "Otheremail":
  713. {
  714. addressDetail.Otheremail = AssignmentOtherData(dataKey, dataValue, addressDetail.Otheremail, GetEmail(addressDetail));
  715. break;
  716. }
  717. #endregion
  718. #region 26-30
  719. case "Personalweb":
  720. {
  721. string[] result = AssignmentData(
  722. dataKey,
  723. dataValue,
  724. addressDetail.Personalweb,
  725. addressDetail.Otherweb,
  726. GetWeb(addressDetail));
  727. switch (result[0])
  728. {
  729. case "0": { addressDetail.Personalweb = result[1]; break; }
  730. case "1": { addressDetail.Otherweb = result[1]; break; }
  731. }
  732. break;
  733. }
  734. case "Companyweb":
  735. {
  736. string[] result = AssignmentData(
  737. dataKey,
  738. dataValue,
  739. addressDetail.Companyweb,
  740. addressDetail.Otherweb,
  741. GetWeb(addressDetail));
  742. switch (result[0])
  743. {
  744. case "0": { addressDetail.Companyweb = result[1]; break; }
  745. case "1": { addressDetail.Otherweb = result[1]; break; }
  746. }
  747. break;
  748. }
  749. case "Otherweb":
  750. {
  751. addressDetail.Otherweb = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherweb, GetWeb(addressDetail));
  752. break;
  753. }
  754. case "Oicq":
  755. {
  756. string[] result = AssignmentData(
  757. dataKey,
  758. dataValue,
  759. addressDetail.Oicq,
  760. addressDetail.Otherim,
  761. GetIm(addressDetail));
  762. switch (result[0])
  763. {
  764. case "0": { addressDetail.Oicq = result[1]; break; }
  765. case "1": { addressDetail.Otherim = result[1]; break; }
  766. }
  767. break;
  768. }
  769. case "Msn":
  770. {
  771. string[] result = AssignmentData(
  772. dataKey,
  773. dataValue,
  774. addressDetail.Msn,
  775. addressDetail.Otherim,
  776. GetIm(addressDetail));
  777. switch (result[0])
  778. {
  779. case "0": { addressDetail.Msn = result[1]; break; }
  780. case "1": { addressDetail.Otherim = result[1]; break; }
  781. }
  782. break;
  783. }
  784. #endregion
  785. #region 31-35
  786. case "Otherim":
  787. {
  788. addressDetail.Otherim = AssignmentOtherData(dataKey, dataValue, addressDetail.Otherim, GetIm(addressDetail));
  789. break;
  790. }
  791. case "Cpcountrycode":
  792. {
  793. addressDetail.Cpcountrycode = AssignmentData(dataKey, dataValue, addressDetail.Cpcountrycode);
  794. break;
  795. }
  796. case "Cpprovcode":
  797. {
  798. addressDetail.Cpprovcode = AssignmentData(dataKey, dataValue, addressDetail.Cpprovcode);
  799. break;
  800. }
  801. case "Cpareacode":
  802. {
  803. addressDetail.Cpareacode = AssignmentData(dataKey, dataValue, addressDetail.Cpareacode);
  804. break;
  805. }
  806. case "Cpcitycode":
  807. {
  808. addressDetail.Cpcitycode = AssignmentData(dataKey, dataValue, addressDetail.Cpcitycode);
  809. break;
  810. }
  811. #endregion
  812. #region 36-40
  813. case "Cpstreetcode":
  814. {
  815. addressDetail.Cpstreetcode = AssignmentData(dataKey, dataValue, addressDetail.Cpstreetcode);
  816. break;
  817. }
  818. case "Cpzipcode":
  819. {
  820. addressDetail.Cpzipcode = AssignmentData(dataKey, dataValue, addressDetail.Cpzipcode);
  821. break;
  822. }
  823. case "Cpaddress":
  824. {
  825. addressDetail.Cpaddress = AssignmentData(dataKey, dataValue, addressDetail.Cpaddress);
  826. break;
  827. }
  828. case "Cpname":
  829. {
  830. addressDetail.Cpname = AssignmentData(dataKey, dataValue, addressDetail.Cpname);
  831. break;
  832. }
  833. case "Cpdepartname":
  834. {
  835. addressDetail.Cpdepartname = AssignmentData(dataKey, dataValue, addressDetail.Cpdepartname);
  836. break;
  837. }
  838. #endregion
  839. #region 41-45
  840. case "Memo":
  841. {
  842. addressDetail.Memo = AssignmentMemoData(dataKey, dataValue, addressDetail.Memo);
  843. break;
  844. }
  845. case "Startcode":
  846. {
  847. addressDetail.Startcode = AssignmentData(dataKey, dataValue, addressDetail.Startcode);
  848. break;
  849. }
  850. case "Bloodcode":
  851. {
  852. addressDetail.Bloodcode = AssignmentData(dataKey, dataValue, addressDetail.Bloodcode);
  853. break;
  854. }
  855. case "Schoolname":
  856. {
  857. addressDetail.Schoolname = AssignmentData(dataKey, dataValue, addressDetail.Schoolname);
  858. break;
  859. }
  860. case "Bokeurl":
  861. {
  862. addressDetail.Bokeurl = AssignmentData(dataKey, dataValue, addressDetail.Bokeurl);
  863. break;
  864. }
  865. #endregion
  866. #region 46
  867. case "Userjob":
  868. {
  869. addressDetail.Userjob = AssignmentData(dataKey, dataValue, addressDetail.Userjob);
  870. break;
  871. }
  872. case "Groupname":
  873. {
  874. //????????????????????????????
  875. if (string.IsNullOrEmpty(addressDetail.Addgroupname) && addressDetail.Addgroupname != "?????") {
  876. addressDetail.Addgroupname = AssignmentData(dataKey, dataValue, addressDetail.Addgroupname);
  877. addressDetail.Addnewgroup = "true";
  878. }
  879. if (addressDetail.Addgroupname == "?????") {
  880. addressDetail.Addgroupname = string.Empty;
  881. addressDetail.Addnewgroup = "false";
  882. }
  883. break;
  884. }
  885. #endregion
  886. default:
  887. {
  888. if (Richinfo.ToolKit.WebUtility.MobileHelper.IsMobile(dataValue))
  889. {
  890. string[] result = AssignmentData(
  891. dataKey,
  892. dataValue,
  893. addressDetail.Mobilephone,
  894. addressDetail.Othermobilephone,
  895. GetMobile(addressDetail));
  896. switch (result[0])
  897. {
  898. case "0": { addressDetail.Mobilephone = result[1]; break; }
  899. case "1": { addressDetail.Othermobilephone = result[1]; break; }
  900. }
  901. }
  902. if (Richinfo.ToolKit.WebUtility.EMailHelper.CheckEmail(dataValue))
  903. {
  904. string[] result = AssignmentData(
  905. dataKey,
  906. dataValue,
  907. addressDetail.Familyemail,
  908. addressDetail.Otheremail,
  909. GetEmail(addressDetail));
  910. switch (result[0])
  911. {
  912. case "0": { addressDetail.Familyemail = result[1]; break; }
  913. case "1": { addressDetail.Otheremail = result[1]; break; }
  914. }
  915. }
  916. break;
  917. }
  918. }
  919. }
  920. }
  921. }
  922. }
  923. }