Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucMessanger1.ClearMessages();
                this.ucMessanger1.UnmarkControls();

                bizMessage bizM = new bizMessage();
                if (this.lstExecutives.SelectedValue == "")
                {
                    this.ucMessanger1.ProcessMessage("Account Executive: " + bizM.GetMessageText("ValueNotSelected"), Enums.enMsgType.Err, "", null, true);
                    return;
                }

                bizClient biz = new bizClient();

                if (biz.TransferClient(int.Parse(Request.QueryString["cid"]), this.lstExecutives.SelectedValue) == true)
                {
                    Response.Redirect("FindClient.aspx", false);
                }
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
Esempio n. 2
0
        private void PopulateOpportunities()
        {
            var bizM = new bizMessage();

            var biz = new bizClient();
            var ss  = biz.FindOpportunities(txtFindOpportunity.Text);

            lstOpportunity.Items.Clear();
            if (txtFindOpportunity.Text != "")
            {
                foreach (var s in ss)
                {
                    lstOpportunity.Items.Add(new ListItem(s, s));
                }

                lstOpportunity.Visible     = true;
                divOpportunities.Visible   = true;
                lblFoundOpportunities.Text = lstOpportunity.Items.Count + " opportunities found";
            }
            else
            {
                lstOpportunity.Visible     = false;
                divSource.Visible          = false;
                lblFoundOpportunities.Text = "";
            }
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
0
        private void PopulateClientFromBA()
        {
            bizMessage bizM = new bizMessage();
            bizClient  biz  = new bizClient();
            List <sp_engage_get_clientResult> client;

            client = biz.GetClientFromBA(Request.QueryString["cc"].ToString());
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (client.Count == 1)
            {
                this.txtClientCode.Text = client[0].ClientCode;
                this.txtClientName.Text = client[0].ClientName;
                this.txtAddress.Text    = client[0].Address_Line_1 + "\n" +
                                          client[0].Address_Line_2 + "\n" +
                                          client[0].Address_Line_3;
                this.txtOfficePhone.Text      = client[0].Phone;
                this.txtOfficeFacsimilie.Text = client[0].Fax;
                this.txtABNACN.Text           = client[0].ABN;
                int result;
                if (int.TryParse(client[0].Postcode, out result) == true &&
                    client[0].Postcode.Length == 4)
                {
                    this.ucAUPSS1.PostCode = client[0].Postcode;
                }
                //if (this.ucAUPSS1.SuburbControl.Items.FindByValue(client[0].Suburb) != null)
                //{
                //    this.ucAUPSS1.Suburb = client[0].Suburb;
                //}
                this.txtSource.Text = "iBAIS";
                if (client[0].Anzsic_Code != "")
                {
                    this.txtFindIndustry.Text = client[0].Anzsic_Code;
                }
                PopulateIndustries();
                if (this.lstIndustry.Items.Count == 1)
                {
                    this.lstIndustry.SelectedIndex = 0;
                }
                if (client[0].ActiveClientInd.ToString() == "N")
                {
                    if (this.ddlBusinessType.Items.Count > 0)
                    {
                        this.ddlBusinessType.SelectedValue = this.ddlBusinessType.Items.FindByText("Reclaimed business").Value;
                    }
                }
                else
                {
                    if (this.ddlBusinessType.Items.Count > 0)
                    {
                        this.ddlBusinessType.SelectedValue = this.ddlBusinessType.Items.FindByText("New business (Existing clients)").Value;
                    }
                }
            }
        }
        private void PopulateContacts()
        {
            bizClient biz = new bizClient();
            List <sp_web_ListClientContactsResult> ccs = biz.ListClientContacts(int.Parse(Request.QueryString["cid"]));

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.ddlContact.Items.Add(new ListItem("-- Please Select --", ""));
            foreach (sp_web_ListClientContactsResult cc in ccs)
            {
                this.ddlContact.Items.Add(new ListItem(cc.ContactName, cc.ContactID.ToString()));
            }
        }
Esempio n. 6
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();
        }
Esempio n. 7
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();
        }
Esempio n. 8
0
        private void PopulateAssociations()
        {
            bizMessage bizM = new bizMessage();

            bizClient biz = new bizClient();
            IQueryable <Association> asss = biz.ListAssociationsByIndustry(this.lstIndustry.SelectedValue);

            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            this.ddlAssociation.Items.Clear();
            this.ddlAssociation.Items.Add(new ListItem("-- Please Select --", ""));
            foreach (Association ass in asss)
            {
                this.ddlAssociation.Items.Add(new ListItem(ass.AssociationName, ass.AssociationCode));
            }
        }
 protected void btnSetPrimary_Click(object sender, EventArgs e)
 {
     try
     {
         bizClient biz = new bizClient();
         if (biz.SetPrimaryContact(int.Parse(Request.QueryString["cid"]), int.Parse(Request.QueryString["coid"])) == true)
         {
             this.ucMessanger1.ProcessMessages(biz.MSGS, true);
         }
     }
     catch (Exception ex)
     {
         bizLog.InsertExceptionLog(ex);
         Response.Redirect("~/ErrorPage.aspx", false);
     }
 }
Esempio n. 10
0
        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);
            }
        }
Esempio n. 11
0
 protected void btnActiveInactive_Click(object sender, EventArgs e)
 {
     try
     {
         bizClient biz  = new bizClient();
         bool      flag = false;
         if (this.btnActiveInactive.Text == "Inactivate")
         {
             flag = true;
         }
         if (biz.SetInactiveField(int.Parse(Request.QueryString["cid"]), flag) == true)
         {
             PopulateClientDetails();
         }
         this.ucMessanger1.ProcessMessages(biz.MSGS, true);
     }
     catch (Exception ex)
     {
         bizLog.InsertExceptionLog(ex);
         Response.Redirect("~/ErrorPage.aspx", false);
     }
 }
Esempio n. 12
0
        private void SetControls()
        {
            ((Main)Master).HeaderTitle = "Add Client";
            bizSetting bizS = new bizSetting();

            ((Main)Master).HeaderDetails = "Client to be added by "
                                           + bizActiveDirectory.GetUserFullName(bizS.GetSetting(bizUser.GetCurrentUserNameWithoutDomain()))
                                           + " (Now)";
            //executive
            bizClient biz = new bizClient();

            bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"];
            bizUser.enGageUser exec = bizUser.GetAccountExecutive(user.SMIUserName);
            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")";
            //defaults
            this.ddlFlagged.SelectedValue = "false";

            if (Request.QueryString["name"] != null)
            {
                txtClientName.Text = HttpUtility.UrlDecode(Request.QueryString["name"]);
            }
        }
Esempio n. 13
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;
            }
        }
Esempio n. 14
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();



            /*
             *
             */
        }
Esempio n. 15
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;
            }

            //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) + ")";
            }
        }
Esempio n. 16
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);
            }
        }
Esempio n. 17
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.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;
            }
        }
Esempio n. 18
0
        private void LoadClientsBA()
        {
            bizMessage bizM = new bizMessage();

            //this.ucMessanger1.ClearMessages();

            if (this.txtSearchCriteria.Text == "")
            {
                this.ucMessanger1.ProcessMessage(bizM.GetMessageText("EmptyField"), Enums.enMsgType.Err, "SearchCriteria", typeof(TextBox), false);
                return;
            }

            bizSetting bizS       = new bizSetting();
            int        MaxRecords = int.Parse(bizS.GetSetting("FindClient.MaxRecords"));

            bizClient biz     = new bizClient();
            int?      records = 0;
            List <sp_engage_search_clientResult> clients = biz.FindClientInBA(this.txtSearchCriteria.Text
                                                                              , this.ddlClient.SelectedValue
                                                                              , char.Parse(this.ddlMatch.SelectedValue)
                                                                              , MaxRecords
                                                                              , ref records);

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);

            if (clients == null)
            {
                return;
            }

            if (records == 0)
            {
                this.btnAdd.Visible       = true;
                this.tdHeaderBA.Visible   = false;
                this.grvClientsBA.Visible = false;
                this.tdFooterBA.Visible   = false;
                this.ucMessanger1.ProcessMessage("iBAIS: " + bizM.GetMessageText("NoClientsFound"), Enums.enMsgType.Warn, "", null, false);
            }
            if (records > 0 && records <= MaxRecords)
            {
                this.btnAdd.Visible          = true;
                this.lblResultCountBA.Text   = clients.Count.ToString();
                this.lblSearchBA.Text        = this.txtSearchCriteria.Text;
                this.tdHeaderBA.Visible      = true;
                this.grvClientsBA.DataSource = clients;
                this.grvClientsBA.DataBind();
                this.grvClientsBA.Visible = true;
                this.tdFooterBA.Visible   = true;
                this.lnkBA.Enabled        = true;
                if (clients.Count <= this.grvClientsBA.PageSize)
                {
                    this.lnkBA.Enabled = false;
                }
                if (records == MaxRecords)
                {
                    this.ucMessanger1.ProcessMessage("iBAIS: " + bizM.GetMessageText("MaxClientsReached"), Enums.enMsgType.Warn, "", null, false);
                }
            }
            if (records > MaxRecords)
            {
                this.btnAdd.Visible       = false;
                this.tdHeaderBA.Visible   = false;
                this.grvClientsBA.Visible = false;
                this.tdFooterBA.Visible   = false;
                this.ucMessanger1.ProcessMessage("iBAIS: " + bizM.GetMessageText("TooManyClientsFound"), Enums.enMsgType.Warn, "", null, false);
            }
        }
Esempio n. 19
0
        private void LoadClients()
        {
            bizMessage biz = new bizMessage();

            this.ucMessanger1.ClearMessages();
            this.txtSearchCriteria.CssClass = "control";
            //this.ucMessanger1.UnmarkControls(); // todo: doesn't work
            this.grvClientsClientName.Visible = false;
            this.grvClientsAddress.Visible    = false;
            this.grvClientsIndustry.Visible   = false;

            if (this.txtSearchCriteria.Text == "")
            {
                this.ucMessanger1.ProcessMessage(biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, "SearchCriteria", typeof(TextBox), false);
                return;
            }

            bizSetting bizS       = new bizSetting();
            int        MaxRecords = int.Parse(bizS.GetSetting("FindClient.MaxRecords"));

            bizClient bizC    = new bizClient();
            int?      records = 0;
            List <sp_web_FindClientByFieldResult> clients = bizC.FindClientByField(this.txtSearchCriteria.Text
                                                                                   , this.ddlClient.SelectedValue
                                                                                   , char.Parse(this.ddlMatch.SelectedValue)
                                                                                   , null
                                                                                   , MaxRecords
                                                                                   , ref records);

            this.ucMessanger1.ProcessMessages(bizC.MSGS, true);

            if (clients == null)
            {
                return;
            }


            // get all users in AD

            var allusersResult = bizUser.GetUsersAccountExecutives(clients.Select <sp_web_FindClientByFieldResult, string>(x => x.AccountExecutiveID).Distinct().ToList());

            // change all clients
            clients.ForEach(
                x =>
            {
                if (x.AccountExecutiveID != "" && allusersResult.ContainsKey(x.AccountExecutiveID))
                {
                    bizUser.enGageUser exec = allusersResult[x.AccountExecutiveID];    //bizUser.GetAccountExecutive(x.AccountExecutiveID);
                    if (exec != null)
                    {
                        x.DisplayName = exec.DisplayName;
                    }
                    else
                    {
                        x.DisplayName = x.AccountExecutiveID;
                    }
                }
            }

                );

            List <sp_web_FindClientByFieldResult> cn  = clients.Where(c => c.Match == "client").ToList();
            List <sp_web_FindClientByFieldResult> add = clients.Where(c => c.Match == "address").ToList();
            List <sp_web_FindClientByFieldResult> ind = clients.Where(c => c.Match == "industry").ToList();

            if (records == 0)
            {
                this.btnAdd.Visible = true;

                this.tdHeaderCN.Visible  = false;
                this.tdFooterCN.Visible  = false;
                this.tdHeaderAD.Visible  = false;
                this.tdFooterAD.Visible  = false;
                this.tdHeaderIND.Visible = false;
                this.tdFooterIND.Visible = false;
                this.ucMessanger1.ProcessMessage("enGage: " + biz.GetMessageText("NoClientsFound"), Enums.enMsgType.Warn, "", null, false);
                // change the new postpack url
                btnAdd.PostBackUrl += "?name=" + HttpUtility.UrlEncode(this.txtSearchCriteria.Text);
                return;
            }

            if (records > 0 && records <= MaxRecords)
            {
                this.btnAdd.Visible = true;

                /*foreach (sp_web_FindClientByFieldResult c in cn)
                 * {
                 *  if (c.AccountExecutiveID != "")
                 *  {
                 *      bizUser.enGageUser exec = bizUser.GetAccountExecutive(c.AccountExecutiveID);
                 *      if (exec != null)
                 *          c.DisplayName = exec.DisplayName;
                 *      else
                 *          c.DisplayName = c.AccountExecutiveID;
                 *  }
                 * }
                 * foreach (sp_web_FindClientByFieldResult c in add)
                 * {
                 *  if (c.AccountExecutiveID != "")
                 *  {
                 *      bizUser.enGageUser exec = bizUser.GetAccountExecutive(c.AccountExecutiveID);
                 *      if (exec != null)
                 *          c.DisplayName = exec.DisplayName;
                 *      else
                 *          c.DisplayName = c.AccountExecutiveID;
                 *  }
                 * }
                 * foreach (sp_web_FindClientByFieldResult c in ind)
                 * {
                 *  if (c.AccountExecutiveID != "")
                 *  {
                 *      bizUser.enGageUser exec = bizUser.GetAccountExecutive(c.AccountExecutiveID);
                 *      if (exec != null)
                 *          c.DisplayName = exec.DisplayName;
                 *      else
                 *          c.DisplayName = c.AccountExecutiveID;
                 *  }
                 * }*/

                if (cn.Count == 0)
                {
                    this.tdHeaderCN.Visible           = false;
                    this.grvClientsClientName.Visible = false;
                    this.tdFooterCN.Visible           = false;
                }
                else
                {
                    this.lblResultCountCN.Text           = cn.Count.ToString();
                    this.lblSearchCN.Text                = this.txtSearchCriteria.Text;
                    this.tdHeaderCN.Visible              = true;
                    this.grvClientsClientName.DataSource = cn;
                    this.grvClientsClientName.DataBind();
                    this.grvClientsClientName.Visible = true;
                    this.tdFooterCN.Visible           = true;
                    this.lnkCN.Enabled = true;
                    if (cn.Count <= this.grvClientsClientName.PageSize)
                    {
                        this.lnkCN.Enabled = false;
                    }
                }
                if (add.Count == 0)
                {
                    this.tdHeaderAD.Visible        = false;
                    this.grvClientsAddress.Visible = false;
                    this.tdFooterAD.Visible        = false;
                }
                else
                {
                    this.lblResultCountAD.Text        = add.Count.ToString();
                    this.lblSearchAD.Text             = this.txtSearchCriteria.Text;
                    this.tdHeaderAD.Visible           = true;
                    this.grvClientsAddress.DataSource = add;
                    this.grvClientsAddress.DataBind();
                    this.grvClientsAddress.Visible = true;
                    this.tdFooterAD.Visible        = true;
                    this.lnkAD.Enabled             = true;
                    if (add.Count <= this.grvClientsAddress.PageSize)
                    {
                        this.lnkAD.Enabled = false;
                    }
                }
                if (ind.Count == 0)
                {
                    this.tdHeaderIND.Visible        = false;
                    this.grvClientsIndustry.Visible = false;
                    this.tdFooterIND.Visible        = false;
                }
                else
                {
                    this.lblResultCountIND.Text        = ind.Count.ToString();
                    this.lblSearchIND.Text             = this.txtSearchCriteria.Text;
                    this.tdHeaderIND.Visible           = true;
                    this.grvClientsIndustry.DataSource = ind;
                    this.grvClientsIndustry.DataBind();
                    this.grvClientsIndustry.Visible = true;
                    this.tdFooterIND.Visible        = true;
                    this.lnkIND.Enabled             = true;
                    if (ind.Count <= this.grvClientsIndustry.PageSize)
                    {
                        this.lnkIND.Enabled = false;
                    }
                }

                if (records == MaxRecords)
                {
                    this.ucMessanger1.ProcessMessage("enGage: " + biz.GetMessageText("MaxClientsReached"), Enums.enMsgType.Warn, "", null, false);
                }

                return;
            }
            if (records > MaxRecords)
            {
                this.btnAdd.Visible = false;

                this.tdHeaderCN.Visible  = false;
                this.tdFooterCN.Visible  = false;
                this.tdHeaderAD.Visible  = false;
                this.tdFooterAD.Visible  = false;
                this.tdHeaderIND.Visible = false;
                this.tdFooterIND.Visible = false;
                this.ucMessanger1.ProcessMessage("enGage: " + biz.GetMessageText("TooManyClientsFound"), Enums.enMsgType.Warn, "", null, false);
                return;
            }
        }
        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. 21
0
        private void LoadClients()
        {
            bizMessage bizM       = new bizMessage();
            bizSetting bizS       = new bizSetting();
            int        MaxRecords = int.Parse(bizS.GetSetting("FindClient.MaxRecords"));

            bizClient biz = new bizClient();

            this.ucMessanger1.ClearMessages();
            if (Request.QueryString["gr"] == "ba")
            {
                int?records = 0;
                List <sp_engage_search_clientResult> clients = biz.FindClientInBA(Request.QueryString["sc"]
                                                                                  , Request.QueryString["f1"]
                                                                                  , char.Parse(Request.QueryString["f2"])
                                                                                  , MaxRecords
                                                                                  , ref records);
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);

                if (clients == null)
                {
                    return;
                }

                this.grvClientsBA.DataSource = clients;
                this.grvClientsBA.DataBind();
                this.lblResultCount.Text = clients.Count.ToString();
            }
            else
            {
                int?records = 0;
                List <sp_web_FindClientByFieldResult> clients = biz.FindClientByField(Request.QueryString["sc"]
                                                                                      , Request.QueryString["f1"]
                                                                                      , char.Parse(Request.QueryString["f2"])
                                                                                      , Request.QueryString["gr"]
                                                                                      , MaxRecords
                                                                                      , ref records);
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);

                if (clients == null)
                {
                    return;
                }

                foreach (sp_web_FindClientByFieldResult c in clients)
                {
                    if (c.AccountExecutiveID != "")
                    {
                        using (Timeline.Capture("bizUser.GetAccountExecutive", "AD"))
                        {
                            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);
                            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
                            if (exec != null)
                            {
                                c.DisplayName = exec.DisplayName;
                            }
                            else
                            {
                                c.DisplayName = c.AccountExecutiveID;
                            }
                        }
                    }
                }
                this.grvClients.DataSource = clients;
                this.grvClients.DataBind();
                this.lblResultCount.Text = clients.Count.ToString();
            }

            this.lblSearch.Text      = Request.QueryString["sc"];
            this.btnBack.PostBackUrl = "FindClient.aspx?" +
                                       "sc=" + Request.QueryString["sc"] + "&" +
                                       "f1=" + Request.QueryString["f1"] + "&" +
                                       "f2=" + Request.QueryString["f2"];
        }
Esempio n. 22
0
        protected void grvClients_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    if (Session["USER"] == null)
                    {
                        return;
                    }

                    bizUser.enGageUser             user   = (bizUser.enGageUser)Session["USER"];
                    sp_web_FindClientByFieldResult client = (sp_web_FindClientByFieldResult)e.Row.DataItem;
                    bizClient          biz = new bizClient();
                    bizUser.enGageUser exec;

                    using (Timeline.Capture("bizUser.GetAccountExecutive", "AD"))
                    {
                        var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(client.AccountExecutiveID);
                        exec = bizUser.GetAccountExecutive(u);
                    }

                    //if (client.ClientName != null)
                    //{
                    //    if (client.ClientName.Length > 35) e.Row.Cells[2].Text = client.ClientName.Remove(33) + "..";
                    //}

                    //if (client.IndustryName != null)
                    //{
                    //    if (client.IndustryName.Length > 35) e.Row.Cells[3].Text = client.IndustryName.Remove(33) + "..";
                    //}

                    //if (e.Row.Cells[4].Text != "")
                    //{
                    //    if (e.Row.Cells[4].Text.Length > 15) e.Row.Cells[4].Text = e.Row.Cells[4].Text.Remove(13) + "..";
                    //}

                    //if (e.Row.Cells[5].Text != "")
                    //{
                    //    if (e.Row.Cells[5].Text.Length > 15) e.Row.Cells[5].Text = e.Row.Cells[5].Text.Remove(13) + "..";
                    //}

                    if (e.Row.Cells[5].Text != "")
                    {
                        e.Row.Cells[5].Text = Regex.Replace(e.Row.Cells[5].Text, Request.QueryString["sc"], "<b>" + Request.QueryString["sc"].ToUpper() + "</b>", RegexOptions.IgnoreCase);
                    }

                    if (client.Inactive == true)
                    {
                        e.Row.CssClass = "lightgrey";
                    }
                    else
                    {
                        if (client.FollowUpDate < DateTime.Now)
                        {
                            e.Row.Cells[2].CssClass = "ochre-bold";
                        }
                    }

                    // SECURITY
                    Image img = (Image)e.Row.FindControl("imgArrow");
                    switch (user.Role)
                    {
                    case (int)Enums.enUserRole.Executive:
                        if (exec != null)
                        {
                            if (user.DisplayName != exec.DisplayName)
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                            if (user.Branch != exec.Branch)
                            {
                                img.ImageUrl  = "~/images/ArrowHollowSmall.gif";
                                e.Row.Enabled = false;
                                if (client.Inactive == true)
                                {
                                    e.Row.CssClass = "lightgrey-italic";
                                }
                                else
                                {
                                    e.Row.CssClass = "darkgrey";
                                }
                            }
                        }
                        else
                        {
                            e.Row.CssClass = "darkgrey";
                            img.ImageUrl   = "~/images/ArrowHollowSmall.gif";
                            e.Row.Enabled  = false;
                            if (client.Inactive == true)
                            {
                                e.Row.CssClass = "lightgrey-italic";
                            }
                            else
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                        }
                        break;

                    case (int)Enums.enUserRole.Branch:
                        if (exec != null)
                        {
                            if (user.DisplayName != exec.DisplayName)
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                            if (user.Branch != exec.Branch)
                            {
                                img.ImageUrl  = "~/images/ArrowHollowSmall.gif";
                                e.Row.Enabled = false;
                                if (client.Inactive == true)
                                {
                                    e.Row.CssClass = "lightgrey-italic";
                                }
                                else
                                {
                                    e.Row.CssClass = "darkgrey";
                                }
                            }
                        }
                        else
                        {
                            e.Row.CssClass = "darkgrey";
                            img.ImageUrl   = "~/images/ArrowHollowSmall.gif";
                            //e.Row.Enabled = false;
                            if (client.Inactive == true)
                            {
                                e.Row.CssClass = "lightgrey-italic";
                            }
                            else
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                        }
                        break;

                    case (int)Enums.enUserRole.Region:
                        if (exec != null)
                        {
                            if (user.DisplayName != exec.DisplayName)
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                            if (user.Region != exec.Region)
                            {
                                img.ImageUrl  = "~/images/ArrowHollowSmall.gif";
                                e.Row.Enabled = false;
                                if (client.Inactive == true)
                                {
                                    e.Row.CssClass = "lightgrey-italic";
                                }
                                else
                                {
                                    e.Row.CssClass = "darkgrey";
                                }
                            }
                        }
                        else
                        {
                            e.Row.CssClass = "darkgrey";
                            img.ImageUrl   = "~/images/ArrowHollowSmall.gif";
                            e.Row.Enabled  = false;
                            if (client.Inactive == true)
                            {
                                e.Row.CssClass = "lightgrey-italic";
                            }
                            else
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                        }
                        break;

                    case (int)Enums.enUserRole.Company:
                        if (exec != null)
                        {
                            if (user.DisplayName != exec.DisplayName)
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                        }
                        else
                        {
                            e.Row.CssClass = "darkgrey";
                            img.ImageUrl   = "~/images/ArrowHollowSmall.gif";
                            e.Row.Enabled  = false;
                            if (client.Inactive == true)
                            {
                                e.Row.CssClass = "lightgrey-italic";
                            }
                            else
                            {
                                e.Row.CssClass = "darkgrey";
                            }
                        }
                        break;

                    case (int)Enums.enUserRole.Administrator:
                        // do nothing
                        if (exec == null)
                        {
                            //e.Row.CssClass = "darkgrey";
                            img.ImageUrl           = "~/images/ArrowHollowSmall.gif";
                            e.Row.Cells[4].Enabled = false;
                            //if (client.Inactive == true) e.Row.CssClass = "lightgrey-italic";
                            //else e.Row.CssClass = "darkgrey";
                        }
                        break;
                    }

                    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='ViewClient.aspx?cid=" + DataBinder.Eval(e.Row.DataItem, "ClientID") + "'";
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
Esempio n. 23
0
        private void InsertQuickCall()
        {
            Client    c   = new Client();
            bizClient biz = new bizClient();

            //CLIENT//
            //general
            c.Inactive = false;
            bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"];
            c.AccountExecutiveID = user.UserName;
            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)
            {
                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.AddedBy = bizUser.GetCurrentUserName();
            c.Added   = DateTime.Now;

            if (biz.ValidateClient(c) == false)
            {
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                return;
            }

            //CONTACT//
            Contact    cl   = new Contact();
            bizContact bizC = new bizContact();

            if (this.ckbAddContact.Checked == true)
            {
                //general
                cl.ContactName = this.txtContactName.Text;
                cl.Title       = this.ddlTitle.SelectedValue;
                cl.Mobile      = this.txtMobile.Text;
                cl.DirectLine  = this.txtDirectLine.Text;
                cl.Email       = this.txtEmail.Text;
                //audit
                cl.AddedBy = bizUser.GetCurrentUserName();
                cl.Added   = DateTime.Now;
            }

            if (this.ckbAddContact.Checked == true)
            {
                if (bizC.ValidateContact(cl) == false)
                {
                    this.ucMessanger1.ProcessMessages(bizC.MSGS, true);
                    return;
                }
                c.Contacts.Add(cl);
            }

            //OPPORTUNITY//
            Opportunity    o    = new Opportunity();
            bizOpportunity bizO = new bizOpportunity();

            //general
            o.OpportunityName = this.txtOpportunityName.Text;
            if (this.txtOpportunityDue.Text != "")
            {
                o.OpportunityDue = DateTime.Parse(this.txtOpportunityDue.Text);
            }
            o.IncumbentBroker  = this.txtIncumbentBroker.Text;
            o.IncumbentInsurer = this.txtIncumbentInsurer.Text;
            if (this.ddlClassification.SelectedValue != "")
            {
                o.ClassificationID = int.Parse(this.ddlClassification.SelectedValue);
            }
            if (this.ddlBusinessType.SelectedValue != "")
            {
                o.BusinessTypeID = int.Parse(this.ddlBusinessType.SelectedValue);
            }
            if (this.ddlFlagged.SelectedValue != "")
            {
                o.Flagged = bool.Parse(this.ddlFlagged.SelectedValue);
            }
            //o.NetBrokerageQuoted = decimal.Parse(this.txtNetBrokerageQuoted.Text);
            //o.NetBrokerageActual = decimal.Parse(this.txtNetBrokerageActual.Text);
            //audit
            o.AddedBy = bizUser.GetCurrentUserName();
            o.Added   = DateTime.Now;

            if (bizO.ValidateQuickQuoteOpportunity(o) == false)
            {
                this.ucMessanger1.ProcessMessages(bizO.MSGS, true);
                return;
            }
            c.Opportunities.Add(o);

            //ACTIVITY//
            bizActivity bizA = new bizActivity();
            char        ot   = 'S';
            List <sp_web_ListStatusesByOutcomeTypeResult> ss = bizA.ListStatusesByOutcomeType(ot);

            foreach (var s in ss)
            {
                Activity na = new Activity();
                //general
                na.OpportunityStatusID = s.StatusID;
                if (this.txtFollowUpDate.Text != "")
                {
                    na.FollowUpDate = DateTime.Parse(this.txtFollowUpDate.Text);
                }
                na.Inactive = false;
                if (s.StatusName == "Go-to-Market")
                {
                    na.ActivityNote = this.txtActivityNote.Text;
                }
                else
                {
                    na.ActivityNote = "Quick call";
                }
                //audit
                na.AddedBy = bizUser.GetCurrentUserName();
                na.Added   = DateTime.Now;
                o.Activities.Add(na);
                if (s.StatusName == "Go-to-Market")
                {
                    break;
                }
            }

            foreach (Activity na in o.Activities)
            {
                if (bizA.ValidateActivity(na, true) == false)
                {
                    this.ucMessanger1.ProcessMessages(bizA.MSGS, true);
                    return;
                }
            }

            int oid = biz.InsertClient(c);

            if (oid != 0)
            {
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                Response.Redirect("ViewClient.aspx?cid=" + oid.ToString(), false);
            }
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);
        }