public HttpResponseBase SaveVendor() { string jsonStr = String.Empty; try { VendorQuery venQuery = new VendorQuery(); venQuery.user_type = 2;//變更者類型1.供應商2.管理員 if (Request.Params["vendor_id"].ToString() == "") { #region 獲取供應商數據 if (!string.IsNullOrEmpty(Request.Params["vendor_status"].ToString())) { venQuery.vendor_status = Convert.ToUInt32(Request.Params["vendor_status"].ToString()); } else { venQuery.vendor_status = 1; } _vendorMgr = new VendorMgr(connectionString); if (!string.IsNullOrEmpty(Request.Params["vendor_email"].ToString())) { try { if (_vendorMgr.IsExitEmail(Request.Params["vendor_email"].ToString().ToLower()) != 0) { jsonStr = "{success:true,msg:0}";//返回json數據 this.Response.Clear(); this.Response.Write(jsonStr); this.Response.End(); return this.Response; } else { venQuery.vendor_email = Request.Params["vendor_email"].Trim().ToLower(); } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false,msg:1}"; this.Response.Clear(); this.Response.Write(jsonStr); this.Response.End(); return this.Response; } } else { venQuery.vendor_email = ""; } BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt(); if (!string.IsNullOrEmpty(Request.Params["vendor_password"].ToString())) { venQuery.vendor_password = hash.SHA256Encrypt(Request.Params["vendor_password"].ToString()); } else { //新增供應商時如果未設置密碼則將統一編號進行加密作為密碼進行保存 venQuery.vendor_password = hash.SHA256Encrypt(Request.Params["vendor_invoice"]); } if (!string.IsNullOrEmpty(Request.Params["vendor_name_full"].ToString())) { venQuery.vendor_name_full = Request.Params["vendor_name_full"].ToString().Trim(); } else { venQuery.vendor_name_full = ""; } if (!string.IsNullOrEmpty(Request.Params["vendor_name_simple"].ToString())) { venQuery.vendor_name_simple = Request.Params["vendor_name_simple"].ToString().Trim(); } else { venQuery.vendor_name_simple = ""; } if (!string.IsNullOrEmpty(Request.Params["vendor_invoice"].ToString())) { venQuery.vendor_invoice = Request.Params["vendor_invoice"].ToString(); } else { venQuery.vendor_invoice = ""; } if (!string.IsNullOrEmpty(Request.Params["company_phone"].ToString())) { venQuery.company_phone = Request.Params["company_phone"].ToString(); } else { venQuery.company_phone = ""; } if (!string.IsNullOrEmpty(Request.Params["company_fax"].ToString())) { venQuery.company_fax = Request.Params["company_fax"].ToString(); } else { venQuery.company_fax = ""; } if (!string.IsNullOrEmpty(Request.Params["company_person"].ToString())) { venQuery.company_person = Request.Params["company_person"].ToString(); } else { venQuery.company_person = ""; } if (!string.IsNullOrEmpty(Request.Params["company_zip"].ToString())) { venQuery.company_zip = Convert.ToUInt32(Request.Params["company_zip"].ToString()); } else { venQuery.company_zip = 0; } if (!string.IsNullOrEmpty(Request.Params["company_address"].ToString())) { venQuery.company_address = Request.Params["company_address"].ToString(); } else { venQuery.company_address = ""; } if (!string.IsNullOrEmpty(Request.Params["invoice_zip"].ToString())) { venQuery.invoice_zip = Convert.ToUInt32(Request.Params["invoice_zip"].ToString()); } else { venQuery.invoice_zip = 0; } if (!string.IsNullOrEmpty(Request.Params["invoice_address"].ToString())) { venQuery.invoice_address = Request.Params["invoice_address"].ToString(); } else { venQuery.invoice_address = ""; } if (!string.IsNullOrEmpty(Request.Params["pm"].ToString())) { venQuery.product_manage = Convert.ToUInt32(Request.Params["pm"].ToString()); } else { venQuery.product_manage = 0; } if (!string.IsNullOrEmpty(Request.Params["cost_percent"].ToString())) { venQuery.cost_percent = Convert.ToUInt32(Request.Params["cost_percent"].ToString()); } else { venQuery.cost_percent = 0; } if (!string.IsNullOrEmpty(Request.Params["creditcard_1_percent"].ToString())) { venQuery.creditcard_1_percent = Convert.ToUInt32(Request.Params["creditcard_1_percent"].ToString()); } else { venQuery.creditcard_1_percent = 0; } if (!string.IsNullOrEmpty(Request.Params["creditcard_3_percent"].ToString())) { venQuery.creditcard_3_percent = Request.Params["creditcard_3_percent"].ToString(); } else { venQuery.creditcard_3_percent = "0"; } if (!string.IsNullOrEmpty(Request.Params["agreement_createdate"].ToString())) { venQuery.agreement_createdate = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["agreement_createdate"].ToString())); } else { venQuery.agreement_createdate = 0; } if (!string.IsNullOrEmpty(Request.Params["agreement_start"].ToString())) { venQuery.agreement_start = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["agreement_start"].ToString())); } else { venQuery.agreement_start = 0; } if (!string.IsNullOrEmpty(Request.Params["agreement_end"].ToString())) { venQuery.agreement_end = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["agreement_end"].ToString())); } else { venQuery.agreement_end = 0; } if (!string.IsNullOrEmpty(Request.Params["checkout_type"].ToString())) { venQuery.checkout_type = Convert.ToUInt32(Request.Params["checkout_type"].ToString()); } else { venQuery.checkout_type = 1; } if (venQuery.checkout_type == 3) { if (!string.IsNullOrEmpty(Request.Params["checkout_other"].ToString())) { venQuery.checkout_other = Request.Params["checkout_other"].ToString(); } else { venQuery.checkout_other = ""; } } if (!string.IsNullOrEmpty(Request.Params["bank_code"].ToString())) { venQuery.bank_code = Request.Params["bank_code"].ToString(); } else { venQuery.bank_code = ""; } if (!string.IsNullOrEmpty(Request.Params["bank_name"].ToString())) { venQuery.bank_name = Request.Params["bank_name"].ToString(); } else { venQuery.bank_name = ""; } if (!string.IsNullOrEmpty(Request.Params["bank_number"].ToString())) { venQuery.bank_number = Request.Params["bank_number"].ToString(); } else { venQuery.bank_number = ""; } if (!string.IsNullOrEmpty(Request.Params["bank_account"].ToString())) { venQuery.bank_account = Request.Params["bank_account"].ToString(); } else { venQuery.bank_account = ""; } if (!string.IsNullOrEmpty(Request.Params["bank_number"].ToString())) { venQuery.bank_number = Request.Params["bank_number"].ToString(); } else { venQuery.bank_number = ""; } if (!string.IsNullOrEmpty(Request.Params["freight_low_limit"].ToString())) { venQuery.freight_low_limit = Convert.ToUInt32(Request.Params["freight_low_limit"].ToString()); } else { venQuery.freight_low_limit = 0; } if (!string.IsNullOrEmpty(Request.Params["freight_low_money"].ToString())) { venQuery.freight_low_money = Convert.ToUInt32(Request.Params["freight_low_money"].ToString()); } else { venQuery.freight_low_money = 0; } if (!string.IsNullOrEmpty(Request.Params["freight_return_low_money"].ToString())) { venQuery.freight_return_low_money = Convert.ToUInt32(Request.Params["freight_return_low_money"].ToString()); } else { venQuery.freight_return_low_money = 0; } if (!string.IsNullOrEmpty(Request.Params["freight_normal_limit"].ToString())) { venQuery.freight_normal_limit = Convert.ToUInt32(Request.Params["freight_normal_limit"].ToString()); } else { venQuery.freight_normal_limit = 0; } if (!string.IsNullOrEmpty(Request.Params["freight_normal_money"].ToString())) { venQuery.freight_normal_money = Convert.ToUInt32(Request.Params["freight_normal_money"].ToString()); } else { venQuery.freight_normal_money = 0; } if (!string.IsNullOrEmpty(Request.Params["freight_return_normal_money"].ToString())) { venQuery.freight_return_normal_money = Convert.ToUInt32(Request.Params["freight_return_normal_money"].ToString()); } else { venQuery.freight_return_normal_money = 0; } if (!string.IsNullOrEmpty(Request.Params["assist"].ToString())) { venQuery.assist = Convert.ToUInt32(Request.Params["assist"].ToString()); } else { venQuery.assist = 0; } //if (!string.IsNullOrEmpty(Request.Params["dispatch"].ToString())) //{ // venQuery.dispatch = Convert.ToUInt32(Request.Params["dispatch"].ToString()); //} //else //{ // venQuery.dispatch = 0; //} //if (!string.IsNullOrEmpty(Request.Params["product_mode"].ToString())) //{ // venQuery.product_mode = Convert.ToUInt32(Request.Params["product_mode"].ToString()); //} //else //{ // venQuery.product_mode = 1; //} if (!string.IsNullOrEmpty(Request.Params["procurement_days"].ToString())) { venQuery.procurement_days = Convert.ToInt32(Request.Params["procurement_days"].ToString()); } else { venQuery.procurement_days = 0; } if (!string.IsNullOrEmpty(Request.Params["self_send_days"].ToString())) { venQuery.self_send_days = Convert.ToInt32(Request.Params["self_send_days"].ToString()); } else { venQuery.self_send_days = 0; } if (!string.IsNullOrEmpty(Request.Params["stuff_ware_days"].ToString())) { venQuery.stuff_ware_days = Convert.ToInt32(Request.Params["stuff_ware_days"].ToString()); } else { venQuery.stuff_ware_days = 0; } if (!string.IsNullOrEmpty(Request.Params["dispatch_days"].ToString())) { venQuery.dispatch_days = Convert.ToInt32(Request.Params["dispatch_days"].ToString()); } else { venQuery.dispatch_days = 0; } if (!string.IsNullOrEmpty(Request.Params["gigade_bunus_percent"].ToString())) { venQuery.gigade_bunus_percent = Convert.ToUInt32(Request.Params["gigade_bunus_percent"].ToString()); } else { venQuery.gigade_bunus_percent = 0; } if (!string.IsNullOrEmpty(Request.Params["gigade_bunus_threshold"].ToString())) { venQuery.gigade_bunus_threshold = Convert.ToUInt32(Request.Params["gigade_bunus_threshold"].ToString()); } else { venQuery.gigade_bunus_threshold = 0; } if (!string.IsNullOrEmpty(Request.Params["vendor_note"].ToString())) { venQuery.vendor_note = Request.Params["vendor_note"].ToString(); } else { venQuery.vendor_note = ""; } if (!string.IsNullOrEmpty(Request.Params["prod_cate"].ToString())) { venQuery.prod_cate = Request.Params["prod_cate"].ToString(); } else { venQuery.prod_cate = ""; } if (!string.IsNullOrEmpty(Request.Params["buy_cate"].ToString())) { venQuery.buy_cate = Request.Params["buy_cate"].ToString(); } else { venQuery.buy_cate = ""; } if (!string.IsNullOrEmpty(Request.Params["tax_type"].ToString())) { venQuery.tax_type = Request.Params["tax_type"].ToString(); } else { venQuery.tax_type = ""; } #endregion #region //對聯絡人的 信息處理 if (!string.IsNullOrEmpty(Request.Params["conactValues"].ToString())) { string contact = Request.Params["conactValues"].ToString(); string[] contactarr = contact.Split('|'); string[] contact1; for (int i = 0; i < contactarr.Length - 1; i++) { contact1 = contactarr[i].Split(','); if (i == 0) { venQuery.contact_type_1 = 4; venQuery.contact_name_1 = contact1[1]; venQuery.contact_phone_1_1 = contact1[2]; venQuery.contact_phone_2_1 = contact1[3]; venQuery.contact_mobile_1 = contact1[4]; venQuery.contact_email_1 = contact1[5].ToLower(); } else if (i == 1) { venQuery.contact_type_2 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_2 = contact1[1]; venQuery.contact_phone_1_2 = contact1[2]; venQuery.contact_phone_2_2 = contact1[3]; venQuery.contact_mobile_2 = contact1[4]; venQuery.contact_email_2 = contact1[5].ToLower().ToLower(); } else if (i == 2) { venQuery.contact_type_3 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_3 = contact1[1]; venQuery.contact_phone_1_3 = contact1[2]; venQuery.contact_phone_2_3 = contact1[3]; venQuery.contact_mobile_3 = contact1[4]; venQuery.contact_email_3 = contact1[5].ToLower(); } else if (i == 3) { venQuery.contact_type_4 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_4 = contact1[1]; venQuery.contact_phone_1_4 = contact1[2]; venQuery.contact_phone_2_4 = contact1[3]; venQuery.contact_mobile_4 = contact1[4]; venQuery.contact_email_4 = contact1[5].ToLower(); } else if (i == 4) { venQuery.contact_type_5 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_5 = contact1[1]; venQuery.contact_phone_1_5 = contact1[2]; venQuery.contact_phone_2_5 = contact1[3]; venQuery.contact_mobile_5 = contact1[4]; venQuery.contact_email_5 = contact1[5].ToLower(); } } } #endregion venQuery.ip = Request.UserHostAddress; venQuery.file_name = "VendorList.chtml"; venQuery.created = DateTime.Now; venQuery.kuser_id = Convert.ToUInt32((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); venQuery.export_flag = 1; venQuery.kuser = (int)venQuery.kuser_id; venQuery.kdate = venQuery.created; //供應商類型 if (!string.IsNullOrEmpty(Request.Params["gigade_vendor_type"])) { venQuery.vendor_type = Request.Params["gigade_vendor_type"].ToString(); } mgr = new CallerMgr(connectionString); Caller caller = new Caller(); caller = mgr.GetUserById(Convert.ToInt32(venQuery.kuser_id)); venQuery.kuser_name = caller.user_username; return VendorAdd(venQuery); } else { venQuery.vendor_id = Convert.ToUInt32(Request.Params["vendor_id"].ToString()); venQuery.vendor_code = Request.Params["vendor_code"].ToString(); _vendorMgr = new VendorMgr(connectionString); _configMgr = new ConfigMgr(connectionString); Vendor oldven = _vendorMgr.GetSingle(venQuery); StringBuilder update_log = new StringBuilder(); List<TableChangeLog> list = new List<TableChangeLog>(); #region 獲取供應商數據 uint isUint = 0;//判斷字符串是否能夠轉換為uint類型 if (uint.TryParse(Request.Params["vendor_status"].ToString(), out isUint)) { venQuery.vendor_status = Convert.ToUInt32(Request.Params["vendor_status"].ToString()); if (oldven.vendor_status != venQuery.vendor_status) {//1:啟用2:停用3:失格 // update_log.AppendFormat("vendor_status:{0}:{1}:供應商狀態#", oldven.vendor_status, venQuery.vendor_status); TableChangeLog item = new TableChangeLog(); item.change_field = "vendor_status"; item.old_value = oldven.vendor_status.ToString(); item.new_value = venQuery.vendor_status.ToString(); item.field_ch_name = "供應商狀態"; list.Add(item); } } else { venQuery.vendor_status = oldven.vendor_status; } //供應商類型 if (!string.IsNullOrEmpty(Request.Params["gigade_vendor_type"])) { venQuery.vendor_type = Request.Params["gigade_vendor_type"].ToString(); } int tmp = 0; string[] strs = venQuery.vendor_type.Split(','); for (int i = 0; i < strs.Length; i++) { if (!int.TryParse(strs[i], out tmp)) { venQuery.vendor_type = oldven.vendor_type; break; } } if (oldven.vendor_type != venQuery.vendor_type) { // update_log.AppendFormat("vendor_type:{0}:{1}:供應商類型#", oldven.vendor_type, venQuery.vendor_type); TableChangeLog item = new TableChangeLog(); item.change_field = "vendor_type"; item.old_value = oldven.vendor_type; item.new_value = venQuery.vendor_type; item.field_ch_name = "供應商類型"; list.Add(item); } if (!string.IsNullOrEmpty(Request.Params["vendor_email"].ToString())) { int total = _vendorMgr.IsExitEmail(Request.Params["vendor_email"].ToString().ToLower()); try { if (total > 1) { jsonStr = "{success:true,msg:0}";//返回json數據 this.Response.Clear(); this.Response.Write(jsonStr); this.Response.End(); return this.Response; } else { if (total == 1) { if (Request.Params["vendor_email"].ToString().ToLower() == oldven.vendor_email.ToLower()) { venQuery.vendor_email = oldven.vendor_email.ToLower(); } else { jsonStr = "{success:true,msg:0}";//返回json數據rue this.Response.Clear(); this.Response.Write(jsonStr); this.Response.End(); return this.Response; } } else if (total == 0) { venQuery.vendor_email = Request.Params["vendor_email"].ToString().ToLower(); if (oldven.vendor_email != venQuery.vendor_email) { // update_log.AppendFormat("vendor_email:{0}:{1}:公司Email#", oldven.vendor_email, venQuery.vendor_email); TableChangeLog item = new TableChangeLog(); item.change_field = "vendor_email"; item.old_value = oldven.vendor_email; item.new_value = venQuery.vendor_email; item.field_ch_name = "公司Email"; list.Add(item); } } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false,msg:1}"; this.Response.Clear(); this.Response.Write(jsonStr); this.Response.End(); return this.Response; } } else { venQuery.vendor_email = oldven.vendor_email; } //if (!string.IsNullOrEmpty(Request.Params["vendor_password"].ToString())) //{ // BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt(); // venQuery.vendor_password = hash.SHA256Encrypt(Request.Params["vendor_password"].ToString()); //} //else //{ // venQuery.vendor_password = oldven.vendor_password; //} if (!string.IsNullOrEmpty(Request.Params["vendor_name_full"].ToString())) { venQuery.vendor_name_full = Request.Params["vendor_name_full"].ToString().Trim(); } else { venQuery.vendor_name_full = oldven.vendor_name_full; } if (!string.IsNullOrEmpty(Request.Params["vendor_name_simple"].ToString())) { venQuery.vendor_name_simple = Request.Params["vendor_name_simple"].ToString().Trim(); } else { venQuery.vendor_name_simple = oldven.vendor_name_simple; } if (!string.IsNullOrEmpty(Request.Params["vendor_invoice"].ToString())) { venQuery.vendor_invoice = Request.Params["vendor_invoice"].ToString(); if (oldven.vendor_invoice != venQuery.vendor_invoice) { // update_log.AppendFormat("vendor_invoice:{0}:{1}:統一編號#", oldven.vendor_invoice, venQuery.vendor_invoice); TableChangeLog item = new TableChangeLog(); item.change_field = "vendor_invoice"; item.old_value = oldven.vendor_invoice; item.new_value = venQuery.vendor_invoice; item.field_ch_name = "統一編號"; list.Add(item); } } else { venQuery.vendor_invoice = oldven.vendor_invoice; } if (!string.IsNullOrEmpty(Request.Params["company_phone"].ToString())) { venQuery.company_phone = Request.Params["company_phone"].ToString(); if (oldven.company_phone != venQuery.company_phone) { //update_log.AppendFormat("company_phone:{0}:{1}:公司電話#", oldven.company_phone, venQuery.company_phone); TableChangeLog item = new TableChangeLog(); item.change_field = "company_phone"; item.old_value = oldven.company_phone; item.new_value = venQuery.company_phone; item.field_ch_name = "公司電話"; list.Add(item); } } else { venQuery.company_phone = oldven.company_phone; } if (!string.IsNullOrEmpty(Request.Params["company_fax"].ToString())) { venQuery.company_fax = Request.Params["company_fax"].ToString(); if (oldven.company_fax != venQuery.company_fax) { // update_log.AppendFormat("company_fax:{0}:{1}:公司傳真#", oldven.company_fax, venQuery.company_fax); TableChangeLog item = new TableChangeLog(); item.change_field = "company_fax"; item.old_value = oldven.company_fax; item.new_value = venQuery.company_fax; item.field_ch_name = "公司傳真"; list.Add(item); } } if (!string.IsNullOrEmpty(Request.Params["company_person"].ToString())) { venQuery.company_person = Request.Params["company_person"].ToString(); if (oldven.company_person != venQuery.company_person) { //update_log.AppendFormat("company_person:{0}:{1}:公司負責人#", oldven.company_person, venQuery.company_person); TableChangeLog item = new TableChangeLog(); item.change_field = "company_person"; item.old_value = oldven.company_person; item.new_value = venQuery.company_person; item.field_ch_name = "公司負責人"; list.Add(item); } } if (!string.IsNullOrEmpty(Request.Params["company_zip"].ToString())) { venQuery.company_zip = Convert.ToUInt32(Request.Params["company_zip"].ToString()); } venQuery.company_address = Request.Params["company_address"].ToString(); if (oldven.company_zip != venQuery.company_zip || oldven.company_address != venQuery.company_address) { //update_log.AppendFormat("company_address:{0}:{1}:公司地址#", oldven.company_zip + "&" + oldven.company_address, venQuery.company_zip + "&" + venQuery.company_address); TableChangeLog item = new TableChangeLog(); item.change_field = "company_address"; item.old_value = oldven.company_zip + "&" + oldven.company_address; item.new_value = venQuery.company_zip + "&" + venQuery.company_address; item.field_ch_name = "公司地址"; list.Add(item); } if (!string.IsNullOrEmpty(Request.Params["invoice_zip"].ToString())) { venQuery.invoice_zip = Convert.ToUInt32(Request.Params["invoice_zip"].ToString()); } venQuery.invoice_address = Request.Params["invoice_address"].ToString(); if (oldven.invoice_zip != venQuery.invoice_zip || oldven.invoice_address != venQuery.invoice_address) { //update_log.AppendFormat("invoice_address:{0}:{1}:發票地址#", oldven.invoice_zip + "&" + oldven.invoice_address, venQuery.invoice_zip + "&" + venQuery.invoice_address); TableChangeLog item = new TableChangeLog(); item.change_field = "invoice_address"; item.old_value = oldven.invoice_zip + "&" + oldven.invoice_address; item.new_value = venQuery.invoice_zip + "&" + venQuery.invoice_address; item.field_ch_name = "發票地址"; list.Add(item); } venQuery.erp_id = oldven.erp_id; if (uint.TryParse(Request.Params["cost_percent"].ToString(), out isUint)) { venQuery.cost_percent = Convert.ToUInt32(Request.Params["cost_percent"].ToString()); if (oldven.cost_percent != venQuery.cost_percent) { //update_log.AppendFormat("cost_percent:{0}:{1}:成本百分比#", oldven.cost_percent, venQuery.cost_percent); TableChangeLog item = new TableChangeLog(); item.change_field = "cost_percent"; item.old_value = oldven.cost_percent.ToString(); item.new_value = venQuery.cost_percent.ToString(); item.field_ch_name = "成本百分比"; list.Add(item); } } else { venQuery.cost_percent = 0; } if (uint.TryParse(Request.Params["creditcard_1_percent"].ToString(), out isUint)) { venQuery.creditcard_1_percent = Convert.ToUInt32(Request.Params["creditcard_1_percent"].ToString()); } else { venQuery.creditcard_1_percent = 0; } if (!string.IsNullOrEmpty(Request.Params["creditcard_3_percent"].ToString())) { venQuery.creditcard_3_percent = Request.Params["creditcard_3_percent"].ToString(); } else { venQuery.creditcard_3_percent = "0"; } if (!string.IsNullOrEmpty(Request.Params["agreement_createdate"].ToString())) { venQuery.agreement_createdate = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["agreement_createdate"].ToString())); if (oldven.agreement_createdate != venQuery.agreement_createdate) { //update_log.AppendFormat("agreement_createdate:{0}:{1}:合約簽訂日期#", CommonFunction.GetNetTime(oldven.agreement_createdate).ToShortDateString(), CommonFunction.GetNetTime(venQuery.agreement_createdate).ToShortDateString()); TableChangeLog item = new TableChangeLog(); item.change_field = "agreement_createdate"; item.old_value = CommonFunction.GetNetTime(oldven.agreement_createdate).ToShortDateString(); item.new_value = CommonFunction.GetNetTime(venQuery.agreement_createdate).ToShortDateString(); item.field_ch_name = "合約簽訂日期"; list.Add(item); } } else { venQuery.agreement_createdate = oldven.agreement_createdate; } if (!string.IsNullOrEmpty(Request.Params["agreement_start"].ToString())) { venQuery.agreement_start = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["agreement_start"].ToString())); if (oldven.agreement_start != venQuery.agreement_start) { // update_log.AppendFormat("agreement_start:{0}:{1}:合約開始日#", CommonFunction.GetNetTime(oldven.agreement_start).ToShortDateString(), CommonFunction.GetNetTime(venQuery.agreement_start).ToShortDateString()); TableChangeLog item = new TableChangeLog(); item.change_field = "agreement_start"; item.old_value = CommonFunction.GetNetTime(oldven.agreement_start).ToShortDateString(); item.new_value = CommonFunction.GetNetTime(venQuery.agreement_start).ToShortDateString(); item.field_ch_name = "合約開始日"; list.Add(item); } } else { venQuery.agreement_start = oldven.agreement_start; } if (!string.IsNullOrEmpty(Request.Params["agreement_end"].ToString())) { venQuery.agreement_end = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["agreement_end"].ToString())); if (oldven.agreement_end != venQuery.agreement_end) { // update_log.AppendFormat("agreement_end:{0}:{1}:合約結束日#", CommonFunction.GetNetTime(oldven.agreement_end).ToShortDateString(), CommonFunction.GetNetTime(venQuery.agreement_end).ToShortDateString()); TableChangeLog item = new TableChangeLog(); item.change_field = "agreement_end"; item.old_value = CommonFunction.GetNetTime(oldven.agreement_end).ToShortDateString(); item.new_value = CommonFunction.GetNetTime(venQuery.agreement_end).ToShortDateString(); item.field_ch_name = "合約結束日"; list.Add(item); } } else { venQuery.agreement_end = oldven.agreement_end; } if (uint.TryParse(Request.Params["checkout_type"].ToString(), out isUint)) { venQuery.checkout_type = Convert.ToUInt32(Request.Params["checkout_type"].ToString()); } else { venQuery.checkout_type = oldven.checkout_type; } if (venQuery.checkout_type == 3) { if (!string.IsNullOrEmpty(Request.Params["checkout_other"].ToString())) { venQuery.checkout_other = Request.Params["checkout_other"].ToString(); } else { venQuery.checkout_other = oldven.checkout_other; } } if (!string.IsNullOrEmpty(Request.Params["bank_code"].ToString())) { venQuery.bank_code = Request.Params["bank_code"].ToString(); if (oldven.bank_code != venQuery.bank_code) { //update_log.AppendFormat("bank_code:{0}:{1}:銀行代碼#", oldven.bank_code, venQuery.bank_code); TableChangeLog item = new TableChangeLog(); item.change_field = "bank_code"; item.old_value = oldven.bank_code; item.new_value = venQuery.bank_code; item.field_ch_name = "銀行代碼"; list.Add(item); } } else { venQuery.bank_code = oldven.bank_code; } if (!string.IsNullOrEmpty(Request.Params["bank_name"].ToString())) { venQuery.bank_name = Request.Params["bank_name"].ToString(); if (oldven.bank_name != venQuery.bank_name) { //update_log.AppendFormat("bank_name:{0}:{1}:銀行名稱#", oldven.bank_name, venQuery.bank_name); TableChangeLog item = new TableChangeLog(); item.change_field = "bank_name"; item.old_value = oldven.bank_name; item.new_value = venQuery.bank_name; item.field_ch_name = "銀行名稱"; list.Add(item); } } else { venQuery.bank_name = oldven.bank_name; } if (!string.IsNullOrEmpty(Request.Params["bank_number"].ToString())) { venQuery.bank_number = Request.Params["bank_number"].ToString(); if (oldven.bank_number != venQuery.bank_number) { // update_log.AppendFormat("bank_number:{0}:{1}:銀行賬號#", oldven.bank_number, venQuery.bank_number); TableChangeLog item = new TableChangeLog(); item.change_field = "bank_number"; item.old_value = oldven.bank_number; item.new_value = venQuery.bank_number; item.field_ch_name = "銀行賬號"; list.Add(item); } } else { venQuery.bank_number = oldven.bank_number; } if (!string.IsNullOrEmpty(Request.Params["bank_account"].ToString())) { venQuery.bank_account = Request.Params["bank_account"].ToString(); if (oldven.bank_account != venQuery.bank_account) { //update_log.AppendFormat("bank_account:{0}:{1}:銀行戶名#", oldven.bank_account, venQuery.bank_account); TableChangeLog item = new TableChangeLog(); item.change_field = "bank_account"; item.old_value = oldven.bank_account; item.new_value = venQuery.bank_account; item.field_ch_name = "銀行戶名"; list.Add(item); } } else { venQuery.bank_account = oldven.bank_account; } if (!string.IsNullOrEmpty(Request.Params["bank_number"].ToString())) { venQuery.bank_number = Request.Params["bank_number"].ToString(); } else { venQuery.bank_number = oldven.bank_number; } if (uint.TryParse(Request.Params["freight_low_limit"].ToString(), out isUint)) { venQuery.freight_low_limit = Convert.ToUInt32(Request.Params["freight_low_limit"].ToString()); } else { venQuery.freight_low_limit = 0; } if (uint.TryParse(Request.Params["freight_low_money"].ToString(), out isUint)) { venQuery.freight_low_money = Convert.ToUInt32(Request.Params["freight_low_money"].ToString()); } else { venQuery.freight_low_money = 0; } if (uint.TryParse(Request.Params["freight_return_low_money"].ToString(), out isUint)) { venQuery.freight_return_low_money = Convert.ToUInt32(Request.Params["freight_return_low_money"].ToString()); } else { venQuery.freight_return_low_money = 0; } if (uint.TryParse(Request.Params["freight_normal_limit"].ToString(), out isUint)) { venQuery.freight_normal_limit = Convert.ToUInt32(Request.Params["freight_normal_limit"].ToString()); } else { venQuery.freight_normal_limit = 0; } if (uint.TryParse(Request.Params["freight_normal_money"].ToString(), out isUint)) { venQuery.freight_normal_money = Convert.ToUInt32(Request.Params["freight_normal_money"].ToString()); } else { venQuery.freight_normal_money = 0; } if (uint.TryParse(Request.Params["freight_return_normal_money"].ToString(), out isUint)) { venQuery.freight_return_normal_money = Convert.ToUInt32(Request.Params["freight_return_normal_money"].ToString()); } else { venQuery.freight_return_normal_money = 0; } if (uint.TryParse(Request.Params["assist"].ToString(), out isUint)) { venQuery.assist = Convert.ToUInt32(Request.Params["assist"].ToString()); } else { venQuery.assist = venQuery.assist; } //if (uint.TryParse(Request.Params["dispatch"].ToString(), out isUint)) //{ // venQuery.dispatch = Convert.ToUInt32(Request.Params["dispatch"].ToString()); //} //else //{ // venQuery.dispatch = 0; //} //if (uint.TryParse(Request.Params["product_mode"].ToString(), out isUint)) //{ // venQuery.product_mode = Convert.ToUInt32(Request.Params["product_mode"].ToString()); //} //else //{ // venQuery.product_mode = 0; //} //try //{ // //Regex email = new System.Text.RegularExpressions.Regex("(([a-z0-9]{1})([\\.a-z0-9_-]*)@([a-z0-9]+)(\\.([a-z0-9]+)){1,3})"); // //Regex name = new System.Text.RegularExpressions.Regex("[\u4e00-\u9fa5]"); // //if (email.IsMatch(Request.Params["pm"].ToString())) // //{ // // venQuery.product_manage = _configMgr.QueryByEmail(Request.Params["pm"].ToString()); // //} // //else if (name.IsMatch(Request.Params["pm"].ToString())) // //{ // // venQuery.product_manage = _configMgr.QueryByName(Request.Params["pm"].ToString()); // //} //} //catch (Exception ex) //{ // Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); // logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); // logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; // log.Error(logMessage); // venQuery.product_manage = 0; //} if (!string.IsNullOrEmpty(Request.Params["procurement_days"].ToString())) { venQuery.procurement_days = Convert.ToInt32(Request.Params["procurement_days"].ToString()); } else { venQuery.procurement_days = 0; } if (!string.IsNullOrEmpty(Request.Params["self_send_days"].ToString())) { venQuery.self_send_days = Convert.ToInt32(Request.Params["self_send_days"].ToString()); if (oldven.self_send_days != venQuery.self_send_days) { //update_log.AppendFormat("self_send_days:{0}:{1}:自出出貨天數#", oldven.self_send_days, venQuery.self_send_days); TableChangeLog item = new TableChangeLog(); item.change_field = "self_send_days"; item.old_value = oldven.self_send_days.ToString(); item.new_value = venQuery.self_send_days.ToString(); item.field_ch_name = "自出出貨天數"; list.Add(item); } } else { venQuery.self_send_days = 0; } if (!string.IsNullOrEmpty(Request.Params["stuff_ware_days"].ToString())) { venQuery.stuff_ware_days = Convert.ToInt32(Request.Params["stuff_ware_days"].ToString()); if (oldven.stuff_ware_days != venQuery.stuff_ware_days) { // update_log.AppendFormat("stuff_ware_days:{0}:{1}:寄倉出貨天數#", oldven.stuff_ware_days, venQuery.stuff_ware_days); TableChangeLog item = new TableChangeLog(); item.change_field = "stuff_ware_days"; item.old_value = oldven.stuff_ware_days.ToString(); item.new_value = venQuery.stuff_ware_days.ToString(); item.field_ch_name = "寄倉出貨天數"; list.Add(item); } } else { venQuery.stuff_ware_days = 0; } if (!string.IsNullOrEmpty(Request.Params["dispatch_days"].ToString())) { venQuery.dispatch_days = Convert.ToInt32(Request.Params["dispatch_days"].ToString()); if (oldven.dispatch_days != venQuery.dispatch_days) { // update_log.AppendFormat("dispatch_days:{0}:{1}:調度出貨天數#", oldven.dispatch_days, venQuery.dispatch_days); TableChangeLog item = new TableChangeLog(); item.change_field = "dispatch_days"; item.old_value = oldven.dispatch_days.ToString(); item.new_value = venQuery.dispatch_days.ToString(); item.field_ch_name = "調度出貨天數"; list.Add(item); } } else { venQuery.dispatch_days = 0; } if (Request.Params["pm"].ToString() == "") { venQuery.product_manage = 0; } else { if (uint.TryParse(Request.Params["pm"].ToString(), out isUint)) { venQuery.product_manage = Convert.ToUInt32(Request.Params["pm"].ToString()); } else { venQuery.product_manage = oldven.product_manage; } } if (oldven.product_manage != venQuery.product_manage) { // update_log.AppendFormat("product_manage:{0}:{1}:管理人員#", oldven.product_manage, venQuery.product_manage); TableChangeLog item = new TableChangeLog(); item.change_field = "product_manage"; item.old_value = oldven.product_manage.ToString(); item.new_value = venQuery.product_manage.ToString(); item.field_ch_name = "管理人員"; list.Add(item); } if (uint.TryParse(Request.Params["gigade_bunus_percent"].ToString(), out isUint)) { venQuery.gigade_bunus_percent = Convert.ToUInt32(Request.Params["gigade_bunus_percent"].ToString()); } else { venQuery.gigade_bunus_percent = 0; } if (uint.TryParse(Request.Params["gigade_bunus_threshold"].ToString(), out isUint)) { venQuery.gigade_bunus_threshold = Convert.ToUInt32(Request.Params["gigade_bunus_threshold"].ToString()); } else { venQuery.gigade_bunus_threshold = 0; } venQuery.vendor_note = Request.Params["vendor_note"].ToString(); #endregion #region 對聯絡人的 信息處理 string delcon = string.Empty; if (!string.IsNullOrEmpty(Request.Params["delconnect"].ToString())) { delcon = Request.Params["delconnect"].ToString().TrimEnd(','); var delArr = delcon.Split(','); int re_1 = 0, re_2 = 0, re_3 = 0; if (delArr.Length == 4) { //update_log.AppendFormat("contact_type_2:{0}:{1}:原第二聯絡人類型#", oldven.contact_type_2, 7); //update_log.AppendFormat("contact_name_2:{0}:{1}:原第二聯絡人姓名#", oldven.contact_name_2, "刪除"); //update_log.AppendFormat("contact_phone_1_2:{0}:{1}:原第二聯絡人電話一#", oldven.contact_phone_1_2, "刪除"); //update_log.AppendFormat("contact_phone_2_2:{0}:{1}:原第二聯絡人電話二#", oldven.contact_phone_2_2, "刪除"); //update_log.AppendFormat("contact_mobile_2:{0}:{1}:原第二聯絡人手機號碼#", oldven.contact_mobile_2, "刪除"); //update_log.AppendFormat("contact_email_2:{0}:{1}:原第二聯絡人郵箱#", oldven.contact_email_2, "刪除"); //update_log.AppendFormat("contact_type_3:{0}:{1}:原第三聯絡人類型#", oldven.contact_type_3, 7); //update_log.AppendFormat("contact_name_3:{0}:{1}:原第三聯絡人姓名#", oldven.contact_name_3, "刪除"); //update_log.AppendFormat("contact_phone_1_3:{0}:{1}:原第三聯絡人電話一#", oldven.contact_phone_1_3, "刪除"); //update_log.AppendFormat("contact_phone_2_3:{0}:{1}:原第三聯絡人電話二#", oldven.contact_phone_2_3, "刪除"); //update_log.AppendFormat("contact_mobile_3:{0}:{1}:原第三聯絡人手機號碼#", oldven.contact_mobile_3, "刪除"); //update_log.AppendFormat("contact_email_3:{0}:{1}:原第三聯絡人郵箱#", oldven.contact_email_3, "刪除"); //update_log.AppendFormat("contact_type_4:{0}:{1}:原第四聯絡人類型#", oldven.contact_type_4, 7); //update_log.AppendFormat("contact_name_4:{0}:{1}:原第四聯絡人姓名#", oldven.contact_name_4, "刪除"); //update_log.AppendFormat("contact_phone_1_4:{0}:{1}:原第四聯絡人電話一#", oldven.contact_phone_1_4, "刪除"); //update_log.AppendFormat("contact_phone_2_4:{0}:{1}:原第四聯絡人電話二#", oldven.contact_phone_2_4, "刪除"); //update_log.AppendFormat("contact_mobile_4:{0}:{1}:原第四聯絡人手機號碼#", oldven.contact_mobile_4, "刪除"); //update_log.AppendFormat("contact_email_4:{0}:{1}:原第四聯絡人郵箱#", oldven.contact_email_4, "刪除"); //update_log.AppendFormat("contact_type_5:{0}:{1}:第五聯絡人類型#", oldven.contact_type_5, 7); //update_log.AppendFormat("contact_name_5:{0}:{1}:第五聯絡人姓名#", oldven.contact_name_5, "刪除"); //update_log.AppendFormat("contact_phone_1_5:{0}:{1}:第五聯絡人電話一#", oldven.contact_phone_1_5, "刪除"); //update_log.AppendFormat("contact_phone_2_5:{0}:{1}:第五聯絡人電話二#", oldven.contact_phone_2_5, "刪除"); //update_log.AppendFormat("contact_mobile_5:{0}:{1}:第五聯絡人手機號碼#", oldven.contact_mobile_5, "刪除"); //update_log.AppendFormat("contact_email_5:{0}:{1}:第五聯絡人郵箱#", oldven.contact_email_5, "刪除"); list.Add(new TableChangeLog() { change_field = "contact_type_2", old_value = oldven.contact_type_2.ToString(), new_value = "7", field_ch_name = "原第二聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_2", old_value = oldven.contact_name_2, new_value = "刪除", field_ch_name = "原第二聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_2", old_value = oldven.contact_phone_1_2, new_value = "刪除", field_ch_name = "原第二聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_2", old_value = oldven.contact_phone_2_2, new_value = "刪除", field_ch_name = "原第二聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_2", old_value = oldven.contact_mobile_2, new_value = "刪除", field_ch_name = "原第二聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_2", old_value = oldven.contact_email_2, new_value = "刪除", field_ch_name = "原第二聯絡人郵箱" }); list.Add(new TableChangeLog() { change_field = "contact_type_3", old_value = oldven.contact_type_3.ToString(), new_value = "7", field_ch_name = "原第三聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_3", old_value = oldven.contact_name_3, new_value = "刪除", field_ch_name = "原第三聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_3", old_value = oldven.contact_phone_1_3, new_value = "刪除", field_ch_name = "原第三聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_3", old_value = oldven.contact_phone_2_3, new_value = "刪除", field_ch_name = "原第三聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_3", old_value = oldven.contact_mobile_3, new_value = "刪除", field_ch_name = "原第三聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_3", old_value = oldven.contact_email_3, new_value = "刪除", field_ch_name = "原第三聯絡人郵箱" }); list.Add(new TableChangeLog() { change_field = "contact_type_4", old_value = oldven.contact_type_4.ToString(), new_value = "7", field_ch_name = "原第四聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_4", old_value = oldven.contact_name_4, new_value = "刪除", field_ch_name = "原第四聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_4", old_value = oldven.contact_phone_1_4, new_value = "刪除", field_ch_name = "原第四聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_4", old_value = oldven.contact_phone_2_4, new_value = "刪除", field_ch_name = "原第四聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_4", old_value = oldven.contact_mobile_4, new_value = "刪除", field_ch_name = "原第四聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_4", old_value = oldven.contact_email_4, new_value = "刪除", field_ch_name = "原第四聯絡人郵箱" }); list.Add(new TableChangeLog() { change_field = "contact_type_5", old_value = oldven.contact_type_5.ToString(), new_value = "7", field_ch_name = "第五聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_5", old_value = oldven.contact_name_5, new_value = "刪除", field_ch_name = "第五聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_5", old_value = oldven.contact_phone_1_5, new_value = "刪除", field_ch_name = "第五聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_5", old_value = oldven.contact_phone_2_5, new_value = "刪除", field_ch_name = "第五聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_5", old_value = oldven.contact_mobile_5, new_value = "刪除", field_ch_name = "第五聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_5", old_value = oldven.contact_email_5, new_value = "刪除", field_ch_name = "第五聯絡人郵箱" }); } else { for (int i = 0; i < delArr.Length; i++) { int del = Convert.ToInt32(delArr[i]); if (del == 1 && re_1 == 0 && oldven.contact_type_2 != 0) { re_1++; //update_log.AppendFormat("contact_type_2:{0}:{1}:原第二聯絡人類型#", oldven.contact_type_2, 7); //update_log.AppendFormat("contact_name_2:{0}:{1}:原第二聯絡人姓名#", oldven.contact_name_2, "刪除"); //update_log.AppendFormat("contact_phone_1_2:{0}:{1}:原第二聯絡人電話一#", oldven.contact_phone_1_2, "刪除"); //update_log.AppendFormat("contact_phone_2_2:{0}:{1}:原第二聯絡人電話二#", oldven.contact_phone_2_2, "刪除"); //update_log.AppendFormat("contact_mobile_2:{0}:{1}:原第二聯絡人手機號碼#", oldven.contact_mobile_2, "刪除"); //update_log.AppendFormat("contact_email_2:{0}:{1}:原第二聯絡人郵箱#", oldven.contact_email_2, "刪除"); list.Add(new TableChangeLog() { change_field = "contact_type_2", old_value = oldven.contact_type_2.ToString(), new_value = "7", field_ch_name = "原第二聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_2", old_value = oldven.contact_name_2, new_value = "刪除", field_ch_name = "原第二聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_2", old_value = oldven.contact_phone_1_2, new_value = "刪除", field_ch_name = "原第二聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_2", old_value = oldven.contact_phone_2_2, new_value = "刪除", field_ch_name = "原第二聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_2", old_value = oldven.contact_mobile_2, new_value = "刪除", field_ch_name = "原第二聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_2", old_value = oldven.contact_email_2, new_value = "刪除", field_ch_name = "原第二聯絡人郵箱" }); } else if (((del == 2 && re_2 == 0) || re_1 == 1) && oldven.contact_type_3 != 0) { if (re_1 == 1) { re_1++; } else { re_2++; } //update_log.AppendFormat("contact_type_3:{0}:{1}:原第三聯絡人類型#", oldven.contact_type_3, 7); //update_log.AppendFormat("contact_name_3:{0}:{1}:原第三聯絡人姓名#", oldven.contact_name_3, "刪除"); //update_log.AppendFormat("contact_phone_1_3:{0}:{1}:原第三聯絡人電話一#", oldven.contact_phone_1_3, "刪除"); //update_log.AppendFormat("contact_phone_2_3:{0}:{1}:原第三聯絡人電話二#", oldven.contact_phone_2_3, "刪除"); //update_log.AppendFormat("contact_mobile_3:{0}:{1}:原第三聯絡人手機號碼#", oldven.contact_mobile_3, "刪除"); //update_log.AppendFormat("contact_email_3:{0}:{1}:原第三聯絡人郵箱#", oldven.contact_email_3, "刪除"); list.Add(new TableChangeLog() { change_field = "contact_type_3", old_value = oldven.contact_type_3.ToString(), new_value = "7", field_ch_name = "原第三聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_3", old_value = oldven.contact_name_3, new_value = "刪除", field_ch_name = "原第三聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_3", old_value = oldven.contact_phone_1_3, new_value = "刪除", field_ch_name = "原第三聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_3", old_value = oldven.contact_phone_2_3, new_value = "刪除", field_ch_name = "原第三聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_3", old_value = oldven.contact_mobile_3, new_value = "刪除", field_ch_name = "原第三聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_3", old_value = oldven.contact_email_3, new_value = "刪除", field_ch_name = "原第三聯絡人郵箱" }); } else if (((del == 3 && re_3 == 0) || re_1 == 2 || re_2 == 1) && oldven.contact_type_4 != 0) { if (re_1 == 2) { re_1++; } else if (re_2 == 1) { re_2++; } else { re_3++; } //update_log.AppendFormat("contact_type_4:{0}:{1}:原第四聯絡人類型#", oldven.contact_type_4, 7); //update_log.AppendFormat("contact_name_4:{0}:{1}:原第四聯絡人姓名#", oldven.contact_name_4, "刪除"); //update_log.AppendFormat("contact_phone_1_4:{0}:{1}:原第四聯絡人電話一#", oldven.contact_phone_1_4, "刪除"); //update_log.AppendFormat("contact_phone_2_4:{0}:{1}:原第四聯絡人電話二#", oldven.contact_phone_2_4, "刪除"); //update_log.AppendFormat("contact_mobile_4:{0}:{1}:原第四聯絡人手機號碼#", oldven.contact_mobile_4, "刪除"); //update_log.AppendFormat("contact_email_4:{0}:{1}:原第四聯絡人郵箱#", oldven.contact_email_4, "刪除"); list.Add(new TableChangeLog() { change_field = "contact_type_4", old_value = oldven.contact_type_4.ToString(), new_value = "7", field_ch_name = "原第四聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_4", old_value = oldven.contact_name_4, new_value = "刪除", field_ch_name = "原第四聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_4", old_value = oldven.contact_phone_1_4, new_value = "刪除", field_ch_name = "原第四聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_4", old_value = oldven.contact_phone_2_4, new_value = "刪除", field_ch_name = "原第四聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_4", old_value = oldven.contact_mobile_4, new_value = "刪除", field_ch_name = "原第四聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_4", old_value = oldven.contact_email_4, new_value = "刪除", field_ch_name = "原第四聯絡人郵箱" }); } else if ((del == 4 || re_1 == 3 || re_2 == 2 || re_3 == 1) && oldven.contact_type_5 != 0) { //update_log.AppendFormat("contact_type_5:{0}:{1}:第五聯絡人類型#", oldven.contact_type_5, 7); //update_log.AppendFormat("contact_name_5:{0}:{1}:第五聯絡人姓名#", oldven.contact_name_5, "刪除"); //update_log.AppendFormat("contact_phone_1_5:{0}:{1}:第五聯絡人電話一#", oldven.contact_phone_1_5, "刪除"); //update_log.AppendFormat("contact_phone_2_5:{0}:{1}:第五聯絡人電話二#", oldven.contact_phone_2_5, "刪除"); //update_log.AppendFormat("contact_mobile_5:{0}:{1}:第五聯絡人手機號碼#", oldven.contact_mobile_5, "刪除"); //update_log.AppendFormat("contact_email_5:{0}:{1}:第五聯絡人郵箱#", oldven.contact_email_5, "刪除"); list.Add(new TableChangeLog() { change_field = "contact_type_5", old_value = oldven.contact_type_5.ToString(), new_value = "7", field_ch_name = "第五聯絡人類型" }); list.Add(new TableChangeLog() { change_field = "contact_name_5", old_value = oldven.contact_name_5, new_value = "刪除", field_ch_name = "第五聯絡人姓名" }); list.Add(new TableChangeLog() { change_field = "contact_phone_1_5", old_value = oldven.contact_phone_1_5, new_value = "刪除", field_ch_name = "第五聯絡人電話一" }); list.Add(new TableChangeLog() { change_field = "contact_phone_2_5", old_value = oldven.contact_phone_2_5, new_value = "刪除", field_ch_name = "第五聯絡人電話二" }); list.Add(new TableChangeLog() { change_field = "contact_mobile_5", old_value = oldven.contact_mobile_5, new_value = "刪除", field_ch_name = "第五聯絡人手機號碼" }); list.Add(new TableChangeLog() { change_field = "contact_email_5", old_value = oldven.contact_email_5, new_value = "刪除", field_ch_name = "第五聯絡人郵箱" }); } } } } string[] contactarr = null; if (!string.IsNullOrEmpty(Request.Params["conactValues"].ToString())) { string contact = Request.Params["conactValues"].ToString(); contactarr = contact.Split('|'); } for (int i = 0; i < 5; i++) { string[] contact1 = null; if (contactarr != null && contactarr.Length > i + 1) { contact1 = contactarr[i].Split(','); } if (i == 0) { if (contact1 != null) { venQuery.contact_type_1 = 4; venQuery.contact_name_1 = contact1[1]; venQuery.contact_phone_1_1 = contact1[2]; venQuery.contact_phone_2_1 = contact1[3]; venQuery.contact_mobile_1 = contact1[4]; venQuery.contact_email_1 = contact1[5].ToLower(); if (oldven.contact_type_1 != venQuery.contact_type_1) { // update_log.AppendFormat("contact_type_1:{0}:{1}:第一聯絡人類型#", oldven.contact_type_1, venQuery.contact_type_1); list.Add(new TableChangeLog() { change_field = "contact_type_1", old_value = oldven.contact_type_1.ToString(), new_value = venQuery.contact_type_1.ToString(), field_ch_name = "第一聯絡人類型" }); } if (oldven.contact_name_1 != venQuery.contact_name_1) { // update_log.AppendFormat("contact_name_1:{0}:{1}:第一聯絡人姓名#", oldven.contact_name_1, venQuery.contact_name_1); list.Add(new TableChangeLog() { change_field = "contact_name_1", old_value = oldven.contact_name_1, new_value = venQuery.contact_name_1, field_ch_name = "第一聯絡人姓名" }); } if (oldven.contact_phone_1_1 != venQuery.contact_phone_1_1) { //update_log.AppendFormat("contact_phone_1_1:{0}:{1}:第一聯絡人電話一#", oldven.contact_phone_1_1, venQuery.contact_phone_1_1); list.Add(new TableChangeLog() { change_field = "contact_phone_1_1", old_value = oldven.contact_phone_1_1, new_value = venQuery.contact_phone_1_1, field_ch_name = "第一聯絡人電話一" }); } if (oldven.contact_phone_2_1 != venQuery.contact_phone_2_1) { // update_log.AppendFormat("contact_phone_2_1:{0}:{1}:第一聯絡人電話二#", oldven.contact_phone_2_1, venQuery.contact_phone_2_1); list.Add(new TableChangeLog() { change_field = "contact_phone_2_1", old_value = oldven.contact_phone_2_1, new_value = venQuery.contact_phone_2_1, field_ch_name = "第一聯絡人電話二" }); } if (oldven.contact_mobile_1 != venQuery.contact_mobile_1) { // update_log.AppendFormat("contact_mobile_1:{0}:{1}:第一聯絡人手機號碼#", oldven.contact_mobile_1, venQuery.contact_mobile_1); list.Add(new TableChangeLog() { change_field = "contact_mobile_1", old_value = oldven.contact_mobile_1, new_value = venQuery.contact_mobile_1, field_ch_name = "第一聯絡人手機號碼" }); } if (oldven.contact_email_1 != venQuery.contact_email_1) { //update_log.AppendFormat("contact_email_1:{0}:{1}:第一聯絡人郵箱#", oldven.contact_email_1, venQuery.contact_email_1); list.Add(new TableChangeLog() { change_field = "contact_email_1", old_value = oldven.contact_email_1, new_value = venQuery.contact_email_1, field_ch_name = "第一聯絡人郵箱" }); } } } else if (i == 1) { if (contact1 != null) { venQuery.contact_type_2 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_2 = contact1[1]; venQuery.contact_phone_1_2 = contact1[2]; venQuery.contact_phone_2_2 = contact1[3]; venQuery.contact_mobile_2 = contact1[4]; venQuery.contact_email_2 = contact1[5].ToLower().ToLower(); if (oldven.contact_type_2 != venQuery.contact_type_2) { // update_log.AppendFormat("contact_type_2:{0}:{1}:第二聯絡人類型#", oldven.contact_type_2, venQuery.contact_type_2); list.Add(new TableChangeLog() { change_field = "contact_type_2", old_value = oldven.contact_type_2.ToString(), new_value = venQuery.contact_type_2.ToString(), field_ch_name = "第二聯絡人類型" }); } if (oldven.contact_name_2 != venQuery.contact_name_2) { //update_log.AppendFormat("contact_name_2:{0}:{1}:第二聯絡人姓名#", oldven.contact_name_2, venQuery.contact_name_2); list.Add(new TableChangeLog() { change_field = "contact_name_2", old_value = oldven.contact_name_2, new_value = venQuery.contact_name_2, field_ch_name = "第二聯絡人姓名" }); } if (oldven.contact_phone_1_2 != venQuery.contact_phone_1_2) { //update_log.AppendFormat("contact_phone_1_2:{0}:{1}:第二聯絡人電話一#", oldven.contact_phone_1_2, venQuery.contact_phone_1_2); list.Add(new TableChangeLog() { change_field = "contact_phone_1_2", old_value = oldven.contact_phone_1_2, new_value = venQuery.contact_phone_1_2, field_ch_name = "第二聯絡人電話一" }); } if (oldven.contact_phone_2_2 != venQuery.contact_phone_2_2) { //update_log.AppendFormat("contact_phone_2_2:{0}:{1}:第二聯絡人電話二#", oldven.contact_phone_2_2, venQuery.contact_phone_2_2); list.Add(new TableChangeLog() { change_field = "contact_phone_2_2", old_value = oldven.contact_phone_2_2, new_value = venQuery.contact_phone_2_2, field_ch_name = "第二聯絡人電話二" }); } if (oldven.contact_mobile_2 != venQuery.contact_mobile_2) { // update_log.AppendFormat("contact_mobile_2:{0}:{1}:第二聯絡人手機號碼#", oldven.contact_mobile_2, venQuery.contact_mobile_2); list.Add(new TableChangeLog() { change_field = "contact_mobile_2", old_value = oldven.contact_mobile_2, new_value = venQuery.contact_mobile_2, field_ch_name = "第二聯絡人手機號碼" }); } if (oldven.contact_email_2 != venQuery.contact_email_2) { // update_log.AppendFormat("contact_email_2:{0}:{1}:第二聯絡人郵箱#", oldven.contact_email_2, venQuery.contact_email_2); list.Add(new TableChangeLog() { change_field = "contact_email_2", old_value = oldven.contact_email_2, new_value = venQuery.contact_email_2, field_ch_name = "第二聯絡人郵箱" }); } } } else if (i == 2) { if (contact1 != null) { venQuery.contact_type_3 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_3 = contact1[1]; venQuery.contact_phone_1_3 = contact1[2]; venQuery.contact_phone_2_3 = contact1[3]; venQuery.contact_mobile_3 = contact1[4]; venQuery.contact_email_3 = contact1[5].ToLower(); if (oldven.contact_type_3 != venQuery.contact_type_3) { //update_log.AppendFormat("contact_type_3:{0}:{1}:第三聯絡人類型#", oldven.contact_type_3, venQuery.contact_type_3); list.Add(new TableChangeLog() { change_field = "contact_type_3", old_value = oldven.contact_type_3.ToString(), new_value = venQuery.contact_type_3.ToString(), field_ch_name = "第三聯絡人類型" }); } if (oldven.contact_name_3 != venQuery.contact_name_3) { //update_log.AppendFormat("contact_name_3:{0}:{1}:第三聯絡人姓名#", oldven.contact_name_3, venQuery.contact_name_3); list.Add(new TableChangeLog() { change_field = "contact_name_3", old_value = oldven.contact_name_3, new_value = venQuery.contact_name_3, field_ch_name = "第三聯絡人姓名" }); } if (oldven.contact_phone_1_3 != venQuery.contact_phone_1_3) { // update_log.AppendFormat("contact_phone_1_3:{0}:{1}:第三聯絡人電話一#", oldven.contact_phone_1_3, venQuery.contact_phone_1_3); list.Add(new TableChangeLog() { change_field = "contact_phone_1_3", old_value = oldven.contact_phone_1_3, new_value = venQuery.contact_phone_1_3, field_ch_name = "第三聯絡人電話一" }); } if (oldven.contact_phone_2_3 != venQuery.contact_phone_2_3) { // update_log.AppendFormat("contact_phone_2_3:{0}:{1}:第三聯絡人電話二#", oldven.contact_phone_2_3, venQuery.contact_phone_2_3); list.Add(new TableChangeLog() { change_field = "contact_phone_2_3", old_value = oldven.contact_phone_2_3, new_value = venQuery.contact_phone_2_3, field_ch_name = "第三聯絡人電話二" }); } if (oldven.contact_mobile_3 != venQuery.contact_mobile_3) { // update_log.AppendFormat("contact_mobile_3:{0}:{1}:第三聯絡人手機號碼#", oldven.contact_mobile_3, venQuery.contact_mobile_3); list.Add(new TableChangeLog() { change_field = "contact_mobile_3", old_value = oldven.contact_mobile_3, new_value = venQuery.contact_mobile_3, field_ch_name = "第三聯絡人手機號碼" }); } if (oldven.contact_email_3 != venQuery.contact_email_3) { // update_log.AppendFormat("contact_email_3:{0}:{1}:第三聯絡人郵箱#", oldven.contact_email_3, venQuery.contact_email_3); list.Add(new TableChangeLog() { change_field = "contact_email_3", old_value = oldven.contact_email_3, new_value = venQuery.contact_email_3, field_ch_name = "第三聯絡人郵箱" }); } } } else if (i == 3) { if (contact1 != null) { venQuery.contact_type_4 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_4 = contact1[1]; venQuery.contact_phone_1_4 = contact1[2]; venQuery.contact_phone_2_4 = contact1[3]; venQuery.contact_mobile_4 = contact1[4]; venQuery.contact_email_4 = contact1[5].ToLower(); if (oldven.contact_type_4 != venQuery.contact_type_4) { //update_log.AppendFormat("contact_type_4:{0}:{1}:第四聯絡人類型#", oldven.contact_type_4, venQuery.contact_type_4); list.Add(new TableChangeLog() { change_field = "contact_type_4", old_value = oldven.contact_type_4.ToString(), new_value = venQuery.contact_type_4.ToString(), field_ch_name = "原第四聯絡人類型" }); } if (oldven.contact_name_4 != venQuery.contact_name_4) { // update_log.AppendFormat("contact_name_4:{0}:{1}:第四聯絡人姓名#", oldven.contact_name_4, venQuery.contact_name_4); list.Add(new TableChangeLog() { change_field = "contact_name_4", old_value = oldven.contact_name_4, new_value = venQuery.contact_name_4, field_ch_name = "第四聯絡人姓名" }); } if (oldven.contact_phone_1_4 != venQuery.contact_phone_1_4) { //update_log.AppendFormat("contact_phone_1_4:{0}:{1}:第四聯絡人電話一#", oldven.contact_phone_1_4, venQuery.contact_phone_1_4); list.Add(new TableChangeLog() { change_field = "contact_phone_1_4", old_value = oldven.contact_phone_1_4, new_value = venQuery.contact_phone_1_4, field_ch_name = "第四聯絡人電話一" }); } if (oldven.contact_phone_2_4 != venQuery.contact_phone_2_4) { // update_log.AppendFormat("contact_phone_2_4:{0}:{1}:第四聯絡人電話二#", oldven.contact_phone_2_4, venQuery.contact_phone_2_4); list.Add(new TableChangeLog() { change_field = "contact_phone_2_4", old_value = oldven.contact_phone_2_4, new_value = venQuery.contact_phone_2_4, field_ch_name = "第四聯絡人電話二" }); } if (oldven.contact_mobile_4 != venQuery.contact_mobile_4) { // update_log.AppendFormat("contact_mobile_4:{0}:{1}:第四聯絡人手機號碼#", oldven.contact_mobile_4, venQuery.contact_mobile_4); list.Add(new TableChangeLog() { change_field = "contact_mobile_4", old_value = oldven.contact_mobile_4, new_value = venQuery.contact_mobile_4, field_ch_name = "第四聯絡人手機號碼" }); } if (oldven.contact_email_4 != venQuery.contact_email_4) { // update_log.AppendFormat("contact_email_4:{0}:{1}:第四聯絡人郵箱#", oldven.contact_email_4, venQuery.contact_email_4); list.Add(new TableChangeLog() { change_field = "contact_email_4", old_value = oldven.contact_email_4, new_value = venQuery.contact_email_4, field_ch_name = "第四聯絡人郵箱" }); } } } else if (i == 4) { if (contact1 != null) { venQuery.contact_type_5 = Convert.ToUInt32(ContactType(contact1[0].ToString())); venQuery.contact_name_5 = contact1[1]; venQuery.contact_phone_1_5 = contact1[2]; venQuery.contact_phone_2_5 = contact1[3]; venQuery.contact_mobile_5 = contact1[4]; venQuery.contact_email_5 = contact1[5].ToLower(); if (oldven.contact_type_5 != venQuery.contact_type_5) { //update_log.AppendFormat("contact_type_5:{0}:{1}:第五聯絡人類型#", oldven.contact_type_5, venQuery.contact_type_5); list.Add(new TableChangeLog() { change_field = "contact_type_5", old_value = oldven.contact_type_5.ToString(), new_value = venQuery.contact_type_5.ToString(), field_ch_name = "第五聯絡人類型" }); } if (oldven.contact_name_5 != venQuery.contact_name_5) { // update_log.AppendFormat("contact_name_5:{0}:{1}:第五聯絡人姓名#", oldven.contact_name_5, venQuery.contact_name_5); list.Add(new TableChangeLog() { change_field = "contact_name_5", old_value = oldven.contact_name_5, new_value = venQuery.contact_name_5, field_ch_name = "第五聯絡人姓名" }); } if (oldven.contact_phone_1_5 != venQuery.contact_phone_1_5) { // update_log.AppendFormat("contact_phone_1_5:{0}:{1}:第五聯絡人電話一#", oldven.contact_phone_1_5, venQuery.contact_phone_1_5); list.Add(new TableChangeLog() { change_field = "contact_phone_1_5", old_value = oldven.contact_phone_1_5, new_value = venQuery.contact_phone_1_5, field_ch_name = "第五聯絡人電話一" }); } if (oldven.contact_phone_2_5 != venQuery.contact_phone_2_5) { // update_log.AppendFormat("contact_phone_2_5:{0}:{1}:第五聯絡人電話二#", oldven.contact_phone_2_5, venQuery.contact_phone_2_5); list.Add(new TableChangeLog() { change_field = "contact_phone_2_5", old_value = oldven.contact_phone_2_5, new_value = venQuery.contact_phone_2_5, field_ch_name = "第五聯絡人電話二" }); } if (oldven.contact_mobile_5 != venQuery.contact_mobile_5) { //update_log.AppendFormat("contact_mobile_5:{0}:{1}:第五聯絡人手機號碼#", oldven.contact_mobile_5, venQuery.contact_mobile_5); list.Add(new TableChangeLog() { change_field = "contact_mobile_5", old_value = oldven.contact_mobile_5, new_value = venQuery.contact_mobile_5, field_ch_name = "第五聯絡人手機號碼" }); } if (oldven.contact_email_5 != venQuery.contact_email_5) { //update_log.AppendFormat("contact_email_5:{0}:{1}:第五聯絡人郵箱#", oldven.contact_email_5, venQuery.contact_email_5); list.Add(new TableChangeLog() { change_field = "contact_email_5", old_value = oldven.contact_email_5, new_value = venQuery.contact_email_5, field_ch_name = "第五聯絡人郵箱" }); } } } } #endregion venQuery.ip = Request.UserHostAddress; venQuery.file_name = "VendorList.chtml"; venQuery.created = DateTime.Now; venQuery.kuser_id = Convert.ToUInt32((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); venQuery.export_flag = 1; mgr = new CallerMgr(connectionString); Caller caller = new Caller(); caller = mgr.GetUserById(Convert.ToInt32(venQuery.kuser_id)); venQuery.kuser_name = caller.user_username; return VendorEdit(venQuery, list); } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }
public DataTable GetData(DataTable dtHZ, List<VendorAccountCustom> liStore, int type, DataTable tempTemp, int tempFreightDelivery_Normal, int tempFreightDelivery_Low) { uint product_money = 0; uint product_cost = 0; uint order_payment = 0; uint money_creditcard_1 = 0; uint freight_delivery_normal = 0; uint freight_delivery_low = 0; uint freight_return_normal = 0; uint freight_return_low = 0; int account_amount = 0; int fritotal = 0; int yingTotal = 0; int mianx = 0; //DateTime mindate = DateTime.MinValue; //DateTime maxdate = DateTime.MinValue; _configMgr = new ConfigMgr(mySqlConnectionString); DataTable dt = _configMgr.GetConfig(new ConfigQuery { config_name = "is_not_billing_checked" }); string[] paymentarr = null; if (dt.Rows.Count != 0) { paymentarr = dt.Rows[0]["config_value"].ToString().Split(',').ToArray(); } for (int i = 0; i < liStore.Count; i++) { DataRow dr = dtHZ.NewRow(); int tt = 0; VendorAccountCustom item = liStore[i]; if ((i > 0 && (item.slave_id != liStore[i - 1].slave_id || item.order_id != liStore[i - 1].order_id)) || i == 0) { dr[0] = item.accountdate.ToString("yyyy/MM/dd"); dr[1] = item.ordercreatedate.ToString("yyyy/MM/dd"); dr[2] = item.slavedate_delivery.ToString("yyyy/MM/dd"); dr[3] = item.order_id; dr[4] = item.slave_id; dr[5] = item.product_money; dr[6] = item.product_cost; dr[7] = item.paymentname; if (item.money_creditcard_1 != 0) { dr[8] = "-" + item.money_creditcard_1; } else { dr[8] = 0; } dr[9] = item.freight_delivery_normal; dr[10] = item.freight_delivery_low; if (item.freight_return_normal != 0) { dr[11] = "-" + item.freight_return_normal; } else { dr[11] = 0; } if (item.freight_return_low != 0) { dr[12] = "-" + item.freight_return_low; } else { dr[12] = 0; } dr[13] = item.account_amount; product_money += item.product_money; product_cost += item.product_cost; //order_payment += item.Order_Payment; money_creditcard_1 += item.money_creditcard_1; freight_delivery_normal += item.freight_delivery_normal; freight_delivery_low += item.freight_delivery_low; freight_return_normal += item.freight_return_normal; freight_return_low += item.freight_return_low; account_amount += item.account_amount; } if (item.Product_Mode == 1) { item.ProductMode = "自出"; } else if (item.Product_Mode == 2) { item.ProductMode = "寄倉"; } else if (item.Product_Mode == 3) { item.ProductMode = "調度倉"; } if (item.Detail_Status != 4) { item.Single_Money = 0; item.Single_Cost = 0; item.single_cost_subtotal = 0; } else { item.single_cost_subtotal = item.Single_Cost * item.Buy_Num; } if (item.item_mode == 0) { item.itemmode = "單一"; } else if (item.item_mode == 1) { item.itemmode = "父"; } else if (item.item_mode == 2) { item.itemmode = "子"; } dr[14] = item.ProductMode; dr[15] = item.product_freight; dr[16] = item.itemmode; dr[17] = item.Product_Name + item.Product_Spec_Name; if (item.item_mode == 2) { dr[19] = item.Buy_Num * item.parent_num; } else { dr[18] = item.Buy_Num; dr[20] = item.Single_Cost; dr[21] = item.single_cost_subtotal; dr[22] = item.Event_Cost == 0 ? "-" : item.Event_Cost.ToString(); dr[23] = item.Deduct_Account; dr[24] = item.Single_Money; dr[25] = item.Single_Money * item.Buy_Num; if (item.tax_type == 3) { if (item.Event_Cost == 0) { tt = Convert.ToInt32(item.Single_Cost * item.Buy_Num); } else { tt = Convert.ToInt32(item.Event_Cost * item.Buy_Num); } mianx += tt; } } dr[26] = ""; dr[27] = item.order_status_name; dr[28] = item.parent_id; if (item.od_bag_check_money * item.Buy_Num == 0) { dr[29] = 0; } else { dr[29] = "-" + (item.od_bag_check_money * item.Buy_Num); } //dr[29] = item.od_bag_check_money * item.Buy_Num == 0 ? 0 : '-' + (item.od_bag_check_money * item.Buy_Num); if (item.tax_type == 1) { item.taxtype = "應稅"; } else if (item.tax_type == 3) { item.taxtype = "免稅"; } dr[30] = item.taxtype; if (item.item_mode != 1) { dr[31] = item.Item_Id; dr[32] = " " + item.upc_id; } else { dr[31] = ""; dr[32] = ""; } dr[33] = item.Note_Admin; dtHZ.Rows.Add(dr); } if (type == 1 || type == 3) { DataRow dre = dtHZ.NewRow(); dre[0] = "總計"; dre[5] = product_money; dre[6] = product_cost; dre[7] = order_payment; dre[8] = "-" + money_creditcard_1; dre[9] = freight_delivery_normal; dre[10] = freight_delivery_low; if (freight_return_normal != 0) { dre[11] = "-" + freight_return_normal; } else { dre[11] = freight_return_normal; } if (freight_return_low == 0) { dre[12] = 0; } else { dre[12] = "-" + freight_return_low; } dre[13] = account_amount; dtHZ.Rows.Add(dre); DataRow drJiC = dtHZ.NewRow(); drJiC[12] = "寄倉費"; drJiC[13] = "-" + Convert.ToInt32(tempTemp.Rows[0]["m_bag_check_money"].ToString()); if (drJiC[13].ToString() != "-0") { dtHZ.Rows.Add(drJiC); } DataRow drFre = dtHZ.NewRow(); drFre[12] = "運費"; drFre[13] = tempFreightDelivery_Low + tempFreightDelivery_Normal; if (drFre[13].ToString() != "0") { dtHZ.Rows.Add(drFre); } fritotal = tempFreightDelivery_Low + tempFreightDelivery_Normal - (Convert.ToInt32(tempTemp.Rows[0]["m_bag_check_money"].ToString())) + 0; if (drJiC[13].ToString() != "-0" || drFre[13].ToString() != "0") { DataRow drFreTotal = dtHZ.NewRow(); drFreTotal[13] = account_amount + fritotal; dtHZ.Rows.Add(drFreTotal); } yingTotal = account_amount + fritotal - mianx; DataRow drT1 = dtHZ.NewRow(); int year = Convert.ToInt32(Request.Params["dateOne"].ToString()); int month = Convert.ToInt32(Request.Params["dateTwo"].ToString()); DateTime dtime = new DateTime(year, month, 1); drT1[0] = "※" + Request.Params["dateTwo"].ToString() + "月對帳表出貨日期:" + dtime.AddDays(-11).ToShortDateString() + "~" + dtime.AddMonths(1).AddDays(-12).ToShortDateString() + "(到店取貨:" + dtime.AddDays(-16).ToShortDateString() + "~" + dtime.AddMonths(1).AddDays(-17).ToShortDateString() + ")"; dtHZ.Rows.Add(drT1); DataRow drT2 = dtHZ.NewRow(); drT2[0] = "※發票抬頭:吉甲地好市集股份有限公司,統編:25137186。"; dtHZ.Rows.Add(drT2); DataRow drT3 = dtHZ.NewRow(); drT3[0] = "※正本發票或發據請寄至:115台北市南港區八德路四段768巷9號3樓之1(會計部收),02-2783-3183。"; dtHZ.Rows.Add(drT3); DataRow drT7 = dtHZ.NewRow(); drT7[0] = "※" + Request.Params["dateTwo"].ToString() + "月對帳表(" + dtime.AddMonths(1).Month + "月對帳時程):"; dtHZ.Rows.Add(drT7); DataRow drT4 = dtHZ.NewRow(); drT4[0] = "1.對帳表提供:吉甲地提供對帳表,月初前3工作日"; dtHZ.Rows.Add(drT4); DataRow drT5 = dtHZ.NewRow(); drT5[0] = "2.對帳:廠商對帳OK後正本請款發票/收據寄達至吉甲地(每月10前,遇假日順延一日)"; dtHZ.Rows.Add(drT5); DataRow drT6 = dtHZ.NewRow(); drT6[0] = "3.付款:吉甲地廠商款付款,每月最後一工作日"; dtHZ.Rows.Add(drT6); DataRow drT8 = dtHZ.NewRow(); drT8[13] = "(稅別金額如下,提供開立發票參考,如金額有誤,請跟吉甲地連絡,如為開立收據,可毋需理會)"; dtHZ.Rows.Add(drT8); DataRow drShuiBei = dtHZ.NewRow(); drShuiBei[13] = "稅別"; drShuiBei[14] = "免稅"; drShuiBei[15] = "應稅"; drShuiBei[16] = "統計"; dtHZ.Rows.Add(drShuiBei); DataRow DrXS = dtHZ.NewRow(); DrXS[13] = "銷售額"; if (yingTotal < 0) { mianx = mianx + yingTotal; yingTotal = 0; } DrXS[14] = mianx; DrXS[15] = Math.Round(yingTotal / 1.05); DrXS[16] = "/"; dtHZ.Rows.Add(DrXS); DataRow DrS = dtHZ.NewRow(); DrS[13] = "稅額"; DrS[14] = 0; DrS[15] = yingTotal - Math.Round(yingTotal / 1.05); DrS[16] = "/"; dtHZ.Rows.Add(DrS); DataRow DrZong = dtHZ.NewRow(); DrZong[13] = "發票金額"; DrZong[14] = mianx; DrZong[15] = yingTotal; DrZong[16] = mianx + yingTotal; dtHZ.Rows.Add(DrZong); } else if (type == 2) { DataRow drTt = dtHZ.NewRow(); dtHZ.Rows.Add(drTt); DataRow drTt1 = dtHZ.NewRow(); dtHZ.Rows.Add(drTt1); } return dtHZ; }
/// <summary> /// 群組列表 /// </summary> /// <returns></returns> public ActionResult VipUserGroupList() { string user_email = (Session["caller"] as Caller).user_email; int user_id = (Session["caller"] as Caller).user_id; _configMgr = new ConfigMgr(mySqlConnectionString); List<ConfigQuery> store = _configMgr.Query("member_group", 7);//獲取7個會員群組管理人員 ViewBag.valetservice = 0; ViewBag.modifyonly = 0; foreach (var item in store) { if (item.email == user_email) { ViewBag.valetservice = 1; } } if (user_id == 85 || user_id == 96) { ViewBag.modifyonly = 1; } return View(); }