Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucMessanger1.ClearMessages();
                this.ucMessanger1.UnmarkControls();

                bizMessage bizM = new bizMessage();
                if (this.txtAddress.Text.Length > this.txtAddress.MaxLength)
                {
                    this.ucMessanger1.ProcessMessage("Address: " + bizM.GetMessageText("ValueGreaterThanMax"), Enums.enMsgType.Err, "", null, true);
                    return;
                }

                Client    c   = new Client();
                bizClient biz = new bizClient();

                c.ClientID = int.Parse(Request.QueryString["cid"]);
                //if (this.ddlAccountExecutive.SelectedValue != "")
                //    c.AccountExecutiveID = int.Parse(this.ddlAccountExecutive.SelectedValue);
                c.ClientCode     = this.txtClientCode.Text;
                c.ClientName     = this.txtClientName.Text;
                c.RegisteredName = this.txtRegisteredName.Text;
                c.InsuredName    = this.txtInsuredName.Text;
                if (this.txtABNACN.Text != "")
                {
                    c.ABNACN = this.txtABNACN.Text;
                }
                c.Source           = this.txtSource.Text;
                c.OfficeFacsimilie = this.txtOfficeFacsimilie.Text;
                c.OfficePhone      = this.txtOfficePhone.Text;
                //address
                if (this.txtAddress.Text != "")
                {
                    c.Address = this.txtAddress.Text;
                }
                if (this.rblAddressTypes.SelectedIndex == 0 && this.ucAUPSS1.SuburbControl.SelectedIndex > -1)
                {
                    if (this.ucAUPSS1.PostCode != "")
                    {
                        c.PostCode = this.ucAUPSS1.PostCode;
                    }
                    if (this.ucAUPSS1.StateCode != "")
                    {
                        c.StateCode = this.ucAUPSS1.StateCode;
                    }
                    if (this.ucAUPSS1.Suburb != "")
                    {
                        c.Location = this.ucAUPSS1.Suburb;
                    }
                }
                //industry
                if (this.lstIndustry.SelectedValue != "")
                {
                    c.AnzsicCode = this.lstIndustry.SelectedValue;
                }
                if (this.ddlAssociation.SelectedValue != "")
                {
                    c.AssociationCode = this.ddlAssociation.SelectedValue;
                }
                c.AssociationMemberNumber = this.txtAssociationMemberNumber.Text;
                //audit
                c.ModifiedBy = bizUser.GetCurrentUserName();
                c.Modified   = DateTime.Now;
                //action
                if (biz.ValidateClient(c) == false)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                    return;
                }
                if (biz.UpdateClient(c) == true)
                {
                    Response.Redirect("ViewClient.aspx?cid=" + c.ClientID.ToString(), false);
                }
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }