public ActionResult Scrubber()
        {
            ViewBag.IsFileError   = "false";
            ViewBag.CurrentUser   = this.CurrentLoggedInUser;
            ViewBag.LeadTypesList = leadService.GetLeadTypes().Where(x => x.IsActive == true).ToList().Select(x => new DropDownModel()
            {
                Name = x.Name,
                Id   = x.Id
            }).OrderBy(x => x.Name).ToList();
            var usedCredits      = userScrubService.GetScrubsByUserId(this.CurrentLoggedInUser.Id).Sum(x => x.ScrubCredits);
            var userTotalCredits = this.CurrentLoggedInUser.CreditScore;

            ViewBag.remainingCredits = LeadsHelpers.ToUsNumberFormat(userTotalCredits - usedCredits);
            ViewBag.totalCredits     = LeadsHelpers.ToUsNumberFormat(userTotalCredits);
            ViewBag.NoCredits        = false;
            return(View());
        }
Beispiel #2
0
        public ActionResult UserScrubsGrid(DateTime date)
        {
            var usersList = userService.GetUsers().ToList();
            var Leads     = leadService.GetLeadTypes().ToList();
            List <UserScrubsGridModel> retData = new List <UserScrubsGridModel>();
            var userScrubs = userScrubService.GetAllUserScrubs().OrderByDescending(x => x.CreatedDate).ToList().Where(x => x.CreatedDate.Date == date.Date);
            int iCount     = 0;

            foreach (var u in userScrubs)
            {
                iCount += 1;
                List <int> leadTypes       = JsonConvert.DeserializeObject <List <DropDownModel> >(u.LeadTypeIds).Select(x => x.Id).ToList();
                string     InputExtensions = u.InputFilePath.Split('.')[1];
                retData.Add(new UserScrubsGridModel()
                {
                    Sno          = iCount,
                    UserName     = usersList.Where(x => x.Id == u.UserId).FirstOrDefault().Name,
                    ScrubCredits = LeadsHelpers.ToUsNumberFormat(u.ScrubCredits),
                    CreatedAt    = u.CreatedDate.ToString("dd-MMM-yyyy hh:mm:ss tt"),
                    LeadType     = String.Join(",", Leads.Where(x => leadTypes.Contains(x.Id)).Select(x => x.Name).ToList()),
                    Matched      = "Input File  <a href='" + u.InputFilePath + "' style='cursor:pointer' download='InputFile-" + u.Id + "." + InputExtensions + "'><i class='fa fa-download' ></i></a><br>" + "Matched- " + u.MatchedCount + " <a href='" + u.MatchedPath + ".csv' style='cursor:pointer' download='Matched-" + u.Id + ".csv'><i class='fa fa-download' ></i></a><br>" + "Clean- " + u.UnMatchedCount + " <a href='" + u.UnMatchedPath + ".csv' style='cursor:pointer' download='UnMatched-" + u.Id + ".csv'><i class='fa fa-download' ></i></a>",
                });
            }
            var jsonData = new { data = from emp in retData select emp };

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