private static void ReadTable() { if (PLConfig.bRead) { return; } uint num = 0; object szValue = new object(); uint createHandle = PLLink.GetLink().TableGET_CreateHandle("Configuration", 0, 0, 0U); PLLink.GetLink().TableGET_AddFilter(createHandle, "ConfigStatus", "EQ", "0", 1); while (PLLink.GetLink().TableGET_GetNextRecord(createHandle) == 0) { PLLink.GetLink().TableGET_RecordField_ValueString(createHandle, "ConfigName", "", ref szValue); string str = szValue.ToString().Trim(); int recordFieldValueI32 = PLLink.GetLink().TableGET_RecordField_ValueI32(createHandle, "ConfigID"); PLConfig.AddMapNNtoID(str, recordFieldValueI32); PLConfig.AddMapIDtoNN(recordFieldValueI32, str); StaticData.AddNicknameToList(str); PLLink.GetLink().TableGET_RecordField_ValueString(createHandle, "ConfigValue", "", ref szValue); PLConfig.AddMapNametoValue(str, szValue.ToString().Trim()); PLLink.GetLink().TableGET_RecordField_ValueString(createHandle, "ConfigSection", "", ref szValue); PLConfig.AddMapNametoSection(str, szValue.ToString().Trim()); } PLLink.GetLink().TableGET_CloseHandle(createHandle); num = 0U; PLConfig.bRead = true; }
public static string GetValueFromName(string Key) { string str; if (!Key.Equals("")) { if (!PLConfig.bRead) { PLConfig.ReadTable(); } if (PLConfig.m_MapNametoValue != null) { Key = Key.ToUpper(); str = PLConfig.m_MapNametoValue.ContainsKey(Key) ? Convert.ToString(PLConfig.m_MapNametoValue[Key]) : ""; } else { str = ""; } } else { str = ""; } return(str); }
public static int GetIDFromNN(string Key) { int num; if (!Key.Equals("")) { if (!PLConfig.bRead) { PLConfig.ReadTable(); } if (PLConfig.m_MapNNtoID != null) { Key = Key.ToUpper(); num = PLConfig.m_MapNNtoID.ContainsKey(Key) ? Convert.ToInt32(PLConfig.m_MapNNtoID[Key]) : 0; } else { num = 0; } } else { num = 0; } return(num); }
public override void Send() { object nProcessed = new object(); object nExceptions = new object(); object vunIDCreated = new object(); object nExceptionError = new object(); object szExceptionErrorMsg = new object(); object szExceptionSentData = new object(); object szValue = new object(); string szDefault = ""; string empty1 = string.Empty; string empty2 = string.Empty; this.m_lSendErrorCount = 0L; this.GetLink().TablePOST_Send(this.m_hndPOST, ref nProcessed, ref nExceptions); short int16_1 = Convert.ToInt16(nProcessed); short int16_2 = Convert.ToInt16(nExceptions); PLXMLData.m_lErrorCount += (long)int16_2; if (((int)int16_2 > 0 ? 1 : (this.m_lCounter != (int)int16_1 ? 1 : 0)) != 0) { this.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST); PLConfig plConfig = this; plConfig.m_lSendErrorCount = plConfig.m_lSendErrorCount + 1L; } while (this.GetLink().TablePOST_GetNextResult(this.m_hndPOST, ref vunIDCreated, ref nExceptionError, ref szExceptionErrorMsg, ref szExceptionSentData) == 0) { if (Convert.ToInt32(nExceptionError) <= 0) { int int32 = Convert.ToInt32(vunIDCreated); this.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_Name.sLinkName, szDefault, ref szValue); string Key = szValue.ToString(); PLConfig.AddMapIDtoNN(int32, Key); PLConfig.AddMapNNtoID(Key, int32); this.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_ExternalID_1.sLinkName, szDefault, ref szValue); if (!szValue.ToString().Equals("")) { PLConfig.AddMapExtID1toPLID(szValue.ToString(), int32); } this.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_ExternalID_2.sLinkName, szDefault, ref szValue); if (!szValue.ToString().Equals("")) { PLConfig.AddMapExtID2toPLID(szValue.ToString(), int32); } this.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_Value.sLinkName, szDefault, ref szValue); if (!szValue.ToString().Equals("")) { PLConfig.AddMapNametoValue(Key, szValue.ToString()); } } } this.GetLink().TablePOST_Reset(this.m_hndPOST); this.m_lCounter = 0; }
public static string GetNNFromID(int nID) { string str; if (!nID.Equals(0)) { if (!PLConfig.bRead) { PLConfig.ReadTable(); } str = PLConfig.m_MapIDtoNN == null ? "" : (PLConfig.m_MapIDtoNN.ContainsKey(nID) ? PLConfig.m_MapIDtoNN[nID].ToString() : ""); } else { str = ""; } return(str); }
public static int GetIDFromExtID2(string Key) { int num; if (!Key.Equals((object)0)) { if (!PLConfig.bRead) { PLConfig.ReadTable(); } num = PLConfig.m_MapExtID2toPLID == null ? 0 : (PLConfig.m_MapExtID2toPLID.ContainsKey(Key) ? Convert.ToInt32(PLConfig.m_MapExtID2toPLID[Key]) : 0); } else { num = 0; } return(num); }
public int ResetQuickBooksConnection() { if (!PLConfig.bRead) { PLConfig.ReadTable(); } Dictionary <string, int> .Enumerator enumerator = PLConfig.m_MapNNtoID.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <string, int> current = enumerator.Current; bool flag; if (!current.Key.ToLower().Contains("qb_companyname")) { current = enumerator.Current; if (!current.Key.ToLower().Contains("qb_lastsyncdate")) { current = enumerator.Current; if (!current.Key.ToLower().Contains("qb_pclaw_")) { current = enumerator.Current; flag = !current.Key.ToLower().Contains("qb_employee_"); goto label_8; } } } flag = false; label_8: if (!flag) { current = enumerator.Current; if (current.Value != 0) { current = enumerator.Current; this.ReadExisting((uint)current.Value); this.Value = string.Empty; this.Section = string.Empty; this.UserID = 0; } } } return(PLLink.GetLink().ResetAllQuickBooksIDs()); }
public void WriteValueToPCLawConfig(string sName, string sValue, string sSection, int nUserID) { uint idFromNn = (uint)PLConfig.GetIDFromNN(sName); if ((int)idFromNn == 0) { this.Status = PLXMLData.eSTATUS.ACTIVE; this.Name = sName; this.Value = sValue; this.Section = sSection; this.UserID = nUserID; } else { this.ReadExisting(idFromNn); this.Value = sValue; this.Section = sSection; this.UserID = nUserID; } this.AddRecord(); this.SendLast(); }
public override void AddRecord() { if (!this.m_Name.m_bIsSet) { this.Name = this.MakeNN(true); } else if ((this.m_ID.m_bIsSet && this.m_ID.nValue.Equals(0) || !this.m_ID.m_bIsSet ? (PLConfig.GetIDFromNN(this.Name) > 0 ? 1 : 0) : 0) != 0) { this.Name = this.MakeNN(true); } StaticData.AddNicknameToList(this.Name); base.AddRecord(); this.GetLink().TablePOST_AddRecord(this.m_hndPOST); PLConfig plConfig = this; plConfig.m_lCounter = plConfig.m_lCounter + 1; if (this.m_lCounter < PLXMLData.m_nMaxCounter) { return; } this.Send(); }