Пример #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 mC      = (param[0] as string).Trim();
            string taxCode = (param[1] as string).Trim();
            string str3    = (param[2] as string).Trim();

            if (mC.Length == 0)
            {
                MessageBoxHelper.Show("请输入购货单位名称", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(new object[] { "Cancel" });
            }
            if (str3.Length == 0)
            {
                MessageBoxHelper.Show("请输入购货单位身份证号码/组织机构代码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(new object[] { "Cancel" });
            }
            string str4 = "";
            string sJBM = "";

            switch (MessageBoxHelper.Show("是否有上级单位?", "输入确认", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
            {
            case DialogResult.Cancel:
                return(new object[] { "Cancel" });

            case DialogResult.Yes:
            {
                if ((taxCode.Length != 0) && (this.ghdwmanager.QueryByTaxCode(taxCode).Rows.Count > 0))
                {
                    MessageBoxHelper.Show("与此税号对应的购货单位已存在", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return(new object[] { "Error" });
                }
                BMGHDWSelect select = new BMGHDWSelect();
                if (select.ShowDialog() != DialogResult.OK)
                {
                    return(new object[] { str4 });
                }
                sJBM = select.SelectedSJBM;
                break;
            }
            }
            if (this.ghdwmanager.QueryByMCAndSJBM(mC, sJBM).Rows.Count > 0)
            {
                MessageBoxHelper.Show("新增购货单位名称与其同级单位名称重复!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(new object[] { "Error" });
            }
            model = new BMGHDWModel {
                SJBM  = sJBM,
                MC    = mC,
                SH    = taxCode,
                IDCOC = str3,
                WJ    = 1
            };
            model.BM = this.ghdwmanager.TuiJianBM(model.SJBM);
            str4     = this.ghdwmanager.AddPurchaseKP(model, 1);
            if (str4 == "0")
            {
                str4 = "OK";
                return(new object[] { str4 });
            }
            this.log.Info("新增购货单位失败:" + str4);
            return(new object[] { "Error:", str4 });
        }
Пример #2
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());
        }