private string prepareInsertStatement()
        {
            string fieldsSQL = " INSERT INTO CUSTOMER_PIN_HISTORY (";
            string valuesSQL = " VALUES(";

            if (IDENTITY_NUMBER != null && IDENTITY_NUMBER != "")
            {
                fieldsSQL += "IDENTITY_NUMBER";
                valuesSQL += " '" + IDENTITY_NUMBER + "'";
            }
            else
            {
                throw new Exception("Identity Number not found");
            }

            if (PIN != null && PIN != "")
            {
                fieldsSQL += ", PIN";
                valuesSQL += ", '" + PIN.Replace("'", "~") + "'";
            }
            else
            {
                //throw new Exception("Customer Type not found");
            }

            if (CHANNEL_GROUP_ID != null && CHANNEL_GROUP_ID != "")
            {
                fieldsSQL += ", CHANNEL_GROUP_ID";
                valuesSQL += ", " + CHANNEL_GROUP_ID.Replace("'", "~") + "";
            }
            else
            {
                //throw new Exception("Customer Type not found");
            }

            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);
        }
        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);
        }