Ejemplo n.º 1
0
        private bool SimpleValidated()
        {
            bool flag = true;

            if (this.textBoxWaitMC.Text.Trim().Length == 0)
            {
                this.textBoxWaitMC.Focus();
                flag = false;
            }
            if (this.textBoxJM.Text.Trim().Trim().Length != 0)
            {
                string input = this.textBoxJM.Text.Trim();
                if ((input[0] < 'A') || (input[0] > 'Z'))
                {
                    this.textBoxJM.Focus();
                    flag = false;
                    MessageManager.ShowMsgBox("INP-235501");
                    return(flag);
                }
                string pattern = "^[A-Z0-9]+$";
                Regex  regex   = new Regex(pattern);
                if (!regex.IsMatch(input))
                {
                    this.textBoxJM.Focus();
                    flag = false;
                    MessageManager.ShowMsgBox("INP-235502");
                    return(flag);
                }
            }
            if (Flbm.IsYM())
            {
                DAL.BMSPFLManager manager = new DAL.BMSPFLManager();
                if (!manager.CanUseThisSPFLBM(this.comBoxSPFL.Text.Trim(), false, false))
                {
                    MessageBox.Show("查无此分类编码或此分类编码不可用,请重新输入!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    this.comBoxSPFL.Focus();
                    this.SPFLMC.Text = "";
                    return(false);
                }
                this.SPFLMC.Text = manager.GetSPFLMCBYBM(this.comBoxSPFL.Text.Trim());
                if (("是" == this.comboBoxYHZC.SelectedItem.ToString()) && (this.comboBoxYHZCMC.Text == ""))
                {
                    MessageBox.Show("优惠类型不能为空,请重新选择!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    this.comboBoxYHZCMC.Focus();
                    return(false);
                }
            }
            else
            {
                flag = true;
            }
            if (!flag)
            {
                MessageManager.ShowMsgBox("INP-235309");
            }
            return(flag);
        }
Ejemplo n.º 2
0
        public void ChooseYHZCMCForFYXM()
        {
            DataTable table = new DAL.BMFYXMManager().QueryFYXMYHZCIsAndYHZCMCIsEmpty();

            if (table != null)
            {
                DAL.BMSPFLManager manager2 = new DAL.BMSPFLManager();
                List <string>     sqlID    = new List <string>();
                List <Dictionary <string, object> > param = new List <Dictionary <string, object> >();
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    Dictionary <string, object> item = new Dictionary <string, object>();
                    string   str        = GetSafeData.ValidateValue <string>(table.Rows[i], "BM");
                    string   bm         = GetSafeData.ValidateValue <string>(table.Rows[i], "SPFL");
                    string   str3       = GetSafeData.ValidateValue <string>(table.Rows[i], "YHZC");
                    string   sPFLMCBYBM = manager2.GetSPFLMCBYBM(bm);
                    string   str5       = "";
                    object[] objArray   = ServiceFactory.InvokePubService("Aisino.Fwkp.Bmgl.GetSLV_BY_BM", new object[] { bm });
                    if ((objArray != null) && (objArray.Length > 0))
                    {
                        string[] strArray = (objArray[0] as DataTable).Rows[0]["ZZSTSGL"].ToString().Split(new char[] { ',', '、', ';', ',', ';' });
                        if (strArray.Length > 0)
                        {
                            str5 = strArray[0];
                            if ((!Flbm.IsDK() && (strArray.Length == 1)) && strArray[0].Contains("1.5%"))
                            {
                                str3 = "否";
                                str5 = "";
                            }
                            if ((!Flbm.IsDK() && (strArray.Length > 1)) && strArray[0].Contains("1.5%"))
                            {
                                str5 = strArray[1];
                            }
                        }
                        else
                        {
                            str3 = "否";
                        }
                    }
                    else
                    {
                        str3 = "否";
                    }
                    item.Add("BM", str);
                    item.Add("SPFL", bm);
                    item.Add("SPFLMC", sPFLMCBYBM);
                    item.Add("YHZC", str3);
                    item.Add("YHZCMC", str5);
                    sqlID.Add("aisino.Fwkp.Bmgl.BMSPFL.UpdateFYXMSPFL");
                    param.Add(item);
                }
                new DAL.BMSPFLManager().UpdateSPFLTable(sqlID, param, false);
            }
        }
Ejemplo n.º 3
0
        public void checkspspfl()
        {
            DataTable table = new DAL.BMSPManager().QuerySPSPFLLNotEmptyAndNotXT();

            if (table != null)
            {
                DAL.BMSPFLManager manager2 = new DAL.BMSPFLManager();
                List <string>     sqlID    = new List <string>();
                List <Dictionary <string, object> > param = new List <Dictionary <string, object> >();
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    Dictionary <string, object> item = new Dictionary <string, object>();
                    string str        = GetSafeData.ValidateValue <string>(table.Rows[i], "BM");
                    string bm         = GetSafeData.ValidateValue <string>(table.Rows[i], "SPFL");
                    string str3       = GetSafeData.ValidateValue <string>(table.Rows[i], "LSLVBS");
                    string str4       = GetSafeData.ValidateValue <string>(table.Rows[i], "YHZC");
                    string str5       = GetSafeData.ValidateValue <string>(table.Rows[i], "YHZCMC");
                    string sPFLMCBYBM = string.Empty;
                    item.Add("BM", str);
                    if (manager2.CanUseThisSPFLBM(bm, true, false))
                    {
                        item.Add("SPFL", bm);
                        sPFLMCBYBM = manager2.GetSPFLMCBYBM(bm);
                        item.Add("SPFLMC", sPFLMCBYBM);
                        if (manager2.CanUseThisYHZC(bm))
                        {
                            item.Add("YHZC", str4);
                            item.Add("YHZCMC", str5);
                            item.Add("LSLVBS", str3);
                        }
                        else
                        {
                            item.Add("YHZC", "否");
                            item.Add("YHZCMC", "");
                            item.Add("LSLVBS", "");
                        }
                    }
                    else
                    {
                        item.Add("SPFL", "");
                        item.Add("SPFLMC", "");
                        item.Add("YHZC", "");
                        item.Add("YHZCMC", "");
                        item.Add("LSLVBS", "");
                    }
                    sqlID.Add("aisino.Fwkp.Bmgl.BMSPFL.UpdateSPSPFL");
                    param.Add(item);
                }
                new DAL.BMSPFLManager().UpdateSPFLTable(sqlID, param, false);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }