예제 #1
0
        private void PopuplateFollowUpsSummary()
        {
            bizActivity biz              = new bizActivity();
            int?        FollowUpsCount   = 0;
            int?        FollowUpsOverdue = 0;
            decimal?    SubmittedAmount  = 0;
            int?        SubmittedCount   = 0;
            int?        SubmittedOverdue = 0;

            bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"];
            if (user == null)
            {
                return;
            }

            var allString = "(All)";
            List <sp_web_FollowUpsResult> d1 = biz.GetFollowUps(user.UserName, 0, 0, -1, string.Join(",", new string[] { Enums.ActivityActions.Qualify.ToString(), Enums.ActivityActions.Recognise.ToString() }), allString, allString, true);
            List <sp_web_FollowUpsResult> d2 = biz.GetFollowUps(user.UserName, 0, 0, -1, string.Join(",", new string[] { Enums.ActivityActions.Contact.ToString(), Enums.ActivityActions.Discover.ToString(), Enums.ActivityActions.Respond.ToString() }), allString, allString, false);
            List <sp_web_FollowUpsResult> d3 = biz.GetFollowUps(user.UserName, 0, 0, -1, string.Join(",", new string[] { Enums.ActivityActions.Agree.ToString(), Enums.ActivityActions.Process.ToString() }), allString, allString, false);

            var _allQualify      = d1;
            var _allRespond      = d2.Where(x => x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();
            var _allComplete     = d3;
            var allOpportunities = _allQualify.Concat(_allRespond).Concat(_allComplete).Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();

            var quoted = _allRespond.Sum(x => (x.NetBrokerageQuoted.HasValue) ? x.NetBrokerageQuoted : 0);

            FollowUpsCount   = allOpportunities.Count;
            FollowUpsOverdue = allOpportunities.Where(x => x.FollowUpDate < DateTime.Today.Date).Count();
            SubmittedAmount  = quoted;
            SubmittedCount   = _allRespond.Count;
            SubmittedOverdue = _allRespond.Where(x => x.FollowUpDate < DateTime.Today.Date).Count();

            //   biz.FollowUpsSummary(user.UserName, ref FollowUpsCount, ref FollowUpsOverdue, ref SubmittedCount, ref SubmittedAmount, ref SubmittedOverdue);
            this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?1?", FollowUpsCount.ToString());
            if (this.Environment == "Production")
            {
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?2?", "<span class='header-line2-due'>(" + FollowUpsOverdue.ToString() + " due)</span>");
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?3?", "<span style='font-weight:bold;'>" + string.Format("{0:c}", SubmittedAmount) + "</span>");
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?4?", "<span style='font-weight:bold;'>" + SubmittedCount.ToString() + "</span>");
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?5?", "<span class='header-line2-due'>(" + SubmittedOverdue.ToString() + " due)</span>");
            }
            else
            {
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?2?", "<span class='header-line2-due-alt'>(" + FollowUpsOverdue.ToString() + " due)</span>");
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?3?", "<span style='font-weight:bold;'>" + string.Format("{0:c}", SubmittedAmount) + "</span>");
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?4?", "<span style='font-weight:bold;'>" + SubmittedCount.ToString() + "</span>");
                this.lblHeaderLine2.Text = this.lblHeaderLine2.Text.Replace("?5?", "<span class='header-line2-due-alt'>(" + SubmittedOverdue.ToString() + " due)</span>");
            }
        }
예제 #2
0
        private void PopulateFollowUps()
        {
            bizMessage bizM = new bizMessage();

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

            bizActivity biz = new bizActivity();
            var         u   = bizUser.GetAccountExecutiveIdBySmiUserName(ddlExecutive.SelectedValue);
            List <sp_web_FollowUpsResult> d1 = biz.GetFollowUps(u, int.Parse(this.ddlOAMPSIncome.SelectedValue), int.Parse(this.ddlBusinessType.SelectedValue), int.Parse(this.ddlFlagged.SelectedValue), string.Join(",", new string[] { Enums.ActivityActions.Qualify.ToString(), Enums.ActivityActions.Recognise.ToString() }), ddlRegion.SelectedValue, ddlBranch.SelectedValue, false);
            List <sp_web_FollowUpsResult> d2 = biz.GetFollowUps(u, int.Parse(this.ddlOAMPSIncome.SelectedValue), int.Parse(this.ddlBusinessType.SelectedValue), int.Parse(this.ddlFlagged.SelectedValue), string.Join(",", new string[] { Enums.ActivityActions.Contact.ToString(), Enums.ActivityActions.Discover.ToString(), Enums.ActivityActions.Respond.ToString() }), ddlRegion.SelectedValue, ddlBranch.SelectedValue, false);
            List <sp_web_FollowUpsResult> d3 = biz.GetFollowUps(u, int.Parse(this.ddlOAMPSIncome.SelectedValue), int.Parse(this.ddlBusinessType.SelectedValue), int.Parse(this.ddlFlagged.SelectedValue), string.Join(",", new string[] { Enums.ActivityActions.Agree.ToString(), Enums.ActivityActions.Process.ToString() }), ddlRegion.SelectedValue, ddlBranch.SelectedValue, false);

            //_allIdentify = d1.Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();
            _allQualify  = d1.Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();
            _allRespond  = d2.Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();
            _allComplete = d3.Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();

            estimated = _allQualify.Sum(x => (x.NetBrokerageEstimated.HasValue) ? x.NetBrokerageEstimated : 0);
            quoted    = _allRespond.Sum(x => (x.NetBrokerageQuoted.HasValue) ? x.NetBrokerageQuoted : 0);
            actual    = _allComplete.Sum(x => (x.NetBrokerageActual.HasValue) ? x.NetBrokerageActual : 0);

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


            // combine all results to have a filtered summery for the week
            var allFollowups            = _allQualify.Concat(_allRespond).Concat(_allComplete).Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();;
            var weekStartDate           = (DateTime.Now.AddDays(-(DateTime.Now.DayOfWeek - DayOfWeek.Monday)));
            var weekEndDate             = weekStartDate.AddDays(6);
            var weeklyFilteredFollowUps = allFollowups.Where(x =>
            {
                return(((x.FollowUpDate.HasValue) ?
                        (x.FollowUpDate.Value.Date >= weekStartDate.Date &&
                         x.FollowUpDate.Value.Date <= weekEndDate.Date) : false)

                       ||
                       ((x.OpportunityDue.HasValue) ?
                        DateTime.Now.Date >= x.OpportunityDue.Value.Date : false
                       )
                       );
            }).ToList();

            this.grvSummary.DataSource = weeklyFilteredFollowUps;
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);
            this.grvSummary.DataBind();

            // change the way the gridview displays the header
            AlterGridRendering(grvSummary);

            if (weeklyFilteredFollowUps.Count() <= this.grvSummary.PageSize)
            {
                this.lnkSeeAll0.Enabled = false;
            }
            else
            {
                this.lnkSeeAll0.Enabled = true;
            }
        }
예제 #3
0
        private void PopulateFollowUps()
        {
            var bizM = new bizMessage();

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

            var biz = new bizActivity();

            bool isRegion, isBranch, isAll;

            isRegion = isBranch = isAll = false;
            GridUtilities.SetUserAllowedOpportunities(user, ref isRegion, ref isBranch, ref isAll);

            var d1 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Recognise",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);
            var d2 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Qualify",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);
            var d3 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Contact",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);
            var d4 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Discover",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);
            var d5 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Respond",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);
            var d6 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Agree",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);
            var d7 = biz.GetFollowUps(ddlFilterExcutives.SelectedValue, int.Parse(ddlOAMPSIncome.SelectedValue),
                                      int.Parse(ddlBusinessType.SelectedValue), int.Parse(ddlFlagged.SelectedValue), "Process",
                                      ddlFilterRegion.SelectedValue, ddlFilterBranch.SelectedValue, isAll);


            _allIdentify =
                d1.Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate).ToList();
            _allQualify =
                d2.Concat(d1)
                .Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate)
                .ToList();
            _allRespond =
                d3.Concat(d4)
                .Concat(d5)
                .Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate)
                .ToList();
            _allComplete =
                d6.Concat(d7)
                .Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate)
                .ToList();

            // get the summary matrix for opprtunities
            decimal?estimated = 0, quoted = 0, actual = 0;
            int?    noOfOpportunities = 0;

            estimated = _allQualify.Sum(x => (x.NetBrokerageEstimated.HasValue) ? x.NetBrokerageEstimated : 0);
            quoted    = _allRespond.Sum(x => (x.NetBrokerageQuoted.HasValue) ? x.NetBrokerageQuoted : 0);
            actual    = _allComplete.Sum(x => (x.NetBrokerageActual.HasValue) ? x.NetBrokerageActual : 0);


            //biz.FollowUpsMatrix(user.UserName, string.Join(",", new string[] { Enums.ActivityActions.Qualify.ToString(), Enums.ActivityActions.Recognise.ToString() }),false,CalenderUtilities.CutOffDate, ref noOfOpportunities, ref estimated, ref quoted, ref actual);
            setFollowUpMatrix(lblQualifyMatrix, estimated, actual, _allQualify.Count,
                              Enums.ActivityActions.Qualify.ToString());

            //biz.FollowUpsMatrix(user.UserName, string.Join(",", new string[] { Enums.ActivityActions.Contact.ToString(), Enums.ActivityActions.Discover.ToString(), Enums.ActivityActions.Respond.ToString() }),false,CalenderUtilities.CutOffDate, ref noOfOpportunities, ref estimated, ref quoted, ref actual);
            setFollowUpMatrix(lblRespondMatrix, quoted, actual, _allRespond.Count,
                              Enums.ActivityActions.Contact.ToString());

            //biz.FollowUpsMatrix(user.UserName, string.Join(",", new string[] { Enums.ActivityActions.Agree.ToString(), Enums.ActivityActions.Process.ToString() }),false,CalenderUtilities.CutOffDate, ref noOfOpportunities, ref estimated, ref quoted, ref actual);
            setFollowUpMatrix(lblCompleteMatrix, quoted, actual, _allComplete.Count,
                              Enums.ActivityActions.Agree.ToString());


            //this.grvIdentified.DataSource = allIdentify;
            //this.ucMessanger1.ProcessMessages(biz.MSGS, true);
            //this.grvIdentified.DataBind();

            grvQualifiedIn.DataSource = _allQualify;
            ucMessanger1.ProcessMessages(biz.MSGS, true);
            grvQualifiedIn.DataBind();

            grvInterested.DataSource = _allRespond;
            ucMessanger1.ProcessMessages(biz.MSGS, true);
            grvInterested.DataBind();

            grvAccepted.DataSource = _allComplete;
            ucMessanger1.ProcessMessages(biz.MSGS, true);
            grvAccepted.DataBind();


            // combine all results to have a filtered summery for the week
            var allFollowups =
                d1.Concat(d2)
                .Concat(d3)
                .Concat(d4)
                .Concat(d5)
                .Concat(d6)
                .Where(x => x.OutcomeType != "C" && x.FollowUpDate >= CalenderUtilities.CutOffDate)
                .ToList();

            ;
            var weekStartDate           = (DateTime.Now.AddDays(-(DateTime.Now.DayOfWeek - DayOfWeek.Monday)));
            var weekEndDate             = weekStartDate.AddDays(6);
            var weeklyFilteredFollowUps = allFollowups.Where(x =>
            {
                return(((x.FollowUpDate.HasValue)
                    ? (x.FollowUpDate.Value.Date >= weekStartDate.Date &&
                       x.FollowUpDate.Value.Date <= weekEndDate.Date)
                    : false)
                       ||
                       ((x.OpportunityDue.HasValue)
                           ? DateTime.Now.Date >= x.OpportunityDue.Value.Date
                           : false
                       )
                       );
            }).ToList();

            grvSummary.DataSource = weeklyFilteredFollowUps;
            ucMessanger1.ProcessMessages(biz.MSGS, true);
            grvSummary.DataBind();

            // change the way the gridview displays the header
            AlterGridRendering(grvSummary);
            AlterGridRendering(grvQualifiedIn);
            AlterGridRendering(grvInterested);
            AlterGridRendering(grvAccepted);


            if (weeklyFilteredFollowUps.Count() <= grvSummary.PageSize)
            {
                lnkSeeAll0.Enabled = false;
            }
            else
            {
                lnkSeeAll0.Enabled = true;
            }
            lblQualifiedIn.Text = "Qualifying"; // + _allQualify.Count.ToString() + " active)";
            lnkSeeAll2.Enabled  = true;
            lblInterested.Text  = "Responding"; // + _allRespond.Count.ToString() + " active)";
            lnkSeeAll3.Enabled  = true;
            lblAccepted.Text    = "Completing"; // + _allComplete.Count.ToString() + " active)";
            lnkSeeAll6.Enabled  = true;
        }