// GET: ClientDashboard public ActionResult ClientDashboard(string korisnik) { ClientDashboardModel model = new ClientDashboardModel(); Session["OdabraniKlijent"] = ObjectId.Parse(korisnik); return(View(model)); }
public ActionResult DodajPlanIshrane(string planID) { ObjectId i = ObjectId.Parse(planID); ClientDashboardModel model = new ClientDashboardModel(); Korisnici.DodajPlanIshrane((ObjectId)Session["OdabraniKlijent"], i); return(View("~/Views/ClientDashboard/ClientDashboard.cshtml", model)); }
public ActionResult ClientTablePartial(int month) { ClientDashboardModel model = new ClientDashboardModel(); //get the employee code. string empCd = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name; var _user = unitOfWork.User.GetByEmpID(empCd);//get the role for user. string role = _user.RIC_User_Role.FirstOrDefault().RIC_Role.RR_Role_Name; //get the date of current month. DateTime date = SystemClock.US_Date.Date.AddMonths(month); DateTime startOfMonth = new DateTime(date.Year, date.Month, 1); DateTime endOfMonth = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month)); model.FromDate = startOfMonth; model.ToDate = endOfMonth; model.EmpCd = empCd; // DateTime endOfMonth2 = endOfMonth; endOfMonth = endOfMonth.AddDays(1);// add the days in end of month. // if end of month is greter than date then change the end of month to todays date. if (endOfMonth >= SystemClock.US_Date.Date) { endOfMonth = SystemClock.US_Date.Date.AddDays(1); } //get the submission ,interview and hire based on company. model.ClientTable = new List <ClintModelTable>(); model.ClientTable = unitOfWork.RIC_Job_Report.Get_JobRepoartForUser(empCd, startOfMonth, endOfMonth, role). GroupBy(s => s.RJ_Company, StringComparer.InvariantCultureIgnoreCase)// ignore the case of string. .Select(s => new ClintModelTable() { Company = s.Key, Submissions = s.Count(subCount => subCount.RJ_Submit_Date != null && subCount.RJ_Submit_Date >= startOfMonth && subCount.RJ_Submit_Date <= endOfMonth), Interviews = s.Count(intCount => intCount.RJ_Interview_Date != null && intCount.RJ_Interview_Date >= startOfMonth && intCount.RJ_Interview_Date <= endOfMonth), Hires = s.Count(hireCount => hireCount.RJ_Hire_Date != null && hireCount.RJ_Hire_Date >= startOfMonth && hireCount.RJ_Hire_Date <= endOfMonth), // FromDate=startOfMonth, // ToDate=endOfMonth2, // EmpCd=empCd }).ToList(); //get the total submission ,Interviews,Hires.. model.TotalSubmission = model.ClientTable.Sum(s => s.Submissions); model.TotalInterviews = model.ClientTable.Sum(s => s.Interviews); model.TotalHires = model.ClientTable.Sum(s => s.Hires); return(PartialView(model)); }