Example #1
0
        private void PopulateClientDetails()
        {
            bizMessage bizM = new bizMessage();

            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(int.Parse(Request.QueryString["cid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (c == null)
            {
                return;
            }

            //client details
            this.lblClientName.Text  = c.ClientName;
            this.lblOfficePhone.Text = c.OfficePhone;
            if (c.Address == null)
            {
                this.lblAddress.Text     = "no address";
                this.lblAddress.CssClass = "page-text-nodata";
            }
            else
            {
                this.lblAddress.Text = c.Address + ", " + c.Location + " " + c.StateCode + " " + c.PostCode;
            }
            if (c.Industry != null)
            {
                this.lblAssociation.Text = c.Industry.IndustryName + " (" + c.Industry.AnzsicCode + ")";
            }
            if (c.AssociationCode != null)
            {
                this.lblAssociation.Text = c.Association.AssociationName;
            }

            //executive
            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);

            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")";

            if (c.Inactive == true)
            {
                this.lblClientName.Enabled       = false;
                this.lblOfficePhone.Enabled      = false;
                this.lblAddress.Enabled          = false;
                this.lblAssociation.Enabled      = false;
                this.lblAccountExecutive.Enabled = false;
            }
            else
            {
                this.lblClientName.Enabled       = true;
                this.lblOfficePhone.Enabled      = true;
                this.lblAddress.Enabled          = true;
                this.lblAssociation.Enabled      = true;
                this.lblAccountExecutive.Enabled = true;
            }
        }
Example #2
0
        private void PopulateClientDetails()
        {
            bizMessage bizM = new bizMessage();
            bizSetting bizS = new bizSetting();

            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(Convert.ToInt32(Request.QueryString["cid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (c == null)
            {
                return;
            }

            //general
            this.lblClientName.Text       = c.ClientName;
            this.lblOfficeFacsimilie.Text = c.OfficeFacsimilie;
            this.lblOfficePhone.Text      = c.OfficePhone;

            //address
            this.lblAddress.Text = c.Address + ", " + c.Location + " " + c.StateCode + " " + c.PostCode;

            //executive
            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);

            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")";

            //active contacts
            bizContact     bizA  = new bizContact();
            List <Contact> acons = c.Contacts.Where(co => co.Inactive == false).ToList();

            this.grvActiveContacts.DataSource = acons;
            this.ucMessanger1.ProcessMessages(bizA.MSGS, false);
            this.grvActiveContacts.DataBind();
            this.lblActiveContacts.Text = acons.Count.ToString();

            //inactive contacts
            bizContact     bizI  = new bizContact();
            List <Contact> icons = c.Contacts.Where(co => co.Inactive == true).ToList();

            this.grvInactiveContacts.DataSource = icons;
            this.ucMessanger1.ProcessMessages(bizI.MSGS, false);
            this.grvInactiveContacts.DataBind();
            this.lblInactiveContacts.Text = icons.Count.ToString();

            //buttons
            this.btnBack.PostBackUrl = "ViewClient.aspx?cid=" + c.ClientID.ToString();
        }
Example #3
0
        private void PopulateClientDetails()
        {
            bizMessage bizM = new bizMessage();
            bizSetting bizS = new bizSetting();

            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(Convert.ToInt32(Request.QueryString["cid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (c == null)
            {
                return;
            }

            //general
            this.lblClientName.Text       = c.ClientName;
            this.lblOfficeFacsimilie.Text = c.OfficeFacsimilie;
            this.lblOfficePhone.Text      = c.OfficePhone;

            //address
            this.lblAddress.Text = c.Address + ", " + c.Location + " " + c.StateCode + " " + c.PostCode;

            //executive
            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);

            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")";

            //open opportunities
            List <sp_web_ListClientOpenOpportunitiesResult> ooppos = biz.ListClientOpenOpportunities(c.ClientID);

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.grvOpenOpportunities.DataSource = ooppos;
            this.grvOpenOpportunities.DataBind();
            this.lblOpenOpportunities.Text = ooppos.Count.ToString();

            //open opportunities
            List <sp_web_ListClientClosedOpportunitiesResult> coppos = biz.ListClientClosedOpportunities(c.ClientID);

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.grvClosedOpportunities.DataSource = coppos;
            this.grvClosedOpportunities.DataBind();
            this.lblClosedOpportunities.Text = coppos.Count.ToString();

            //buttons
            this.btnBack.PostBackUrl = "ViewClient.aspx?cid=" + c.ClientID.ToString();
        }
        protected void grvContacts_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    Contact c = (Contact)e.Row.DataItem;

                    if (c.Mobile == "")
                    {
                        e.Row.Cells[4].Text     = "no mobile";
                        e.Row.Cells[4].CssClass = "lightgrey-italic";
                    }
                    if (c.DirectLine == "")
                    {
                        e.Row.Cells[5].Text     = "no direct line";
                        e.Row.Cells[5].CssClass = "lightgrey-italic";
                    }
                    if (c.Email == "")
                    {
                        e.Row.Cells[6].Text     = "no email address";
                        e.Row.Cells[6].CssClass = "lightgrey-italic";
                    }

                    bizClient biz    = new bizClient();
                    Client    client = biz.GetClient(c.ClientID);
                    if (client.PrimaryContactID == c.ContactID)
                    {
                        e.Row.Cells[3].CssClass = "blue-bold";
                    }

                    e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor = '#F4F3F0';this.style.cursor='hand';");
                    e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor = 'white';");
                    e.Row.Attributes["onClick"] = "location.href='ViewContact.aspx?cid=" + DataBinder.Eval(e.Row.DataItem, "ClientID") + "&coid=" + DataBinder.Eval(e.Row.DataItem, "ContactID") + "'";
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
        private void PopulateClientDetails()
        {
            bizMessage bizM = new bizMessage();
            bizSetting bizS = new bizSetting();

            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(Convert.ToInt32(Request.QueryString["cid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (c == null)
            {
                return;
            }

            //general
            this.lblClientCode.Text     = c.ClientCode;
            this.lblClientName.Text     = c.ClientName;
            this.lblRegisteredName.Text = c.RegisteredName;
            this.lblInsuredName.Text    = c.InsuredName;
            if (c.ABNACN != null)
            {
                this.lblABNACN.Text = c.ABNACN;
            }
            this.lblSource.Text           = c.Source;
            this.lblOfficeFacsimilie.Text = c.OfficeFacsimilie;
            this.lblOfficePhone.Text      = c.OfficePhone;

            //address
            if (c.Address == null)
            {
                this.lblAddress.Text     = "no address";
                this.lblAddress.CssClass = "page-text-nodata";
            }
            else
            {
                this.lblAddress.Text = c.Address + ", " + c.Location + " " + c.StateCode + " " + c.PostCode;
            }

            //industry
            if (c.AnzsicCode != null)
            {
                this.lblIndustry.Text = c.Industry.IndustryName + " (" + c.Industry.AnzsicCode + ")";
            }
            if (c.AssociationCode != null)
            {
                this.lblAssociationName.Text         = c.Association.AssociationName;
                this.lblAssociationMemberNumber.Text = c.AssociationMemberNumber;
            }

            //executive
            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);

            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            if (exec != null)
            {
                this.lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")";
            }
            else
            {
                this.lblAccountExecutive.Text = "<b>" + c.AccountExecutiveID + "</b>" + ", Unknown Branch (Unknown Region)";
            }
            //contacts
            bizContact     bizC = new bizContact();
            List <Contact> cons = c.Contacts.Where(co => co.Inactive == false).ToList();

            this.grvContacts.DataSource = cons;
            this.ucMessanger1.ProcessMessages(bizC.MSGS, false);
            this.grvContacts.DataBind();
            this.lblActiveContacts.Text   = cons.Count.ToString();
            this.lblInactiveContacts.Text = (c.Contacts.Count - cons.Count).ToString();

            //opportunities
            List <sp_web_ListClientOpenOpportunitiesResult> oppos = biz.ListClientOpenOpportunities(c.ClientID);

            this.grvOpportunities.DataSource = oppos;
            this.ucMessanger1.ProcessMessages(bizC.MSGS, false);
            this.grvOpportunities.DataBind();
            this.lblOpenOpportunities.Text = oppos.Count.ToString();
            List <sp_web_ListClientClosedOpportunitiesResult> coppos = biz.ListClientClosedOpportunities(c.ClientID);

            this.lblClosedOpportunities.Text = (coppos.Count).ToString();

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

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

            //buttons
            this.hplContactsSeeAll.NavigateUrl = "ClientContactsAll.aspx?cid=" + c.ClientID.ToString();
            if (c.Contacts.Count - cons.Count == 0)
            {
                this.hplContactsSeeAll.Enabled = false;
            }
            this.hplOpportunitiesSeeAll.NavigateUrl = "ClientOpportunitiesAll.aspx?cid=" + c.ClientID.ToString();
            if (coppos.Count == 0)
            {
                this.hplOpportunitiesSeeAll.Enabled = false;
            }
            this.btnAddContact.PostBackUrl     = "AddContact.aspx?cid=" + c.ClientID.ToString();
            this.btnAddOpportunity.PostBackUrl = "AddOpportunity.aspx?cid=" + c.ClientID.ToString();
            if (c.Inactive == true)
            {
                this.lblClientName.Enabled       = false;
                this.lblOfficePhone.Enabled      = false;
                this.lblAddress.Enabled          = false;
                this.lblOfficeFacsimilie.Enabled = false;
                this.btnAddContact.Enabled       = false;
                this.btnAddOpportunity.Enabled   = false;
                this.btnActiveInactive.Text      = "Activate";
                this.btnEditClient.Enabled       = false;
            }
            else
            {
                this.lblClientName.Enabled       = true;
                this.lblOfficePhone.Enabled      = true;
                this.lblAddress.Enabled          = true;
                this.lblOfficeFacsimilie.Enabled = true;
                this.btnAddContact.Enabled       = true;
                this.btnAddOpportunity.Enabled   = true;
                this.btnActiveInactive.Text      = "Inactivate";
                this.btnEditClient.Enabled       = true;
            }
            this.btnEditClient.PostBackUrl = "EditClient.aspx?cid=" + c.ClientID.ToString();
            this.btnTransfer.PostBackUrl   = "TransferClient.aspx?cid=" + c.ClientID.ToString();

            // SECURITY
            //sp_web_GetUserByIDResult exec = biz.GetAccountExecutive(c.AccountExecutiveID);
            //this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"];
            switch (user.Role)
            {
            case (int)Enums.enUserRole.Executive:
                if (user.Branch == exec.Branch)
                {
                    if (exec == null)
                    {
                    }
                    else if (user.DisplayName != exec.DisplayName)
                    {
                        DisableButtons();
                        DisableGrids();
                    }
                }
                else
                {
                    Response.Redirect("~/FindClient.aspx", false);
                    return;
                }
                break;

            case (int)Enums.enUserRole.Branch:
                if (exec == null)
                {
                }
                else if (user.Branch == exec.Branch)
                {
                    if (user.DisplayName != exec.DisplayName)
                    {
                        //DisableButtons();
                        //DisableGrids();
                    }
                }
                else
                {
                    Response.Redirect("~/FindClient.aspx", false);
                    return;
                }
                break;

            case (int)Enums.enUserRole.Region:
                if (exec == null)
                {
                    DisableButtons();
                    DisableGrids();
                }
                else if (user.Region == exec.Region)
                {
                    if (user.DisplayName != exec.DisplayName)
                    {
                        DisableButtons();
                        DisableGrids();
                    }
                }
                else
                {
                    Response.Redirect("~/FindClient.aspx", false);
                    return;
                }
                break;

            case (int)Enums.enUserRole.Company:
                if (exec == null)
                {
                    DisableButtons();
                    DisableGrids();
                }
                else if (user.DisplayName != exec.DisplayName)
                {
                    DisableButtons();
                    DisableGrids();
                }
                break;

            case (int)Enums.enUserRole.Administrator:
                // full access
                break;
            }
        }
        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();
        }
        private void PopulateClientDetails()
        {
            bizMessage bizM = new bizMessage();
            bizSetting bizS = new bizSetting();

            bizClient biz = new bizClient();
            Client    c;

            c = biz.GetClient(Convert.ToInt32(Request.QueryString["cid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (c == null)
            {
                return;
            }

            //read only
            this.lblClientName.Text       = c.ClientName;
            this.lblOfficeFacsimilie.Text = c.OfficeFacsimilie;
            this.lblOfficePhone.Text      = c.OfficePhone;
            if (c.Address == null)
            {
                this.lblAddress.Text     = "no address";
                this.lblAddress.CssClass = "page-text-nodata";
            }
            else
            {
                this.lblAddress.Text = c.Address + ", " + c.Location + " " + c.StateCode + " " + c.PostCode;
            }

            //executive
            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);

            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
            ucMessanger1.ProcessMessages(biz.MSGS, false);
            lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")";

            //general
            //this.ddlAccountExecutive.SelectedValue = c.AccountExecutiveID.ToString();
            this.txtClientCode.Text     = c.ClientCode;
            this.txtClientName.Text     = c.ClientName;
            this.txtRegisteredName.Text = c.RegisteredName;
            this.txtInsuredName.Text    = c.InsuredName;
            if (c.ABNACN != null)
            {
                this.txtABNACN.Text = c.ABNACN;
            }
            this.txtSource.Text           = c.Source;
            this.txtOfficeFacsimilie.Text = c.OfficeFacsimilie;
            this.txtOfficePhone.Text      = c.OfficePhone;

            //address
            this.txtAddress.Text = c.Address;
            if (c.Location != null)
            {
                this.ucAUPSS1.PostCode = c.PostCode;
                this.ucAUPSS1.SetSuburbAndStateCode(c.Location, c.StateCode);
                //this.ucAUPSS1.Suburb = c.Location;
                //this.ucAUPSS1.StateCode = c.StateCode;
                this.rblAddressTypes.SelectedIndex = 0;
            }
            else
            {
                this.rblAddressTypes.SelectedIndex = 1;
            }

            //industry
            if (c.AnzsicCode != null)
            {
                bizIndustry bizI = new bizIndustry();
                Industry    ind  = bizI.GetIndustry(c.AnzsicCode);
                this.ucMessanger1.ProcessMessages(bizI.MSGS, false);
                this.lstIndustry.Items.Add(new ListItem(ind.IndustryName + " (" + ind.AnzsicCode + ")", ind.AnzsicCode));
                this.lstIndustry.SelectedIndex = 0;
                if (this.lstIndustry.Items.Count > 0)
                {
                    this.lstIndustry.Visible = true;
                }
                PopulateAssociations();
                if (c.AssociationCode == null)
                {
                    this.ddlAssociation.SelectedIndex = 0;
                }
                else
                {
                    this.ddlAssociation.Items.RemoveAt(0);
                    this.ddlAssociation.SelectedValue = c.AssociationCode;
                }
                this.txtAssociationMemberNumber.Text = c.AssociationMemberNumber;
            }

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

            if (c.Modified.HasValue == true)
            {
                ((Main)Master).HeaderDetails += " / modified by "
                                                + bizActiveDirectory.GetUserFullName(c.ModifiedBy)
                                                + " (" + string.Format("{0:dd-MMM-yy}", c.Modified.Value) + ")";
            }
        }
Example #8
0
        private void PopulateContactDetails()
        {
            bizMessage bizM = new bizMessage();
            bizSetting bizS = new bizSetting();

            bizContact biz = new bizContact();
            Contact    c;

            c = biz.GetContact(Convert.ToInt32(Request.QueryString["coid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (c == null)
            {
                return;
            }

            //general
            this.txtContactName.Text    = c.ContactName;
            this.ddlTitle.SelectedValue = c.Title;
            this.txtMobile.Text         = c.Mobile;
            this.txtDirectLine.Text     = c.DirectLine;
            this.txtEmail.Text          = c.Email;

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

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

            bizClient bizC = new bizClient();
            Client    cl   = bizC.GetClient(int.Parse(Request.QueryString["cid"]));
            var       u    = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(cl.AccountExecutiveID);

            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
            this.ucMessanger1.ProcessMessages(bizC.MSGS, false);

            if (Session["USER"] == null)
            {
                this.ucMessanger1.ProcessMessage("Session: " + bizM.GetMessageText("SessionMissing"), Enums.enMsgType.Err, "", null, true);
                return;
            }
            bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"];

            switch (user.Role)
            {
            case (int)Enums.enUserRole.Executive:
                if (user.Branch == exec.Branch)
                {
                    if (user.DisplayName != exec.DisplayName)
                    {
                        this.btnSave.Visible = false;
                    }
                }
                else
                {
                    Response.Redirect("~/FindClient.aspx", false);
                    return;
                }
                break;

            case (int)Enums.enUserRole.Branch:
                if (user.Branch != exec.Branch)
                {
                    Response.Redirect("~/FindClient.aspx", false);
                    return;
                }
                break;

            case (int)Enums.enUserRole.Region:
                if (user.Region == exec.Region)
                {
                    this.btnSave.Visible = false;
                }
                else
                {
                    Response.Redirect("~/FindClient.aspx", false);
                    return;
                }
                break;

            case (int)Enums.enUserRole.Company:
                this.btnSave.Visible = false;
                break;

            case (int)Enums.enUserRole.Administrator:
                // full access
                break;
            }
        }
Example #9
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();



            /*
             *
             */
        }