public ActionResult FilterContactSearchAdvanceCollaborator() { var user = UserContext.GetCurrentUser(); var branchId = UserContext.GetDefaultBranch(); var employeeType = user.IsCollaborator ? EmployeeType.Collaborator : user.IsConsultant ? EmployeeType.Consultant : EmployeeType.All; var userIds = user.UserID.ToString(); //if (user.IsCollaborator) //{ // if (user.GroupCollaboratorType == (int)GroupCollaboratorType.LeaderCollaborator) // userIds = string.Join(",", StoreData.ListUser.Where(c => c.GroupId == user.GroupId).Select(c => c.UserID).Distinct()); // else if (user.GroupCollaboratorType == (int)GroupCollaboratorType.ManagerCollaborator) // userIds = string.Empty; //} //else if (user.IsConsultant) //{ // if (user.GroupConsultantType == (int)GroupConsultantType.LeaderConsultant) // userIds = string.Join(",", StoreData.ListUser.Where(c => c.GroupId == user.GroupId).Select(c => c.UserID).Distinct()); // else if (user.GroupConsultantType == (int)GroupConsultantType.ManagerConsultant) // userIds = string.Empty; //} var levels = LevelRepository.GetAllWithContactCount(userIds, branchId, employeeType) ?? new List <LevelInfo>(); foreach (var level in StoreData.ListLevel.Where(c => !levels.Exists(p => p.LevelId == c.LevelId))) { levels.Add(level); } ViewBag.LevelWithContactCount = levels.OrderBy(c => c.LevelId).ToList(); return(View()); }
public List <LevelInfo> GetLevelWithContactCount(string userIds, int employeeTypeId) { var branchId = UserContext.GetDefaultBranch(); var employeeType = (EmployeeType)employeeTypeId; var levels = LevelRepository.GetAllWithContactCount(userIds, branchId, employeeType) ?? new List <LevelInfo>(); foreach (var level in StoreData.ListLevel.Where(c => !levels.Exists(p => p.LevelId == c.LevelId))) { levels.Add(level); } return(levels.OrderBy(c => c.LevelId).ToList()); }
//Danh sach contact public ActionResult FilterContactSearchAdvance() { #region "Log Checkpoint - Begin Load Danh sach contact cho TVTS 28/10/2016" int SessionLog = TmpJobReportRepository.GetSessionLog(); ViewBag.SessionLog = SessionLog; DateTime TimeBegin = DateTime.Now; ViewBag.TimeBegin = TimeBegin.ToString("dd/MM/yyyy HH:mm:ss:fff"); var logbegin = new LogDashBoard { Date = DateTime.Now.Date, Time = TimeBegin.ToString("dd/MM/yyyy HH:mm:ss:fff"), Name = "BEGIN_LOAD_DANH_SACH_CONTACT_TVTS", ContactId = 0, CreatedBy = UserContext.GetCurrentUser().UserID, Runtime = "0", Session = SessionLog, }; LogDashBoardRepository.CreateLogDashBoard(logbegin); #endregion var user = UserContext.GetCurrentUser(); var branchId = UserContext.GetDefaultBranch(); var employeeType = user.IsCollaborator ? EmployeeType.Collaborator : user.IsConsultant ? EmployeeType.Consultant : EmployeeType.All; var userIds = user.UserID.ToString(); var levels = LevelRepository.GetAllWithContactCount(userIds, branchId, employeeType) ?? new List <LevelInfo>(); foreach (var level in StoreData.ListLevel.Where(c => !levels.Exists(p => p.LevelId == c.LevelId))) { levels.Add(level); } ViewBag.LevelWithContactCount = levels.OrderBy(c => c.LevelId).ToList(); #region "Log Checkpoint - End Load Danh sach contact cho TVTS 28/10/2016 " DateTime TimeEnd = DateTime.Now; var logend = new LogDashBoard { Date = DateTime.Now.Date, Time = TimeEnd.ToString("dd/MM/yyyy HH:mm:ss:fff"), Name = "END_CONTROLLER_LOAD_DANH_SACH_CONTACT_TVTS", ContactId = 0, CreatedBy = UserContext.GetCurrentUser().UserID, Runtime = "0", Session = SessionLog, }; LogDashBoardRepository.CreateLogDashBoard(logend); #endregion return(View()); }
public ActionResult FilterContactTodayCollaborator() { //int totalExists; //int handoverCount; //int completeInCount; //int completeOutCount; //int notCompleteCount; var branchId = UserContext.GetDefaultBranch(); var userId = UserContext.GetCurrentUser().UserID.ToString(); //ContactRepository.ContactsFilterStatictsToday(userId, branchId, DateTime.Now, out handoverCount, out completeInCount, out completeOutCount, out notCompleteCount, EmployeeType.Collaborator); //ContactRepository.FilterTodayAll(userId, DateTime.Now.AddMonths(-1).AddDays(-1).Date, DateTime.Now.Date.AddSeconds(-1), branchId, EmployeeType.Collaborator, 1, 1, out totalExists); //ViewBag.HandoverCount = handoverCount; //ViewBag.CompleteInCount = completeInCount; //ViewBag.CompleteOutCount = completeOutCount; //ViewBag.NotCompleteCount = notCompleteCount; //ViewBag.TotalExists = totalExists; var user = UserContext.GetCurrentUser(); var employeeType = user.IsCollaborator ? EmployeeType.Collaborator : user.IsConsultant ? EmployeeType.Consultant : EmployeeType.All; var userIds = user.UserID.ToString(); //if (user.IsCollaborator) //{ // if (user.GroupCollaboratorType == (int)GroupCollaboratorType.LeaderCollaborator) // userIds = string.Join(",", StoreData.ListUser.Where(c => c.GroupId == user.GroupId).Select(c => c.UserID).Distinct()); // else if (user.GroupCollaboratorType == (int)GroupCollaboratorType.ManagerCollaborator) // userIds = string.Empty; //} //else if (user.IsConsultant) //{ // if (user.GroupConsultantType == (int)GroupConsultantType.LeaderConsultant) // userIds = string.Join(",", StoreData.ListUser.Where(c => c.GroupId == user.GroupId).Select(c => c.UserID).Distinct()); // else if (user.GroupConsultantType == (int)GroupConsultantType.ManagerConsultant) // userIds = string.Empty; //} var levels = LevelRepository.GetAllWithContactCount(userIds, branchId, employeeType) ?? new List <LevelInfo>(); foreach (var level in StoreData.ListLevel .Where(c => c.LevelId <= 3) .Where(c => !levels.Exists(p => p.LevelId == c.LevelId))) { levels.Add(level); } ViewBag.LevelWithContactCount = levels.OrderBy(c => c.LevelId).ToList(); return(View()); }