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 na = new Activity(); //general na.OpportunityID = int.Parse(Request.QueryString["oid"]); if (this.ddlOpportunityStatus.SelectedValue != "") { na.OpportunityStatusID = int.Parse(this.ddlOpportunityStatus.SelectedValue); } na.ActivityNote = this.txtActivityNote.Text; if (this.txtFollowUpDate.Text != "") { na.FollowUpDate = DateTime.Parse(this.txtFollowUpDate.Text); } na.Inactive = false; if (this.ddlContact.SelectedValue != "") { na.ContactID = int.Parse(this.ddlContact.SelectedValue); } //additional Opportunity no = new Opportunity(); Client nc = new Client(); switch (this.ddlOpportunityStatus.SelectedItem.Text) { case "Identified": break; case "Qualified-in": break; case "Qualified-out": no.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text); break; case "Interested": no.OpportunityDue = DateTime.Parse(this.txtOpportunityDue.Text); no.IncumbentBroker = this.txtIncumbentBroker.Text; no.IncumbentInsurer = this.txtIncumbentInsurer.Text; no.ClassificationID = int.Parse(this.ddlClassification.SelectedValue); break; case "Not Interested": no.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text); break; case "Go-to-Market": break; case "Revisit next year": no.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text); break; case "Quoted": no.NetBrokerageQuoted = decimal.Parse(this.txtNetBrokerageQuoted.Text); break; case "Can't Place": no.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text); break; case "Accepted": no.NetBrokerageActual = decimal.Parse(this.txtNetBrokerageActual.Text); break; case "Lost": no.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text); break; case "Processed": no.DateCompleted = DateTime.Parse(this.txtDateCompleted.Text); no.MemoNumber = this.txtMemoNumber.Text; nc.ClientCode = this.txtClientCode.Text; break; default: // all pending statuses break; } //audit na.AddedBy = bizUser.GetCurrentUserName(); na.Added = DateTime.Now; //action if (biz.ValidateActivity(na) == false) { this.ucMessanger1.ProcessMessages(biz.MSGS, true); return; } int aid = biz.InsertActivity(na, no, nc, no); if (aid != 0) { this.ucMessanger1.ProcessMessages(biz.MSGS, true); Response.Redirect("ViewActivity.aspx?cid=" + Request.QueryString["cid"] + "&oid=" + Request.QueryString["oid"] + "&aid=" + aid.ToString() , false); } this.ucMessanger1.ProcessMessages(biz.MSGS, true); } catch (Exception ex) { bizLog.InsertExceptionLog(ex); Response.Redirect("~/ErrorPage.aspx", false); } }