Example #1
0
        /// <summary>
        /// 确定
        /// </summary>
        protected void OKButton_Click(object sender, EventArgs e)
        {
            using (ContractProvider contProvider = new ContractProvider())
            {
                if (!string.IsNullOrWhiteSpace(rccrd.Text.Trim()))
                {
                    decimal d = 0;
                    if (decimal.TryParse(rccrd.Text.Trim(), out d) == false)
                    {
                        this.ShowErrorMessage("信用额度错误,请重新输入!");
                        this.rccrd.Focus();
                        return;
                    }
                }

                if (this.CurrentID.Length == 0)
                {
                    //新增
                    try
                    {
                        int custNO = contProvider.GetMaxCustNo();

                        contProvider.InsertCustomer(custNO.ToString(), rcnam.Text, rctrc.SelectedValue, rcarea.SelectedValue, rcprov.Text, rccoty.Text, rcadr1.Text, rcadr2.Text, rcadr3.Text, rcpon1.Text, rcpon2.Text, rcpon3.Text, rcfax1.Text, rcfax2.Text, rcemai1.Text, rcemai2.Text, rcctat.Text, rcsalr.SelectedValue, rccur.SelectedValue, rcterm.SelectedValue, rcbank.Text, rcacct.Text, rctcod.Text, rccrd.Text, rchyb.Text, rcdflg.SelectedValue, rcgrad.Text, rckind.Text, rctax.SelectedValue);
                    }
                    catch (Exception error)
                    {
                        this.ShowErrorMessage(this.GetGlobalResourceString("CreateErrorMessage") + error.Message);
                        return;
                    }
                }
                else
                {
                    //编辑
                    try
                    {
                        contProvider.UpdateCustomer(this.CurrentID, rcnam.Text, rctrc.SelectedValue, rcarea.SelectedValue, rcprov.Text, rccoty.Text, rcadr1.Text, rcadr2.Text, rcadr3.Text, rcpon1.Text, rcpon2.Text, rcpon3.Text, rcfax1.Text, rcfax2.Text, rcemai1.Text, rcemai2.Text, rcctat.Text, rcsalr.SelectedValue, rccur.SelectedValue, rcterm.SelectedValue, rcbank.Text, rcacct.Text, rctcod.Text, rccrd.Text, rchyb.Text, rcdflg.SelectedValue, rcgrad.Text, rckind.Text, rctax.SelectedValue);
                    }
                    catch (Exception error)
                    {
                        this.ShowErrorMessage(this.GetGlobalResourceString("UpdateErrorMessage") + error.Message);
                        return;
                    }
                }
            }
            //回调
            this.DialogCallback("'CloseRefresh'", "window");
        }