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

                if (this.UIValidation() == false)
                {
                    return;
                }

                bizActivity biz = new bizActivity();

                Activity a = biz.GetActivity(int.Parse(Request.QueryString["aid"]));
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                //general
                if (this.txtFollowUpDate.Text != "")
                {
                    a.FollowUpDate = DateTime.Parse(this.txtFollowUpDate.Text);
                }
                else
                {
                    a.FollowUpDate = null;
                }
                if (this.ddlContact.SelectedValue != "")
                {
                    a.ContactID = int.Parse(this.ddlContact.SelectedValue);
                }
                else
                {
                    a.ContactID = null;
                }
                a.ActivityNote = this.txtActivityNote.Text;
                a.Inactive     = false;
                //additional
                switch (this.lblActivityStatus.Text)
                {
                case "Identified":
                    break;

                case "Qualified-in":
                    break;

                case "Qualified-out":
                    a.Opportunity.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text);
                    break;

                case "Interested":
                    a.Opportunity.OpportunityDue   = DateTime.Parse(this.txtOpportunityDue.Text);
                    a.Opportunity.IncumbentBroker  = this.txtIncumbentBroker.Text;
                    a.Opportunity.IncumbentInsurer = this.txtIncumbentInsurer.Text;
                    a.Opportunity.ClassificationID = int.Parse(this.ddlClassification.SelectedValue);
                    break;

                case "Not Interested":
                    a.Opportunity.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text);
                    break;

                case "Go-to-Market":
                    break;

                case "Revisit next year":
                    a.Opportunity.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text);
                    break;

                case "Quoted":
                    a.Opportunity.NetBrokerageQuoted = decimal.Parse(this.txtNetBrokerageQuoted.Text);
                    break;

                case "Can't Place":
                    a.Opportunity.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text);
                    break;

                case "Accepted":
                    a.Opportunity.NetBrokerageActual = decimal.Parse(this.txtNetBrokerageActual.Text);
                    break;

                case "Lost":
                    a.Opportunity.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text);
                    break;

                case "Processed":
                    a.Opportunity.DateCompleted     = DateTime.Parse(this.txtDateCompleted.Text);
                    a.Opportunity.MemoNumber        = this.txtMemoNumber.Text;
                    a.Opportunity.Client.ClientCode = this.txtClientCode.Text;
                    break;

                default:     // all pending statuses
                    break;
                }
                //audit
                a.ModifiedBy = bizUser.GetCurrentUserName();
                a.Modified   = DateTime.Now;
                //action
                if (biz.ValidateActivity(a) == false)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                    return;
                }
                if (biz.UpdateActivity(a, a.Opportunity) == true)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                    Response.Redirect("ViewActivity.aspx?cid=" + Request.QueryString["cid"]
                                      + "&oid=" + Request.QueryString["oid"]
                                      + "&aid=" + Request.QueryString["aid"]
                                      , false);
                }
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }