public string ModifyCustomer(BMSFHRModel customer, string OldBM) { string str = this.CheckCustomer(customer); if (str != "0") { return(str); } if (customer.WJ == 1) { string str2 = this.jyCustomer.CheckTaxCode(customer.SH, (FPLX)11); if (str2 != "0000") { MessageManager.ShowMsgBox(str2, new string[] { "税号" }); return(str2); } } if ((customer.BM != OldBM) && this.bmsfhrDAL.ExistCustomer(customer)) { MessageManager.ShowMsgBox("INP-235108"); return("编码已存在"); } if (this.bmsfhrDAL.ExistCusMC(OldBM, customer.MC, customer.SJBM)) { MessageManager.ShowMsgBox("INP-235132"); return("收/发货人已存在"); } return(this.bmsfhrDAL.ModifyCustomer(customer, OldBM)); }
public string AddCustomerKP(BMSFHRModel customer, int Addtype) { string str = this.CheckCustomer(customer); if (str == "0") { if (customer.WJ == 1) { string str2 = this.jyCustomer.CheckTaxCode(customer.SH, (FPLX)11); if (str2 != "0000") { MessageManager.ShowMsgBox(str2, new string[] { "税号" }); return(str2); } } if (this.bmsfhrDAL.ExistCusMC(customer.BM, customer.MC, customer.SJBM)) { MessageManager.ShowMsgBox("INP-235132"); return("收/发货人已存在"); } if (this.bmsfhrDAL.ExistCustomer(customer)) { MessageManager.ShowMsgBox("INP-235108"); return("编码已存在"); } str = this.bmsfhrDAL.AddCustomer(customer); if ((Addtype == 1) && (str == "0")) { MessageManager.ShowMsgBox("INP-235201"); } } return(str); }
public bool ExistCustomer(BMSFHRModel customer) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("bm", customer.BM); return(this.baseDAO.queryValueSQL <int>("aisino.Fwkp.Bmgl.BMSFHR.SFHRExist", dictionary) > 0); }
public string ModifyCustomer(BMSFHRModel customer, string OldBM) { try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("oldBM", OldBM); dictionary.Add("BM", customer.BM); dictionary.Add("MC", customer.MC); dictionary.Add("JM", customer.JM); dictionary.Add("SJBM", customer.SJBM); dictionary.Add("SH", customer.SH); dictionary.Add("DZDH", customer.DZDH); dictionary.Add("YHZH", customer.YHZH); dictionary.Add("YZBM", customer.YZBM); dictionary.Add("KJM", customer.KJM); dictionary.Add("WJ", customer.WJ); if (this.baseDAO.未确认DAO方法2_疑似updateSQL("aisino.Fwkp.Bmgl.BMSFHR.SFHRModify", dictionary) > 0) { return("0"); } return("e31"); } catch (Exception exception) { if (!exception.Message.Contains("UNIQUE constraint failed")) { throw; } return("e1"); } }
private void LoadData(string BM) { this.sfhrModel = (BMSFHRModel)this.sfhrManager.GetModel(BM); this.textBoxBM.Text = this.sfhrModel.BM; this.textBoxWaitMC.Text = this.sfhrModel.MC; this.textBoxSJBM.Text = this.sfhrModel.SJBM; this.textBoxJM.Text = this.sfhrModel.JM; }
public string UpdateSubNodesSJBM(BMSFHRModel customer, string YuanBM) { string str = this.CheckCustomer(customer); if (str != "0") { return(str); } return(this.bmsfhrDAL.UpdateSubNodesSJBM(customer, YuanBM)); }
public string UpdateSubNodesSJBM(BMSFHRModel customer, string YuanBM) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("bm", YuanBM); dictionary.Add("bmLike", YuanBM + "%"); DataTable table = this.baseDAO.querySQLDataTable("aisino.Fwkp.Bmgl.BMSFHR.SFHRBMGetSubNode", dictionary); List <string> list = new List <string>(); List <Dictionary <string, object> > list2 = new List <Dictionary <string, object> >(); try { Dictionary <string, object> item = new Dictionary <string, object>(); item.Add("bm", YuanBM); item.Add("afterbm", customer.BM); item.Add("MC", customer.MC); item.Add("JM", customer.JM); item.Add("SH", customer.SH); item.Add("SJBM", customer.SJBM); item.Add("DZDH", customer.DZDH); item.Add("YHZH", customer.YHZH); item.Add("YZBM", customer.YZBM); list.Add("aisino.Fwkp.Bmgl.BMSFHR.SFHRBMModify"); list2.Add(item); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { string str = table.Rows[i]["BM"].ToString(); string str2 = table.Rows[i]["SJBM"].ToString(); string str3 = customer.BM + str.Substring(YuanBM.Length); string str4 = customer.BM + str2.Substring(YuanBM.Length); Dictionary <string, object> dictionary3 = new Dictionary <string, object>(); dictionary3.Add("bm", str); dictionary3.Add("newBM", str3); dictionary3.Add("newSJBM", str4); list.Add("aisino.Fwkp.Bmgl.BMSFHR.SFHRBMUpdateSJBMandBM"); list2.Add(dictionary3); } } if (this.baseDAO.未确认DAO方法1(list.ToArray(), list2) > 0) { return("0"); } return("errorModify"); } catch (Exception exception) { if (!exception.Message.Contains("UNIQUE constraint failed")) { throw; } return("e1"); } }
public BMSFHRFenLei(string SJBM, BMSFHR Father) { this.sfhrManager = new BLL.BMSFHRManager(); this.sfhrModel = new BMSFHRModel(); this.bm = ""; this.yuanBM = ""; this._sjbm = ""; this.SuggestBM = ""; this.Initialize(); this._sjbm = SJBM; this.father = Father; this.Text = "收/发货人分类编码添加"; }
public BMSFHR_Edit(string SJBM, BMSFHR Father) { this.sfhrManager = new BMSFHRManager(); this.sfhrModel = new BMSFHRModel(); this.log = LogUtil.GetLogger <BMSFHR_Edit>(); this.invoiceHandler = new InvoiceHandler(); this._bm = ""; this._sjbm = ""; this.SuggestBM = ""; this.Initialize(); this._sjbm = SJBM; this.father = Father; this.Text = "收/发货人编码添加"; }
public BMSFHRFenLei(string BM, bool Isupdate) { this.sfhrManager = new BLL.BMSFHRManager(); this.sfhrModel = new BMSFHRModel(); this.bm = ""; this.yuanBM = ""; this._sjbm = ""; this.SuggestBM = ""; this.Initialize(); this.bm = BM; this.yuanBM = BM; this.isUpdate = Isupdate; this.Text = "收/发货人分类编码编辑"; }
public BMSFHR_Edit(string BM, bool Isupdate) { this.sfhrManager = new BMSFHRManager(); this.sfhrModel = new BMSFHRModel(); this.log = LogUtil.GetLogger <BMSFHR_Edit>(); this.invoiceHandler = new InvoiceHandler(); this._bm = ""; this._sjbm = ""; this.SuggestBM = ""; this.Initialize(); this._bm = BM; this.yuanBM = BM; this.isUpdate = Isupdate; this.Text = "收/发货人编码编辑"; }
public string CheckCustomer(BMSFHRModel customer) { if (customer == null) { return("e11"); } if ((customer.BM == null) || (customer.BM.Length == 0)) { return("e12"); } if ((customer.MC != null) && (customer.MC.Length != 0)) { return("0"); } return("e13"); }
public string AddCustomer(BMSFHRModel customer) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("BM", customer.BM); dictionary.Add("MC", customer.MC); dictionary.Add("JM", customer.JM); dictionary.Add("SH", customer.SH); dictionary.Add("DZDH", customer.DZDH); dictionary.Add("YHZH", customer.YHZH); dictionary.Add("YZBM", customer.YZBM); dictionary.Add("SJBM", customer.SJBM); dictionary.Add("KJM", customer.KJM); dictionary.Add("WJ", customer.WJ); if (this.baseDAO.未确认DAO方法2_疑似updateSQL("aisino.Fwkp.Bmgl.BMSFHR.SFHRAdd", dictionary) > 0) { return("0"); } return("e02"); }
public BMBaseModel GetModel(string BM) { DataTable kH = this.bmsfhrDAL.GetKH(BM); BMSFHRModel model = new BMSFHRModel(); if (kH.Rows.Count > 0) { DataRow row = kH.Rows[0]; model.BM = GetSafeData.ValidateValue <string>(row, "BM"); model.MC = GetSafeData.ValidateValue <string>(row, "MC"); model.JM = GetSafeData.ValidateValue <string>(row, "JM"); model.SJBM = GetSafeData.ValidateValue <string>(row, "SJBM"); model.SH = GetSafeData.ValidateValue <string>(row, "SH"); model.DZDH = GetSafeData.ValidateValue <string>(row, "DZDH"); model.YHZH = GetSafeData.ValidateValue <string>(row, "YHZH"); model.YZBM = GetSafeData.ValidateValue <string>(row, "YZBM"); model.WJ = GetSafeData.ValidateValue <int>(row, "WJ"); } return(model); }
public ImportResult ImportData(string codeFile) { ImportResult result2; try { string[] strArray = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (strArray.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (strArray[index].StartsWith("{收/发货人编码}") || strArray[index].StartsWith("{发货人编码}")) { string str2 = strArray[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行收/发货人编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == strArray.Length) { throw new CustomException("此文件不符合收/发货人编码文本格式"); } } } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); string str4 = this.TuiJianBM(""); string str5 = ""; bool flag2 = false; for (int i = index; i < strArray.Length; i++) { BMSFHRModel model; string lineText = strArray[i].Trim(); if (((lineText.Length == 0) || lineText.StartsWith("//")) || !lineText.Contains(str)) { continue; } string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } model = new BMSFHRModel { BM = strArray2[0], MC = strArray2[1], JM = strArray2[2], }; model.KJM = CommonFunc.GenerateKJM(model.MC); string str7 = ""; string str8 = ""; ResultType none = ResultType.None; if (strArray2.Length > 3) { if (strArray2.Length < 7) { continue; } model.SH = strArray2[3].ToUpper(); model.WJ = 1; string str9 = ""; if (str == "~~") { str9 = strArray2[4].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str9 = strArray2[4].Replace("#|#", "\r\n"); } else { str9 = strArray2[4]; } model.DZDH = str9; string str10 = ""; if (str == "~~") { str10 = strArray2[5].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str10 = strArray2[5].Replace("#|#", "\r\n"); } else { str10 = strArray2[5]; } model.YHZH = str10; string str11 = ""; if (str == "~~") { str11 = strArray2[6].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str11 = strArray2[6].Replace("#|#", "\r\n"); } else { str11 = strArray2[6]; } model.YZBM = str11; } while (stack.Count > 0) { flag2 = false; if (model.BM.Length > stack.Peek().BM.Length) { if (!model.BM.StartsWith(stack.Peek().BM)) { goto Label_0430; } model.SJBM = stack.Peek().BM; if (stack.Peek().Result == ResultType.Invalid) { str7 = "无效"; str8 = "上级编码无效"; none = ResultType.Invalid; result.Invalid++; } else if (stack.Peek().Result == ResultType.Failed) { str7 = "失败"; str8 = "上级编码失败"; none = ResultType.Failed; result.Failed++; } else { if (stack.Peek().Result != ResultType.Duplicated) { goto Label_0430; } str5 = this.TuiJianBM(stack.Peek().BM); if (model.BM.Length == str5.Length) { goto Label_0430; } str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } goto Label_06A9; } stack.Pop(); } flag2 = true; Label_0430: if ((flag2 && (str4 != "001")) && (model.BM.Length != str4.Length)) { str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } else if ("0" != this.CheckCustomer(model)) { str7 = "无效"; str8 = "编码或名称为空"; result.Invalid++; none = ResultType.Invalid; } else if (!Regex.IsMatch(model.BM, "^[0-9a-z]{1,16}$")) { str7 = "无效"; str8 = "编码需小于16位,且仅由数字和小写字母组成"; result.Invalid++; none = ResultType.Invalid; } else if (this.bmsfhrDAL.ExistCustomer(model)) { if (str7.Length == 0) { str7 = "重复"; result.Duplicated++; } if (str8.Length == 0) { str8 = "编码重复"; none = ResultType.Duplicated; } else { str8 = str8 + "且编码重复"; none = ResultType.Invalid; } } else if ((model.SH != null) && (((model.SH.Length < 6) || (model.SH.Length > 20)) || (((model.WJ == 1) && (model.SH.Length != 0)) && ("0000" != this.jyCustomer.CheckTaxCode(model.SH, (FPLX)11))))) { str7 = "失败"; str8 = "收发货人税号错误" + model.SH; result.Failed++; none = ResultType.Failed; } else if (this.bmsfhrDAL.ExistCusMC(model.BM, model.MC, model.SJBM)) { str7 = "失败"; str8 = "同级同族已存在相同名称的收/发货人" + model.SH; result.Failed++; none = ResultType.Failed; } else { string[] spellCode = StringUtils.GetSpellCode(model.MC); for (int j = 0; j < spellCode.Length; j++) { string text1 = spellCode[j]; } if (this.bmsfhrDAL.AddCustomer(model) == "0") { str7 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str7 = "失败"; result.Failed++; none = ResultType.Failed; } } Label_06A9 :; result.DtResult.Rows.Add(new object[] { model.BM, model.MC, str7, str8 }); stack.Push(new lastBMJG(model.BM, none)); } result.ImportTable = "收/发货人编码.DB"; result2 = result; } catch { throw; } return(result2); }
public string AddCustomer(BMSFHRModel customer) { return(this.AddCustomerKP(customer, 0)); }
private void ReNode(string tableName, string SJBM) { try { int num; DataRow row2; DataRow row3; DataRow row4; DataRow row5; DataRow row6; DataRow row7; DataRow row8; DataRow[] rowArray = this.baseDAO.querySQLDataTable("SELECT * FROM " + tableName).Select("SJBM = '" + SJBM + "'"); bool flag = false; foreach (DataRow row in rowArray) { if (GetSafeData.ValidateValue <string>(row, "BM").Length > 0x10) { flag = true; break; } } if (!flag) { goto Label_0CE4; } switch (tableName) { case "BM_KH": num = 0; num = 0; goto Label_0322; case "BM_SP": num = 0; num = 0; goto Label_056E; case "BM_SFHR": num = 0; num = 0; goto Label_06FC; case "BM_FYXM": num = 0; num = 0; goto Label_083E; case "BM_GHDW": num = 0; num = 0; goto Label_09CC; case "BM_CL": num = 0; num = 0; goto Label_0B47; case "BM_XHDW": num = 0; num = 0; goto Label_0CD5; default: return; } Label_0129: row2 = rowArray[num]; BMKHModel customer = new BMKHModel(); BMKHManager manager = new BMKHManager(); string yuanBM = GetSafeData.ValidateValue <string>(row2, "BM"); int num4 = num + 1; int length = rowArray.Length; customer.BM = SJBM + num4.ToString().PadLeft(length.ToString().Length + 1, '0'); customer.MC = GetSafeData.ValidateValue <string>(row2, "MC"); customer.JM = GetSafeData.ValidateValue <string>(row2, "JM"); customer.KJM = GetSafeData.ValidateValue <string>(row2, "KJM"); customer.SH = GetSafeData.ValidateValue <string>(row2, "SH"); customer.DZDH = GetSafeData.ValidateValue <string>(row2, "DZDH"); customer.YHZH = GetSafeData.ValidateValue <string>(row2, "YHZH"); customer.YJDZ = GetSafeData.ValidateValue <string>(row2, "YJDZ"); customer.BZ = GetSafeData.ValidateValue <string>(row2, "BZ"); customer.YSKM = GetSafeData.ValidateValue <string>(row2, "YSKM"); customer.DQBM = GetSafeData.ValidateValue <string>(row2, "DQBM"); customer.DQMC = GetSafeData.ValidateValue <string>(row2, "DQMC"); customer.DQKM = GetSafeData.ValidateValue <string>(row2, "DQKM"); customer.SJBM = GetSafeData.ValidateValue <string>(row2, "SJBM"); customer.SFZJY = GetSafeData.ValidateValue <bool>(row2, "SFZJY"); customer.WJ = GetSafeData.ValidateValue <int>(row2, "WJ"); string str3 = manager.UpdateSubNodesSJBM(customer, yuanBM); while ("e1" == str3) { num++; int num6 = num + 1; int num7 = rowArray.Length; customer.BM = SJBM + num6.ToString().PadLeft(num7.ToString().Length + 1, '0'); str3 = manager.UpdateSubNodesSJBM(customer, yuanBM); } if ("0" == str3) { this.ReNode(tableName, customer.BM); } num++; Label_0322: if (num < rowArray.Length) { goto Label_0129; } return; Label_033C: row3 = rowArray[num]; BMSPModel merchandise = new BMSPModel(); BMSPManager manager2 = new BMSPManager(); string str4 = GetSafeData.ValidateValue <string>(row3, "BM"); int num8 = num + 1; int num9 = rowArray.Length; merchandise.BM = SJBM + num8.ToString().PadLeft(num9.ToString().Length + 1, '0'); merchandise.MC = GetSafeData.ValidateValue <string>(row3, "MC"); merchandise.JM = GetSafeData.ValidateValue <string>(row3, "JM"); merchandise.KJM = GetSafeData.ValidateValue <string>(row3, "KJM"); merchandise.SJBM = GetSafeData.ValidateValue <string>(row3, "SJBM"); merchandise.SLV = GetSafeData.ValidateValue <double>(row3, "SLV"); merchandise.SPSM = GetSafeData.ValidateValue <string>(row3, "SPSM"); merchandise.GGXH = GetSafeData.ValidateValue <string>(row3, "GGXH"); merchandise.JLDW = GetSafeData.ValidateValue <string>(row3, "JLDW"); merchandise.DJ = GetSafeData.ValidateValue <double>(row3, "DJ"); merchandise.HSJBZ = GetSafeData.ValidateValue <bool>(row3, "HSJBZ"); merchandise.XSSRKM = GetSafeData.ValidateValue <string>(row3, "XSSRKM"); merchandise.YJZZSKM = GetSafeData.ValidateValue <string>(row3, "YJZZSKM"); merchandise.XSTHKM = GetSafeData.ValidateValue <string>(row3, "XSTHKM"); merchandise.HYSY = GetSafeData.ValidateValue <bool>(row3, "HYSY"); merchandise.XTHASH = GetSafeData.ValidateValue <string>(row3, "XTHASH"); merchandise.XTCODE = GetSafeData.ValidateValue <string>(row3, "XTCODE"); merchandise.ISHIDE = GetSafeData.ValidateValue <string>(row3, "ISHIDE"); merchandise.WJ = GetSafeData.ValidateValue <int>(row3, "WJ"); string str5 = manager2.UpdateSubNodesSJBM(merchandise, str4); while ("e1" == str5) { num++; int num10 = num + 1; int num11 = rowArray.Length; merchandise.BM = SJBM + num10.ToString().PadLeft(num11.ToString().Length + 1, '0'); str5 = manager2.UpdateSubNodesSJBM(merchandise, str4); } if ("0" == str5) { this.ReNode(tableName, merchandise.BM); } num++; Label_056E: if (num < rowArray.Length) { goto Label_033C; } return; Label_0588: row4 = rowArray[num]; BMSFHRModel model3 = new BMSFHRModel(); BMSFHRManager manager3 = new BMSFHRManager(); string str6 = GetSafeData.ValidateValue <string>(row4, "BM"); int num12 = num + 1; int num13 = rowArray.Length; model3.BM = SJBM + num12.ToString().PadLeft(num13.ToString().Length + 1, '0'); model3.MC = GetSafeData.ValidateValue <string>(row4, "MC"); model3.JM = GetSafeData.ValidateValue <string>(row4, "JM"); model3.SJBM = GetSafeData.ValidateValue <string>(row4, "SJBM"); model3.SH = GetSafeData.ValidateValue <string>(row4, "SH"); model3.DZDH = GetSafeData.ValidateValue <string>(row4, "DZDH"); model3.YHZH = GetSafeData.ValidateValue <string>(row4, "YHZH"); model3.YZBM = GetSafeData.ValidateValue <string>(row4, "YZBM"); model3.WJ = GetSafeData.ValidateValue <int>(row4, "WJ"); string str7 = manager3.UpdateSubNodesSJBM(model3, str6); while ("e1" == str7) { num++; int num14 = num + 1; int num15 = rowArray.Length; model3.BM = SJBM + num14.ToString().PadLeft(num15.ToString().Length + 1, '0'); str7 = manager3.UpdateSubNodesSJBM(model3, str6); } if ("0" == str7) { this.ReNode(tableName, model3.BM); } num++; Label_06FC: if (num < rowArray.Length) { goto Label_0588; } return; Label_0716: row5 = rowArray[num]; BMFYXMModel feiyong = new BMFYXMModel(); BMFYXMManager manager4 = new BMFYXMManager(); string str8 = GetSafeData.ValidateValue <string>(row5, "BM"); int num16 = num + 1; int num3 = rowArray.Length; feiyong.BM = SJBM + num16.ToString().PadLeft(num3.ToString().Length + 1, '0'); feiyong.MC = GetSafeData.ValidateValue <string>(row5, "MC"); feiyong.JM = GetSafeData.ValidateValue <string>(row5, "JM"); feiyong.SJBM = GetSafeData.ValidateValue <string>(row5, "SJBM"); feiyong.WJ = GetSafeData.ValidateValue <int>(row5, "WJ"); string str9 = manager4.UpdateSubNodesSJBM(feiyong, str8); while ("e1" == str9) { num++; num3 = num + 1; num3 = rowArray.Length; string introduced65 = num3.ToString(); feiyong.BM = SJBM + introduced65.PadLeft(num3.ToString().Length + 1, '0'); str9 = manager4.UpdateSubNodesSJBM(feiyong, str8); } if ("0" == str9) { this.ReNode(tableName, feiyong.BM); } num++; Label_083E: if (num < rowArray.Length) { goto Label_0716; } return; Label_0858: row6 = rowArray[num]; BMGHDWModel purchase = new BMGHDWModel(); BMGHDWManager manager5 = new BMGHDWManager(); string str10 = GetSafeData.ValidateValue <string>(row6, "BM"); num3 = num + 1; num3 = rowArray.Length; string introduced66 = num3.ToString(); purchase.BM = SJBM + introduced66.PadLeft(num3.ToString().Length + 1, '0'); purchase.MC = GetSafeData.ValidateValue <string>(row6, "MC"); purchase.JM = GetSafeData.ValidateValue <string>(row6, "JM"); purchase.SH = GetSafeData.ValidateValue <string>(row6, "SH"); purchase.DZDH = GetSafeData.ValidateValue <string>(row6, "DZDH"); purchase.YHZH = GetSafeData.ValidateValue <string>(row6, "YHZH"); purchase.IDCOC = GetSafeData.ValidateValue <string>(row6, "IDCOC"); purchase.SJBM = GetSafeData.ValidateValue <string>(row6, "SJBM"); purchase.WJ = GetSafeData.ValidateValue <int>(row6, "WJ"); string str11 = manager5.UpdateSubNodesSJBM(purchase, str10); while ("e1" == str11) { num++; num3 = num + 1; num3 = rowArray.Length; string introduced67 = num3.ToString(); purchase.BM = SJBM + introduced67.PadLeft(num3.ToString().Length + 1, '0'); str11 = manager5.UpdateSubNodesSJBM(purchase, str10); } if ("0" == str11) { this.ReNode(tableName, purchase.BM); } num++; Label_09CC: if (num < rowArray.Length) { goto Label_0858; } return; Label_09E6: row7 = rowArray[num]; BMCLModel car = new BMCLModel(); BMCLManager manager6 = new BMCLManager(); string str12 = GetSafeData.ValidateValue <string>(row7, "BM"); num3 = num + 1; num3 = rowArray.Length; string introduced68 = num3.ToString(); car.BM = SJBM + introduced68.PadLeft(num3.ToString().Length + 1, '0'); car.MC = GetSafeData.ValidateValue <string>(row7, "MC"); car.JM = GetSafeData.ValidateValue <string>(row7, "JM"); car.SJBM = GetSafeData.ValidateValue <string>(row7, "SJBM"); car.CPXH = GetSafeData.ValidateValue <string>(row7, "CPXH"); car.CD = GetSafeData.ValidateValue <string>(row7, "CD"); car.SCCJMC = GetSafeData.ValidateValue <string>(row7, "SCCJMC"); car.WJ = GetSafeData.ValidateValue <int>(row7, "WJ"); string str13 = manager6.UpdateSubNodesSJBM(car, str12); while ("e1" == str13) { num++; num3 = num + 1; num3 = rowArray.Length; string introduced69 = num3.ToString(); car.BM = SJBM + introduced69.PadLeft(num3.ToString().Length + 1, '0'); str13 = manager6.UpdateSubNodesSJBM(car, str12); } if ("0" == str13) { this.ReNode(tableName, car.BM); } num++; Label_0B47: if (num < rowArray.Length) { goto Label_09E6; } return; Label_0B61: row8 = rowArray[num]; BMXHDWModel model7 = new BMXHDWModel(); BMXHDWManager manager7 = new BMXHDWManager(); string str14 = GetSafeData.ValidateValue <string>(row8, "BM"); num3 = num + 1; num3 = rowArray.Length; string introduced70 = num3.ToString(); model7.BM = SJBM + introduced70.PadLeft(num3.ToString().Length + 1, '0'); model7.MC = GetSafeData.ValidateValue <string>(row8, "MC"); model7.JM = GetSafeData.ValidateValue <string>(row8, "JM"); model7.SJBM = GetSafeData.ValidateValue <string>(row8, "SJBM"); model7.SH = GetSafeData.ValidateValue <string>(row8, "SH"); model7.DZDH = GetSafeData.ValidateValue <string>(row8, "DZDH"); model7.YHZH = GetSafeData.ValidateValue <string>(row8, "YHZH"); model7.YZBM = GetSafeData.ValidateValue <string>(row8, "YZBM"); model7.WJ = GetSafeData.ValidateValue <int>(row8, "WJ"); string str15 = manager7.UpdateSubNodesSJBM(model7, str14); while ("e1" == str15) { num++; num3 = num + 1; num3 = rowArray.Length; string introduced71 = num3.ToString(); model7.BM = SJBM + introduced71.PadLeft(num3.ToString().Length + 1, '0'); str15 = manager7.UpdateSubNodesSJBM(model7, str14); } if ("0" == str15) { this.ReNode(tableName, model7.BM); } num++; Label_0CD5: if (num < rowArray.Length) { goto Label_0B61; } return; Label_0CE4 :; foreach (DataRow row9 in this.baseDAO.querySQLDataTable("SELECT * FROM " + tableName + " WHERE SJBM ='" + SJBM + "'").Rows) { string sJBM = GetSafeData.ValidateValue <string>(row9, "BM"); this.ReNode(tableName, sJBM); } } catch (Exception) { } }
private void ReFirstNodes(string tableName, DataTable topNodeTable, int maxLenOfTopNodes, bool padFlag) { try { int num3; int num = 0; int result = 0; switch (tableName) { case "BM_KH": num = 0; result = 0; foreach (DataRow row in topNodeTable.Rows) { BMKHModel customer = new BMKHModel(); BMKHManager manager = new BMKHManager(); customer.SJBM = GetSafeData.ValidateValue <string>(row, "SJBM"); string s = GetSafeData.ValidateValue <string>(row, "BM"); if (padFlag) { customer.BM = s.PadLeft(maxLenOfTopNodes, '0'); } else { int num4 = num + 1; customer.BM = customer.SJBM + num4.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } customer.MC = GetSafeData.ValidateValue <string>(row, "MC"); customer.JM = GetSafeData.ValidateValue <string>(row, "JM"); customer.KJM = GetSafeData.ValidateValue <string>(row, "KJM"); customer.SH = GetSafeData.ValidateValue <string>(row, "SH"); customer.DZDH = GetSafeData.ValidateValue <string>(row, "DZDH"); customer.YHZH = GetSafeData.ValidateValue <string>(row, "YHZH"); customer.YJDZ = GetSafeData.ValidateValue <string>(row, "YJDZ"); customer.BZ = GetSafeData.ValidateValue <string>(row, "BZ"); customer.YSKM = GetSafeData.ValidateValue <string>(row, "YSKM"); customer.DQBM = GetSafeData.ValidateValue <string>(row, "DQBM"); customer.DQMC = GetSafeData.ValidateValue <string>(row, "DQMC"); customer.DQKM = GetSafeData.ValidateValue <string>(row, "DQKM"); customer.SFZJY = GetSafeData.ValidateValue <bool>(row, "SFZJY"); customer.WJ = GetSafeData.ValidateValue <int>(row, "WJ"); if (!int.TryParse(s, out result)) { result++; } for (string str2 = manager.UpdateSubNodesSJBM(customer, s); "e1" == str2; str2 = manager.UpdateSubNodesSJBM(customer, s)) { if (padFlag) { result++; customer.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; int num6 = num + 1; customer.BM = customer.SJBM + num6.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } return; case "BM_SP": num = 0; result = 0; foreach (DataRow row2 in topNodeTable.Rows) { BMSPModel merchandise = new BMSPModel(); BMSPManager manager2 = new BMSPManager(); merchandise.SJBM = GetSafeData.ValidateValue <string>(row2, "SJBM"); string str3 = GetSafeData.ValidateValue <string>(row2, "BM"); if (padFlag) { merchandise.BM = str3.PadLeft(maxLenOfTopNodes, '0'); } else { int num8 = num + 1; merchandise.BM = merchandise.SJBM + num8.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } merchandise.MC = GetSafeData.ValidateValue <string>(row2, "MC"); merchandise.JM = GetSafeData.ValidateValue <string>(row2, "JM"); merchandise.KJM = GetSafeData.ValidateValue <string>(row2, "KJM"); merchandise.SLV = GetSafeData.ValidateValue <double>(row2, "SLV"); merchandise.SPSM = GetSafeData.ValidateValue <string>(row2, "SPSM"); merchandise.GGXH = GetSafeData.ValidateValue <string>(row2, "GGXH"); merchandise.JLDW = GetSafeData.ValidateValue <string>(row2, "JLDW"); merchandise.DJ = GetSafeData.ValidateValue <double>(row2, "DJ"); merchandise.HSJBZ = GetSafeData.ValidateValue <bool>(row2, "HSJBZ"); merchandise.XSSRKM = GetSafeData.ValidateValue <string>(row2, "XSSRKM"); merchandise.YJZZSKM = GetSafeData.ValidateValue <string>(row2, "YJZZSKM"); merchandise.XSTHKM = GetSafeData.ValidateValue <string>(row2, "XSTHKM"); merchandise.HYSY = GetSafeData.ValidateValue <bool>(row2, "HYSY"); merchandise.XTHASH = GetSafeData.ValidateValue <string>(row2, "XTHASH"); merchandise.XTCODE = GetSafeData.ValidateValue <string>(row2, "XTCODE"); merchandise.ISHIDE = GetSafeData.ValidateValue <string>(row2, "ISHIDE"); merchandise.WJ = GetSafeData.ValidateValue <int>(row2, "WJ"); if (!int.TryParse(str3, out result)) { result++; } for (string str4 = manager2.UpdateSubNodesSJBM(merchandise, str3); "e1" == str4; str4 = manager2.UpdateSubNodesSJBM(merchandise, str3)) { if (padFlag) { result++; merchandise.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; int num10 = num + 1; merchandise.BM = merchandise.SJBM + num10.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } return; case "BM_SFHR": num = 0; result = 0; foreach (DataRow row3 in topNodeTable.Rows) { BMSFHRModel model3 = new BMSFHRModel(); BMSFHRManager manager3 = new BMSFHRManager(); model3.SJBM = GetSafeData.ValidateValue <string>(row3, "SJBM"); string str5 = GetSafeData.ValidateValue <string>(row3, "BM"); if (padFlag) { model3.BM = str5.PadLeft(maxLenOfTopNodes, '0'); } else { int num12 = num + 1; model3.BM = model3.SJBM + num12.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } model3.MC = GetSafeData.ValidateValue <string>(row3, "MC"); model3.JM = GetSafeData.ValidateValue <string>(row3, "JM"); model3.SH = GetSafeData.ValidateValue <string>(row3, "SH"); model3.DZDH = GetSafeData.ValidateValue <string>(row3, "DZDH"); model3.YHZH = GetSafeData.ValidateValue <string>(row3, "YHZH"); model3.YZBM = GetSafeData.ValidateValue <string>(row3, "YZBM"); model3.WJ = GetSafeData.ValidateValue <int>(row3, "WJ"); if (!int.TryParse(str5, out result)) { result++; } for (string str6 = manager3.UpdateSubNodesSJBM(model3, str5); "e1" == str6; str6 = manager3.UpdateSubNodesSJBM(model3, str5)) { if (padFlag) { result++; model3.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; int num14 = num + 1; model3.BM = model3.SJBM + num14.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } return; case "BM_FYXM": num = 0; result = 0; foreach (DataRow row4 in topNodeTable.Rows) { BMFYXMModel feiyong = new BMFYXMModel(); BMFYXMManager manager4 = new BMFYXMManager(); feiyong.SJBM = GetSafeData.ValidateValue <string>(row4, "SJBM"); string str7 = GetSafeData.ValidateValue <string>(row4, "BM"); if (padFlag) { feiyong.BM = str7.PadLeft(maxLenOfTopNodes, '0'); } else { int num16 = num + 1; feiyong.BM = feiyong.SJBM + num16.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } feiyong.MC = GetSafeData.ValidateValue <string>(row4, "MC"); feiyong.JM = GetSafeData.ValidateValue <string>(row4, "JM"); feiyong.WJ = GetSafeData.ValidateValue <int>(row4, "WJ"); if (!int.TryParse(str7, out result)) { result++; } for (string str8 = manager4.UpdateSubNodesSJBM(feiyong, str7); "e1" == str8; str8 = manager4.UpdateSubNodesSJBM(feiyong, str7)) { if (padFlag) { result++; feiyong.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; int num18 = num + 1; feiyong.BM = feiyong.SJBM + num18.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } return; case "BM_GHDW": num = 0; result = 0; foreach (DataRow row5 in topNodeTable.Rows) { BMGHDWModel purchase = new BMGHDWModel(); BMGHDWManager manager5 = new BMGHDWManager(); purchase.SJBM = GetSafeData.ValidateValue <string>(row5, "SJBM"); string str9 = GetSafeData.ValidateValue <string>(row5, "BM"); if (padFlag) { purchase.BM = str9.PadLeft(maxLenOfTopNodes, '0'); } else { num3 = num + 1; purchase.BM = purchase.SJBM + num3.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } purchase.MC = GetSafeData.ValidateValue <string>(row5, "MC"); purchase.JM = GetSafeData.ValidateValue <string>(row5, "JM"); purchase.SH = GetSafeData.ValidateValue <string>(row5, "SH"); purchase.DZDH = GetSafeData.ValidateValue <string>(row5, "DZDH"); purchase.YHZH = GetSafeData.ValidateValue <string>(row5, "YHZH"); purchase.IDCOC = GetSafeData.ValidateValue <string>(row5, "IDCOC"); purchase.WJ = GetSafeData.ValidateValue <int>(row5, "WJ"); if (!int.TryParse(str9, out result)) { result++; } for (string str10 = manager5.UpdateSubNodesSJBM(purchase, str9); "e1" == str10; str10 = manager5.UpdateSubNodesSJBM(purchase, str9)) { if (padFlag) { result++; purchase.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; num3 = num + 1; purchase.BM = purchase.SJBM + num3.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } return; case "BM_CL": num = 0; result = 0; foreach (DataRow row6 in topNodeTable.Rows) { BMCLModel car = new BMCLModel(); BMCLManager manager6 = new BMCLManager(); car.SJBM = GetSafeData.ValidateValue <string>(row6, "SJBM"); string str11 = GetSafeData.ValidateValue <string>(row6, "BM"); if (padFlag) { car.BM = str11.PadLeft(maxLenOfTopNodes, '0'); } else { num3 = num + 1; car.BM = car.SJBM + num3.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } car.MC = GetSafeData.ValidateValue <string>(row6, "MC"); car.JM = GetSafeData.ValidateValue <string>(row6, "JM"); car.CPXH = GetSafeData.ValidateValue <string>(row6, "CPXH"); car.CD = GetSafeData.ValidateValue <string>(row6, "CD"); car.SCCJMC = GetSafeData.ValidateValue <string>(row6, "SCCJMC"); car.WJ = GetSafeData.ValidateValue <int>(row6, "WJ"); if (!int.TryParse(str11, out result)) { result++; } for (string str12 = manager6.UpdateSubNodesSJBM(car, str11); "e1" == str12; str12 = manager6.UpdateSubNodesSJBM(car, str11)) { if (padFlag) { result++; car.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; num3 = num + 1; car.BM = car.SJBM + num3.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } return; case "BM_XHDW": break; default: return; } num = 0; result = 0; foreach (DataRow row7 in topNodeTable.Rows) { BMXHDWModel model7 = new BMXHDWModel(); BMXHDWManager manager7 = new BMXHDWManager(); model7.SJBM = GetSafeData.ValidateValue <string>(row7, "SJBM"); string str13 = GetSafeData.ValidateValue <string>(row7, "BM"); if (padFlag) { model7.BM = str13.PadLeft(maxLenOfTopNodes, '0'); } else { num3 = num + 1; model7.BM = model7.SJBM + num3.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } model7.MC = GetSafeData.ValidateValue <string>(row7, "MC"); model7.JM = GetSafeData.ValidateValue <string>(row7, "JM"); model7.SH = GetSafeData.ValidateValue <string>(row7, "SH"); model7.DZDH = GetSafeData.ValidateValue <string>(row7, "DZDH"); model7.YHZH = GetSafeData.ValidateValue <string>(row7, "YHZH"); model7.YZBM = GetSafeData.ValidateValue <string>(row7, "YZBM"); model7.WJ = GetSafeData.ValidateValue <int>(row7, "WJ"); if (!int.TryParse(str13, out result)) { result++; } for (string str14 = manager7.UpdateSubNodesSJBM(model7, str13); "e1" == str14; str14 = manager7.UpdateSubNodesSJBM(model7, str13)) { if (padFlag) { result++; model7.BM = result.ToString().PadLeft(maxLenOfTopNodes, '0'); } else { num++; num3 = num + 1; model7.BM = model7.SJBM + num3.ToString().PadLeft(topNodeTable.Rows.Count.ToString().Length + 2, '0'); } } num++; } } catch (Exception) { } }
protected override object[] doService(object[] param) { BMSFHRModel model; if (!CheckPermission.Check("SFHR")) { return(null); } if (param.Length < 2) { throw new ArgumentException("参数错误,至少有2个参数"); } string mC = (param[0] as string).Trim(); string taxCode = (param[1] as string).Trim(); if (mC.Length == 0) { MessageBoxHelper.Show("请输入收/发货人名称", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(new object[] { "Cancel" }); } if (taxCode.Length == 0) { MessageBoxHelper.Show("请输入收/发货人税号", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(new object[] { "Cancel" }); } string str3 = ""; string sJBM = ""; switch (MessageBoxHelper.Show("是否有上级单位?", "输入确认", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Cancel: return(new object[] { "Cancel" }); case DialogResult.Yes: { if (this.sfhrManager.QueryByTaxCode(taxCode).Rows.Count > 0) { MessageBoxHelper.Show("与此税号对应的收/发货人已存在", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); return(new object[] { "Error" }); } BMSFHRSelect select = new BMSFHRSelect(); if (select.ShowDialog() != DialogResult.OK) { return(new object[] { str3 }); } sJBM = select.SelectedSJBM; break; } } if (this.sfhrManager.QueryByMCAndSJBM(mC, sJBM).Rows.Count > 0) { MessageBoxHelper.Show("新增收发货人名称与其同级单位名称重复!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); return(new object[] { "Error" }); } model = new BMSFHRModel { SJBM = sJBM, MC = mC, SH = taxCode, WJ = 1 }; model.BM = this.sfhrManager.TuiJianBM(model.SJBM); str3 = this.sfhrManager.AddCustomerKP(model, 1); if (str3 == "0") { str3 = "OK"; return(new object[] { str3 }); } this.log.Info("新增收/发货人失败:" + str3); return(new object[] { "Error:", str3 }); }