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);
            }
        }
        private void PopulateActivityDetails()
        {
            bizMessage  bizM = new bizMessage();
            bizSetting  bizS = new bizSetting();
            bizActivity biz  = new bizActivity();

            Activity a;

            a = biz.GetActivity(Convert.ToInt32(Request.QueryString["aid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (a == null)
            {
                return;
            }

            //general
            this.lblActivityStatus.Text = a.Status.StatusName;
            this.hidStatusID.Value      = a.OpportunityStatusID.ToString();
            this.txtActivityNote.Text   = a.ActivityNote;
            this.txtFollowUpDate.Text   = string.Format("{0:dd/MM/yyyy}", a.FollowUpDate);
            if (a.ContactID.HasValue == true)
            {
                this.ddlContact.SelectedValue = a.ContactID.ToString();
            }

            //audit
            ((Main)Master).HeaderDetails = "Activity added by "
                                           + bizActiveDirectory.GetUserFullName(a.AddedBy)
                                           + " (" + string.Format("{0:dd-MMM-yy}", a.Added) + ")";

            if (a.Modified.HasValue == true)
            {
                ((Main)Master).HeaderDetails += " / modified by "
                                                + bizActiveDirectory.GetUserFullName(a.ModifiedBy)
                                                + " (" + string.Format("{0:dd-MMM-yy}", a.Modified.Value) + ")";
            }

            ////inactive
            //if (a.Inactive == true)
            //{
            //    //general
            //    this.ddlOpportunityStatus.Enabled = false;
            //    this.txtActivityNote.Enabled = false;
            //    this.txtFollowUpDate.Enabled = false;
            //    this.btnFollowUpDate.Enabled = false;
            //    this.txtFollowUpNote.Enabled = false;
            //    //additional
            //    this.txtIncumbentBroker.Enabled = false;
            //    this.txtIncumbentInsurer.Enabled = false;
            //    this.ddlClassification.Enabled = false;
            //    this.txtNetBrokerageQuoted.Enabled = false;
            //    this.txtNetBrokerageActual.Enabled = false;
            //    this.txtDateCompleted.Enabled = false;
            //    this.btnDateCompleted.Enabled = false;
            //    this.txtMemoNumber.Enabled = false;
            //    this.txtClientCode.Enabled = false;
            //    //buttons
            //    this.btnSave.Enabled = false;
            //}
        }
Esempio n. 3
0
        protected void btnSetReminder_Click(object sender, EventArgs e)
        {
            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(int.Parse(Request.QueryString["cid"]));

            bizOpportunity biz2 = new bizOpportunity();
            Opportunity    o;

            o = biz2.GetOpportunity(int.Parse(Request.QueryString["oid"]));

            bizActivity biz3 = new bizActivity();
            Activity    a;

            a = biz3.GetActivity(Convert.ToInt32(Request.QueryString["aid"]));

            string subject = string.Format("enGage Follow-up: {0},{1} - {2}", c.ClientName, o.OpportunityName, a.Status.StatusName);

            //To do - set this to the name of the activity.

            DateTime startDate = DateTime.MinValue;
            DateTime endDate   = DateTime.MinValue;

            if (a.FollowUpDate != null)
            {
                startDate = DateTime.Parse(string.Format("{0} 08:00 AM", string.Format("{0:dd/MM/yyyy}", a.FollowUpDate)));
                endDate   = DateTime.Parse(string.Format("{0} 08:05 AM", string.Format("{0:dd/MM/yyyy}", a.FollowUpDate)));
            }

            string urlPort     = (HttpContext.Current.Request.Url.IsDefaultPort) ? "":":" + HttpContext.Current.Request.Url.Port.ToString();
            string activityURL = "http://" + HttpContext.Current.Request.Url.Host + urlPort + "/ViewActivity.aspx?";

            List <string> queryStringList = new List <string>();

            if (!string.IsNullOrEmpty(Request.QueryString["cid"]))
            {
                queryStringList.Add(String.Format("cid={0}", Request.QueryString["cid"]));
            }

            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                queryStringList.Add(String.Format("oid={0}", Request.QueryString["oid"]));
            }

            if (!string.IsNullOrEmpty(Request.QueryString["aid"]))
            {
                queryStringList.Add(String.Format("aid={0}", Request.QueryString["aid"]));
            }


            activityURL += string.Join("&", queryStringList.ToArray());

            string t = "BEGIN:VCALENDAR\n" +
                       "PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN\n" +
                       "VERSION:2.0\n" +
                       "BEGIN:VEVENT\n" +
                       "DTSTART:" + startDate.ToUniversalTime().ToString("yyyyMMddTHHmmssZ") + "\n" +
                       "DTEND:" + endDate.ToUniversalTime().ToString("yyyyMMddTHHmmssZ") + "\n" +
//"LOCATION:My office\n" +
//"CATEGORIES:Business\n" +
                       "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + Helper.CalenderUtilities.EncodeQuotedPrintable("Activity Note: " + a.ActivityNote + "\n\n" + activityURL) + "=0D=0A\n" +
                       "SUMMARY:" + subject + "\n" +
                       "PRIORITY:3\n" +
                       "END:VEVENT\n" +
                       "END:VCALENDAR";

            Response.Clear();
            Response.ContentType = "application/VCS";
            Response.AddHeader("content-disposition", "attachment; filename=\"calendar.vcs\"");
            Response.Write(t.ToString());
            Response.End();



            /*
             *
             */
        }
        protected void SetReminder()
        {
            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(int.Parse(Request.QueryString["cid"]));

            bizOpportunity biz2 = new bizOpportunity();
            Opportunity    o;

            o = biz2.GetOpportunity(int.Parse(Request.QueryString["oid"]));

            bizActivity biz3 = new bizActivity();
            Activity    a;

            a = biz3.GetActivity(int.Parse(Request.QueryString["aid"]));

            string subject = string.Format("Client Follow-up: {0}, {1} - {2}", c.ClientName, o.OpportunityName, a.Status.StatusName);

            //To do - set this to the name of the activity.

            DateTime startDate = DateTime.MinValue;
            DateTime endDate   = DateTime.MinValue;

            if (a.FollowUpDate != null)
            {
                startDate = DateTime.Parse(string.Format("{0} 08:00 AM", string.Format("{0:dd/MM/yyyy}", a.FollowUpDate)));
                endDate   = DateTime.Parse(string.Format("{0} 08:05 AM", string.Format("{0:dd/MM/yyyy}", a.FollowUpDate)));
            }

            string urlPort     = (HttpContext.Current.Request.Url.IsDefaultPort) ? "" : ":" + HttpContext.Current.Request.Url.Port.ToString();
            string activityURL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path).Replace(Request.Url.Segments[Request.Url.Segments.Length - 1], "") + "ViewOpportunity.aspx?";

            List <string> queryStringList = new List <string>();

            if (!string.IsNullOrEmpty(Request.QueryString["cid"]))
            {
                queryStringList.Add(String.Format("cid={0}", Request.QueryString["cid"]));
            }

            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                queryStringList.Add(String.Format("oid={0}", Request.QueryString["oid"]));
            }

            queryStringList.Add(String.Format("aid={0}", Request.QueryString["aid"]));



            activityURL += string.Join("&", queryStringList.ToArray());
            var htmltab        = @"&nbsp\;";
            var opportunityDue = ((a.Opportunity.OpportunityDue.HasValue) ? @"<br><B>Renewal Date :</B> " + htmltab + a.Opportunity.OpportunityDue.Value.ToString("dd/MM/yyyy") + "<br>" : "<br>");

            string t = "BEGIN:VCALENDAR\n" +
                       "PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN\n" +
                       "VERSION:2.0\n" +
                       "BEGIN:VEVENT\n" +
                       "DTSTART:" + startDate.ToUniversalTime().ToString("yyyyMMddTHHmmssZ") + "\n" +
                       "DTEND:" + endDate.ToUniversalTime().ToString("yyyyMMddTHHmmssZ") + "\n" +
                       //"LOCATION:My office\n" +
                       //"CATEGORIES:Business\n" +
                       "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + Helper.CalenderUtilities.EncodeQuotedPrintable("Currently at:" + a.Status.StatusName + "\n" +
                                                                                                                 ((a.Opportunity.OpportunityDue.HasValue) ? "Renewal Date : " + a.Opportunity.OpportunityDue.Value.ToString("dd/MM/yyyy") + "\n" : "") +
                                                                                                                 "Activity Note: " + a.ActivityNote + "\n\n" + activityURL) + "=0D=0A\n" +
                       "SUMMARY:" + subject + "\n" +
                       "PRIORITY:0\n" +
                       "X-ALT-DESC;FMTTYPE=text/html:" + @"<!DOCTYPE HTML PUBLIC \""-//W3C//DTD HTML 3.2//EN\"">\n<HTML>\n<HEAD>\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n" +
                       "<b>Currently at:</b> " + htmltab + a.Status.StatusName +
                       opportunityDue +
                       @"<br><b>Activity Note:</b> " + htmltab + a.ActivityNote + "<br><br>" + "<A HREF=\"" + HttpUtility.UrlEncode(activityURL) + "\">" + activityURL + "</A>" + "<br>" + "</BODY>\n</HTML> " +
                       "X-MICROSOFT-CDO-BUSYSTATUS:FREE" +
                       "TRIGGER:-PT15M" +
                       "END:VEVENT" +
                       "END:VCALENDAR";

            var tempPage = new Page();

            Response.Clear();
            Response.ContentType = "application/VCS";
            Response.AddHeader("content-disposition", "attachment; filename=\"calendar.vcs\"");
            Response.Write(t.ToString());
            Response.Flush();
            // Response.End();
        }
Esempio n. 5
0
        private void PopulateActivityDetails()
        {
            bizMessage  bizM = new bizMessage();
            bizSetting  bizS = new bizSetting();
            bizActivity biz  = new bizActivity();

            Activity a;

            a = biz.GetActivity(Convert.ToInt32(Request.QueryString["aid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (a == null)
            {
                return;
            }

            this.lblActivityStatus.Text = a.Status.StatusName;
            this.lblActivityNote.Text   = a.ActivityNote.Replace("\n", "<br />");
            this.lblFollowUpDate.Text   = string.Format("{0:dd-MMM-yy}", a.FollowUpDate);
            if (a.ContactID.HasValue == true)
            {
                this.lblContact.Text = a.Contact.ContactName;
            }

            ((Main)Master).HeaderDetails = "Activity added by "
                                           + bizActiveDirectory.GetUserFullName(a.AddedBy)
                                           + " (" + string.Format("{0:dd-MMM-yy}", a.Added) + ")";

            if (a.Modified.HasValue == true)
            {
                ((Main)Master).HeaderDetails += " / modified by "
                                                + bizActiveDirectory.GetUserFullName(a.ModifiedBy)
                                                + " (" + string.Format("{0:dd-MMM-yy}", a.Modified.Value) + ")";
            }

            //inactive
            if (a.Inactive == true)
            {
                this.tblActivity.Disabled    = true;
                this.btnInactivate.Visible   = false;
                this.btnSendEmail.Visible    = false;
                this.btnAddActivity.Visible  = false;
                this.btnEditActivity.Visible = false;
            }
            else
            {
                if (biz.GetInitialStatus().StatusID == a.OpportunityStatusID)
                {
                    this.btnInactivate.Visible = false;
                }

                if (this.lblOpportunityStatus.Text != this.lblActivityStatus.Text)
                {
                    this.btnInactivate.Visible = false;
                }

                this.btnSendEmail.Visible = a.ContactID.HasValue;
                if (a.ContactID.HasValue == true)
                {
                    if (a.Contact.Email != "")
                    {
                        this.btnSendEmail.OnClientClick = "javascript:location.href='mailto:" + a.Contact.Email + "'";
                    }
                }
            }
        }