public bool ExistCustomer(BMCLModel car) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("bm", car.BM); return(this.baseDAO.queryValueSQL <int>("aisino.Fwkp.Bmgl.BMCL.CLExist", dictionary) > 0); }
public string AutoNodeLogic(string DLMC) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("MC", DLMC); dictionary.Add("SJBM", ""); DataTable table = this.baseDAO.querySQLDataTable("aisino.Fwkp.Bmgl.BMCL.CLMCExist", dictionary); int count = table.Rows.Count; if (count == 0) { string str = this.TuiJianBM(""); BMCLModel car = new BMCLModel { BM = str, MC = DLMC, SJBM = "", WJ = 0 }; if ("0" == this.AddCustomer(car)) { return(car.BM); } } if (1 == count) { return(table.Rows[0]["BM"].ToString()); } return(""); }
public string ModifyCustomer(BMCLModel car, string OldBM) { try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("oldBM", OldBM); dictionary.Add("BM", car.BM); dictionary.Add("MC", car.MC); dictionary.Add("JM", car.JM); dictionary.Add("SJBM", car.SJBM); dictionary.Add("CPXH", car.CPXH); dictionary.Add("CD", car.CD); dictionary.Add("SCCJMC", car.SCCJMC); dictionary.Add("KJM", car.KJM); dictionary.Add("WJ", car.WJ); dictionary.Add("SPFL", car.SPFL); dictionary.Add("YHZC", car.YHZC); dictionary.Add("SPFLMC", car.SPFLMC); dictionary.Add("YHZCMC", car.YHZCMC); if (this.baseDAO.未确认DAO方法2_疑似updateSQL("aisino.Fwkp.Bmgl.BMCL.CLModify", 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.clModel = (BMCLModel)this.clManager.GetModel(BM); this.textBoxBM.Text = this.clModel.BM; this.textBoxWaitMC.Text = this.clModel.MC; this.textBoxSJBM.Text = this.clModel.SJBM; this.textBoxJM.Text = this.clModel.JM; }
public string ModifyCustomer(BMCLModel car, string OldBM) { string str = this.CheckCustomer(car); if (str != "0") { return(str); } return(this.bmclDAL.ModifyCustomer(car, OldBM)); }
public string UpdateSubNodesSJBM(BMCLModel car, string YuanBM) { string str = this.CheckCustomer(car); if (str != "0") { return(str); } return(this.bmclDAL.UpdateSubNodesSJBM(car, YuanBM)); }
public string UpdateSubNodesSJBM(BMCLModel car, 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.BMCL.CLBMGetSubNode", 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", car.BM); item.Add("MC", car.MC); item.Add("JM", car.JM); item.Add("CPXH", car.CPXH); item.Add("CD", car.CD); item.Add("SCCJMC", car.SCCJMC); item.Add("SJBM", car.SJBM); list.Add("aisino.Fwkp.Bmgl.BMCL.CLBMModify"); 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 = car.BM + str.Substring(YuanBM.Length); string str4 = car.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.BMCL.CLBMUpdateSJBMandBM"); 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 BMCLFenLei(string SJBM, BMCL Father) { this.clManager = new BLL.BMCLManager(); this.clModel = new BMCLModel(); this.bm = ""; this.yuanBM = ""; this._sjbm = ""; this.SuggestBM = ""; this.Initialize(); this._sjbm = SJBM; this.father = Father; this.Text = "车辆分类编码添加"; }
public BMCLFenLei(string BM, bool Isupdate) { this.clManager = new BLL.BMCLManager(); this.clModel = new BMCLModel(); this.bm = ""; this.yuanBM = ""; this._sjbm = ""; this.SuggestBM = ""; this.Initialize(); this.bm = BM; this.yuanBM = BM; this.isUpdate = Isupdate; this.Text = "车辆分类编码编辑"; }
public string CheckCustomer(BMCLModel car) { if (car == null) { return("e11"); } if ((car.BM == null) || (car.BM.Length == 0)) { return("e12"); } if ((car.MC != null) && (car.MC.Length != 0)) { return("0"); } return("e13"); }
public string AddCustomerToAuto(BMCLModel car, string SJBM) { try { DataTable table = this.bmclDAL.QueryByMCAndSJBM(car.MC, SJBM); if (table.Rows.Count > 0) { car.BM = table.Rows[0]["BM"].ToString(); this.bmclDAL.ModifyCustomer(car, table.Rows[0]["BM"].ToString()); return("OverWrite"); } this.bmclDAL.AddCustomer(car); return("Insert"); } catch { return("DBError"); } }
public string AddCustomerKP(BMCLModel car, int Addtype) { string str = this.CheckCustomer(car); if (str == "0") { int wJ = car.WJ; if (this.bmclDAL.ExistCustomer(car)) { MessageManager.ShowMsgBox("INP-235108"); return("编码已存在"); } str = this.bmclDAL.AddCustomer(car); if ((Addtype == 1) && (str == "0")) { MessageManager.ShowMsgBox("INP-235201"); } } return(str); }
public BMBaseModel GetModel(string BM) { DataTable kH = this.bmclDAL.GetKH(BM); BMCLModel model = new BMCLModel(); 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.CPXH = GetSafeData.ValidateValue <string>(row, "CPXH"); model.CD = GetSafeData.ValidateValue <string>(row, "CD"); model.SCCJMC = GetSafeData.ValidateValue <string>(row, "SCCJMC"); model.WJ = GetSafeData.ValidateValue <int>(row, "WJ"); model.SPFL = GetSafeData.ValidateValue <string>(row, "SPFL"); model.YHZC = GetSafeData.ValidateValue <string>(row, "YHZC"); model.SPFLMC = GetSafeData.ValidateValue <string>(row, "SPFLMC"); model.YHZCMC = GetSafeData.ValidateValue <string>(row, "YHZCMC"); } return(model); }
public string AddCustomer(BMCLModel car) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("BM", car.BM); dictionary.Add("MC", car.MC); dictionary.Add("JM", car.JM); dictionary.Add("CPXH", car.CPXH); dictionary.Add("CD", car.CD); dictionary.Add("SCCJMC", car.SCCJMC); dictionary.Add("KJM", car.KJM); dictionary.Add("SJBM", car.SJBM); dictionary.Add("WJ", car.WJ); dictionary.Add("SPFL", car.SPFL); dictionary.Add("YHZC", car.YHZC); dictionary.Add("SPFLMC", car.SPFLMC); dictionary.Add("YHZCMC", car.YHZCMC); if (this.baseDAO.未确认DAO方法2_疑似updateSQL("aisino.Fwkp.Bmgl.BMCL.CLAdd", dictionary) > 0) { return("0"); } return("e02"); }
public string AddCustomer(BMCLModel car) { return(this.AddCustomerKP(car, 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) { } }
public ImportResult ImportDataZC(string codeFile) { new Dictionary <string, object>(); ImportResult result = new ImportResult(); XmlDocument document = new XmlDocument(); try { try { document.Load(codeFile); } catch { throw new Exception("不符合机动车编码格式"); } XmlNode documentElement = document.DocumentElement; try { if (documentElement.Attributes["TYPE"].Value != "JDCBIANMA") { throw new Exception("不符合机动车编码格式"); } } catch { throw new Exception("不符合机动车编码格式"); } XmlNodeList list = null; list = documentElement.SelectNodes("/Data/CLXX/Row"); List <Dictionary <string, string> > list2 = new List <Dictionary <string, string> >(); foreach (XmlNode node2 in list) { Dictionary <string, string> item = new Dictionary <string, string>(); if (Flbm.IsYM()) { if (node2.Attributes["SPFLBM"] == null) { item.Add("SPFLBM", ""); } else { item.Add(node2.Attributes["SPFLBM"].Name, node2.Attributes["SPFLBM"].Value); } } item.Add(node2.Attributes["SCQYMC"].Name, node2.Attributes["SCQYMC"].Value); item.Add(node2.Attributes["DJ"].Name, node2.Attributes["DJ"].Value); item.Add(node2.Attributes["CDMC"].Name, node2.Attributes["CDMC"].Value); item.Add(node2.Attributes["CPXH"].Name, node2.Attributes["CPXH"].Value); item.Add(node2.Attributes["CLLXMC"].Name, node2.Attributes["CLLXMC"].Value); item.Add(node2.Attributes["CLDLMC"].Name, node2.Attributes["CLDLMC"].Value); item.Add(node2.Attributes["CPBM"].Name, node2.Attributes["CPBM"].Value); list2.Add(item); } DAL.BMSPFLManager manager = new DAL.BMSPFLManager(); foreach (Dictionary <string, string> dictionary2 in list2) { BMCLModel car = new BMCLModel(); string searchid = ""; searchid = this.bmclDAL.AutoNodeLogic(dictionary2["CLDLMC"]); car.SJBM = searchid; car.BM = this.TuiJianBM(searchid); car.MC = dictionary2["CLLXMC"]; car.SCCJMC = dictionary2["SCQYMC"]; car.CPXH = dictionary2["CPXH"]; car.CD = dictionary2["CDMC"]; if (Flbm.IsYM() && manager.CanUseThisSPFLBM(dictionary2["SPFLBM"], false, false)) { car.SPFL = dictionary2["SPFLBM"]; car.SPFLMC = manager.GetSPFLMCBYBM(car.SPFL); if (!manager.CanUseThisYHZC(car.SPFL)) { car.YHZC = "否"; car.YHZCMC = ""; } } car.KJM = CommonFunc.GenerateKJM(car.MC); car.WJ = 1; string str2 = this.AddCustomerToAuto(car, car.SJBM); if ("OverWrite" == str2) { result.Correct++; result.DtResult.Rows.Add(new object[] { car.BM, car.MC, "正确传入", "覆盖记录:" + car.BM }); } else if ("Insert" == str2) { result.Correct++; result.DtResult.Rows.Add(new object[] { car.BM, car.MC, "正确传入", "插入成功:" + car.BM }); } else { result.Failed++; result.DtResult.Rows.Add(new object[] { car.BM, car.MC, "失败", "数据库读写错误" }); } } } catch { throw; } result.ImportTable = "车辆编码.DB"; return(result); }
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) { } }
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("{车辆编码}")) { 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++) { BMCLModel 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 BMCLModel { 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 < 6) { throw new CustomException(string.Format("第{0}行数据不全", i)); } model.WJ = 1; string str9 = ""; if (str == "~~") { str9 = strArray2[3].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str9 = strArray2[3].Replace("#|#", "\r\n"); } else { str9 = strArray2[3]; } model.CPXH = str9; string str10 = ""; if (str == "~~") { str10 = strArray2[4].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str10 = strArray2[4].Replace("#|#", "\r\n"); } else { str10 = strArray2[4]; } model.CD = str10; string str11 = ""; if (str == "~~") { str11 = strArray2[5].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str11 = strArray2[5].Replace("#|#", "\r\n"); } else { str11 = strArray2[5]; } model.SCCJMC = str11; if (Flbm.IsYM() && (strArray2.Length > 6)) { DAL.BMSPFLManager manager = new DAL.BMSPFLManager(); string bm = ""; if (str == "~~") { bm = strArray2[6].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { bm = strArray2[6].Replace("#|#", "\r\n"); } else { bm = strArray2[6]; } if (strArray2.Length > 7) { string str13 = ""; if (str == "~~") { str13 = strArray2[7].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str13 = strArray2[7].Replace("#|#", "\r\n"); } else { str13 = strArray2[7]; } if (manager.CanUseThisSPFLBM(bm, false, false)) { model.SPFL = bm; model.SPFLMC = manager.GetSPFLMCBYBM(bm); if (manager.CanUseThisYHZC(bm)) { if ((str13.Trim() == "是") || (str13.Trim() == "否")) { model.YHZC = str13; if (model.YHZC == "否") { model.YHZCMC = ""; } } else { model.YHZC = "否"; model.YHZCMC = ""; } if (strArray2.Length > 9) { bool flag3 = false; if (str13.Trim() == "是") { object[] objArray = ServiceFactory.InvokePubService("Aisino.Fwkp.Bmgl.GetSLV_BY_BM", new object[] { model.SPFL }); if ((objArray != null) && (objArray.Length > 0)) { string[] strArray3 = (objArray[0] as DataTable).Rows[0]["ZZSTSGL"].ToString().Split(new char[] { ',', '、', ';', ',', ';' }); if (strArray3.Length > 0) { foreach (string str14 in strArray3) { if (strArray2[9].Trim() == str14) { model.YHZC = "是"; string str15 = ""; if (str == "~~") { str15 = strArray2[9].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str15 = strArray2[9].Replace("#|#", "\r\n"); } else { str15 = strArray2[9]; } model.YHZCMC = str15; flag3 = true; } if (!Flbm.IsDK() && strArray2[9].Trim().Contains("1.5%")) { model.YHZC = "否"; model.YHZCMC = ""; } } } } if (!flag3) { model.YHZC = "否"; model.YHZCMC = ""; } } else if (str13.Trim() == "否") { model.YHZC = "否"; model.YHZCMC = ""; } else { model.YHZC = "否"; model.YHZCMC = ""; } } } else { model.YHZC = "否"; model.YHZCMC = ""; } } } } } while (stack.Count > 0) { flag2 = false; if (model.BM.Length > stack.Peek().BM.Length) { if (!model.BM.StartsWith(stack.Peek().BM)) { goto Label_07AE; } 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_07AE; } str5 = this.TuiJianBM(stack.Peek().BM); if (model.BM.Length == str5.Length) { goto Label_07AE; } str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } goto Label_0940; } stack.Pop(); } flag2 = true; Label_07AE: 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.bmclDAL.ExistCustomer(model)) { if (str7.Length == 0) { str7 = "重复"; result.Duplicated++; } if (str8.Length == 0) { str8 = "编码重复"; none = ResultType.Duplicated; } else { str8 = str8 + "且编码重复"; none = ResultType.Invalid; } } else { string[] spellCode = StringUtils.GetSpellCode(model.MC); for (int j = 0; j < spellCode.Length; j++) { string text1 = spellCode[j]; } if (this.bmclDAL.AddCustomer(model) == "0") { str7 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str7 = "失败"; result.Failed++; none = ResultType.Failed; } } Label_0940 :; 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); }