/// <summary> /// 操作商品細項 /// </summary> /// <param name="pe">需要操作的商品條件</param> /// <returns>操作是否成功</returns> public bool UpdateProductExt(List<ProductExtCustom> lists , Caller _caller,string controlId) { bool flag = true; IFunctionImplMgr _functionMgr = new FunctionMgr(conStr); //用於找到控件的function信息 ITableHistoryImplMgr _tableHistoryMgr; //用於歷史記錄保存的類 IProductExtImplMgr _productExtMgr = new ProductExtMgr(conStr); try { Function fun = _functionMgr.QueryFunction(controlId, "/ProductParticulars/Index"); ArrayList aList = new ArrayList(); _tableHistoryMgr = new TableHistoryMgr(conStr);//實例化歷史記錄的類 HistoryBatch batch = new HistoryBatch { functionid = fun.RowId }; Int64 n_Time = CommonFunction.GetPHPTime(); batch.kuser = _caller.user_email; foreach (ProductExtCustom item in lists) { aList.Add(pei.UpdateProductExt(item)); batch.batchno = n_Time + "_" + "2" + "_" + item.Product_id;//add by wwei0216w 2015/7/6 註:將item_id改為product_id 統一使用product_id查詢 flag = _tableHistoryMgr.SaveHistory<ProductExtCustom>(item, batch, aList); if(flag == false) { throw new Exception("ProductExtMgr-->UpdateProductExt Exception!" ); } } return flag; } catch (Exception ex) { throw new Exception("ProductExtMgr-->UpdateProductExt-->" + ex.Message, ex); } }
public List<Caller> Query(Caller caller, out int totalCount) { totalCount = 0; List<Caller> callers = new List<Caller>(); return callers; }
public int Update(Caller caller) { return 0; }
public int Save(Caller caller) { return 0; }
public int RFKT(AseldQuery ase, IinvdQuery ivd,int pnum) { string json = string.Empty; int result = 0; IialgQuery q = new IialgQuery(); uint id = 0; DateTime dt = new DateTime(); int sun = 0; _proditemMgr = new ProductItemMgr(mySqlConnectionString); ProductItem Proitems = new ProductItem(); try { {//商品id q.item_id = ase.item_id; Proitems.Item_Id = ase.item_id; } // (DateTime.TryParse(Request.Params["made_date"].ToString(), out dt)) {//商品製造日期 //q.made_dt = ivd.made_date; q.made_dt = new DateTime(3000,1,1); } //if (int.TryParse(Request.Params["prod_qty"].ToString(), out sun)) {//商品原有數量 q.qty_o = ivd.prod_qty; } //if (int.TryParse(Request.Params["pnum"].ToString(), out sun)) {//商品撿貨數量 q.pnum = pnum; } //if (!string.IsNullOrEmpty(Request.Params["loc_id"].ToString())) {//商品撿貨數量 q.loc_id = ase.sel_loc; } //if (!string.IsNullOrEmpty(Request.Params["order_id"])) { q.order_id = ase.ord_id.ToString(); } q.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; //進行庫調 _iagDao = new IialgDao(mySqlConnectionString); Caller call = new Caller(); call = (System.Web.HttpContext.Current.Session["caller"] as Caller); string path = "/WareHouse/KutiaoAddorReduce"; //if (q.loc_id == "YY999999") 無主料位時也進行庫調 if (false) { json = "{success:false}"; } else { Proitems.Item_Stock = q.pnum - q.qty_o; result = _iagDao.addIialgIstock_AutoMarket(q); if (result == 2) { json = "{success:true,msg:2}"; } if (result == 100) { //_proditemMgr.UpdateItemStock(Proitems, path, call); json = "{success:true,msg:100}"; } } } catch (Exception ex) { throw new Exception("MarketTallyMgr-->RFKT-->" + ex.Message, ex); } return result; }
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 bool AddProductExtentName(Caller caller) { try { string msg = string.Empty; var productExtent = peDao.QueryStart(); IPriceMasterImplMgr _priceMasterMgr = new PriceMasterMgr(connectionStr); List<PriceMaster> priceMasters = _priceMasterMgr.Query(productExtent.Select(p => p.Price_Master_Id).ToArray()); foreach (PriceMaster pm in priceMasters) { var item = productExtent.Find(m => m.Price_Master_Id == pm.price_master_id); pm.product_name = (item.Product_Prefix == "" ? "" : PriceMaster.L_HKH + item.Product_Prefix + PriceMaster.R_HKH) + pm.product_name + (item.Product_Suffix == "" ? "" : PriceMaster.L_HKH + item.Product_Suffix + PriceMaster.R_HKH); } if (_priceMasterMgr.UpdatePriceMasters(priceMasters, caller, out msg)) { productExtent.ForEach(p => { p.Apply_id = priceMasters.Find(m => m.price_master_id == p.Price_Master_Id).apply_id; p.Flag = 1;//待審核 }); return Update(productExtent); } return false; } catch (Exception ex) { throw new Exception("ProdNameExtendMgr.AddProductExtentName-->" + ex.Message, ex); } }
/// <summary> /// 調用儲存過程為price_master 裱中的name添加前後綴 /// </summary> /// <param name="days">過期天數(超多少天的前後綴自動刪除)</param> /// <returns>受影響的行數</returns> public int ResetExtendName(Caller callId, uint product_id = 0) { try { IPriceMasterImplMgr pmMgr = new PriceMasterMgr(connectionStr); MySqlDao _mySqlDao = new MySqlDao(connectionStr); ArrayList sqlList = new ArrayList(); string msg = string.Empty; List<ProdNameExtendCustom> list = new List<ProdNameExtendCustom>(); if (product_id != 0) { list = peDao.GetPastProductById(product_id); } else { list = peDao.GetPastProduct(); } foreach (var pM in list) { //pM.Product_Name = pM.Product_Name.Replace(PriceMaster.L_HKH + pM.Product_Prefix + PriceMaster.R_HKH, "")//替換掉priceMaster中product_name的前綴 //.Replace(PriceMaster.L_HKH + pM.Product_Suffix + PriceMaster.R_HKH, "");//替換掉priceMaster中product_name的後綴 bool tempFlag = true; int index = 0;///定義index防止錯誤導致下面的while無限循環 while(tempFlag)///循環刪除前後綴 { index ++; pM.Product_Name = ClearPreSuName(pM.Product_Name, PriceMaster.L_HKH.ToString(), PriceMaster.R_HKH.ToString()); if (pM.Product_Name.IndexOf(PriceMaster.L_HKH.ToString()) == -1 && pM.Product_Name.IndexOf(PriceMaster.R_HKH.ToString()) == -1||index>10) { tempFlag = false; } } PriceMaster p = new PriceMaster(); p.price_master_id = pM.Price_Master_Id; p.product_name = pM.Product_Name; sqlList.Add(pmMgr.UpdateName(p)); //將去掉前後綴的名稱update到price_master表 pM.Flag = 3;//過期 pM.Event_End = pM.Event_End; pM.Event_Start = pM.Event_Start; } if (_mySqlDao.ExcuteSqls(sqlList)) { peDao.Update(list.Select(p => (ProdNameExtend)p).ToList()); } if (msg == "") { int days = 30;//過期多少天刪除 return peDao.DeleteExtendName(days); } else { return -1; } } catch (Exception ex) { throw new Exception("ProdNameExtendMgr-->ResetExtendName-->" + ex.Message, ex); } }
/// <summary> /// 更新,保存ProdNameExtend表 /// </summary> /// <param name="pn">需要保存的數據</param> /// <returns>保存結果</returns> public bool SaveByList(List<ProdNameExtendCustom> listpn, Caller caller) { try { List<ProdNameExtendCustom> listUpdate = listpn.FindAll(m => m.Flag == 2 || m.Flag == 1);//從中過濾出 Flag==2 (作用中)的 Flag==1 (審核中)商品 listUpdate.ForEach(m => listpn.Remove(m)); //移除掉狀態等於2,4的商品 if (UpdateTime(listUpdate))//作用中的商品,審核中的商品只有時間是可以修改的~所以只用更新時間//edit by wwei0216w { var result = peDao.SaveByList(listpn); AddProductExtentName(caller); return result; } else { return false; } } catch (Exception ex) { throw new Exception("ProdNameExtendMgr-->SaveByList-->" + ex.Message, ex); } }
public HttpResponseBase KutiaoAddorReduce() { string jsonStr = String.Empty; _iinvd = new IinvdMgr(mySqlConnectionString); _iagMgr = new IialgMgr(mySqlConnectionString); Iinvd invd = new Iinvd(); iialg iag = new iialg(); IstockChange Icg = new IstockChange(); ProductItem Proitems = new ProductItem(); int results = 0; try { invd.row_id = Convert.ToInt32(Request.Params["row_id"]);//行號碼 int resultcount = 0; int kucuncount = Convert.ToInt32(Request.Params["benginnumber"]);//庫存數量 int tiaozhengcount = Convert.ToInt32(Request.Params["changenumber"]); int kucuntype = Convert.ToInt32(Request.Params["kutiaotype"]); if (!string.IsNullOrEmpty(Request.Params["item_id"]))//商品細項編號 { Icg.item_id = Convert.ToUInt32(Request.Params["item_id"]); Proitems.Item_Id = Icg.item_id; } int oldsumcount = _iinvd.GetProqtyByItemid(Convert.ToInt32(Icg.item_id));//總庫存 string iarc_id = ""; if (!string.IsNullOrEmpty(Request.Params["iarcid"])) { iarc_id = Request.Params["iarcid"];//庫調原因 } #region 庫存調整的時候,商品庫存也要調整 _proditemMgr = new ProductItemMgr(mySqlConnectionString); int item_stock = 0; #endregion if (kucuntype == 1)//表示選擇了加 { resultcount = kucuncount + tiaozhengcount; item_stock = tiaozhengcount; } else//表示選擇了減號 { resultcount = kucuncount - tiaozhengcount; item_stock = -tiaozhengcount; } Proitems.Item_Stock = item_stock; invd.prod_qty = resultcount;//此時為更改后的庫存 invd.change_dtim = DateTime.Now; invd.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; Icg.sc_trans_type = 2; Icg.sc_num_old = oldsumcount; Icg.sc_time = DateTime.Now; Icg.sc_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; if (!string.IsNullOrEmpty(Request.Params["po_id"])) { Icg.sc_cd_id = Request.Params["po_id"];//採購單編號 } if (!string.IsNullOrEmpty(Request.Params["doc_no"])) { Icg.sc_trans_id = Request.Params["doc_no"];//庫調單號 } if (!string.IsNullOrEmpty(Request.Params["remarks"])) { Icg.sc_note = Request.Params["remarks"];//備註 } _istockMgr = new IstockChangeMgr(mySqlConnectionString); int j = _iinvd.kucunTiaozheng(invd); //更改iloc表中的狀態並且在iialg表中插入數據 string path = "/WareHouse/KutiaoAddorReduce"; Caller call = new Caller(); call = (System.Web.HttpContext.Current.Session["caller"] as Caller); int k = 0; if (iarc_id == "NE" || iarc_id == "RF")//庫存調整-不改動前台庫存 { k = 1; } else { k = _proditemMgr.UpdateItemStock(Proitems, path, call); } int newsumcount = _iinvd.GetProqtyByItemid(Convert.ToInt32(Icg.item_id));//總庫存 Icg.sc_num_chg = newsumcount - oldsumcount; Icg.sc_num_new = newsumcount; Icg.sc_istock_why = 2; if (oldsumcount != newsumcount) { results = _istockMgr.insert(Icg); } else { results = 1; } if (j > 0 && results > 0 && k > 0) { jsonStr = "{success:true}"; } else { jsonStr = "{success:false}"; } } 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); this.Response.End(); return this.Response; }
//RF直接庫調 public HttpResponseBase RFKT() { string json = string.Empty; IialgQuery q = new IialgQuery(); uint id = 0; DateTime dt = new DateTime(); int sun = 0; _proditemMgr = new ProductItemMgr(mySqlConnectionString); ProductItem Proitems = new ProductItem(); try { if (uint.TryParse(Request.Params["item_id"].ToString(), out id)) {//商品id q.item_id = id; Proitems.Item_Id = id; } if (DateTime.TryParse(Request.Params["made_date"].ToString(), out dt)) {//商品製造日期 q.made_dt = dt; } if (int.TryParse(Request.Params["prod_qty"].ToString(), out sun)) {//商品原有數量 q.qty_o = sun; } if (int.TryParse(Request.Params["pnum"].ToString(), out sun)) {//商品撿貨數量 q.pnum = sun; } if (!string.IsNullOrEmpty(Request.Params["loc_id"].ToString())) {//商品撿貨數量 q.loc_id = Request.Params["loc_id"]; } if (!string.IsNullOrEmpty(Request.Params["order_id"])) { q.order_id = Request.Params["order_id"]; } q.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; //進行庫調 _iagMgr = new IialgMgr(mySqlConnectionString); Caller call = new Caller(); call = (System.Web.HttpContext.Current.Session["caller"] as Caller); string path = "/WareHouse/KutiaoAddorReduce"; if (q.loc_id == "YY999999") { json = "{success:false}"; } else { Proitems.Item_Stock = q.pnum - q.qty_o; int result = _iagMgr.addIialgIstock(q); if (result == 2) { json = "{success:true,msg:2}"; } if (result == 100) { _proditemMgr.UpdateItemStock(Proitems, path, call); json = "{success:true,msg:100}"; } } } 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); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
// 更新表Iinvd庫存鎖的狀態 public JsonResult UpdateIinvdActive() { string jsonStr = string.Empty; try { _iinvd = new IinvdMgr(mySqlConnectionString); Iinvd nvd = new Iinvd(); IialgQuery q = new IialgQuery(); _iagMgr = new IialgMgr(mySqlConnectionString); int id = Convert.ToInt32(Request.Params["id"]); string active = Request.Params["active"]; string lock_id = Request.Params["lock_id"]; if (!string.IsNullOrEmpty(Request.Params["po_id"].ToString())) { q.po_id = Request.Params["po_id"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["remarks"].ToString())) { q.remarks = Request.Params["remarks"].ToString(); } if (active == "H") { nvd.ista_id = "A"; nvd.qity_id = 0; } else if (active == "A") { nvd.qity_id = Convert.ToInt32(lock_id); nvd.ista_id = "H"; } nvd.row_id = id; nvd.change_user = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); nvd.change_dtim = DateTime.Now; if (_iinvd.UpdateIinvdLock(nvd, q) > 0) { //加鎖成功往iialg插入一條數據;解鎖不需要記錄 if (active == "A") { Iinvd store = _iinvd.GetIinvd(nvd).FirstOrDefault(); q.loc_id = store.plas_loc_id; q.item_id = store.item_id; q.iarc_id = "KS"; q.qty_o = store.prod_qty; q.type = 1; q.adj_qty = -store.prod_qty; q.create_dtim = DateTime.Now; q.create_user = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); q.made_dt = store.made_date; q.cde_dt = store.cde_dt; if (_iagMgr.insertiialg(q) > 0) { Caller call = new Caller(); call = (System.Web.HttpContext.Current.Session["caller"] as Caller); ProductItem proitem = new ProductItem(); _proditemMgr = new ProductItemMgr(mySqlConnectionString); int item_stock = store.prod_qty; proitem.Item_Stock = -item_stock; proitem.Item_Id = store.item_id; string path = "/WareHouse/KutiaoAddorReduce"; _proditemMgr.UpdateItemStock(proitem, path, call); return Json(new { success = "true" }); } else { return Json(new { success = "false" }); } } else { Iinvd store = _iinvd.GetIinvd(nvd).FirstOrDefault(); q.loc_id = store.plas_loc_id; q.item_id = store.item_id; q.iarc_id = "KS"; q.qty_o = 0; q.type = 1; q.adj_qty = store.prod_qty; q.create_dtim = DateTime.Now; q.create_user = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); q.made_dt = store.made_date; q.cde_dt = store.cde_dt; if (_iagMgr.insertiialg(q) > 0) { Caller call = new Caller(); call = (System.Web.HttpContext.Current.Session["caller"] as Caller); ProductItem proitem = new ProductItem(); _proditemMgr = new ProductItemMgr(mySqlConnectionString); int item_stock = store.prod_qty; proitem.Item_Stock = item_stock; proitem.Item_Id = store.item_id; string path = "/WareHouse/KutiaoAddorReduce"; _proditemMgr.UpdateItemStock(proitem, path, call); return Json(new { success = "true" }); } else { return Json(new { success = "false" }); } } } else { return Json(new { success = "false" }); } } 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); return Json(new { success = "false" }); } }
public HttpResponseBase InsertIinvd() { string jsonStr = String.Empty; Int64 aaa = 0; //無用變數 uint p = 0; //無用變數 try { Iinvd m = new Iinvd(); IialgQuery ia = new IialgQuery(); Iupc iu = new Iupc(); ProductItem proitem = new ProductItem(); Caller call = new Caller(); IstockChangeQuery stock = new IstockChangeQuery(); call = (System.Web.HttpContext.Current.Session["caller"] as Caller); string path = ""; _iinvd = new IinvdMgr(mySqlConnectionString); _iagMgr = new IialgMgr(mySqlConnectionString); _IiupcMgr = new IupcMgr(mySqlConnectionString); #region 獲取數據往 if (Int64.TryParse(Request.Params["item_id"].ToString(), out aaa)) { if (uint.TryParse(Request.Params["item_id"].ToString(), out p)) { m.item_id = uint.Parse(Request.Params["item_id"].ToString()); } if (Request.Params["item_id"].ToString().Length > 6) { m.item_id = uint.Parse(_iinvd.Getprodubybar(Request.Params["item_id"].ToString()).Rows[0]["item_id"].ToString()); } } else { if (Request.Params["item_id"].ToString().Length > 6) { m.item_id = uint.Parse(_iinvd.Getprodubybar(Request.Params["item_id"].ToString()).Rows[0]["item_id"].ToString()); } } m.dc_id = 1; m.whse_id = 1; m.prod_qty = Int32.Parse(Request.Params["prod_qty"].ToString());//數量 DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); DateTime dtime; if (DateTime.TryParse(Request.Params["startTime"].ToString(), out dtime)) {//用戶填寫創建時間算出有效日期 DateTime start = DateTime.Parse(Request.Params["startTime"].ToString()); m.made_date = start; if (uint.TryParse(Request.Params["cde_dt_incr"].ToString(), out p)) { m.cde_dt = start.AddDays(Int32.Parse(Request.Params["cde_dt_incr"].ToString())); } else { m.cde_dt = DateTime.Now; } } else { if (DateTime.TryParse(Request.Params["cde_dt"].ToString(), out dtime)) {//用戶填寫有效日期算出製造日期 m.cde_dt = DateTime.Parse(Request.Params["cde_dt"].ToString());//有效時間 if (uint.TryParse(Request.Params["cde_dt_incr"].ToString(), out p)) { m.made_date = m.cde_dt.AddDays(-Int32.Parse(Request.Params["cde_dt_incr"].ToString())); } else { m.made_date = today; } } else { m.cde_dt = today; m.made_date = today; } } m.cde_dt = DateTime.Parse(m.cde_dt.ToShortDateString()); m.made_date = DateTime.Parse(m.made_date.ToShortDateString()); m.plas_loc_id = Request.Params["plas_loc_id"].ToString().ToUpper();//上架料位 string loc_id = Request.Params["loc_id"].ToString().ToUpper(); m.change_dtim = DateTime.Now;//編輯時間 m.receipt_dtim = DateTime.Now;//收貨時間 m.create_user = (Session["caller"] as Caller).user_id; #endregion #region 獲取數據添加打iialg ia.loc_id = m.plas_loc_id.ToString().ToUpper(); ia.item_id = m.item_id; stock.sc_trans_type = 0; if (!string.IsNullOrEmpty(Request.Params["iarc_id"].ToString())) { ia.iarc_id = Request.Params["iarc_id"].ToString(); } else { ia.iarc_id = "PC"; stock.sc_trans_type = 1;//收貨上架 } //if (ia.iarc_id == "DR" || ia.iarc_id == "KR") //{ // type = 2;//RF理貨 //} ia.create_dtim = DateTime.Now; ia.create_user = m.create_user; ia.doc_no = "P" + DateTime.Now.ToString("yyyyMMddHHmmss"); if (!string.IsNullOrEmpty(Request.Params["doc_num"])) { ia.doc_no = Request.Params["doc_num"]; stock.sc_trans_id = ia.doc_no;//交易單號 } if (!string.IsNullOrEmpty(Request.Params["Po_num"])) { ia.po_id = Request.Params["Po_num"]; stock.sc_cd_id = ia.po_id;//前置單號 } if (!string.IsNullOrEmpty(Request.Params["remark"])) { ia.remarks = Request.Params["remark"]; stock.sc_note = ia.remarks;//備註 } ia.made_dt = m.made_date; ia.cde_dt = m.cde_dt; #endregion #region 獲取店內條碼-=添加條碼 if (!string.IsNullOrEmpty(Request.Params["vendor_id"].ToString())) { iu.upc_id = CommonFunction.GetUpc(m.item_id.ToString(), Request.Params["vendor_id"].ToString(), m.cde_dt.ToString("yyMMdd")); } iu.item_id = m.item_id; iu.upc_type_flg = "2";//店內碼 iu.create_user = m.create_user; string result = _IiupcMgr.IsExist(iu);//是否有重複的條碼 if (result == "0") { if (_IiupcMgr.Insert(iu) < 1) { jsonStr = "{success:true,msg:2}"; } } #endregion #region 新增/編輯 #region 庫存調整的時候,商品庫存也要調整 _proditemMgr = new ProductItemMgr(mySqlConnectionString); int item_stock = m.prod_qty; proitem.Item_Stock = item_stock; proitem.Item_Id = m.item_id; #endregion if (_iinvd.IsUpd(m, stock) > 0) {//編輯 ia.qty_o = _iinvd.Selnum(m); ia.adj_qty = m.prod_qty; m.prod_qty = ia.qty_o + m.prod_qty; if (m.prod_qty >= 0) { if (_iinvd.Upd(m) > 0) { if (Request.Params["iialg"].ToString() == "Y") {// if (ia.iarc_id != "PC" && ia.iarc_id != "NE")//------------庫存調整的時候商品庫存也更改,收貨上架的時候不更改,RF理貨的時候也是不更改 { path = "/WareHouse/KutiaoAddorReduce"; _proditemMgr.UpdateItemStock(proitem, path, call); } if (_iagMgr.insertiialg(ia) > 0) { jsonStr = "{success:true,msg:0}";//更新成功 } else { jsonStr = "{success:false,msg:1}";//更新失敗 } } else { jsonStr = "{success:true,msg:0}";//更新成功 } } else { jsonStr = "{success:false,msg:1}";//更新失敗 } } else { jsonStr = "{success:false,msg:1}";//庫存為負數 } } else {//新增 m.ista_id = "A"; m.create_dtim = DateTime.Now; //創建時間 if (_iinvd.Insert(m) > 0) { _IlocMgr = new IlocMgr(mySqlConnectionString); Iloc loc = new BLL.gigade.Model.Iloc(); loc.change_user = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); loc.change_dtim = DateTime.Now; loc.loc_id = m.plas_loc_id.ToString().ToUpper(); if (loc_id.Trim() != m.plas_loc_id.Trim())//判斷如果是主料位不需要進行多餘的操作 { if (_IlocMgr.SetIlocUsed(loc) > 0) { if (Request.Params["iialg"].ToString() == "Y") { if (ia.iarc_id != "PC" && ia.iarc_id != "NE")//------------庫存調整的時候商品庫存也更改,收貨上架的時候不更改,RF理貨的時候也是不更改 { path = "/WareHouse/KutiaoAddorReduce"; _proditemMgr.UpdateItemStock(proitem, path, call); } ia.qty_o = 0; ia.adj_qty = m.prod_qty; if (_iagMgr.insertiialg(ia) > 0) { jsonStr = "{success:true,msg:0}";//更新成功 } else { jsonStr = "{success:false,msg:1}";//更新失敗 } } else { jsonStr = "{success:true,msg:0}";//新增成功 } } else { jsonStr = "{success:false,msg:1}";//新增失敗 } } else { if (Request.Params["iialg"].ToString() == "Y") { if (ia.iarc_id != "PC" && ia.iarc_id != "NE")//------------庫存調整的時候商品庫存也更改,收貨上架的時候不更改,RF理貨的時候也是不更改 { path = "/WareHouse/KutiaoAddorReduce"; _proditemMgr.UpdateItemStock(proitem, path, call); } ia.qty_o = 0; ia.adj_qty = m.prod_qty; if (_iagMgr.insertiialg(ia) > 0) { jsonStr = "{success:true,msg:0}";//更新成功 } else { jsonStr = "{success:false,msg:1}";//更新失敗 } } else { jsonStr = "{success:true,msg:0}";//新增成功 } } } else { jsonStr = "{success:false,msg:1}"; } } #endregion } 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 HttpResponseBase SavePhone() { string jsonStr = string.Empty; UserQuery user = new UserQuery(); HashEncrypt hmd5 = new HashEncrypt(); try { if (!string.IsNullOrEmpty(Request.Params["name"])) { user.user_name = Request.Params["name"].ToString(); } else { user.user_name = ""; } if (!string.IsNullOrEmpty(Request.Params["tel"])) { if (!CommonFunction.isMobile(Request.Params["tel"].ToString())) { jsonStr = "{success:false,msg:0}"; this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; } else { //user.user_mobile = EncryptComputer.EncryptDecryptTextByApi(Request.Params["tel"].ToString()); user.user_mobile = Request.Params["tel"].ToString(); } //if (user.user_mobile.Length < 10 || user.user_mobile.Substring(0, 2).ToString() != "09") //{ // for (int i = user.user_mobile.Length; i < 10; i++) // { // user.user_mobile = "0" + user.user_mobile; // } //} } else { user.user_mobile = ""; } user.user_email = Request.Params["tel"] + "@user.gigade.com.tw"; #region 獲取生日的年月日 try { DateTime birth = Convert.ToDateTime(Request.Params["birth"].ToString()); user.user_birthday_year = Convert.ToUInt32(birth.Year); user.user_birthday_month = Convert.ToUInt32(birth.Month); user.user_birthday_day = Convert.ToUInt32(birth.Day); } catch (Exception) { user.user_birthday_year = 1970; user.user_birthday_month = 0; user.user_birthday_day = 0; } #endregion #region 密碼 user.user_password = "******" + user.user_birthday_year; if (user.user_birthday_month.ToString().Length == 1) { user.user_password += "0" + user.user_birthday_month; } else { user.user_password += user.user_birthday_month; } if (user.user_birthday_day.ToString().Length == 1) { user.user_password += "0" + user.user_birthday_day; } else { user.user_password += user.user_birthday_day; } user.user_password = hmd5.SHA256Encrypt(user.user_password); #endregion if (!string.IsNullOrEmpty(Request.Params["zip"])) { user.user_zip = Convert.ToUInt32(Request.Params["zip"].ToString()); } else { user.user_zip = 0; } if (!string.IsNullOrEmpty(Request.Params["address"])) { user.user_address = Request.Params["address"].ToString(); } else { user.user_address = ""; } if (!string.IsNullOrEmpty(Request.Params["IsAcceptAd"])) { if (Request.Params["IsAcceptAd"].ToString() == "on") { user.send_sms_ad = true; } } else { user.send_sms_ad = false; } if (!string.IsNullOrEmpty(Request.Params["Remark"])) { user.adm_note = Request.Params["Remark"].ToString(); } else { user.adm_note = ""; } user.ip = Request.UserHostAddress; user.file_name = "UserPhone.chtml"; user.created = DateTime.Now; user.kuser_id = Convert.ToUInt32((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); mgr = new CallerMgr(mySqlConnectionString); Caller caller = new Caller(); caller = mgr.GetUserById(Convert.ToInt32(user.kuser_id)); user.kuser_name = caller.user_username; user.content = "user_email:" + user.user_email + ",user_mobile:" + user.user_mobile + ",user_birthday_year" + user.user_birthday_year + ",user_birthday_month" + user.user_birthday_month + ",user_birthday_day" + user.user_birthday_day + ",user_zip" + user.user_zip + ",user_address" + user.user_address + ",send_sms_ad" + user.send_sms_ad + ",adm_note" + user.adm_note; user.user_status = 1; user.user_source = "電話會員"; user.user_login_attempts = 0; user.user_reg_date = Convert.ToUInt32(CommonFunction.GetPHPTime(DateTime.Now.ToString())); user.user_updatedate = Convert.ToUInt32(CommonFunction.GetPHPTime(DateTime.Now.ToString())); user.user_type = 2; _usmpgr = new UsersMgr(mySqlConnectionString);//實現方法 if (_usmpgr.QueryByUserMobile(user.user_mobile).Rows.Count == 0) { _usmpgr = new UsersMgr(mySqlConnectionString); if (_usmpgr.SaveUserPhone(user) > 0) { jsonStr = "{success:true,msg:1}"; } else { jsonStr = "{success:false,msg:2 }"; } } else { jsonStr = "{success:false,msg:3 }"; } } 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:0}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }
/// <summary> /// 修改商品站台價格表(price_master)信息時,申請審核以及保存價格審核記錄 /// </summary> /// <param name="priceMasters">price_master列表</param> /// <param name="caller"></param> /// <returns>返品錯誤信息</returns> public bool UpdatePriceMasters(List<Model.PriceMaster> priceMasters, Caller caller, out string msg) { msg = string.Empty; bool result = false; try { string batchNo = CommonFunction.GetPHPTime().ToString() + "_" + caller.user_id + "_"; PriceMasterTsMgr _priceMasterTsMgr = new PriceMasterTsMgr(connectionString); HistoryBatch batch = new HistoryBatch(); batch.kuser = caller.user_email; //價格修改 申請審核 PriceUpdateApply priceUpdateApply = new PriceUpdateApply(); priceUpdateApply.apply_user = (uint)caller.user_id; //價格審核記錄 PriceUpdateApplyHistory applyHistroy = new PriceUpdateApplyHistory(); applyHistroy.user_id = (int)priceUpdateApply.apply_user; //applyHistroy.price_status = 1; //applyHistroy.type = 3; applyHistroy.price_status = 1; //edit by wwei0216w 2014/12/16 價格修改時 price_status為 2申請審核 applyHistroy.type = 1;//edit by wwei0216w 所作操作為 1:申請審核的操作 PriceUpdateApplyMgr _priceUpdateApplyMgr = new PriceUpdateApplyMgr(connectionString); PriceUpdateApplyHistoryMgr _priceUpdateApplyHistoryMgr = new PriceUpdateApplyHistoryMgr(connectionString); TableHistoryMgr _tableHistoryMgr = new TableHistoryMgr(connectionString); foreach (var pM in priceMasters) { ArrayList excuteSql = new ArrayList(); priceUpdateApply.price_master_id = pM.price_master_id; int apply_id = _priceUpdateApplyMgr.Save(priceUpdateApply); if (apply_id != -1) { pM.apply_id = (uint)apply_id; pM.price_status = 2;//申請審核 applyHistroy.apply_id = apply_id; batch.batchno = batchNo + pM.product_id;//批號 excuteSql.Add(_priceMasterTsMgr.UpdateTs(pM));//將修改數據保存至price_master_ts表 excuteSql.Add(_priceUpdateApplyHistoryMgr.SaveSql(applyHistroy));//保存審核記錄 if (!_tableHistoryMgr.SaveHistory<PriceMaster>(pM, batch, excuteSql)) msg += pM.product_id.ToString() + ";"; else { result = true; } } } } catch (Exception e) { msg += e.Message; } return result; }
/// <summary> /// 用來刪除商品前後綴的請求 add by wwei 0216w 2014/12/12 /// </summary> /// <returns></returns> public int OperateExtendName(uint product_id = 0) { string startRunInfo = ""; string endRunInfo = ""; try { startRunInfo = DateTime.Now.ToString() + ": OperateExtendName Start"; //記錄服務執行的開始時間 DateTime dt_Start = DateTime.Now; Caller caller = new Caller(); IProdNameExtendImplMgr _prodnameExtendMgr = new ProdNameExtendMgr(connectionString); //加上商品前後綴 _prodnameExtendMgr.AddProductExtentName(caller); //去掉商品前後綴 _prodnameExtendMgr.ResetExtendName(caller, product_id); //記錄服務執行的結束時間 DateTime dt_End = DateTime.Now; Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("OperateExtendNameStart:{0};OperateExtendNameEnd:{1}", dt_Start.ToString(), dt_End.ToString()); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Info(logMessage); endRunInfo = DateTime.Now.ToString() + ": OperateExtendName End"; WriterInfo("OperateExtendName", startRunInfo, endRunInfo); return 1; } 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); endRunInfo = DateTime.Now.ToString() + ": OperateExtendName Exceptional:" + ex.Message; WriterInfo("OperateExtendName", startRunInfo, endRunInfo); return -1; } }