Ejemplo n.º 1
0
        private void SetTotalPayments()
        {
            var maxPayments = ActiveCourses.Max(c => c.Result.Payments.Max(p => p.Period));

            TotalPayments.Clear();

            for (int i = 0; i < maxPayments; i++)
            {
                var payments = GetPayments(i);
                var payment  = new Payment
                {
                    FundPayment = payments.Sum(p => p.FundPayment),
                    FundPaymentWithPriceIndex = payments.Sum(p => p.FundPaymentWithPriceIndex),
                    InterestPayment           = payments.Sum(p => p.InterestPayment),
                    InterestMonthPercentage   = 0,
                    InterestYearPercentage    = 0,
                    Period     = i + 1,
                    PriceIndex = payments.Max(p => p.PriceIndex),
                    TotalFund  = payments.Sum(p => p.TotalFund),
                    TotalFundWithPriceIndex = payments.Sum(p => p.TotalFundWithPriceIndex),
                    TotalPayment            = payments.Sum(p => p.TotalPayment),
                };
                TotalPayments.Add(payment);
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ActiveNotifications.DataSource = NotificationService.LoadActiveNotifications(SessionVariable.Current.Company.Id)
                                                 .OrderByDescending(x => x.StartDate).ToList();
                ActiveNotifications.DataBind();

                var activeCourses = EnrolService.LoadActiveEnrollments(SessionVariable.Current.User.Id).OrderBy(x => x.Session.Course.Name);
                ActiveCourses.DataSource = activeCourses;
                ActiveCourses.DataBind();

                if (activeCourses.Count() == 0)
                {
                    Panel1.Visible = false;
                }


                Panel2.Visible = false;


                var newCourses = SessionService.LoadNewSessions(SessionVariable.Current.Company.Id, SessionVariable.Current.User.UserType).OrderBy(x => x.Course.Name);
                NewCourses.DataSource = newCourses;
                NewCourses.DataBind();

                if (newCourses.Count() == 0)
                {
                    Panel3.Visible = false;
                }
            }
        }
Ejemplo n.º 3
0
 private void SetVariables()
 {
     Ratio              = Utils.Round2(ActiveCourses.Sum(c => c.Result.TotalReturn) / TotalLoan);
     MaxMonthReturn     = Utils.Round2(TotalPayments.Max(p => p.TotalPayment));
     MinMonthReturn     = Utils.Round2(TotalPayments.First().TotalPayment);
     TotalReturn        = Utils.Round2(ActiveCourses.Sum(p => p.Result.TotalReturn));
     TotalRemainingFund = Utils.Round2(ActiveCourses.Sum(p => p.Result.RemainingFund));
 }