private void UpdateSettings2(SettingsDM setting) { string sAPIInput = ""; APIRunner oAPI = new APIRunner(m); string[] aParamData = new string[10]; int iAPINumber = c.API05_UPDATE_SETTINGS; aParamData[0] = JsonSerializer.Serialize <SettingsDM>(setting); sAPIInput = m.ArrayToString(aParamData); oAPI.ActionCode = iAPINumber; oAPI.InputParameters = sAPIInput; oAPI.CallAPI(c.APIType.SENDDATA_RECEIVEDATA); if (oAPI.ErrorOccured) { ErrorMessage = oAPI.APIErrorMessage; SecretErrorDetails = oAPI.APIErrorSecretInfo; return; } ds1 = oAPI.DatasetReturned; if (m.GetFieldStr("ResultCode", ds1) == c.BATCH_RESULT_OK) { InfoMessage = "Settings updated."; } else { ErrorMessage = m.GetFieldStr("ResultMsg", ds1); } }
public void UpdateSettings(SettingsDM setting) { try { UpdateSettings2(setting); } catch (Exception e) { ErrorMessage = e.Message; SecretErrorDetails = m.ShortenStack(e.StackTrace, true); } }
private void ReadSettings2(SettingsDM setting) { string sAPIInput = ""; APIRunner oAPI = new APIRunner(m); string[] aParamData = new string[10]; int iAPINumber = c.API05_READ_SETTINGS; aParamData[0] = ""; sAPIInput = m.ArrayToString(aParamData); oAPI.ActionCode = iAPINumber; oAPI.InputParameters = sAPIInput; oAPI.CallAPI(c.APIType.SENDDATA_RECEIVEDATA); if (oAPI.ErrorOccured) { ErrorMessage = oAPI.APIErrorMessage; SecretErrorDetails = oAPI.APIErrorSecretInfo; return; } ds1 = oAPI.DatasetReturned; if (m.EmptyTable(ds1)) { ErrorMessage = "Settings table has no rows"; return; } setting.SystemCustomCodes = m.GetFieldStr("SystemCustomCodes", ds1); setting.PinNumber1 = m.GetFieldStr("PinNumber1", ds1); setting.PinNumber2 = m.GetFieldStr("PinNumber2", ds1); setting.PinNumber3 = m.GetFieldStr("PinNumber3", ds1); setting.IncludeSecretInfoInErrMsgToUser = m.GetFieldBol("IncludeSecretInfoInErrMsgToUser", ds1); setting.CopywriteNotice = m.GetFieldStr("CopywriteNotice", ds1); setting.ProductName = m.GetFieldStr("ProductName", ds1); setting.ContactUrl = m.GetFieldStr("ContactUrl", ds1); setting.DisableSystem = m.GetFieldBol("DisableSystem", ds1); setting.DisableMessage = m.GetFieldStr("DisableMessage", ds1); setting.AboutLine1 = m.GetFieldStr("AboutLine1", ds1); setting.AboutLine2 = m.GetFieldStr("AboutLine2", ds1); setting.AboutLine3 = m.GetFieldStr("AboutLine3", ds1); setting.TextField1 = m.GetFieldStr("TextField1", ds1); setting.TextField2 = m.GetFieldStr("TextField2", ds1); setting.TextField3 = m.GetFieldStr("TextField3", ds1); setting.TextField4 = m.GetFieldStr("TextField4", ds1); setting.CheckBox1 = m.GetFieldBol("CheckBox1", ds1); setting.CheckBox2 = m.GetFieldBol("CheckBox2", ds1); setting.CheckBox3 = m.GetFieldBol("CheckBox3", ds1); setting.CheckBox4 = m.GetFieldBol("CheckBox4", ds1); setting.CheckBox5 = m.GetFieldBol("CheckBox5", ds1); setting.CheckBox6 = m.GetFieldBol("CheckBox6", ds1); setting.CheckBox7 = m.GetFieldBol("CheckBox7", ds1); }
private void UpdateSettings2(SettingsDM gItem) { string sSQL; int i2; //if (m.IsEmpty(gItem.GroupName)) //{ // SetResultCode(c.BATCH_RESULT_FAIL, "Group Name cannot be blank."); // return; //} sSQL = "UPDATE [dbo].[W_SystemSettings] "; sSQL = sSQL + " SET "; sSQL = sSQL + " [SystemCustomCodes] = " + m.InQuote(gItem.SystemCustomCodes, 500); sSQL = sSQL + " , [PinNumber1] = " + m.InQuote(gItem.PinNumber1, 500); sSQL = sSQL + " , [PinNumber2] = " + m.InQuote(gItem.PinNumber2, 500); sSQL = sSQL + " , [PinNumber3] = " + m.InQuote(gItem.PinNumber3, 500); sSQL = sSQL + " , [TextField1] = " + m.InQuote(gItem.TextField1, 500); sSQL = sSQL + " , [TextField2] = " + m.InQuote(gItem.TextField2, 500); sSQL = sSQL + " , [TextField3] = " + m.InQuote(gItem.TextField3, 500); sSQL = sSQL + " , [TextField4] = " + m.InQuote(gItem.TextField4, 500); sSQL = sSQL + " , [CheckBox1] = " + m.InQuoteN(gItem.CheckBox1); sSQL = sSQL + " , [CheckBox2] = " + m.InQuoteN(gItem.CheckBox2); sSQL = sSQL + " , [CheckBox3] = " + m.InQuoteN(gItem.CheckBox3); sSQL = sSQL + " , [CheckBox4] = " + m.InQuoteN(gItem.CheckBox4); sSQL = sSQL + " , [CheckBox5] = " + m.InQuoteN(gItem.CheckBox5); sSQL = sSQL + " , [CheckBox6] = " + m.InQuoteN(gItem.CheckBox6); sSQL = sSQL + " , [CheckBox7] = " + m.InQuoteN(gItem.CheckBox7); sSQL = sSQL + " , [IncludeSecretInfoInErrMsgToUser] = " + m.InQuoteN(gItem.IncludeSecretInfoInErrMsgToUser); sSQL = sSQL + " , [CopywriteNotice] = " + m.InQuote(gItem.CopywriteNotice, 500); sSQL = sSQL + " , [ProductName] = " + m.InQuote(gItem.ProductName, 500); sSQL = sSQL + " , [ContactUrl] = " + m.InQuote(gItem.ContactUrl, 500); sSQL = sSQL + " , [DisableSystem] = " + m.InQuoteN(gItem.DisableSystem); sSQL = sSQL + " , [DisableMessage] = " + m.InQuote(gItem.DisableMessage, 500); sSQL = sSQL + " , [AboutLine1] = " + m.InQuote(gItem.AboutLine1, 500); sSQL = sSQL + " , [AboutLine2] = " + m.InQuote(gItem.AboutLine2, 500); sSQL = sSQL + " , [AboutLine3] = " + m.InQuote(gItem.AboutLine3, 500); i2 = m.SQLExecuteCommand(sSQL, c.DB.WhosIn); SetResultCode(c.BATCH_RESULT_OK, "Settings updated."); return; }