public override void Send() { string str; string str1; string str2; string message; string str3; string str4; string str5; FormatException formatException; object obj = new object(); object obj1 = new object(); object obj2 = new object(); object obj3 = new object(); object obj4 = new object(); object obj5 = new object(); object obj6 = new object(); short num = 0; short num1 = 0; string empty = string.Empty; string empty1 = string.Empty; string empty2 = string.Empty; int num2 = 0; int num3 = 0; this.m_lSendErrorCount = (long)0; try { base.GetLink().TablePOST_Send(this.m_hndPOST, ref obj, ref obj1); goto Label0; } catch (NullReferenceException nullReferenceException1) { NullReferenceException nullReferenceException = nullReferenceException1; str = (nullReferenceException.Data == null ? "" : nullReferenceException.Data.ToString()); str1 = (nullReferenceException.HelpLink == null ? "" : nullReferenceException.HelpLink.ToString()); str2 = (nullReferenceException.InnerException == null ? "" : nullReferenceException.InnerException.ToString()); message = nullReferenceException.Message; str3 = (nullReferenceException.Source == null ? "" : nullReferenceException.Source.ToString()); str4 = (nullReferenceException.StackTrace == null ? "" : nullReferenceException.StackTrace.ToString()); str5 = (nullReferenceException.TargetSite == null ? "" : nullReferenceException.TargetSite.ToString()); base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Null Ref Execption: ", message)); base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); base.GetLink().TablePOST_Reset(this.m_hndPOST); } catch (AccessViolationException accessViolationException1) { AccessViolationException accessViolationException = accessViolationException1; str = (accessViolationException.Data == null ? "" : accessViolationException.Data.ToString()); str1 = (accessViolationException.HelpLink == null ? "" : accessViolationException.HelpLink.ToString()); str2 = (accessViolationException.InnerException == null ? "" : accessViolationException.InnerException.ToString()); message = accessViolationException.Message; str3 = (accessViolationException.Source == null ? "" : accessViolationException.Source.ToString()); str4 = (accessViolationException.StackTrace == null ? "" : accessViolationException.StackTrace.ToString()); str5 = (accessViolationException.TargetSite == null ? "" : accessViolationException.TargetSite.ToString()); base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Access Violation Execption: ", message)); base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); base.GetLink().TablePOST_Reset(this.m_hndPOST); } catch (FormatException formatException1) { formatException = formatException1; str = (formatException.Data == null ? "" : formatException.Data.ToString()); str1 = (formatException.HelpLink == null ? "" : formatException.HelpLink.ToString()); str2 = (formatException.InnerException == null ? "" : formatException.InnerException.ToString()); message = formatException.Message; str3 = (formatException.Source == null ? "" : formatException.Source.ToString()); str4 = (formatException.StackTrace == null ? "" : formatException.StackTrace.ToString()); str5 = (formatException.TargetSite == null ? "" : formatException.TargetSite.ToString()); base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Format Execption: ", message)); base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); base.GetLink().TablePOST_Reset(this.m_hndPOST); } catch (Exception exception1) { Exception exception = exception1; str = (exception.Data == null ? "" : exception.Data.ToString()); str1 = (exception.HelpLink == null ? "" : exception.HelpLink.ToString()); str2 = (exception.InnerException == null ? "" : exception.InnerException.ToString()); message = exception.Message; str3 = (exception.Source == null ? "" : exception.Source.ToString()); str4 = (exception.StackTrace == null ? "" : exception.StackTrace.ToString()); str5 = (exception.TargetSite == null ? "" : exception.TargetSite.ToString()); base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Catch All Execption: ", message)); base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); base.GetLink().TablePOST_Reset(this.m_hndPOST); this.m_lCounter = 0; } return; Label0: try { num = Convert.ToInt16(obj); num1 = Convert.ToInt16(obj1); PLXMLData.m_lErrorCount = PLXMLData.m_lErrorCount + (long)num1; if ((num1 > 0 ? true : this.m_lCounter != num)) { base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); PLClient mLSendErrorCount = this; mLSendErrorCount.m_lSendErrorCount = mLSendErrorCount.m_lSendErrorCount + (long)1; } while (base.GetLink().TablePOST_GetNextResult(this.m_hndPOST, ref obj2, ref obj3, ref obj4, ref obj5) == 0) { if (Convert.ToInt32(obj3) <= 0) { num3 = Convert.ToInt32(obj2); base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_NickName.sLinkName, empty, ref obj6); empty1 = obj6.ToString(); PLClient.AddMapIDtoNN(num3, empty1); PLClient.AddMapNNtoID(empty1, num3); base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_ExternalID_1.sLinkName, empty, ref obj6); if (!obj6.ToString().Equals("")) { PLClient.AddMapExtID1toPLID(obj6.ToString(), num3); } base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_ExternalID_2.sLinkName, empty, ref obj6); if (!obj6.ToString().Equals("")) { PLClient.AddMapExtID2toPLID(obj6.ToString(), num3); } base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, "NameKey", empty, ref obj6); if (!obj6.ToString().Equals("")) { PLClient.AddMapNameKeytoPLID(obj6.ToString(), num3); } base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, "ClientPersonContactID", empty, ref obj6); if (StringManip.IsNumeric(obj6.ToString())) { num2 = StringManip.NullToInt(obj6); if (num2 != 0) { PLClient.AddMapNNtoContactID(empty1, num2); PLClient.AddMapClientIDtoContactID(num3, num2); PLClient.AddMapContactIDtoClientID(num2, num3); } } base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, "ClientQuickBooksID", empty, ref obj6); empty2 = obj6.ToString().ToUpper().Trim(); if (!empty2.Equals("")) { PLClient.AddMapPLIDtoQBID(num3, empty2); } } } base.GetLink().TablePOST_Reset(this.m_hndPOST); this.m_lCounter = 0; base.GetLink().SubField_CloseHandle(this.m_hndSubFld); this.m_hndSubFld = 0; } catch (FormatException formatException2) { formatException = formatException2; str = (formatException.Data == null ? "" : formatException.Data.ToString()); str1 = (formatException.HelpLink == null ? "" : formatException.HelpLink.ToString()); str2 = (formatException.InnerException == null ? "" : formatException.InnerException.ToString()); message = formatException.Message; str3 = (formatException.Source == null ? "" : formatException.Source.ToString()); str4 = (formatException.StackTrace == null ? "" : formatException.StackTrace.ToString()); str5 = (formatException.TargetSite == null ? "" : formatException.TargetSite.ToString()); base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients Reading posted items, Catch All Execption: ", message)); base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); this.m_lCounter = 0; return; } }
public void ParseAddress() { char chr; bool flag; bool flag1; bool flag2; bool flag3; int i = 0; int j = 0; string empty = string.Empty; int length = 0; bool flag4 = false; bool flag5 = false; string[] strArrays = new string[] { "united states", " usa", "u.s.a.", "canada", "england", " uk", "australia", "new zealand", "nz" }; string[] strArrays1 = strArrays; i = 0; while (i < this.AddrLines.Count) { empty = this.AddrLines[i].ToString().Trim(); if (!(empty.ToLower().IndexOf("attention") >= 0 || empty.ToLower().IndexOf("attn") >= 0 || empty.ToLower().IndexOf("att'n") >= 0 || empty.ToLower().IndexOf("att") >= 0 ? false : empty.ToLower().IndexOf("atn") < 0)) { this.Attn = empty.Substring(empty.IndexOf(":") + 1).Trim(); this.AddrLines.RemoveAt(i); break; } else if ((empty.ToLower().IndexOf("mr.") >= 0 || empty.ToLower().IndexOf("ms.") >= 0 || empty.ToLower().IndexOf("mrs.") >= 0 ? false : empty.ToLower().IndexOf("miss") < 0)) { i++; } else { this.Attn = empty; this.AddrLines.RemoveAt(i); break; } } if (!this.AddrLines.Count.Equals(0)) { for (i = 0; i < this.AddrLines.Count; i++) { empty = this.AddrLines[i].ToString().Trim(); for (j = 0; j <= strArrays1.GetUpperBound(0); j++) { if (empty.ToLower().IndexOf(strArrays1[j]) >= 0) { this.Country = empty.Substring(empty.ToLower().IndexOf(strArrays1[j]), strArrays1[j].Length); empty = empty.Remove(empty.ToLower().IndexOf(strArrays1[j]), strArrays1[j].Length); this.AddrLines[i] = empty.Trim(); } } } for (i = 0; i <= this.AddrLines.Count - 2; i++) { if (string.IsNullOrEmpty(this.AddrLines[i].ToString().Trim())) { for (j = i + 1; j < this.AddrLines.Count; j++) { this.AddrLines[j - 1] = this.AddrLines[j]; this.AddrLines[j] = string.Empty; } } } while (string.IsNullOrEmpty(this.AddrLines[this.AddrLines.Count - 1].ToString().Trim())) { this.AddrLines.RemoveAt(this.AddrLines.Count - 1); } if (!this.AddrLines.Count.Equals(0)) { flag4 = false; empty = this.AddrLines[this.AddrLines.Count - 1].ToString().Trim(); length = empty.Length; if (StringManip.IsNumeric(empty)) { this.Postal = empty; this.AddrLines[this.AddrLines.Count - 1] = ""; flag4 = true; } if (flag4) { flag = true; } else { flag = (length.Equals(10) || length.Equals(5) || length.Equals(7) || length.Equals(8) ? false : !length.Equals(4)); } if (!flag) { empty = string.Concat(" ", empty); length++; } if ((flag4 ? false : length > 10)) { if (!empty[length - 1 - 10].Equals(' ')) { flag3 = true; } else { chr = empty[length - 1 - 4]; flag3 = !chr.Equals('-'); } if (!flag3) { this.Postal = empty.Substring(length - 1 - 10); empty = empty.Substring(0, length - 1 - 10).Trim(); this.AddrLines[this.AddrLines.Count - 1] = empty; flag4 = true; } } if ((flag4 ? false : length > 8)) { if (!empty[length - 1 - 8].Equals(' ')) { flag2 = true; } else { chr = empty[length - 1 - 3]; flag2 = !chr.Equals(' '); } if (!flag2) { this.Postal = empty.Substring(length - 1 - 8); empty = empty.Substring(0, length - 1 - 8).Trim(); this.AddrLines[this.AddrLines.Count - 1] = empty; flag4 = true; } } if ((flag4 ? false : length > 7)) { if (!empty[length - 1 - 7].Equals(' ')) { flag1 = true; } else { chr = empty[length - 1 - 3]; flag1 = !chr.Equals(' '); } if (!flag1) { this.Postal = empty.Substring(length - 1 - 7); empty = empty.Substring(0, length - 1 - 7).Trim(); this.AddrLines[this.AddrLines.Count - 1] = empty; flag4 = true; } } if ((flag4 ? false : length > 5)) { if ((!empty[length - 1 - 5].Equals(' ') ? false : StringManip.IsNumeric(empty.Substring(length - 5)))) { this.Postal = empty.Substring(length - 1 - 5).Trim(); empty = empty.Substring(0, length - 1 - 5).Trim(); this.AddrLines[this.AddrLines.Count - 1] = empty; flag4 = true; } } if ((flag4 ? false : length > 4)) { if ((!empty[length - 1 - 4].Equals(' ') ? false : StringManip.IsNumeric(empty.Substring(length - 4)))) { this.Postal = empty.Substring(length - 1 - 4).Trim(); empty = (length != 5 ? empty.Substring(0, length - 1 - 4).Trim() : ""); this.AddrLines[this.AddrLines.Count - 1] = empty; flag4 = true; } } if (string.IsNullOrEmpty(this.AddrLines[this.AddrLines.Count - 1].ToString().Trim())) { this.AddrLines.RemoveAt(this.AddrLines.Count - 1); } if (!this.AddrLines.Count.Equals(0)) { flag5 = false; empty = this.AddrLines[this.AddrLines.Count - 1].ToString().Trim(); if (empty.IndexOf(", ") < 0) { this.Prov = empty; } else { this.Prov = empty.Substring(empty.IndexOf(", ") + 2).Trim(); this.City = empty.Substring(0, empty.IndexOf(", ")); flag5 = true; } this.AddrLines.RemoveAt(this.AddrLines.Count - 1); if (!this.AddrLines.Count.Equals(0)) { if ((flag5 ? false : this.AddrLines.Count > 1)) { this.City = this.AddrLines[this.AddrLines.Count - 1].ToString().Trim(); this.AddrLines.RemoveAt(this.AddrLines.Count - 1); } switch (this.AddrLines.Count) { case 0: { break; } case 1: { this.Addr1 = this.AddrLines[0].ToString().Trim(); break; } case 2: { this.Addr1 = this.AddrLines[0].ToString().Trim(); this.Addr2 = this.AddrLines[1].ToString().Trim(); break; } case 3: { this.Addr1 = string.Concat(this.AddrLines[0].ToString().Trim(), " - ", this.AddrLines[1].ToString().Trim()); this.Addr2 = this.AddrLines[2].ToString().Trim(); break; } case 4: { this.Addr1 = string.Concat(this.AddrLines[0].ToString().Trim(), " - ", this.AddrLines[1].ToString().Trim()); this.Addr2 = string.Concat(this.AddrLines[2].ToString().Trim(), " - ", this.AddrLines[3].ToString().Trim()); break; } case 5: { this.Addr1 = string.Concat(this.AddrLines[0].ToString().Trim(), " - ", this.AddrLines[1].ToString().Trim()); strArrays = new string[] { this.AddrLines[2].ToString().Trim(), " - ", this.AddrLines[3].ToString().Trim(), " - ", this.AddrLines[4].ToString().Trim() }; this.Addr2 = string.Concat(strArrays); break; } default: { this.Addr1 = string.Concat(this.AddrLines[0].ToString().Trim(), " - ", this.AddrLines[1].ToString().Trim()); strArrays = new string[] { this.AddrLines[2].ToString().Trim(), " - ", this.AddrLines[3].ToString().Trim(), " - ", this.AddrLines[4].ToString().Trim() }; this.Addr2 = string.Concat(strArrays); break; } } this.AddrLines.Clear(); } } } } }