예제 #1
0
        public ActionResult Dashboard()
        {
            ViewBag.PayPalClientId = "AdpPKo_1ekKlG7W9Njp8INCxwYKhDACND1RMgZZzliXv0YjhFLCnZ507Jlu0F7LBPNHNIVmFHe4njTKl";
            ViewBag.CurrentUser    = this.CurrentLoggedInUser;
            ViewBag.PackagesList   = creditPackageService.GetAllCreditPackages().Where(x => x.IsActive == true).Select(x => new DropDownModel
            {
                Id     = x.Id,
                Name   = x.PackageName,
                Count  = x.Credits,
                Amount = x.Price
            }).ToList();

            return(View());
        }
예제 #2
0
        public ActionResult UserCreditLogsGrid(DateTime date)
        {
            List <UserCreditLogGridViewModel> retData = new List <UserCreditLogGridViewModel>();
            var userCreditLogs = userCreditLogsService.GetAllUserCreditLogs().ToList().Where(x => x.CreatedAt.Date == date.Date);
            var users          = userService.GetUsers().ToList();
            int iCount         = 0;

            foreach (var u in userCreditLogs)
            {
                var    thisUser       = users.Where(x => x.Id == u.UserId).FirstOrDefault();
                string ReferalDetails = string.Empty;
                if (thisUser.ReferedUserId.HasValue && thisUser.ReferedUserId.Value > 0)
                {
                    ReferalDetails = string.Format("Referral Bonus {0} to {1}", LeadsHelpers.ToUsNumberFormat(u.ReferalUserCredits), users.Where(x => x.Id == thisUser.ReferedUserId.Value).FirstOrDefault().Name);
                }
                iCount += 1;
                retData.Add(new UserCreditLogGridViewModel()
                {
                    SNo                = iCount,
                    Id                 = u.Id,
                    UserName           = thisUser.Name,
                    Date               = u.CreatedAt.ToString("dd-MMM-yyyy hh:mm:ss tt"),
                    CreatedAt          = u.CreatedAt,
                    Credits            = LeadsHelpers.ToUsNumberFormat(u.Credits),
                    DisCountPercentage = u.DiscountPercentage.ToString(),
                    AmountPaid         = Math.Round(u.FinalAmount, 2).ToString(),
                    PackageName        = creditPackageService.GetAllCreditPackages().FirstOrDefault(x => x.Id == u.PackageId).PackageName,
                    ReferalInfo        = ReferalDetails
                });
            }
            retData = retData.OrderByDescending(x => x.CreatedAt).ToList();
            var jsonData = new { data = from emp in retData select emp };

            return(new JsonResult()
            {
                Data = jsonData,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = Int32.MaxValue
            });
        }