Beispiel #1
0
        protected override object[] doService(object[] param)
        {
            BMGHDWModel model;

            if (!CheckPermission.Check("GHDW"))
            {
                return(null);
            }
            if (param.Length < 3)
            {
                throw new ArgumentException("参数错误,至少有3个参数");
            }
            string str  = (param[0] as string).Trim();
            string str2 = (param[1] as string).Trim();
            string str3 = (param[2] as string).Trim();

            if (str.Length == 0)
            {
                return(new object[] { "Cancel" });
            }
            if (str3.Length == 0)
            {
                return(new object[] { "Cancel" });
            }
            string sJBM = "";

            sJBM  = this.ghdwmanager.AutoNodeLogic();
            model = new BMGHDWModel {
                SJBM  = sJBM,
                MC    = str,
                SH    = str2,
                IDCOC = str3,
            };
            model.BM = this.ghdwmanager.TuiJianBM(model.SJBM);
            if (model.SJBM == "NoNode")
            {
                this.log.Info("自动增加购货单位失败,“自动保存”上级编码已满");
                MessageBoxHelper.Show("自动保存上级编码已满,请增位后再添加!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(new object[] { "FAIL" });
            }
            if (model.BM.Length > 0x10)
            {
                this.log.Info("自动新增购货单位失败,“自动保存”节点下空位不足");
                return(new object[] { "FAIL" });
            }
            if (model.BM == "NoNode")
            {
                this.log.Info("自动增加购货单位失败,“自动保存”该级编码已满");
                MessageBoxHelper.Show("自动保存该级编码已满,请增位后再添加!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(new object[] { "FAIL" });
            }
            model.KJM = CommonFunc.GenerateKJM(model.MC);
            model.WJ  = 1;
            if (this.ghdwmanager.AddCustomerToAuto(model, sJBM))
            {
                return(new object[] { "OK" });
            }
            this.log.Info("自动新增购货单位失败");
            return(new object[] { "FAIL" });
        }
Beispiel #2
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("KH"))
            {
                return(null);
            }
            string    keyWord = (string)param[0];
            int       topNo   = (int)param[1];
            DataTable table   = this.khmanager.AppendByKey(keyWord, topNo);

            table.Constraints.Clear();
            if (param.Length == 3)
            {
                string[]      collection = ((string)param[2]).Split(new char[] { ',' });
                List <string> list       = new List <string>();
                list.AddRange(collection);
                for (int i = 0; i < table.Columns.Count; i++)
                {
                    if (!list.Contains(table.Columns[i].ColumnName))
                    {
                        table.Columns.RemoveAt(i);
                        i--;
                    }
                }
            }
            return(new object[] { table });
        }
Beispiel #3
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("FYXM"))
            {
                return(null);
            }
            if (param == null)
            {
                string        str      = "MC,BM,SPFL,YHZC,SPFL_ZZSTSGL,YHZC_SLV";
                List <object> list     = new List <object>();
                string[]      strArray = str.Split(new char[] { ',' });
                for (int j = 0; j < strArray.Length; j++)
                {
                    list.Add(strArray[j]);
                }
                return(list.ToArray());
            }
            string    keyWord = (string)param[0];
            int       topNo   = (int)param[1];
            DataTable table   = this.fyxmmanager.AppendByKey(keyWord, topNo);

            table.Constraints.Clear();
            if (param.Length == 3)
            {
                string[]      collection = ((string)param[2]).Split(new char[] { ',' });
                List <string> list2      = new List <string>();
                list2.AddRange(collection);
                for (int k = 0; k < table.Columns.Count; k++)
                {
                    if (!list2.Contains(table.Columns[k].ColumnName))
                    {
                        table.Columns.RemoveAt(k);
                        k--;
                    }
                }
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                for (int m = i + 1; m < table.Rows.Count; m++)
                {
                    if (table.Rows[m]["BM"].ToString() == table.Rows[i]["BM"].ToString())
                    {
                        foreach (string str4 in table.Rows[m]["YHZC_SLV"].ToString().Split(new char[] { ',', '、', ';', ',', ';' }))
                        {
                            if (!string.IsNullOrEmpty(str4) && !table.Rows[i]["YHZC_SLV"].ToString().Contains(str4))
                            {
                                table.Rows[i]["YHZC_SLV"] = table.Rows[i]["YHZC_SLV"].ToString() + "," + str4;
                            }
                        }
                        table.Rows.RemoveAt(m);
                    }
                }
            }
            return(new object[] { table });
        }
Beispiel #4
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("CL"))
            {
                return(null);
            }
            string    keyWord = (string)param[0];
            int       topNo   = (int)param[1];
            DataTable table   = this.clManager.AppendByKey(keyWord, topNo);

            table.Constraints.Clear();
            if (param.Length == 3)
            {
                string[]      collection = ((string)param[2]).Split(new char[] { ',' });
                List <string> list       = new List <string>();
                list.AddRange(collection);
                for (int j = 0; j < table.Columns.Count; j++)
                {
                    if (!list.Contains(table.Columns[j].ColumnName))
                    {
                        table.Columns.RemoveAt(j);
                        j--;
                    }
                }
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                for (int k = i + 1; k < table.Rows.Count; k++)
                {
                    if (table.Rows[k]["BM"].ToString() == table.Rows[i]["BM"].ToString())
                    {
                        foreach (string str3 in table.Rows[k]["YHZC_SLV"].ToString().Split(new char[] { ',', '、', ';', ',', ';' }))
                        {
                            if (!string.IsNullOrEmpty(str3) && !table.Rows[i]["YHZC_SLV"].ToString().Contains(str3))
                            {
                                table.Rows[i]["YHZC_SLV"] = table.Rows[i]["YHZC_SLV"].ToString() + "," + str3;
                            }
                        }
                        table.Rows.RemoveAt(k);
                    }
                }
            }
            return(new object[] { table });
        }
Beispiel #5
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("FYXM"))
            {
                return(null);
            }
            string        str  = "MC,BM,SPFL,YHZC,SPFL_ZZSTSGL,YHZC_SLV,YHZCMC";
            List <object> list = new List <object>();

            if (param == null)
            {
                string[] strArray = str.Split(new char[] { ',' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    list.Add(strArray[i]);
                }
                return(list.ToArray());
            }
            string keyWord = ((string)param[0]).Trim();
            int    num2    = (int)param[1];

            if (param.Length == 3)
            {
                str = (string)param[2];
            }
            string[] strArray2 = str.Split(new char[] { ',' });
            switch (num2)
            {
            case 0:
            {
                BMFYXMSelect select = new BMFYXMSelect(keyWord);
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }
                DataTable fYXM = this.fyxmmanager.GetFYXM(select.SelectedBM);
                DataRow   row  = fYXM.Rows[0];
                for (int j = 0; j < fYXM.Rows.Count; j++)
                {
                    for (int m = j + 1; m < fYXM.Rows.Count; m++)
                    {
                        if (fYXM.Rows[m]["BM"].ToString() == fYXM.Rows[j]["BM"].ToString())
                        {
                            foreach (string str3 in fYXM.Rows[m]["YHZC_SLV"].ToString().Split(new char[] { (char)0xff0c }))
                            {
                                if (!string.IsNullOrEmpty(str3) && !fYXM.Rows[j]["YHZC_SLV"].ToString().Contains(str3))
                                {
                                    fYXM.Rows[j]["YHZC_SLV"] = fYXM.Rows[j]["YHZC_SLV"].ToString() + "," + str3;
                                }
                            }
                            fYXM.Rows.RemoveAt(m);
                        }
                    }
                }
                for (int k = 0; k < strArray2.Length; k++)
                {
                    if (fYXM.Columns.Contains(strArray2[k]))
                    {
                        list.Add(row[strArray2[k]]);
                    }
                    else
                    {
                        list.Add(" ");
                    }
                }
                break;
            }

            case 1:
            {
                DataTable table2 = this.fyxmmanager.AppendByKey(keyWord, 1);
                if ((table2.Rows.Count > 0) && table2.Rows[0]["WJ"].Equals(1))
                {
                    DataRow row2 = table2.Rows[0];
                    for (int n = 0; n < strArray2.Length; n++)
                    {
                        if (table2.Columns.Contains(strArray2[n]))
                        {
                            list.Add(row2[strArray2[n]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                else
                {
                    BMFYXMSelect select2 = new BMFYXMSelect(keyWord);
                    if (select2.ShowDialog() != DialogResult.OK)
                    {
                        return(null);
                    }
                    DataTable table3 = this.fyxmmanager.GetFYXM(select2.SelectedBM);
                    DataRow   row3   = table3.Rows[0];
                    for (int num7 = 0; num7 < strArray2.Length; num7++)
                    {
                        if (table3.Columns.Contains(strArray2[num7]))
                        {
                            list.Add(row3[strArray2[num7]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                break;
            }

            case 2:
            {
                DataTable table4 = this.fyxmmanager.AppendByKeyWJ(keyWord, 1);
                if ((table4.Rows.Count <= 0) || !table4.Rows[0]["WJ"].Equals(1))
                {
                    return(new object[] { "" });
                }
                DataRow row4 = table4.Rows[0];
                for (int num8 = 0; num8 < strArray2.Length; num8++)
                {
                    if (table4.Columns.Contains(strArray2[num8]))
                    {
                        list.Add(row4[strArray2[num8]]);
                    }
                    else
                    {
                        list.Add(" ");
                    }
                }
                break;
            }

            default:
                return(new object[] { "第二个参数没有这种状态" });
            }
            return(list.ToArray());
        }
Beispiel #6
0
        protected override object[] doService(object[] param)
        {
            object[] objArray;
            if (!CheckPermission.Check("KH"))
            {
                return(null);
            }
            try
            {
                string str  = (string)param[0];
                string str2 = (string)param[1];
                string str3 = string.Empty;
                if (param.Length == 3)
                {
                    str3 = (string)param[2];
                }
                string[]      source   = str3.Split(new char[] { ',' });
                List <object> list     = new List <object>();
                AisinoDataSet aisinoDs = new AisinoDataSet();
                if (!string.IsNullOrEmpty(str) && !string.IsNullOrEmpty(str2))
                {
                    aisinoDs = this._khmanager.AppendKhByMcAndSh(str, str2);
                }
                else if (!string.IsNullOrEmpty(str))
                {
                    aisinoDs = this._khmanager.AppendKhByMc(str);
                }
                else if (!string.IsNullOrEmpty(str2))
                {
                    aisinoDs = this._khmanager.AppendKhBySh(str2);
                }
                else
                {
                    BMKHSelect select = new BMKHSelect(str);
                    if (select.ShowDialog() == DialogResult.OK)
                    {
                        DataTable dt = this._khmanager.GetKH(select.SelectedBM);
                        DataRow   dr = dt.Rows[0];
                        foreach (string t in source)
                        {
                            if (!dt.Columns.Contains(t))
                            {
                                list.Add(" ");
                            }
                            else
                            {
                                list.Add(dr[t]);
                            }
                        }
                        //list.AddRange(source.Select<string, object>(delegate (string t) {
                        //    if (!dt.Columns.Contains(t))
                        //    {
                        //        return " ";
                        //    }
                        //    return dr[t];
                        //}));
                        return(list.ToArray());
                    }
                    return(null);
                }
                if (aisinoDs.Data.Rows.Count != 0)
                {
                    if (aisinoDs.Data.Rows.Count == 1)
                    {
                        DataRow dr = aisinoDs.Data.Rows[0];
                        foreach (string t in source)
                        {
                            if (!aisinoDs.Data.Columns.Contains(t))
                            {
                                list.Add(" ");
                            }
                            else
                            {
                                list.Add(dr[t]);
                            }
                        }
                        //list.AddRange(source.Select<string, object>(delegate (string t) {
                        //    if (!aisinoDs.Data.Columns.Contains(t))
                        //    {
                        //        return " ";
                        //    }
                        //    return dr[t];
                        //}));
                        goto Label_0251;
                    }
                    BMKHSelect select2 = new BMKHSelect(aisinoDs);
                    if (select2.ShowDialog() == DialogResult.OK)
                    {
                        DataTable dt = this._khmanager.GetKH(select2.SelectedBM);
                        DataRow   dr = dt.Rows[0];
                        foreach (string t in source)
                        {
                            if (!aisinoDs.Data.Columns.Contains(t))
                            {
                                list.Add(" ");
                            }
                            else
                            {
                                list.Add(dr[t]);
                            }
                        }
                        //list.AddRange(source.Select<string, object>(delegate (string t) {
                        //    if (!dt.Columns.Contains(t))
                        //    {
                        //        return " ";
                        //    }
                        //    return dr[t];
                        //}));
                        goto Label_0251;
                    }
                }
                return(null);

Label_0251:
                objArray = list.ToArray();
            }
            catch
            {
                objArray = null;
            }
            return(objArray);
        }
Beispiel #7
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("XHDW"))
            {
                return(null);
            }
            string keyWord = ((string)param[0]).Trim();
            int    num     = (int)param[1];
            string str2    = "MC,SH,DZDH,YHZH";

            if (param.Length == 3)
            {
                str2 = (string)param[2];
            }
            string[]      strArray = str2.Split(new char[] { ',' });
            List <object> list     = new List <object>();

            switch (num)
            {
            case 0:
            {
                BMXHDWSelect select = new BMXHDWSelect(keyWord);
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }
                DataTable kH  = this.xhdwManager.GetKH(select.SelectedBM);
                DataRow   row = kH.Rows[0];
                for (int i = 0; i < strArray.Length; i++)
                {
                    if (kH.Columns.Contains(strArray[i]))
                    {
                        list.Add(row[strArray[i]]);
                    }
                    else
                    {
                        list.Add(" ");
                    }
                }
                break;
            }

            case 1:
            {
                DataTable table2 = this.xhdwManager.AppendByKey(keyWord, 1);
                if ((table2.Rows.Count > 0) && table2.Rows[0]["WJ"].Equals(1))
                {
                    DataRow row2 = table2.Rows[0];
                    for (int j = 0; j < strArray.Length; j++)
                    {
                        if (table2.Columns.Contains(strArray[j]))
                        {
                            list.Add(row2[strArray[j]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                else
                {
                    BMXHDWSelect select2 = new BMXHDWSelect(keyWord);
                    if (select2.ShowDialog() != DialogResult.OK)
                    {
                        return(null);
                    }
                    DataTable table3 = this.xhdwManager.GetKH(select2.SelectedBM);
                    DataRow   row3   = table3.Rows[0];
                    for (int k = 0; k < strArray.Length; k++)
                    {
                        if (table3.Columns.Contains(strArray[k]))
                        {
                            list.Add(row3[strArray[k]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                break;
            }

            case 2:
            {
                DataTable table4 = this.xhdwManager.AppendByKeyWJ(keyWord, 1);
                if ((table4.Rows.Count <= 0) || !table4.Rows[0]["WJ"].Equals(1))
                {
                    return(new object[] { "" });
                }
                DataRow row4 = table4.Rows[0];
                for (int m = 0; m < strArray.Length; m++)
                {
                    if (table4.Columns.Contains(strArray[m]))
                    {
                        list.Add(row4[strArray[m]]);
                    }
                    else
                    {
                        list.Add(" ");
                    }
                }
                break;
            }

            default:
                return(new object[] { "第二个参数没有这种状态" });
            }
            return(list.ToArray());
        }
Beispiel #8
0
        protected override object[] doService(object[] param)
        {
            BMXHDWModel model;

            if (!CheckPermission.Check("XHDW"))
            {
                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.xhdwManager.QueryByTaxCode(taxCode).Rows.Count > 0)
                {
                    MessageBoxHelper.Show("与此税号对应的销货单位已存在", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return(new object[] { "Error" });
                }
                BMXHDWSelect select = new BMXHDWSelect();
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(new object[] { str3 });
                }
                sJBM = select.SelectedSJBM;
                break;
            }
            }
            if (this.xhdwManager.QueryByMCAndSJBM(mC, sJBM).Rows.Count > 0)
            {
                MessageBoxHelper.Show("新增收发货人名称与其同级单位名称重复!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(new object[] { "Error" });
            }
            model = new BMXHDWModel {
                SJBM = sJBM,
                MC   = mC,
                SH   = taxCode,
                WJ   = 1
            };
            model.BM = this.xhdwManager.TuiJianBM(model.SJBM);
            str3     = this.xhdwManager.AddCustomerKP(model, 1);
            if (str3 == "0")
            {
                str3 = "OK";
                return(new object[] { str3 });
            }
            this.log.Info("新增销货单位失败:" + str3);
            return(new object[] { "Error:", str3 });
        }
Beispiel #9
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("CL"))
            {
                return(null);
            }
            string keyWord = ((string)param[0]).Trim();
            int    num     = (int)param[1];
            string str2    = "MC,CPXH,CD,SCCJMC,BM,SPFL,YHZC,SPFL_ZZSTSGL,YHZC_SLV,YHZCMC";

            if (param.Length == 3)
            {
                str2 = (string)param[2];
            }
            string[]      strArray = str2.Split(new char[] { ',' });
            List <object> list     = new List <object>();

            switch (num)
            {
            case 0:
            {
                BMCLSelect select = new BMCLSelect(keyWord);
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }
                DataTable cL  = this.clManager.GetCL(select.SelectedBM);
                DataRow   row = cL.Rows[0];
                for (int i = 0; i < cL.Rows.Count; i++)
                {
                    for (int k = i + 1; k < cL.Rows.Count; k++)
                    {
                        if (cL.Rows[k]["BM"].ToString() == cL.Rows[i]["BM"].ToString())
                        {
                            foreach (string str3 in cL.Rows[k]["YHZC_SLV"].ToString().Split(new char[] { (char)0xff0c }))
                            {
                                if (!string.IsNullOrEmpty(str3) && !cL.Rows[i]["YHZC_SLV"].ToString().Contains(str3))
                                {
                                    cL.Rows[i]["YHZC_SLV"] = cL.Rows[i]["YHZC_SLV"].ToString() + "," + str3;
                                }
                            }
                            cL.Rows.RemoveAt(k);
                        }
                    }
                }
                for (int j = 0; j < strArray.Length; j++)
                {
                    if (cL.Columns.Contains(strArray[j]))
                    {
                        list.Add(row[strArray[j]]);
                    }
                    else
                    {
                        list.Add(" ");
                    }
                }
                break;
            }

            case 1:
            {
                DataTable table2 = this.clManager.QueryByMC(keyWord);
                if ((table2.Rows.Count > 0) && table2.Rows[0]["WJ"].Equals(1))
                {
                    DataRow row2 = table2.Rows[0];
                    for (int m = 0; m < strArray.Length; m++)
                    {
                        if (table2.Columns.Contains(strArray[m]))
                        {
                            list.Add(row2[strArray[m]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                else
                {
                    BMCLSelect select2 = new BMCLSelect(keyWord);
                    if (select2.ShowDialog() != DialogResult.OK)
                    {
                        return(null);
                    }
                    DataTable table3 = this.clManager.GetCL(select2.SelectedBM);
                    DataRow   row3   = table3.Rows[0];
                    for (int n = 0; n < strArray.Length; n++)
                    {
                        if (table3.Columns.Contains(strArray[n]))
                        {
                            list.Add(row3[strArray[n]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                break;
            }

            default:
                return(new object[] { "第二个参数没有这种状态" });
            }
            return(list.ToArray());
        }
Beispiel #10
0
        protected override object[] doService(object[] param)
        {
            BMKHModel model;

            if (!CheckPermission.Check("KH"))
            {
                return(null);
            }
            if (param.Length < 4)
            {
                throw new ArgumentException("参数错误,至少有4个参数");
            }
            string mC   = (param[0] as string).Trim();
            string str2 = (param[1] as string).Trim();

            if (mC.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:
            {
                BMKHSelect select = new BMKHSelect();
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(new object[] { str3 });
                }
                sJBM = select.SelectedSJBM;
                break;
            }
            }
            if (this.khmanager.QueryByMCAndSJBM(mC, sJBM).Rows.Count > 0)
            {
                MessageBoxHelper.Show("新增客户名称与其同级单位名称重复!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(new object[] { "Error" });
            }
            model = new BMKHModel {
                SJBM = sJBM,
                MC   = mC,
                SH   = str2,
                DZDH = param[2] as string,
                YHZH = param[3] as string,
            };
            model.BM = this.khmanager.TuiJianBM(model.SJBM);
            if (model.BM == "NoNode")
            {
                this.log.Info("新增客户失败,该级编码已满");
                MessageBoxHelper.Show("该级编码已满,请增位后再添加!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(new object[] { "FAIL" });
            }
            string[] spellCode = StringUtils.GetSpellCode(model.MC);
            if (spellCode.Length > 1)
            {
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < spellCode.Length; i++)
                {
                    builder.Append(spellCode[i]);
                }
                model.KJM = builder.ToString();
            }
            else
            {
                model.KJM = spellCode[0];
            }
            model.WJ = 1;
            str3     = this.khmanager.AddCustomerKP(model, 1);
            if (str3 == "0")
            {
                str3 = "OK";
                return(new object[] { str3 });
            }
            this.log.Info("新增客户失败:" + str3);
            return(new object[] { "Error:", str3 });
        }
Beispiel #11
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("GHDW"))
            {
                return(null);
            }
            string keyWord = ((string)param[0]).Trim();
            int    num     = (int)param[1];
            string str2    = "MC,SH,IDCOC";

            if (param.Length == 3)
            {
                str2 = (string)param[2];
            }
            string[]      strArray = str2.Split(new char[] { ',' });
            List <object> list     = new List <object>();

            switch (num)
            {
            case 0:
            {
                BMGHDWSelect select = new BMGHDWSelect(keyWord);
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }
                DataTable gHDW = this.ghdwmanager.GetGHDW(select.SelectedBM);
                DataRow   row  = gHDW.Rows[0];
                for (int i = 0; i < strArray.Length; i++)
                {
                    if (gHDW.Columns.Contains(strArray[i]))
                    {
                        list.Add(row[strArray[i]]);
                    }
                    else
                    {
                        list.Add(" ");
                    }
                }
                break;
            }

            case 1:
            {
                DataTable table2 = this.ghdwmanager.QueryByTaxCode(keyWord);
                if ((table2.Rows.Count > 0) && table2.Rows[0]["WJ"].Equals(1))
                {
                    DataRow row2 = table2.Rows[0];
                    for (int j = 0; j < strArray.Length; j++)
                    {
                        if (table2.Columns.Contains(strArray[j]))
                        {
                            list.Add(row2[strArray[j]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                else
                {
                    BMGHDWSelect select2 = new BMGHDWSelect(keyWord);
                    if (select2.ShowDialog() != DialogResult.OK)
                    {
                        return(null);
                    }
                    DataTable table3 = this.ghdwmanager.GetGHDW(select2.SelectedBM);
                    DataRow   row3   = table3.Rows[0];
                    for (int k = 0; k < strArray.Length; k++)
                    {
                        if (table3.Columns.Contains(strArray[k]))
                        {
                            list.Add(row3[strArray[k]]);
                        }
                        else
                        {
                            list.Add(" ");
                        }
                    }
                }
                break;
            }

            default:
                return(new object[] { "第二个参数没有这种状态" });
            }
            return(list.ToArray());
        }
Beispiel #12
0
        protected override object[] doService(object[] param)
        {
            if (!CheckPermission.Check("SP"))
            {
                return(null);
            }
            string keyWord = (string)param[0];
            int    topNo   = (int)param[1];
            double result  = -1.0;

            if (param.Length >= 4)
            {
                Type type = param[3].GetType();
                if (type == typeof(double))
                {
                    result = (double)param[3];
                }
                else if (type == typeof(string))
                {
                    double.TryParse((string)param[3], out result);
                }
            }
            string specialSP = string.Empty;

            if (param.Length >= 5)
            {
                specialSP = (string)param[4];
            }
            string specialFlag = string.Empty;

            if (param.Length >= 6)
            {
                specialFlag = (string)param[5];
            }
            DataTable table = this.spManager.AppendByKey(keyWord, topNo, result, specialSP, specialFlag);

            table.Constraints.Clear();
            if (param.Length == 3)
            {
                string[]      collection = ((string)param[2]).Split(new char[] { ',' });
                List <string> list       = new List <string>();
                list.AddRange(collection);
                for (int j = 0; j < table.Columns.Count; j++)
                {
                    if (!list.Contains(table.Columns[j].ColumnName))
                    {
                        table.Columns.RemoveAt(j);
                        j--;
                    }
                }
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                for (int k = i + 1; k < table.Rows.Count; k++)
                {
                    if (table.Rows[k]["BM"].ToString() == table.Rows[i]["BM"].ToString())
                    {
                        foreach (string str5 in table.Rows[k]["YHZC_SLV"].ToString().Split(new char[] { ',', '、', ';', ',', ';' }))
                        {
                            if (!string.IsNullOrEmpty(str5) && !table.Rows[i]["YHZC_SLV"].ToString().Contains(str5))
                            {
                                table.Rows[i]["YHZC_SLV"] = table.Rows[i]["YHZC_SLV"].ToString() + "," + str5;
                            }
                        }
                        table.Rows.RemoveAt(k);
                    }
                }
            }
            return(new object[] { table });
        }