public MetaResponse UpdateCustomerMasterMaintenances(string ClientCertificateList) { DataTable dgvList = Utility.Utility_Component.JsonToDt(ClientCertificateList); for (int i = 0; i < dgvList.Rows.Count; i++) { BOL_CUSTOMER_MASTER oCUSTOMER_MMASTER = new BOL_CUSTOMER_MASTER(); BOL_BANK_ACCOUNT_MASTER oBANK_ACCOUNT_MASTER = new BOL_BANK_ACCOUNT_MASTER(); oCUSTOMER_MMASTER = Cast_CUSTOMER_MASTER(dgvList.Rows[i]); oBANK_ACCOUNT_MASTER = Cast_BANK_ACCOUNT_MASTER(dgvList.Rows[i]); switch (dgvList.Rows[i]["MK"].ToString()) { case "M": HandleModify(oCUSTOMER_MMASTER, oBANK_ACCOUNT_MASTER, "M", dgvList.Rows[i]); break; default: break; } } response.Data = Utility.Utility_Component.DtToJSon(dgvList, "CustomerMaster Update"); timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalMilliseconds; return(response); }
private void HandleModify(BOL_CUSTOMER_MASTER oCUSTOMER_MASTER, BOL_BANK_ACCOUNT_MASTER oBANK_ACCOUNT_MASTER, string OPERATION, DataRow row) { string strMsg = ""; CUSTOMER_MASTER DAL_CUSTOMER_MASTER = new CUSTOMER_MASTER(con); using (TransactionScope dbTxn = new TransactionScope()) { //check condition if (!DAL_CUSTOMER_MASTER.IsAlreadyUpdate(oCUSTOMER_MASTER, out strMsg)) // IF updated_at is not already modified { DAL_CUSTOMER_MASTER.CustomerMasterUpdate(oCUSTOMER_MASTER, CURRENT_DATETIME, CURRENT_USER, out strMsg); if (!string.IsNullOrEmpty(strMsg)) { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } } else { //already use in another process dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } #region UPDATE BANK_ACCOUNT_MASTER BANK_ACCOUNT_MASTER DAL_BANK_ACCOUNT_MASTER = new BANK_ACCOUNT_MASTER(con); if (!DAL_BANK_ACCOUNT_MASTER.IsAlreadyUpdated(oBANK_ACCOUNT_MASTER, out strMsg)) // If updated_at is not already modified { //insert the record DAL_BANK_ACCOUNT_MASTER.BankAccountMasterUpdate(oBANK_ACCOUNT_MASTER, CURRENT_DATETIME, CURRENT_USER, out strMsg); } else { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } //return message and MK value if (String.IsNullOrEmpty(strMsg)) //success { dbTxn.Complete(); string S = Convert.ToDateTime(oCUSTOMER_MASTER.ORG_EFFECTIVE_DATE).ToString("yyyy/MM/dd"); row["EFFECTIVE_DATE"] = Convert.ToDateTime(oCUSTOMER_MASTER.EFFECTIVE_DATE).ToString("yyyy/MM/dd"); row["ORG_EFFECTIVE_DATE"] = Convert.ToDateTime(oCUSTOMER_MASTER.EFFECTIVE_DATE).ToString("yyyy/MM/dd"); ResponseUtility.ReturnSuccessMessage(row, UPDATED_AT_DATETIME, CURRENT_DATETIME, CURRENT_USER); } else //failed { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); } #endregion } }
public Response UpdateCustomer(string Customers) { try { string strMessage = ""; DataTable dgvList = Utility.Utility_Component.JsonToDt(Customers); if (dgvList.Rows.Count > 0) { for (int i = 0; i < dgvList.Rows.Count; i++) { BOL_CUSTOMER_MASTER B_Customer = new BOL_CUSTOMER_MASTER(); B_Customer.BILL_BANK_ACCOUNT_NAME_1 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-1"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-1"].ToString() : ""); B_Customer.BILL_BANK_ACCOUNT_NAME_2 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-2"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-2"].ToString() : ""); B_Customer.BILL_BANK_ACCOUNT_NAME_3 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-3"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-3"].ToString() : ""); B_Customer.BILL_BANK_ACCOUNT_NAME_4 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-4"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-4"].ToString() : ""); B_Customer.COMPANY_NO_BOX = (dgvList.Rows[i]["COMPANY_NO_BOX"] != null ? dgvList.Rows[i]["COMPANY_NO_BOX"].ToString() : ""); B_Customer.TRANSACTION_TYPE = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["TRANSACTION_TYPE"] != null ? dgvList.Rows[i]["TRANSACTION_TYPE"].ToString() : "")); B_Customer.NCS_CUSTOMER_CODE = (dgvList.Rows[i]["NCS_CUSTOMER_CODE"] != null ? dgvList.Rows[i]["NCS_CUSTOMER_CODE"].ToString() : ""); B_Customer.EFFECTIVE_DATE = DateTime.Parse(dgvList.Rows[i]["EFFECTIVE_DATE"] != null ? dgvList.Rows[i]["EFFECTIVE_DATE"].ToString() : ""); B_Customer.BILL_BILLING_INTERVAL = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["BILL_BILLING_INTERVAL"] != null ? dgvList.Rows[i]["BILL_BILLING_INTERVAL"].ToString() : "")); B_Customer.BILL_DEPOSIT_RULES = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["BILL_DEPOSIT_RULES"] != null ? dgvList.Rows[i]["BILL_DEPOSIT_RULES"].ToString() : "")); B_Customer.BILL_TRANSFER_FEE = Utility.Utility_Component.dtColumnToDecimal((dgvList.Rows[i]["BILL_TRANSFER_FEE"] != null ? dgvList.Rows[i]["BILL_TRANSFER_FEE"].ToString() : "")); B_Customer.BILL_EXPENSES = Utility.Utility_Component.dtColumnToDecimal(dgvList.Rows[i]["BILL_EXPENSES"] != null ? dgvList.Rows[i]["BILL_EXPENSES"].ToString() : ""); B_Customer.UPDATE_DATE = DateTime.Now; B_Customer.UPDATER_CODE = dgvList.Rows[i]["UPDATER_CODE"].ToString(); CUSTOMER_MASTER DAL_Customer = new CUSTOMER_MASTER(Properties.Settings.Default.MyConnection); DAL_Customer.update(B_Customer, out strMessage); } } if (strMessage == "") { response.Status = 1; response.Message = "Customer updated"; } else { response.Status = 0; response.Message = strMessage; } return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } }
private BOL_CUSTOMER_MASTER Cast_CUSTOMER_MASTER(DataRow row) { BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER(); oCUSTOMER_MASTER.CONTRACT_DATE = Utility_Component.dtColumnToDateTime(row["CONTRACT_DATE"].ToString()); oCUSTOMER_MASTER.SPECIAL_NOTES_1 = row["SPECIAL_NOTES_1"].ToString(); oCUSTOMER_MASTER.SPECIAL_NOTES_2 = row["SPECIAL_NOTES_2"].ToString(); oCUSTOMER_MASTER.SPECIAL_NOTES_3 = row["SPECIAL_NOTES_3"].ToString(); oCUSTOMER_MASTER.SPECIAL_NOTES_4 = row["SPECIAL_NOTES_4"].ToString(); oCUSTOMER_MASTER.NCS_CUSTOMER_CODE = row["NCS_CUSTOMER_CODE"].ToString(); oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = Utility_Component.dtColumnToInt(row["BILL_BILLING_INTERVAL"].ToString()); oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = Utility_Component.dtColumnToInt(row["BILL_DEPOSIT_RULES"].ToString()); oCUSTOMER_MASTER.BILL_TRANSFER_FEE = Utility_Component.dtColumnToDecimal(row["BILL_TRANSFER_FEE"].ToString()); oCUSTOMER_MASTER.BILL_EXPENSES = Utility_Component.dtColumnToDecimal(row["BILL_EXPENSES"].ToString()); oCUSTOMER_MASTER.COMPANY_NAME_CHANGED_DATE = Utility_Component.dtColumnToDateTime(row["COMPANY_NAME_CHANGED_DATE"].ToString()); oCUSTOMER_MASTER.PREVIOUS_COMPANY_NAME = row["PREVIOUS_COMPANY_NAME"].ToString(); oCUSTOMER_MASTER.OBOEGAKI_DATE = Utility_Component.dtColumnToDateTime(row["OBOEGAKI_DATE"].ToString()); return(oCUSTOMER_MASTER); }
public void update(BOL_CUSTOMER_MASTER B_Customer, out string strMessage) { strMessage = ""; ConnectionMaster oMaster = new ConnectionMaster(strConnectionString, strUpdate); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_1", B_Customer.BILL_BANK_ACCOUNT_NAME_1)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_2", B_Customer.BILL_BANK_ACCOUNT_NAME_2)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_3", B_Customer.BILL_BANK_ACCOUNT_NAME_3)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_4", B_Customer.BILL_BANK_ACCOUNT_NAME_4)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BILLING_INTERVAL", B_Customer.BILL_BILLING_INTERVAL)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_DEPOSIT_RULES", B_Customer.BILL_DEPOSIT_RULES)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_TRANSFER_FEE", B_Customer.BILL_TRANSFER_FEE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_EXPENSES", B_Customer.BILL_EXPENSES)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@UPDATE_DATE", B_Customer.UPDATE_DATE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@UPDATER_CODE", B_Customer.UPDATER_CODE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@COMPANY_NO_BOX", B_Customer.COMPANY_NO_BOX)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@TRANSACTION_TYPE", B_Customer.TRANSACTION_TYPE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NCS_CUSTOMER_CODE", B_Customer.NCS_CUSTOMER_CODE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@EFFECTIVE_DATE", B_Customer.EFFECTIVE_DATE)); oMaster.ExcuteQuery(2, out strMessage); }
public MetaResponse SubmitOrderRegister(string list, System.Web.HttpPostedFile file) { using (TransactionScope dbTxn = new TransactionScope()) { try { string msg = ""; //set global PARAMETERS PARAMETERS = Utility.Utility_Component.JsonToDt(list); #region Update REQUEST_DETAIL //cast to REQUEST DETAIL OBJECT BOL_REQUEST_DETAIL oREQUEST_DETAIL = new BOL_REQUEST_DETAIL(); oREQUEST_DETAIL = Cast_REQUEST_DETAIL(); oREQUEST_DETAIL.SYSTEM_SETTING_STATUS = 1; REQUEST_DETAIL DAL_REQUEST_DETAIL = new REQUEST_DETAIL(con); DAL_REQUEST_DETAIL.Update(oREQUEST_DETAIL, CURRENT_DATETIME, CURRENT_USER, out msg); //rollback if not success if (!String.IsNullOrEmpty(msg)) { dbTxn.Dispose(); return(ResponseUtility.ReturnFailMessage(response, timer, BodyMessage)); } #endregion #region Insert CUSTOMER MASTER //COUNT IN CUSTOMER MASTER string COMPANY_NAME = GetParameterByKey("COMPANY_NAME"); string COMPANY_NO_BOX = GetParameterByKey("COMPANY_NO_BOX"); string CONTRACT_PLAN = GetParameterByKey("CONTRACT_PLAN"); int TRANSACTION_TYPE = int.Parse(GetParameterByKey("TRANSACTION_TYPE")); int REQ_SEQ = int.Parse(GetParameterByKey("REQ_SEQ")); int REQ_TYPE = int.Parse(GetParameterByKey("REQ_TYPE")); DateTime START_USE_DATE = DateTime.Parse(GetParameterByKey("START_USE_DATE")); CUSTOMER_MASTER DAL_CUSTOMER_MASTER = new CUSTOMER_MASTER(con); int customer_count = DAL_CUSTOMER_MASTER.getCustomerCountByKeys(COMPANY_NO_BOX, TRANSACTION_TYPE, START_USE_DATE, REQ_SEQ, out msg); if (customer_count == 0) //if customer not found { DataTable LatestCustomer = new DataTable(); BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER(); if (REQ_TYPE == 2) { LatestCustomer = DAL_CUSTOMER_MASTER.GetTopCustomerByKeys(COMPANY_NO_BOX, TRANSACTION_TYPE, START_USE_DATE, out msg); if (LatestCustomer.Rows.Count > 0) { oCUSTOMER_MASTER = Cast_CUSTOMER_MASTER(LatestCustomer.Rows[0]); oCUSTOMER_MASTER.UPDATE_CONTENT = 3; } else //Need another message? { dbTxn.Dispose(); return(ResponseUtility.ReturnFailMessage(response, timer, BodyMessage)); } } if (REQ_TYPE == 1) { oCUSTOMER_MASTER.UPDATE_CONTENT = 1; } //insert info form screen oCUSTOMER_MASTER.COMPANY_NO_BOX = COMPANY_NO_BOX; oCUSTOMER_MASTER.TRANSACTION_TYPE = TRANSACTION_TYPE; oCUSTOMER_MASTER.EFFECTIVE_DATE = START_USE_DATE; oCUSTOMER_MASTER.REQ_SEQ = REQ_SEQ; DAL_CUSTOMER_MASTER.Insert(oCUSTOMER_MASTER, CURRENT_DATETIME, CURRENT_USER, out msg); //rollback if not success if (!String.IsNullOrEmpty(msg)) { dbTxn.Dispose(); return(ResponseUtility.ReturnFailMessage(response, timer, BodyMessage)); } #region Insert Browsing supplier CUSTOMER MASTER BOL_CUSTOMER_MASTER oBROWSING_SUPPLIER = new BOL_CUSTOMER_MASTER(); if (CONTRACT_PLAN == "PRODUCT" && REQ_TYPE == 2) { DateTime NEW_EFFECTIVE_DATE = Convert.ToDateTime(DAL_CUSTOMER_MASTER.GetEffectiveDateForNewApplyingTime(oREQUEST_DETAIL.COMPANY_NO_BOX, TRANSACTION_TYPE, START_USE_DATE, out msg)); if ((NEW_EFFECTIVE_DATE.Month + NEW_EFFECTIVE_DATE.Day) != (START_USE_DATE.Month + START_USE_DATE.Day)) { oBROWSING_SUPPLIER = Cast_CUSTOMER_MASTER(LatestCustomer.Rows[0]); oBROWSING_SUPPLIER.COMPANY_NO_BOX = COMPANY_NO_BOX; oBROWSING_SUPPLIER.TRANSACTION_TYPE = TRANSACTION_TYPE; oBROWSING_SUPPLIER.EFFECTIVE_DATE = Convert.ToDateTime(START_USE_DATE.Year + "/" + NEW_EFFECTIVE_DATE.Month + "/" + NEW_EFFECTIVE_DATE.Day); oBROWSING_SUPPLIER.UPDATE_CONTENT = 3; oBROWSING_SUPPLIER.REQ_SEQ = REQ_SEQ; DAL_CUSTOMER_MASTER.Insert(oBROWSING_SUPPLIER, CURRENT_DATETIME, CURRENT_USER, out msg); } //rollback if not success if (!String.IsNullOrEmpty(msg)) { dbTxn.Dispose(); return(ResponseUtility.ReturnFailMessage(response, timer, BodyMessage)); } } #endregion } #endregion #region Insert REPORT_HISTORY //Insert Report_History BOL_REPORT_HISTORY oREPORT_HISTORY = new BOL_REPORT_HISTORY(); oREPORT_HISTORY.COMPANY_NO_BOX = COMPANY_NO_BOX; oREPORT_HISTORY.REQ_SEQ = REQ_SEQ; oREPORT_HISTORY.REPORT_TYPE = 4; REPORT_HISTORY DAL_REPORT_HISTORY = new REPORT_HISTORY(con); int HISTORY_SEQ = DAL_REPORT_HISTORY.GetReportHistorySEQ(COMPANY_NO_BOX, oREPORT_HISTORY.REPORT_TYPE, oREPORT_HISTORY.REQ_SEQ, out msg); //rollback if not success if (!String.IsNullOrEmpty(msg)) { dbTxn.Dispose(); return(ResponseUtility.ReturnFailMessage(response, timer, BodyMessage)); } oREPORT_HISTORY.REPORT_HISTORY_SEQ = HISTORY_SEQ; oREPORT_HISTORY.OUTPUT_AT = Utility_Component.dtColumnToDateTime(DateTime.Now.ToString()); oREPORT_HISTORY.OUTPUT_FILE = COMPANY_NO_BOX + "-1-" + REQ_SEQ + "_注文書_" + COMPANY_NAME + "様.pdf"; oREPORT_HISTORY.EMAIL_ADDRESS = null; DAL_REPORT_HISTORY.Insert(oREPORT_HISTORY, CURRENT_DATETIME, CURRENT_USER, out msg); //rollback if not success if (!String.IsNullOrEmpty(msg)) { dbTxn.Dispose(); return(ResponseUtility.MailSendingFail(response, timer, BodyMessage)); } #endregion #region Save File //get destination path form config table BOL_CONFIG config = new BOL_CONFIG("CTS050", con); string destination = config.getStringValue("fileSavePath.purchaseOrder"); SaveFile(file, destination, oREPORT_HISTORY.OUTPUT_FILE, out msg); if (!string.IsNullOrEmpty(msg)) { dbTxn.Dispose(); response.Status = 0; timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalSeconds; response.Message = "File Path Not Found"; //add in body message DataRow row = BodyMessage.NewRow(); row["Error Message"] = "File Path Not Found"; BodyMessage.Rows.Add(row); response.Data = Utility_Component.DtToJSon(BodyMessage, "Message"); return(response); } #endregion #region SendMail bool mailSuccess = PrepareAndSendMail(); if (!mailSuccess) { dbTxn.Dispose(); return(ResponseUtility.MailSendingFail(response, timer, BodyMessage)); } #endregion //all process success dbTxn.Complete(); response.Status = 1; response.Message = string.Format(Utility.Messages.Jimugo.I000ZZ016, "注文登録"); DataRow dr = BodyMessage.NewRow(); dr["Message"] = response.Message; dr["UPDATED_AT"] = UPDATED_AT_DATETIME; dr["UPDATED_AT_RAW"] = CURRENT_DATETIME; BodyMessage.Rows.Add(dr); response.Data = Utility_Component.DtToJSon(BodyMessage, "Message"); timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalSeconds; return(response); } catch (Exception ex) { dbTxn.Dispose(); ResponseUtility.GetUnexpectedResponse(response, timer, ex); //add in body message DataRow dr = BodyMessage.NewRow(); dr["Error Message"] = "something went wrong."; BodyMessage.Rows.Add(dr); response.Data = Utility_Component.DtToJSon(BodyMessage, "Message"); return(response); } } }
public void insert(BOL_CUSTOMER_MASTER B_Customer, out string strMessage) { strMessage = ""; ConnectionMaster oMaster = new ConnectionMaster(strConnectionString, strInsert); oMaster.crudCommand.Parameters.Add(new SqlParameter("@COMPANY_NO_BOX", B_Customer.COMPANY_NO_BOX)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@TRANSACTION_TYPE", B_Customer.TRANSACTION_TYPE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@EFFECTIVE_DATE", B_Customer.EFFECTIVE_DATE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@UPDATE_CONTENT", B_Customer.UPDATE_CONTENT)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@COMPANY_NAME", B_Customer.COMPANY_NAME)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@COMPANY_NAME_READING", B_Customer.COMPANY_NAME_READING)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@ESTIMATED_SUBMISSION_DATE", B_Customer.ESTIMATED_SUBMISSION_DATE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACT_DATE", B_Customer.CONTRACT_DATE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@COMPLETION_NOTE_SENDING_DATE", B_Customer.COMPLETION_NOTE_SENDING_DATE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_DEPARTMENT_IN_CHARGE", B_Customer.CONTRACTOR_DEPARTMENT_IN_CHARGE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_CONTACT_NAME", B_Customer.CONTRACTOR_CONTACT_NAME)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_CONTACT_NAME_READING", B_Customer.CONTRACTOR_CONTACT_NAME_READING)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_POSTAL_CODE", B_Customer.CONTRACTOR_POSTAL_CODE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_ADDRESS", B_Customer.CONTRACTOR_ADDRESS)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_ADDRESS_2", B_Customer.CONTRACTOR_ADDRESS_2)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_MAIL_ADDRESS", B_Customer.CONTRACTOR_MAIL_ADDRESS)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@CONTRACTOR_PHONE_NUMBER", B_Customer.CONTRACTOR_PHONE_NUMBER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_SUPPLIER_NAME", B_Customer.BILL_SUPPLIER_NAME)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_SUPPLIER_NAME_READING", B_Customer.BILL_SUPPLIER_NAME_READING)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_COMPANY_NAME", B_Customer.BILL_COMPANY_NAME)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_DEPARTMENT_IN_CHARGE", B_Customer.BILL_DEPARTMENT_IN_CHARGE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_CONTACT_NAME", B_Customer.BILL_CONTACT_NAME)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_CONTACT_NAME_READING", B_Customer.BILL_CONTACT_NAME_READING)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_POSTAL_CODE", B_Customer.BILL_POSTAL_CODE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_ADDRESS", B_Customer.BILL_ADDRESS)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_ADDRESS_2", B_Customer.BILL_ADDRESS_2)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_MAIL_ADDRESS", B_Customer.BILL_MAIL_ADDRESS)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_PHONE_NUMBER", B_Customer.BILL_PHONE_NUMBER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NCS_CUSTOMER_CODE", B_Customer.NCS_CUSTOMER_CODE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_1", B_Customer.BILL_BANK_ACCOUNT_NAME_1)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@ILL_BANK_ACCOUNT_NAME_2", B_Customer.BILL_BANK_ACCOUNT_NAME_2)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_3", B_Customer.BILL_BANK_ACCOUNT_NAME_3)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NAME_4", B_Customer.BILL_BANK_ACCOUNT_NAME_4)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NUMBER_1", B_Customer.BILL_BANK_ACCOUNT_NUMBER_1)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NUMBER_2", B_Customer.BILL_BANK_ACCOUNT_NUMBER_2)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NUMBER_3", B_Customer.BILL_BANK_ACCOUNT_NUMBER_3)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BANK_ACCOUNT_NUMBER_4", B_Customer.BILL_BANK_ACCOUNT_NUMBER_4)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_BILLING_INTERVAL", B_Customer.BILL_BILLING_INTERVAL)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_DEPOSIT_RULES", B_Customer.BILL_DEPOSIT_RULES)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_TRANSFER_FEE", B_Customer.BILL_TRANSFER_FEE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@BILL_EXPENSES", B_Customer.BILL_EXPENSES)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_SERVER", B_Customer.PLAN_SERVER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_SERVER_LIGHT", B_Customer.PLAN_SERVER_LIGHT)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_BROWSER_AUTO", B_Customer.PLAN_BROWSER_AUTO)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_BROWSER", B_Customer.PLAN_BROWSER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_INITIAL_COST", B_Customer.PLAN_INITIAL_COST)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_MONTHLY_COST", B_Customer.PLAN_MONTHLY_COST)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_AMIGO_CAI", B_Customer.PLAN_AMIGO_CAI)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_AMIGO_BIZ", B_Customer.PLAN_AMIGO_BIZ)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_ADD_BOX_SERVER", B_Customer.PLAN_ADD_BOX_SERVER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_ADD_BOX_BROWSER", B_Customer.PLAN_ADD_BOX_BROWSER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_OP_FLAT", B_Customer.PLAN_OP_FLAT)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_OP_SSL", B_Customer.PLAN_OP_SSL)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_OP_BASIC_SERVICE", B_Customer.PLAN_OP_BASIC_SERVICE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_OP_ADD_SERVICE", B_Customer.PLAN_OP_ADD_SERVICE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PLAN_OP_SOCIOS", B_Customer.PLAN_OP_SOCIOS)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@PREVIOUS_COMPANY_NAME", B_Customer.PREVIOUS_COMPANY_NAME)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NML_CODE_NISSAN", B_Customer.NML_CODE_NISSAN)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NML_CODE_NS", B_Customer.NML_CODE_NS)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NML_CODE_JATCO", B_Customer.NML_CODE_JATCO)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NML_CODE_AK", B_Customer.NML_CODE_AK)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NML_CODE_NK", B_Customer.NML_CODE_NK)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@NML_CODE_OTHER", B_Customer.NML_CODE_OTHER)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@UPDATE_DATE", B_Customer.UPDATE_DATE)); oMaster.crudCommand.Parameters.Add(new SqlParameter("@UPDATER_CODE", B_Customer.UPDATER_CODE)); oMaster.ExcuteQuery(1, out strMessage); //_M01 = oMaster.intRtnID; // return intRtn; }
public MetaResponse Disapprove(string COMPANY_NO_BOX, int REQ_TYPE, string CHANGED_ITEMS, string SYSTEM_EFFECTIVE_DATE, string SYSTEM_REGIST_DEADLINE, string List) { try { DataSet ds = new DataSet(); DataTable Listing = Utility_Component.JsonToDt(List); DataRow row; if (Listing.Rows.Count > 1) { row = Listing.Rows[1]; } else { row = Listing.Rows[0]; } string msg = ""; BOL_REQUEST_DETAIL oREQUEST_DETAIL = new BOL_REQUEST_DETAIL(); oREQUEST_DETAIL.REQ_STATUS = 3; if (REQ_TYPE == 1 || REQ_TYPE == 9 || (REQ_TYPE == 2 && !string.IsNullOrEmpty(CHANGED_ITEMS.Trim()))) { oREQUEST_DETAIL.AMIGO_COOPERATION = 1; } else { oREQUEST_DETAIL.AMIGO_COOPERATION = 2; } oREQUEST_DETAIL.AMIGO_COOPERATION_CHENGED_ITEMS = CHANGED_ITEMS.Trim(); try { oREQUEST_DETAIL.SYSTEM_EFFECTIVE_DATE = Convert.ToDateTime(SYSTEM_EFFECTIVE_DATE); } catch (Exception) { } try { oREQUEST_DETAIL.SYSTEM_REGIST_DEADLINE = Convert.ToDateTime(SYSTEM_REGIST_DEADLINE); } catch (Exception) { } oREQUEST_DETAIL.REQ_SEQ = int.Parse(row["REQ_SEQ"].ToString()); oREQUEST_DETAIL.UPDATED_AT = row["UPDATED_AT_RAW"].ToString(); oREQUEST_DETAIL.COMPANY_NO_BOX = COMPANY_NO_BOX; REQUEST_DETAIL DAL_REQUEST_DETAIL = new REQUEST_DETAIL(con); DAL_REQUEST_DETAIL.Disapprove(oREQUEST_DETAIL, CURRENT_USER, CURRENT_DATETIME, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } CUSTOMER_MASTER DAL_CUSTOMER_MASTER = new CUSTOMER_MASTER(con); BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER(); oCUSTOMER_MASTER.COMPANY_NO_BOX = COMPANY_NO_BOX; oCUSTOMER_MASTER.REQ_SEQ = oREQUEST_DETAIL.REQ_SEQ; DAL_CUSTOMER_MASTER.Delete(oCUSTOMER_MASTER, out msg); if (string.IsNullOrEmpty(msg)) { DataTable dtMail = new DataTable(); bool success = DisapproveSendMail(row["COMPANY_NAME"].ToString(), row["INPUT_PERSON"].ToString(), row["INPUT_PERSON_EMAIL_ADDRESS"].ToString(), out dtMail); if (success) { response.Status = 1; row["UPDATED_AT"] = UPDATED_AT_DATETIME; row["UPDATED_AT_RAW"] = CURRENT_DATETIME; row["UPDATED_BY"] = CURRENT_USER; row["UPDATE_MESSAGE"] = string.Format(Messages.Jimugo.I000ZZ016, "否認"); Listing.TableName = "LISTING"; ds.Tables.Add(Listing.Copy()); dtMail.TableName = "MAIL"; ds.Tables.Add(dtMail.Copy()); } else { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } } else { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } response.Data = Utility.Utility_Component.DsToJSon(ds, "Approval"); timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalSeconds; return(response); } catch (Exception ex) { return(ResponseUtility.GetUnexpectedResponse(response, timer, ex)); } }
public MetaResponse Approve(string COMPANY_NO_BOX, int REQ_TYPE, string REQ_TYPE_RAW, string CHANGED_ITEMS, string SYSTEM_EFFECTIVE_DATE, string SYSTEM_REGIST_DEADLINE, string List) { try { DataSet ds = new DataSet(); DataTable Listing = Utility_Component.JsonToDt(List); DataRow row; if (Listing.Rows.Count > 1) { row = Listing.Rows[1]; } else { row = Listing.Rows[0]; } string EMIAL_SENDING_TARGET_FLG = row["MAIL_SENDING_TARGET_FLG"].ToString().Trim(); string MAIL_DESTINATION = row["MAIL_DESTINATION"].ToString().Trim(); int TRANSACTION_TYPE = getTRANSACTION_TYPE(row["TRANSACTION_TYPE"].ToString().Trim()); DateTime START_USE_DATE = Convert.ToDateTime(row["START_USE_DATE"].ToString().Trim()); using (TransactionScope dbTxn = new TransactionScope()) { #region Approve BOL_REQUEST_DETAIL oREQUEST_DETAIL = new BOL_REQUEST_DETAIL(); oREQUEST_DETAIL.COMPANY_NO_BOX = COMPANY_NO_BOX; oREQUEST_DETAIL.REQ_STATUS = 2; if (REQ_TYPE == 1 || REQ_TYPE == 9 || (REQ_TYPE == 2 && !string.IsNullOrEmpty(CHANGED_ITEMS.Trim()))) { oREQUEST_DETAIL.AMIGO_COOPERATION = 1; } else { oREQUEST_DETAIL.AMIGO_COOPERATION = 2; } oREQUEST_DETAIL.AMIGO_COOPERATION_CHENGED_ITEMS = CHANGED_ITEMS.Trim(); try { oREQUEST_DETAIL.SYSTEM_EFFECTIVE_DATE = Convert.ToDateTime(SYSTEM_EFFECTIVE_DATE); } catch (Exception) { } try { oREQUEST_DETAIL.SYSTEM_REGIST_DEADLINE = Convert.ToDateTime(SYSTEM_REGIST_DEADLINE); } catch (Exception) { } oREQUEST_DETAIL.REQ_SEQ = int.Parse(row["REQ_SEQ"].ToString()); if (MAIL_DESTINATION == "1") { oREQUEST_DETAIL.SYSTEM_SETTING_STATUS = 1; } else { oREQUEST_DETAIL.SYSTEM_SETTING_STATUS = 0; } oREQUEST_DETAIL.UPDATED_AT = row["UPDATED_AT_RAW"].ToString(); string msg = ""; REQUEST_DETAIL DAL_REQUEST_DETAIL = new REQUEST_DETAIL(con); DAL_REQUEST_DETAIL.Approve(oREQUEST_DETAIL, CURRENT_USER, CURRENT_DATETIME, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } #endregion if (EMIAL_SENDING_TARGET_FLG == "*" && TRANSACTION_TYPE == 3) { DataTable LatestCustomer = new DataTable(); CUSTOMER_MASTER DAL_CUSTOMER_MASTER = new CUSTOMER_MASTER(con); if (REQ_TYPE == 2 || REQ_TYPE == 9) { LatestCustomer = DAL_CUSTOMER_MASTER.GetTopCustomerByKeys(oREQUEST_DETAIL.COMPANY_NO_BOX, TRANSACTION_TYPE, START_USE_DATE, out msg); } #region CONDUCT NEW CUSTOMER MASTER BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER(); if (LatestCustomer.Rows.Count > 0 && REQ_TYPE != 1) { oCUSTOMER_MASTER = Cast_CUSTOMER_MASTER(LatestCustomer.Rows[0]); } oCUSTOMER_MASTER.COMPANY_NO_BOX = COMPANY_NO_BOX; oCUSTOMER_MASTER.TRANSACTION_TYPE = TRANSACTION_TYPE; oCUSTOMER_MASTER.EFFECTIVE_DATE = START_USE_DATE; oCUSTOMER_MASTER.REQ_SEQ = oREQUEST_DETAIL.REQ_SEQ; oCUSTOMER_MASTER.UPDATE_CONTENT = REQ_TYPE; DAL_CUSTOMER_MASTER.Delete(oCUSTOMER_MASTER, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } DAL_CUSTOMER_MASTER.Insert(oCUSTOMER_MASTER, CURRENT_DATETIME, CURRENT_USER, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } #endregion string CONTRACT_PLAN = row["CONTRACT_PLAN_RAW"].ToString().ToString(); if (CONTRACT_PLAN == "PRODUCT" && REQ_TYPE == 9) { //get latest customer for new applying time DateTime NEW_EFFECTIVE_DATE = Convert.ToDateTime(DAL_CUSTOMER_MASTER.GetEffectiveDateForNewApplyingTime(oREQUEST_DETAIL.COMPANY_NO_BOX, TRANSACTION_TYPE, START_USE_DATE, out msg)); if ((NEW_EFFECTIVE_DATE.Month + NEW_EFFECTIVE_DATE.Day) != (START_USE_DATE.Month + START_USE_DATE.Day)) { #region Insert Browsing CUSTOMER MASTER BOL_CUSTOMER_MASTER oCUSTOMER_MASTER_BROWSING = new BOL_CUSTOMER_MASTER(); oCUSTOMER_MASTER_BROWSING = Cast_CUSTOMER_MASTER(LatestCustomer.Rows[0]); oCUSTOMER_MASTER_BROWSING.COMPANY_NO_BOX = COMPANY_NO_BOX; oCUSTOMER_MASTER_BROWSING.TRANSACTION_TYPE = TRANSACTION_TYPE; oCUSTOMER_MASTER_BROWSING.EFFECTIVE_DATE = Convert.ToDateTime(START_USE_DATE.Year + "/" + NEW_EFFECTIVE_DATE.Month + "/" + NEW_EFFECTIVE_DATE.Day); oCUSTOMER_MASTER_BROWSING.REQ_SEQ = oREQUEST_DETAIL.REQ_SEQ; oCUSTOMER_MASTER_BROWSING.UPDATE_CONTENT = REQ_TYPE; DAL_CUSTOMER_MASTER = new CUSTOMER_MASTER(con); DAL_CUSTOMER_MASTER.Insert(oCUSTOMER_MASTER_BROWSING, CURRENT_DATETIME, CURRENT_USER, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } #endregion } } } DataTable dtMail = new DataTable(); bool mailSuccess = false; if (EMIAL_SENDING_TARGET_FLG == "*" && MAIL_DESTINATION == "1") { mailSuccess = SendMailToMaintenance(COMPANY_NO_BOX, REQ_TYPE_RAW, row["COMPANY_NAME"].ToString(), CHANGED_ITEMS, SYSTEM_REGIST_DEADLINE, out dtMail); if (mailSuccess) { dbTxn.Complete(); return(SetSuccessMessage(row, Listing, dtMail, ds)); } else { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } } else if (EMIAL_SENDING_TARGET_FLG == "*" && MAIL_DESTINATION == "2") { mailSuccess = SendMailToSupplier(row["COMPANY_NAME"].ToString(), row["INPUT_PERSON"].ToString(), row["INPUT_PERSON_EMAIL_ADDRESS"].ToString(), out dtMail); if (mailSuccess) { dbTxn.Complete(); return(SetSuccessMessage(row, Listing, dtMail, ds)); } else { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } } dbTxn.Complete(); return(SetSuccessMessage(row, Listing, dtMail, ds)); } } catch (Exception ex) { return(ResponseUtility.GetUnexpectedResponse(response, timer, ex)); } }
public MetaResponse ApproveCancel(string COMPANY_NO_BOX, string REQ_SEQ, string List) { try { string msg = ""; DataSet ds = new DataSet(); DataTable Listing = Utility_Component.JsonToDt(List); DataRow row; if (Listing.Rows.Count > 1) { row = Listing.Rows[1]; } else { row = Listing.Rows[0]; } REQUEST_DETAIL DAL_REQUEST_DETAIL = new REQUEST_DETAIL(con); //serch with COMPANY_NO_BOX AND REQ_SEQ DataTable APPROVAL_CHECK = DAL_REQUEST_DETAIL.GetDataToCheckApproveCancel(COMPANY_NO_BOX, REQ_SEQ, out msg); //IF QUOTATION DATE NOT NULL THEN ERROR if (!string.IsNullOrEmpty(APPROVAL_CHECK.Rows[0]["QUOTATION_DATE"].ToString())) { return(ResponseError(response, Utility.Messages.Jimugo.E000ZZ037, Listing, ds, row)); } //IF SYSTEM_SETTING_STATUS NOT NULL THEN ERROR if (APPROVAL_CHECK.Rows[0]["SYSTEM_SETTING_STATUS"].ToString() != "0") { return(ResponseError(response, Utility.Messages.Jimugo.E000WB015, Listing, ds, row)); } DAL_REQUEST_DETAIL.ApproveCancel(COMPANY_NO_BOX, row["REQ_SEQ"].ToString(), CURRENT_USER, CURRENT_DATETIME, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } CUSTOMER_MASTER DAL_CUSTOMER_MASTER = new CUSTOMER_MASTER(con); BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER(); oCUSTOMER_MASTER.COMPANY_NO_BOX = COMPANY_NO_BOX; oCUSTOMER_MASTER.REQ_SEQ = Convert.ToInt32(row["REQ_SEQ"]); DAL_CUSTOMER_MASTER.Delete(oCUSTOMER_MASTER, out msg); if (!string.IsNullOrEmpty(msg)) { return(ResponseError(response, Utility.Messages.Jimugo.I000ZZ005, Listing, ds, row)); } else { response.Status = 1; row["UPDATE_MESSAGE"] = string.Format(Messages.Jimugo.I000ZZ016, "承認解除"); Listing.TableName = "LISTING"; ds.Tables.Add(Listing.Copy()); } response.Data = Utility.Utility_Component.DsToJSon(ds, "Approval"); timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalSeconds; return(response); } catch (Exception ex) { return(ResponseUtility.GetUnexpectedResponse(response, timer, ex)); } }
private BOL_CUSTOMER_MASTER Cast_CUSTOMER_MASTER(DataRow row) { BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER(); oCUSTOMER_MASTER.COMPANY_NO_BOX = row["COMPANY_NO_BOX"].ToString().Trim(); string transaction_type = row["TRANSACTION_TYPE"].ToString().Trim(); switch (transaction_type) { case "要元": oCUSTOMER_MASTER.TRANSACTION_TYPE = 1; break; case "サプライヤ": oCUSTOMER_MASTER.TRANSACTION_TYPE = 2; break; case "納代": oCUSTOMER_MASTER.TRANSACTION_TYPE = 3; break; case "生産情報閲覧": oCUSTOMER_MASTER.TRANSACTION_TYPE = 4; break; case "SI": oCUSTOMER_MASTER.TRANSACTION_TYPE = 11; break; case "SOL": oCUSTOMER_MASTER.TRANSACTION_TYPE = 12; break; case "その他": oCUSTOMER_MASTER.TRANSACTION_TYPE = 19; break; } oCUSTOMER_MASTER.EFFECTIVE_DATE = (DateTime)Utility_Component.dtColumnToDateTime(row["EFFECTIVE_DATE"].ToString().Trim()); oCUSTOMER_MASTER.ORG_EFFECTIVE_DATE = Utility_Component.dtColumnToDateTime(row["ORG_EFFECTIVE_DATE"].ToString().Trim()); oCUSTOMER_MASTER.CONTRACT_DATE = Utility_Component.dtColumnToDateTime(row["CONTRACT_DATE"].ToString().Trim()); oCUSTOMER_MASTER.SPECIAL_NOTES_1 = row["SPECIAL_NOTES_1"].ToString().Trim(); oCUSTOMER_MASTER.SPECIAL_NOTES_2 = row["SPECIAL_NOTES_2"].ToString().Trim(); oCUSTOMER_MASTER.SPECIAL_NOTES_3 = row["SPECIAL_NOTES_3"].ToString().Trim(); oCUSTOMER_MASTER.SPECIAL_NOTES_4 = row["SPECIAL_NOTES_4"].ToString().Trim(); oCUSTOMER_MASTER.NCS_CUSTOMER_CODE = row["NCS_CUSTOMER_CODE"].ToString().Trim(); string billingInterval = row["BILL_BILLING_INTERVAL"].ToString(); switch (billingInterval) { case "月額": oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 1; break; case "四半期": oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 2; break; case "半期": oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 3; break; case "年額": oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 4; break; } string deposit_Rules = row["BILL_DEPOSIT_RULES"].ToString(); switch (deposit_Rules) { case "翌月": oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = 0; break; case "当月": oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = 1; break; case "翌々月月頭": oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = 2; break; } oCUSTOMER_MASTER.BILL_TRANSFER_FEE = Utility_Component.dtColumnToDecimal(row["BILL_TRANSFER_FEE"].ToString()); oCUSTOMER_MASTER.BILL_EXPENSES = Utility_Component.dtColumnToDecimal(row["BILL_EXPENSES"].ToString()); oCUSTOMER_MASTER.COMPANY_NAME_CHANGED_DATE = Utility_Component.dtColumnToDateTime(row["COMPANY_NAME_CHANGED_DATE"].ToString()); oCUSTOMER_MASTER.PREVIOUS_COMPANY_NAME = row["PREVIOUS_COMPANY_NAME"].ToString(); oCUSTOMER_MASTER.OBOEGAKI_DATE = Utility_Component.dtColumnToDateTime(row["OBOEGAKI_DATE"].ToString()); oCUSTOMER_MASTER.UPDATED_AT = row["UPDATED_AT"].ToString().Length >= 1 ? row["UPDATED_AT"].ToString() : null; oCUSTOMER_MASTER.UPDATED_AT_RAW = row["UPDATED_AT_RAW"].ToString() == "" ? null : row["UPDATED_AT_RAW"].ToString(); oCUSTOMER_MASTER.UPDATED_BY = row["UPDATED_BY"].ToString().Length >= 1 ? row["UPDATED_BY"].ToString() : null; oCUSTOMER_MASTER.REQ_SEQ = Utility_Component.dtColumnToInt(row["REQ_SEQ"].ToString()); return(oCUSTOMER_MASTER); }
public Response UpdateCustomer(string Customers) { using (TransactionScope dbTxn = new TransactionScope()) { try { string strMessage = ""; DataTable dgvList = Utility.Utility_Component.JsonToDt(Customers); if (dgvList.Rows.Count > 0) { for (int i = 0; i < dgvList.Rows.Count; i++) { BOL_CUSTOMER_MASTER B_Customer = new BOL_CUSTOMER_MASTER(); B_Customer.COMPANY_NO_BOX = (dgvList.Rows[i]["COMPANY_NO_BOX"] != null ? dgvList.Rows[i]["COMPANY_NO_BOX"].ToString() : ""); B_Customer.TRANSACTION_TYPE = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["TRANSACTION_TYPE"] != null ? dgvList.Rows[i]["TRANSACTION_TYPE"].ToString() : "")); B_Customer.NCS_CUSTOMER_CODE = (dgvList.Rows[i]["NCS_CUSTOMER_CODE"] != null ? dgvList.Rows[i]["NCS_CUSTOMER_CODE"].ToString() : ""); B_Customer.EFFECTIVE_DATE = DateTime.Parse(dgvList.Rows[i]["EFFECTIVE_DATE"] != null ? dgvList.Rows[i]["EFFECTIVE_DATE"].ToString() : ""); B_Customer.BILL_BILLING_INTERVAL = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["BILL_BILLING_INTERVAL"] != null ? dgvList.Rows[i]["BILL_BILLING_INTERVAL"].ToString() : "")); B_Customer.BILL_DEPOSIT_RULES = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["BILL_DEPOSIT_RULES"] != null ? dgvList.Rows[i]["BILL_DEPOSIT_RULES"].ToString() : "")); B_Customer.BILL_TRANSFER_FEE = Utility.Utility_Component.dtColumnToDecimal((dgvList.Rows[i]["BILL_TRANSFER_FEE"] != null ? dgvList.Rows[i]["BILL_TRANSFER_FEE"].ToString() : "")); B_Customer.BILL_EXPENSES = Utility.Utility_Component.dtColumnToDecimal(dgvList.Rows[i]["BILL_EXPENSES"] != null ? dgvList.Rows[i]["BILL_EXPENSES"].ToString() : ""); B_Customer.REQ_SEQ = Utility.Utility_Component.dtColumnToInt((dgvList.Rows[i]["REQ_SEQ"] != null ? dgvList.Rows[i]["REQ_SEQ"].ToString() : "")); B_Customer.UPDATED_AT = CURRENT_DATETIME; B_Customer.UPDATED_BY = CURRENT_USER; CUSTOMER_MASTER DAL_Customer = new CUSTOMER_MASTER(con); DAL_Customer.Update(B_Customer, out strMessage); if (!string.IsNullOrEmpty(strMessage)) { break; } BOL_BANK_ACCOUNT_MASTER B_BankAccounts = new BOL_BANK_ACCOUNT_MASTER(); B_BankAccounts.COMPANY_NO_BOX = B_Customer.COMPANY_NO_BOX; B_BankAccounts.REQ_SEQ = B_Customer.REQ_SEQ; B_BankAccounts.BILL_BANK_ACCOUNT_NAME_1 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-1"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-1"].ToString() : ""); B_BankAccounts.BILL_BANK_ACCOUNT_NAME_2 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-2"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-2"].ToString() : ""); B_BankAccounts.BILL_BANK_ACCOUNT_NAME_3 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-3"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-3"].ToString() : ""); B_BankAccounts.BILL_BANK_ACCOUNT_NAME_4 = (dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-4"] != null ? dgvList.Rows[i]["BILL_BANK_ACCOUNT_NAME-4"].ToString() : ""); B_BankAccounts.UPDATED_AT = CURRENT_DATETIME; B_BankAccounts.UPDATED_BY = CURRENT_USER; BANK_ACCOUNT_MASTER DAL_BankAccount = new BANK_ACCOUNT_MASTER(con); DAL_BankAccount.Update(B_BankAccounts, out strMessage); if (!string.IsNullOrEmpty(strMessage)) { break; } } } if (string.IsNullOrEmpty(strMessage)) { dbTxn.Complete(); response.Status = 1; response.Message = "Customer updated"; } else { response.Status = 0; response.Message = strMessage; } return(response); } catch (Exception ex) { dbTxn.Dispose(); response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } } }