예제 #1
0
        private void PopulateOpportunityDetails()
        {
            bizMessage     bizM = new bizMessage();
            bizSetting     bizS = new bizSetting();
            bizOpportunity biz  = new bizOpportunity();
            Opportunity    o;

            o = biz.GetOpportunity(int.Parse(Request.QueryString["oid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (o == null)
            {
                return;
            }

            switch (o.BusinessType.BusinessTypeName)
            {
            case Enums.enBusinessType.NewBusiness:
                this.imgBusinessType.ImageUrl = "~/images/OpportunityNewBusiness.gif";
                break;

            case Enums.enBusinessType.ReclaimedBusiness:
                this.imgBusinessType.ImageUrl = "~/images/OpportunityReclaimedBusiness.gif";
                break;

            case Enums.enBusinessType.ExistingClients:
                this.imgBusinessType.ImageUrl = "~/images/OpportunityExistingClients.gif";
                break;

            case Enums.enBusinessType.QuickQuote:
                this.imgBusinessType.ImageUrl = "~/images/OpportunityQuickQuote.gif";
                break;

            case Enums.enBusinessType.QuickWin:
                this.imgBusinessType.ImageUrl = "~/images/OpportunityQuickWin.gif";
                break;

            case Enums.enBusinessType.QuickCall:
                this.imgBusinessType.ImageUrl = "~/images/OpportunityQuickCall.gif";
                break;
            }

            this.imgFlagged.Visible = o.Flagged;
            if (o.Flagged == false)
            {
                this.btnFlagUnflag.Text = "Flag";
            }
            else
            {
                this.btnFlagUnflag.Text = "Un-Flag";
            }

            this.lblOpportunityName.Text = o.OpportunityName;
            this.lblOpportunityDue.Text  = string.Format("{0:dd-MMM-yy}", o.OpportunityDue);
            if (o.ContactID != null)
            {
                this.lblContact.Text = o.Contact.ContactName;
            }
            this.lblMemoNumber.Text = o.MemoNumber;
            if (o.ClassificationID != null)
            {
                this.lblClassification.Text = o.Classification.ClassificationName;
            }
            this.lblIncumbentBroker.Text      = o.IncumbentBroker;
            this.lblIncumbentUnderwriter.Text = o.IncumbentInsurer;
            this.lblNetBrokerageQuoted.Text   = string.Format("{0:C}", o.NetBrokerageQuoted);
            this.lblNetBrokerageActual.Text   = string.Format("{0:C}", o.NetBrokerageActual);

            List <sp_web_GetCurrentOpportunityStatusResult> s = biz.GetCurrentOpportunityStatus(o.OpportunityID);

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            if (s != null)
            {
                this.lblStatus.Text = s.First().StatusName;
            }

            bizActivity bizA = new bizActivity();

            this.lblNextActivity.Text = "";
            IList <sp_web_ListNextOpportunityStatusesResult> res = bizA.ListNextOpportunityStatuses(o.OpportunityID);

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            foreach (sp_web_ListNextOpportunityStatusesResult r in res)
            {
                this.lblNextActivity.Text += r.StatusName + ",";
            }
            char[] charsToTrim = { ',' };
            this.lblNextActivity.Text = this.lblNextActivity.Text.TrimEnd(charsToTrim);
            if (res.Count == 0)
            {
                IList <sp_web_ListCurrentOpportunityStatusesResult> rs = bizA.ListCurrentOpportunityStatuses(o.OpportunityID);
                this.ucMessanger1.ProcessMessages(biz.MSGS, false);
                foreach (sp_web_ListCurrentOpportunityStatusesResult r in rs)
                {
                    this.lblNextActivity.Text += r.StatusName + ",";
                }
                char[] chrsToTrim = { ',' };
                this.lblNextActivity.Text = this.lblNextActivity.Text.TrimEnd(chrsToTrim);
            }

            this.lblFollowUpCompleted.Text = string.Format("{0:dd-MMM-yy}", biz.GetCurrentFollowUpDate(o.OpportunityID));

            if (biz.IsOpportunityCompleted(o.OpportunityID) == true)
            {
                this.lblNextActivity.Text           = "None - Opportunity has been completed";
                this.lblFollowUpCompletedLabel.Text = "Completed:";
                this.lblFollowUpCompleted.Text      = string.Format("{0:dd-MMM-yy}", o.DateCompleted);
                this.btnAddActivity.Visible         = false;
            }

            this.lblActive.Text   = o.Activities.Where(a => a.Inactive == false).Count().ToString();
            this.lblInactive.Text = o.Activities.Where(a => a.Inactive == true).Count().ToString();
            if (int.Parse(this.lblInactive.Text) == 0)
            {
                this.lnkSeeAll.Enabled = false;
            }
            else
            {
                this.lnkSeeAll.Enabled = true;
            }

            //activities
            this.grvActivities.DataSource = biz.ListOpportunityActiveActivites(o.OpportunityID);
            this.ucMessanger1.ProcessMessages(biz.MSGS, false);
            this.grvActivities.DataBind();

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

            if (o.Modified.HasValue == true)
            {
                ((Main)Master).HeaderDetails += " / modified by "
                                                + bizActiveDirectory.GetUserFullName(o.ModifiedBy)
                                                + " (" + string.Format("{0:dd-MMM-yy}", o.Modified.Value) + ")";
            }
        }
예제 #2
0
        private void PopulateActivityDetails()
        {
            bizMessage  bizM = new bizMessage();
            bizSetting  bizS = new bizSetting();
            bizActivity biz  = new bizActivity();

            //status
            this.ddlOpportunityStatus.Items.Add(new ListItem("-- Please Select --", ""));
            List <sp_web_ListNextOpportunityStatusesResult> ss = biz.ListNextOpportunityStatuses(int.Parse(Request.QueryString["oid"]));

            foreach (sp_web_ListNextOpportunityStatusesResult s in ss)
            {
                this.ddlOpportunityStatus.Items.Add(new ListItem(s.StatusName, s.StatusID.ToString()));
            }
            if (ss.Count == 0) // pending
            {
                List <sp_web_ListCurrentOpportunityStatusesResult> cs = biz.ListCurrentOpportunityStatuses(int.Parse(Request.QueryString["oid"]));
                foreach (sp_web_ListCurrentOpportunityStatusesResult s in cs)
                {
                    this.ddlOpportunityStatus.Items.Add(new ListItem(s.StatusName, s.StatusID.ToString()));
                }
            }

            //bizClient bizC = new bizClient();
            //Client cc = bizC.GetClient(int.Parse(Request.QueryString["cid"]));
            //sp_web_GetUserByIDResult exec = bizC.GetAccountExecutive(cc.AccountExecutiveID);
            //this.ucMessanger1.ProcessMessages(bizC.MSGS, false);
            //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.Enabled = false;
            //                this.btnInactive.Enabled = 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.Enabled = false;
            //            this.btnInactive.Enabled = false;
            //        }
            //        else
            //        {
            //            Response.Redirect("~/FindClient.aspx", false);
            //            return;
            //        }
            //        break;
            //    case (int)Enums.enUserRole.Company:
            //        this.btnSave.Enabled = false;
            //        this.btnInactive.Enabled = false;
            //        break;
            //    case (int)Enums.enUserRole.Administrator:
            //        // full access
            //        break;
            //}
        }