protected void btnFind_Click(object sender, System.EventArgs e)
        {
            string strProviderCode = this.txtProviderCode.Text.Trim();

            if (strProviderCode == "")
            {
                this.SetErrorMsgPageBydirHistory("请输入供应商编码!");
                return;
            }
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                string strProviderName = StoBusi.IsExistProvider(strProviderCode);
                if (strProviderName == "")
                {
                    this.txtProviderName.Text    = "";
                    this.txtProviderName.Enabled = true;
                }
                else
                {
                    this.txtProviderName.Text    = strProviderName;
                    this.txtProviderName.Enabled = false;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
        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;
            }
        }
        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;
            }
        }