public IEnumerable <UserEventAdminListViewModel> UeListAllForAdmin() { UsersDAL userModel = new UsersDAL(); var model = db.tbl_UserEvent.ToList(); List <UserEventAdminListViewModel> liHomeView = new List <UserEventAdminListViewModel>(); foreach (var item in model) { UserEventAdminListViewModel ueModel = new UserEventAdminListViewModel(); ueModel.UserID = item.UserID; ueModel.UserFullName = userModel.GetUser(item.UserID).UserFullName; ueModel.UserPhone = userModel.GetUser(item.UserID).UserPhone; ueModel.UeDateExpires = item.UeDateExpires; ueModel.UeWillExpires = item.UeWillExpires; ueModel.UeNote = item.UeNote; ueModel.Loai = item.UeCount == (int)Enums.EventType.CongTac ? "Công Tác" : "Nghỉ Phép"; ueModel.Color = item.UeCount == 1 ? item.UeOk == true? "success": "default" : item.UeOk == true ? "success" : "danger"; ueModel.UeOk = item.UeOk; ueModel.UeID = item.UeID; ueModel.UeCount = item.UeCount; liHomeView.Add(ueModel); //Edit 0608 } return(liHomeView); }
public AttandanceViewModel ListAllOfUser(int userID) { UsersDAL uDao = new UsersDAL(); var user = uDao.GetUser(userID); var currentMonth = DateTime.Now.Month; AttandanceViewModel model = new AttandanceViewModel(); model.UserID = userID; model.ClientName = user.UserFullName; model.CongDung = TinhCong(currentMonth, userID, Enums.LoaiCong.CongDung); model.CongThem = TinhCong(currentMonth, userID, Enums.LoaiCong.CongThem); model.CongTre = TinhCong(currentMonth, userID, Enums.LoaiCong.CongTre); model.CongPhep = TinhCong(currentMonth, userID, Enums.LoaiCong.CongPhep); model.CurrentMonth = "Tháng " + currentMonth.ToString(); model.ListAttan = listAtOfUser(userID); model.DdlMonth = DdlMonth(DateTime.Now.Month); //var model = db.tbl_Attandance.Select(m => new AttandanceViewModel //{ // UserID = userID, // ClientName = user.UserFullName, // CongDung = TinhCong(userID, Enums.LoaiCong.CongDung), // CongThem = TinhCong(userID, Enums.LoaiCong.CongThem), // CongTre = TinhCong(userID, Enums.LoaiCong.CongTre), // CongPhep = TinhCong(userID, Enums.LoaiCong.CongPhep), // ListAttan = listAtOfUser(userID) //}); return(model); }
public IEnumerable <UserEventListHomeViewModel> UeListAllHome() { UsersDAL userModel = new UsersDAL(); //var model = db.tbl_UserEvent.Select(m => new UserEventListHomeViewModel //{ // UserID = m.UserID, // UserFullName = userModel.GetUser(m.UserID).UserFullName, // UserPhone = userModel.GetUser(m.UserID).UserPhone, // UeDateExpires = m.UeDateExpires, // UeWillExpires = m.UeWillExpires, // UeNote = m.UeNote, // Loai = m.UeCount == (int)Enums.EventType.CongTac ? "Công Tác" : "Nghỉ Phép", // Color = m.UeCount == 1 ? "success" : "default" //}).OrderByDescending(m=>m.UeDateExpires); var model = db.tbl_UserEvent.ToList(); List <UserEventListHomeViewModel> liHomeView = new List <UserEventListHomeViewModel>(); foreach (var item in model) { UserEventListHomeViewModel ueModel = new UserEventListHomeViewModel(); ueModel.UserID = item.UserID; ueModel.UserFullName = userModel.GetUser(item.UserID).UserFullName; ueModel.UserPhone = userModel.GetUser(item.UserID).UserPhone; ueModel.UeDateExpires = item.UeDateExpires; ueModel.UeWillExpires = item.UeWillExpires; ueModel.UeNote = item.UeNote; ueModel.Loai = item.UeCount == (int)Enums.EventType.CongTac ? "Công Tác" : "Nghỉ Phép"; ueModel.Color = item.UeCount == 1 ? "success" : "default"; liHomeView.Add(ueModel); } return(liHomeView); }