예제 #1
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());
        }
예제 #2
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 });
        }