private void btAdd_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.ProviderStruct ps1 = new CMSMStruct.ProviderStruct();
            ps1.strPrvdCode          = this.txtProviderCode.Text.Trim();
            ps1.strPrvdName          = this.txtProviderName.Text.Trim();
            ps1.strPrvdAbbName       = this.txtProviderAbbName.Text.Trim();
            ps1.strPrvdCredit        = this.ddlCredit.SelectedValue;
            ps1.strPrvdQualification = this.txtQualification.Text.Trim();
            ps1.strActiveFlag        = this.ddlActiveFlag.SelectedValue;
            ps1.strPrvdLinkName      = this.txtLinkName.Text.Trim();
            ps1.strPrvdPhone         = this.txtLinkPhone.Text.Trim();
            ps1.strPrvdFax           = this.txtFax.Text.Trim();
            ps1.strPrvdEmail         = this.txtEmail.Text.Trim();
            ps1.strPostCode          = this.txtPostCode.Text.Trim();
            ps1.strAddress           = this.txtAddress.Text.Trim();
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            ps1.strPrvdCreater = ls1.strOperName;
            ps1.strOperName    = ls1.strOperName;

            if (ps1.strPrvdName == "" || ps1.strPrvdName.Length > 20)
            {
                this.Popup("供应商名称不能为空或长度过长!");
                return;
            }

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                string strcount = StoBusi.IsExistProvider(ps1.strPrvdName);
                if (strcount != "0")
                {
                    this.Popup("该供应商名称已经存在,请使用不同的名称!");
                    return;
                }

                if (StoBusi.NewProviderAdd(ps1))
                {
                    this.SetSuccMsgPageBydir("新增供应商档案成功!", "Storage/wfmProviderDetail.aspx");
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("新增供应商档案时发生错误,请重试!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
示例#2
0
        public bool ModProviderInfo(CMSMStruct.ProviderStruct psnew, CMSMStruct.ProviderStruct psold)
        {
            int recount = sac.ModProviderInfo(psnew, psold);

            if (recount <= 0)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        public bool NewProviderAdd(CMSMStruct.ProviderStruct ps1)
        {
            int recount = sac.NewProviderAdd(ps1);

            if (recount <= 0)
            {
                return(false);
            }

            return(true);
        }
        private void btMod_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.ProviderStruct ps1 = new CMSMStruct.ProviderStruct();
            ps1.strPrvdCode          = this.txtProviderCode.Text.Trim();
            ps1.strPrvdName          = this.txtProviderName.Text.Trim();
            ps1.strPrvdAbbName       = this.txtProviderAbbName.Text.Trim();
            ps1.strAddress           = this.txtAddress.Text.Trim();
            ps1.strPostCode          = this.txtPostCode.Text.Trim();
            ps1.strPrvdPhone         = this.txtLinkPhone.Text.Trim();
            ps1.strPrvdFax           = this.txtFax.Text.Trim();
            ps1.strPrvdEmail         = this.txtEmail.Text.Trim();
            ps1.strPrvdLinkName      = this.txtLinkName.Text.Trim();
            ps1.strPrvdCredit        = this.ddlCredit.SelectedValue;
            ps1.strPrvdQualification = this.txtQualification.Text.Trim();
            ps1.strActiveFlag        = this.ddlActiveFlag.SelectedValue;
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            ps1.strOperName = ls1.strOperName;

            if (ps1.strPrvdCode == "" || ps1.strPrvdCode.Length >= 10)
            {
                this.SetErrorMsgPageBydirHistory("供应商编码不能为空或长度过长!");
                return;
            }
            if (ps1.strPrvdName == "" || ps1.strPrvdName.Length > 20)
            {
                this.SetErrorMsgPageBydirHistory("供应商名称不能为空或长度过长!");
                return;
            }

            CMSMStruct.ProviderStruct psold = (CMSMStruct.ProviderStruct)Session["psold"];
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                if (StoBusi.ModProviderInfo(ps1, psold))
                {
                    this.SetSuccMsgPageBydir("修改供应商资料成功!", "Storage/wfmProvider.aspx");
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("修改供应商资料时发生错误,请重试!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            if (Session["Login"] == null)
            {
                Response.Redirect("../Exit.aspx");
                return;
            }

            string    strPVid = Request.QueryString["PVID"];
            string    strPDid = Request.QueryString["PDID"];
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);

            if (!IsPostBack)
            {
                this.txtProviderName.Enabled = false;
                if (strPVid == "" || strPVid == null || strPDid == "" || strPDid == null)
                {
                    this.btAdd.Enabled = true;
                    this.btMod.Enabled = false;
                    lbltitle.Text      = "新供应商资料录入";
                    this.FillDropDownList("AllMaterial", this.ddlProduct);
                    this.ddlProviderTime.Items.Add(new ListItem("及时", "0"));
                    this.ddlProviderTime.Items.Add(new ListItem("一般", "1"));
                    this.ddlProviderTime.Items.Add(new ListItem("不及时", "2"));
                    this.ddlProviderTime.SelectedIndex = 0;
                    this.ddlProviderQuality.Items.Add(new ListItem("好", "0"));
                    this.ddlProviderQuality.Items.Add(new ListItem("一般", "1"));
                    this.ddlProviderQuality.Items.Add(new ListItem("不好", "2"));
                    this.ddlProviderQuality.SelectedIndex = 0;
                }
                else
                {
                    this.btnFind.Enabled = false;
                    this.btAdd.Enabled   = false;
                    this.btMod.Enabled   = true;
                    this.FillDropDownList("AllMaterial", this.ddlProduct);
                    this.ddlProviderTime.Items.Add(new ListItem("及时", "0"));
                    this.ddlProviderTime.Items.Add(new ListItem("一般", "1"));
                    this.ddlProviderTime.Items.Add(new ListItem("不及时", "2"));
                    this.ddlProviderTime.SelectedIndex = 0;
                    this.ddlProviderQuality.Items.Add(new ListItem("好", "0"));
                    this.ddlProviderQuality.Items.Add(new ListItem("一般", "1"));
                    this.ddlProviderQuality.Items.Add(new ListItem("不好", "2"));
                    this.ddlProviderQuality.SelectedIndex = 0;

                    CMSMStruct.ProviderStruct ps1 = StoBusi.GetProviderDetailOne(strPVid, strPDid);
                    this.txtProviderCode.Text             = ps1.strProviderCode;
                    this.txtProviderName.Text             = ps1.strProviderName;
                    this.ddlProduct.SelectedIndex         = this.ddlProduct.Items.IndexOf(this.ddlProduct.Items.FindByText(ps1.strProductName));
                    this.txtProviderPrice.Text            = ps1.strProviderPrice;
                    this.txtProviderUnit.Text             = ps1.strProviderUnit;
                    this.ddlProviderTime.SelectedIndex    = this.ddlProviderTime.Items.IndexOf(this.ddlProviderTime.Items.FindByText(ps1.strProviderTime));
                    this.ddlProviderQuality.SelectedIndex = this.ddlProviderQuality.Items.IndexOf(this.ddlProviderQuality.Items.FindByText(ps1.strProviderQuality));
                    this.txtProviderValue.Text            = ps1.strProviderValue;
                    this.txtLinkName.Text        = ps1.strLinkName;
                    this.txtLinkPhone.Text       = ps1.strLinkPhone;
                    this.txtLinkAddress.Text     = ps1.strLinkAddress;
                    lbltitle.Text                = "供应商资料修改删除";
                    Session["psold"]             = ps1;
                    this.txtProviderCode.Enabled = false;
                    this.ddlProduct.Enabled      = false;
                }
            }
        }
        protected void btMod_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.ProviderStruct ps1 = new CMSMStruct.ProviderStruct();
            ps1.strProviderCode    = this.txtProviderCode.Text.Trim();
            ps1.strProviderName    = this.txtProviderName.Text.Trim();
            ps1.strProductCode     = this.ddlProduct.SelectedValue;
            ps1.strProductName     = this.ddlProduct.SelectedItem.Text;
            ps1.strProviderPrice   = this.txtProviderPrice.Text.Trim();
            ps1.strProviderUnit    = this.txtProviderUnit.Text.Trim();
            ps1.strProviderTime    = this.ddlProviderTime.SelectedItem.Text;
            ps1.strProviderQuality = this.ddlProviderQuality.SelectedItem.Text;
            ps1.strProviderValue   = this.txtProviderValue.Text.Trim();
            ps1.strLinkName        = this.txtLinkName.Text.Trim();
            ps1.strLinkPhone       = this.txtLinkPhone.Text.Trim();
            ps1.strLinkAddress     = this.txtLinkAddress.Text.Trim();

            if (ps1.strProviderCode == "" || ps1.strProviderCode.Length >= 10)
            {
                this.SetErrorMsgPageBydirHistory("供应商编码不能为空或长度过长!");
                return;
            }
            if (ps1.strProviderName == "" || ps1.strProviderName.Length > 20)
            {
                this.SetErrorMsgPageBydirHistory("供应商名称不能为空或长度过长!");
                return;
            }
            if (ps1.strProviderCode == "")
            {
                this.SetErrorMsgPageBydirHistory("供应产品不能为空!");
                return;
            }
            if (ps1.strProviderPrice == "" || ps1.strProviderUnit == "")
            {
                this.SetErrorMsgPageBydirHistory("供应产品单价和单位不能为空!");
                return;
            }

            CMSMStruct.ProviderStruct psold = (CMSMStruct.ProviderStruct)Session["psold"];
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                if (StoBusi.ModProviderInfo(ps1, psold))
                {
                    this.SetSuccMsgPageBydir("修改供应商资料成功!", "Storage/wfmProvider.aspx");
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("修改供应商资料时发生错误,请重试!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
        protected void btAdd_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.ProviderStruct ps1 = new CMSMStruct.ProviderStruct();
            ps1.strProviderCode    = this.txtProviderCode.Text.Trim();
            ps1.strProviderName    = this.txtProviderName.Text.Trim();
            ps1.strProductCode     = this.ddlProduct.SelectedValue;
            ps1.strProductName     = this.ddlProduct.SelectedItem.Text;
            ps1.strProviderPrice   = this.txtProviderPrice.Text.Trim();
            ps1.strProviderUnit    = this.txtProviderUnit.Text.Trim();
            ps1.strProviderTime    = this.ddlProviderTime.SelectedItem.Text;
            ps1.strProviderQuality = this.ddlProviderQuality.SelectedItem.Text;
            ps1.strProviderValue   = this.txtProviderValue.Text.Trim();
            ps1.strLinkName        = this.txtLinkName.Text.Trim();
            ps1.strLinkPhone       = this.txtLinkPhone.Text.Trim();
            ps1.strLinkAddress     = this.txtLinkAddress.Text.Trim();

            if (ps1.strProviderCode == "" || ps1.strProviderCode.Length >= 10)
            {
                this.SetErrorMsgPageBydirHistory("供应商编码不能为空或长度过长!");
                return;
            }
            if (ps1.strProviderName == "" || ps1.strProviderName.Length > 20)
            {
                this.SetErrorMsgPageBydirHistory("供应商名称不能为空或长度过长!");
                return;
            }
            if (ps1.strProviderCode == "")
            {
                this.SetErrorMsgPageBydirHistory("供应产品不能为空!");
                return;
            }
            if (ps1.strProviderPrice == "" || ps1.strProviderUnit == "")
            {
                this.SetErrorMsgPageBydirHistory("供应产品单价和单位不能为空!");
                return;
            }

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                string strProviderName = StoBusi.IsExistProvider(ps1.strProviderCode);
                if (strProviderName != "" && strProviderName != ps1.strProviderName)
                {
                    this.SetErrorMsgPageBydirHistory("供应商编码和名称发生冲突,该编码对应的供应商名称为:" + strProviderName);
                    return;
                }
                else if (StoBusi.IsExistProviderProduct(ps1.strProviderCode, ps1.strProductCode))
                {
                    this.SetErrorMsgPageBydirHistory("该供应商供应的产品资料已经存在!");
                    return;
                }
                else
                {
                    if (StoBusi.NewProviderAdd(ps1))
                    {
                        this.SetSuccMsgPageBydir("新增供应商资料成功!", "Storage/wfmProviderDetail.aspx");
                        return;
                    }
                    else
                    {
                        this.SetErrorMsgPageBydir("新增供应商资料时发生错误,请重试!");
                        return;
                    }
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            if (Session["Login"] == null)
            {
                Response.Redirect("../Exit.aspx");
                return;
            }

            string    strPVid = Request.QueryString["PVID"];
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);

            if (!IsPostBack)
            {
                this.btnFind.Visible = false;
                if (strPVid == "" || strPVid == null)
                {
                    this.btAdd.Enabled = true;
                    this.btMod.Enabled = false;
                    lbltitle.Text      = "新供应商档案录入";
                    this.ddlCredit.Items.Add(new ListItem("好", "0"));
                    this.ddlCredit.Items.Add(new ListItem("一般", "1"));
                    this.ddlCredit.Items.Add(new ListItem("不好", "2"));
                    this.ddlCredit.SelectedIndex = 0;
                    this.ddlActiveFlag.Items.Add(new ListItem("有效", "1"));
                    this.ddlActiveFlag.Items.Add(new ListItem("失效", "0"));
                    this.ddlActiveFlag.SelectedIndex = 0;
                    this.txtProviderCode.Text        = "P-----";
                    this.txtProviderCode.Enabled     = false;
                }
                else
                {
                    this.btnFind.Enabled = false;
                    this.btAdd.Enabled   = false;
                    this.btMod.Enabled   = true;
                    this.ddlCredit.Items.Add(new ListItem("好", "0"));
                    this.ddlCredit.Items.Add(new ListItem("一般", "1"));
                    this.ddlCredit.Items.Add(new ListItem("不好", "2"));
                    this.ddlCredit.SelectedIndex = 0;
                    this.ddlActiveFlag.Items.Add(new ListItem("有效", "1"));
                    this.ddlActiveFlag.Items.Add(new ListItem("失效", "0"));
                    this.ddlActiveFlag.SelectedIndex = 0;

                    CMSMStruct.ProviderStruct ps1 = StoBusi.GetProviderDetailOne(strPVid);
                    this.txtProviderCode.Text        = ps1.strPrvdCode;
                    this.txtProviderName.Text        = ps1.strPrvdName;
                    this.txtProviderAbbName.Text     = ps1.strPrvdAbbName;
                    this.ddlCredit.SelectedIndex     = this.ddlCredit.Items.IndexOf(this.ddlCredit.Items.FindByValue(ps1.strPrvdCredit));
                    this.txtQualification.Text       = ps1.strPrvdQualification;
                    this.ddlActiveFlag.SelectedIndex = this.ddlActiveFlag.Items.IndexOf(this.ddlActiveFlag.Items.FindByValue(ps1.strActiveFlag));
                    this.txtLinkName.Text            = ps1.strPrvdLinkName;
                    this.txtLinkPhone.Text           = ps1.strPrvdPhone;
                    this.txtFax.Text             = ps1.strPrvdFax;
                    this.txtEmail.Text           = ps1.strPrvdEmail;
                    this.txtPostCode.Text        = ps1.strPostCode;
                    this.txtAddress.Text         = ps1.strAddress;
                    lbltitle.Text                = "供应商档案修改";
                    Session["psold"]             = ps1;
                    this.txtProviderCode.Enabled = false;
                    this.txtProviderName.Enabled = false;
                }
            }
        }