public ActionResult OperationalReport() { OperationalReportView view = new OperationalReportView(); view.FromDate = usDate.Date; view.ToDate = usDate.Date; view.IncludeTL = true; view.ExpSelectList = unitOfwork.SubmissionRule.Get().Select(s => new SelectListItem { Text = s.RS_Experience, Value = s.RS_Id.ToString() }).ToList(); view.ExpSelectList.Add(new SelectListItem { Text = "All", Value = "0" }); view.ExpSelectList = view.ExpSelectList .OrderBy(o => o.Value).ToList(); return(View(view)); }
public ActionResult OperationalReport(OperationalReportView operationalView) { DateTime fromDate = operationalView.FromDate; DateTime todate = operationalView.ToDate.AddDays(1); var recruterDepartment = new List <int>() { 12, 14, 21 }; //get the submissions for all users.. var submissions = unitOfwork.RIC_Job_Report.GetAll() .Where(s => s.RJ_Submit_Date >= fromDate && s.RJ_Submit_Date <= todate) .GroupBy(s => new { s.RJ_EmpCd, s.RJ_Submitted_By }).Select(s => new { EmpCd = s.Key.RJ_EmpCd, EmployeeName = s.Key.RJ_Submitted_By, Submissions = s.Count() }); //get the call statistics for all users. var calls = unitOfwork.CallStatistics .Get(s => s.RC_Date >= fromDate && s.RC_Date <= todate) .GroupBy(g => g.RC_Emp_Cd).Select(s => new { EmpCd = s.Key, CallConnectedIn = s.Where(f => f.RC_CallType == "In").Sum(sum => sum.RC_Call_Connected), VoiceMessageIn = s.Where(f => f.RC_CallType == "In").Sum(sum => sum.RC_Voice_Message), CallConnectedOut = s.Where(f => f.RC_CallType == "Out").Sum(sum => sum.RC_Call_Connected), VoiceMessageOut = s.Where(f => f.RC_CallType == "Out").Sum(sum => sum.RC_Voice_Message) }); int expID = int.Parse(operationalView.ExpSelected); // get the opearational repoart based on submission and call statistics. operationalView.FilterData = (from emp in unitOfwork.User.getAllUsers() .Where(s => (operationalView.RemoveInactiveMember || s.RE_Resign_Date == null) && (s.RIC_User_Role.FirstOrDefault().RIC_Role.RR_Role_Name != AdminRoleName) && (s.RIC_User_Role.FirstOrDefault().RIC_Role.RR_Role_Name != directorRoleName) && (s.RIC_User_Role.FirstOrDefault().RIC_Role.RR_Role_Name != HrRoleName) && (s.RIC_User_Role.FirstOrDefault().RIC_Role.RR_Role_Name != AccMgrRoleName) && (s.RMS_Department == null?false:recruterDepartment.Contains(s.RMS_Department.RD_ID)) && ((operationalView.IncludeTL) || s.RIC_User_Role.FirstOrDefault().RUR_Role_ID != tlRoleID) && ((operationalView.IncludeTL) || s.RIC_User_Role.FirstOrDefault().RUR_Role_ID != mgrRoleID) && (s.RE_Sub_Rule_ID == expID || expID == 0) ) join sub in submissions on emp.RE_Emp_Cd equals sub.EmpCd into sj from sSub in sj.DefaultIfEmpty() join call in calls on emp.RE_Emp_Cd equals call.EmpCd into sCa from sCall in sCa.DefaultIfEmpty() select new OperationalList() { EmpCd = emp.RE_Emp_Cd, EmployeeName = emp.RE_Jobdiva_User_Name, TeamLeadName = emp.ReportingTo, Submissions = sSub != null ? sSub.Submissions : 0, CallConnectedIn = sCall != null ? sCall.CallConnectedIn : 0, CallConnectedOut = sCall != null ? sCall.CallConnectedOut : 0, VoiceMessageIn = sCall != null ? sCall.VoiceMessageIn : 0, VoiceMessageOut = sCall != null ? sCall.VoiceMessageOut : 0 }).Where(filter => (operationalView.SubSelected == ">" ? filter.Submissions >= operationalView.Submissions : filter.Submissions <= operationalView.Submissions) && (operationalView.CallSelect == ">" ? filter.CallConnectedOut >= operationalView.Calls : filter.CallConnectedOut <= operationalView.Calls) ).ToList(); ViewBag.ShowTable = true; operationalView.ExpSelectList = unitOfwork.SubmissionRule.Get().Select(s => new SelectListItem { Text = s.RS_Experience, Value = s.RS_Id.ToString() }).ToList(); operationalView.ExpSelectList.Add(new SelectListItem { Text = "All", Value = "0" }); operationalView.ExpSelectList = operationalView.ExpSelectList .OrderBy(o => o.Value).ToList(); return(View(operationalView)); }