private string prepareUpdateStatement() { string fieldsSQL = " UPDATE CUSTOMER_PIN_INFO SET"; string valuesSQL = fieldsSQL; if (UPDATED_BY == null || UPDATED_BY == "") { UPDATED_BY = "SYSTEM GENERATED"; } fieldsSQL = " UPDATED_BY ="; valuesSQL += fieldsSQL + " '" + UPDATED_BY + "'"; fieldsSQL = ", UPDATED_ON ="; valuesSQL += fieldsSQL + " getdate()"; if (CUST_TYPE_CODE != null && CUST_TYPE_CODE != "") { fieldsSQL = ", CUST_TYPE_CODE="; valuesSQL += fieldsSQL + " '" + CUST_TYPE_CODE.Replace("'", "~") + "'"; } if (PIN_TYPE_CODE != null && PIN_TYPE_CODE != "") { fieldsSQL = ", PIN_TYPE_CODE="; valuesSQL += fieldsSQL + " '" + PIN_TYPE_CODE.Replace("'", "~") + "'"; } if (CUSTOMER_STATUS_CODE != null && CUSTOMER_STATUS_CODE != "") { fieldsSQL = ", CUSTOMER_STATUS_CODE="; valuesSQL += fieldsSQL + " '" + CUSTOMER_STATUS_CODE.Replace("'", "~") + "'"; } if (UTILIZED_IVR_RETRIES != null && UTILIZED_IVR_RETRIES != "") { fieldsSQL = ", UTILIZED_IVR_RETRIES="; valuesSQL += fieldsSQL + " " + UTILIZED_IVR_RETRIES.Replace("'", "~") + ""; } if (LAST_PIN_CHANGE_DATE != null && LAST_PIN_CHANGE_DATE != "") { fieldsSQL = ", LAST_PIN_CHANGE_DATE="; valuesSQL += fieldsSQL + " " + LAST_PIN_CHANGE_DATE.Replace("'", "~") + ""; } if (LAST_PIN_ENTRY_DATE != null && LAST_PIN_ENTRY_DATE != "") { fieldsSQL = ", LAST_PIN_ENTRY_DATE="; valuesSQL += fieldsSQL + " " + LAST_PIN_ENTRY_DATE.Replace("'", "~") + ""; } if (LAST_SUCCESFUL_AUTH_DATE != null && LAST_SUCCESFUL_AUTH_DATE != "") { fieldsSQL = ", LAST_SUCCESFUL_AUTH_DATE="; valuesSQL += fieldsSQL + " " + LAST_SUCCESFUL_AUTH_DATE.Replace("'", "~") + ""; } if (LAST_PIN_GENERATION_DATE != null && LAST_PIN_GENERATION_DATE != "") { fieldsSQL = ", LAST_PIN_GENERATION_DATE="; valuesSQL += fieldsSQL + " " + LAST_PIN_GENERATION_DATE.Replace("'", "~") + ""; } if (LAST_STATUS_UPDATE_DATE != null && LAST_STATUS_UPDATE_DATE != "") { fieldsSQL = ", LAST_STATUS_UPDATE_DATE="; valuesSQL += fieldsSQL + " " + LAST_STATUS_UPDATE_DATE.Replace("'", "~") + ""; } if (AUTHORIZED_BY != null && AUTHORIZED_BY != "") { fieldsSQL = ", AUTHORIZED_BY="; valuesSQL += fieldsSQL + " '" + AUTHORIZED_BY.Replace("'", "~") + "'"; } return(valuesSQL); }
private string prepareInsertStatement() { string fieldsSQL = " INSERT INTO CUSTOMER_PIN_INFO ("; string valuesSQL = " VALUES("; if (IDENTITY_NUMBER != null && IDENTITY_NUMBER != "") { fieldsSQL += "IDENTITY_NUMBER"; valuesSQL += " '" + IDENTITY_NUMBER + "'"; } else { throw new Exception("Identity Number not found"); } if (CUST_TYPE_CODE != null && CUST_TYPE_CODE != "") { fieldsSQL += ", CUST_TYPE_CODE"; valuesSQL += ", '" + CUST_TYPE_CODE.Replace("'", "~") + "'"; } else { //throw new Exception("Customer Type not found"); } //if (AVAILABLE_IVR_RETRIES != null && AVAILABLE_IVR_RETRIES != "") //{ // fieldsSQL += ", AVAILABLE_IVR_RETRIES"; // valuesSQL += ", " + AVAILABLE_IVR_RETRIES.Replace("'", "~") + ""; //} //else //{ // //throw new Exception("Customer Type not found"); //} fieldsSQL += ", MAX_IVR_RETRIES"; if (CUST_TYPE_CODE == CUST_TYPE.NEW.GetHashCode().ToString()) { valuesSQL += ", " + ConfigurationManager.AppSettings["MAX_IVR_RETRIES_NEW"] + ""; } else if (CUST_TYPE_CODE == CUST_TYPE.NEW_WITH_PIN.GetHashCode().ToString()) { valuesSQL += ", " + ConfigurationManager.AppSettings["MAX_IVR_RETRIES_NEW_WITH_PIN"] + ""; } else { valuesSQL += ", " + ConfigurationManager.AppSettings["MAX_IVR_RETRIES"] + ""; } fieldsSQL += ", UTILIZED_IVR_RETRIES"; valuesSQL += ", 0"; if (PIN_TYPE_CODE != null && PIN_TYPE_CODE != "") { fieldsSQL += ", PIN_TYPE_CODE"; valuesSQL += ", '" + PIN_TYPE_CODE + "'"; } else { } if (CUSTOMER_STATUS_CODE != null && CUSTOMER_STATUS_CODE != "") { fieldsSQL += ", CUSTOMER_STATUS_CODE"; valuesSQL += ", '" + CUSTOMER_STATUS_CODE + "'"; } else { } if (LAST_PIN_CHANGE_DATE != null && LAST_PIN_CHANGE_DATE != "") { fieldsSQL += ", LAST_PIN_CHANGE_DATE"; valuesSQL += ", " + LAST_PIN_CHANGE_DATE + ""; } else { } if (LAST_PIN_ENTRY_DATE != null && LAST_PIN_ENTRY_DATE != "") { fieldsSQL += ", LAST_PIN_ENTRY_DATE"; valuesSQL += ", " + LAST_PIN_ENTRY_DATE + ""; } else { } if (LAST_SUCCESFUL_AUTH_DATE != null && LAST_SUCCESFUL_AUTH_DATE != "") { fieldsSQL += ", LAST_SUCCESFUL_AUTH_DATE"; valuesSQL += ", " + LAST_SUCCESFUL_AUTH_DATE + ""; } else { } if (LAST_PIN_GENERATION_DATE != null && LAST_PIN_GENERATION_DATE != "") { fieldsSQL += ", LAST_PIN_GENERATION_DATE"; valuesSQL += ", " + LAST_PIN_GENERATION_DATE + ""; } else { } if (LAST_STATUS_UPDATE_DATE != null && LAST_STATUS_UPDATE_DATE != "") { fieldsSQL += ", LAST_STATUS_UPDATE_DATE"; valuesSQL += ", " + LAST_STATUS_UPDATE_DATE + ""; } else { } if (AUTHORIZED_BY != null && AUTHORIZED_BY != "") { fieldsSQL += ", AUTHORIZED_BY"; valuesSQL += ", '" + AUTHORIZED_BY + "'"; } if (CREATED_BY == null || CREATED_BY == "") { CREATED_BY = "SYSTEM GENERATED"; } fieldsSQL += ", CREATED_BY, CREATED_ON"; valuesSQL += ", '" + CREATED_BY.Replace("'", "~") + "', getdate()"; fieldsSQL += ")"; valuesSQL += ")"; return(fieldsSQL + valuesSQL); }