コード例 #1
0
        public ActionResult Index()
        {
            //GetRequisitionComplete();

            var allRequisitions = _requisitionManager.GetAll();
            var employee        = _employeeManager.GetAll();
            //var requstionStatus = _requsitionStatusManager.GetAll();

            List <RequsitionViewModel> requisitionViewList = new List <RequsitionViewModel>();

            foreach (var requisition in allRequisitions)
            {
                var requisitionVM = new RequsitionViewModel();
                requisitionVM.Id           = requisition.Id;
                requisitionVM.Form         = requisition.Form;
                requisitionVM.To           = requisition.To;
                requisitionVM.Description  = requisition.Description;
                requisitionVM.JourneyStart = requisition.JourneyStart;
                requisitionVM.JouneyEnd    = requisition.JouneyEnd;
                requisitionVM.Employee     = employee.Where(x => x.Id == requisition.EmployeeId).FirstOrDefault();
                requisitionVM.Status       = requisition.Status;
                requisitionViewList.Add(requisitionVM);
            }
            return(View(requisitionViewList));
        }
コード例 #2
0
        public ActionResult AssignIndex()
        {
            Manager manager    = new Manager();
            var     employee   = _employeeManager.GetAll();
            var     vehicle    = vehicleManager.GetAll();
            var     managers   = managerManager.GetAll();
            var     requsition = _requsitionManager.GetAll();

            List <ManagerViewModel> managerViewModels = new List <ManagerViewModel>();

            foreach (var allData in managers)
            {
                var managerVM = new ManagerViewModel();
                managerVM.Id         = allData.Id;
                managerVM.Employee   = employee.Where(c => c.Id == allData.EmployeeId).FirstOrDefault();
                managerVM.Vehicle    = vehicle.Where(c => c.Id == allData.VehicleId).FirstOrDefault();
                managerVM.Employee   = employee.Where(c => c.Id == allData.EmployeeId).FirstOrDefault();
                managerVM.Requsition = requsition.Where(c => c.Id == allData.RequsitionId).FirstOrDefault();
                managerViewModels.Add(managerVM);
            }

            return(View(managerViewModels));
        }
コード例 #3
0
        //[Authorize]
        public ActionResult Dashboard()
        {
            var userEmployeeId = GetEmployeeId();

            ViewBag.UserEmployeeId = userEmployeeId;


            var requsition = _requisitionManager.GetAll().OrderByDescending(c => c.Id);


            GetMyRequisitionComments(userEmployeeId);

            var comments = commentManager.Get(c => c.IsReceiverSeen == false).Where(c => c.ReceiverEmployeeId == userEmployeeId);

            var commentsWithRequisition = from r in requsition
                                          join c in comments on r.Id equals c.RequsitionId
                                          select new
            {
                r.Id,
                r.Status,
                c.SenderEmployee,
                c.SenderEmployeeId,
                c.ReceiverEmployeeId,
                c.ReceiverSeenTime,
                c.IsReceiverSeen
            };
            List <CountCommentViewModel> commentsList = new List <CountCommentViewModel>();

            foreach (var item in commentsWithRequisition)
            {
                var comment = new CountCommentViewModel();
                comment.Id = item.Id;
                comment.ReceiverEmployeeId = item.ReceiverEmployeeId;
                comment.Status             = item.Status;
                commentsList.Add(comment);
            }
            if (commentsList.Count(c => c.Status == null) == 0)
            {
                ViewBag.NewRequisitionComments = 0;
            }
            if (commentsList.Count(c => c.Status == null) > 0)
            {
                ViewBag.NewRequisitionComments = commentsList.Count(c => c.Status == null);
            }
            if (commentsList.Count(c => c.Status == "Assign") == 0)
            {
                ViewBag.AssignRequisitionComments = 0;
            }
            if (commentsList.Count(c => c.Status == "Assign") > 0)
            {
                ViewBag.AssignRequisitionComments = commentsList.Count(c => c.Status == "Assign");
            }
            if (commentsList.Count(c => c.Status == "Hold") == 0)
            {
                ViewBag.HoldRequisitionComments = 0;
            }
            if (commentsList.Count(c => c.Status == "Hold") > 0)
            {
                ViewBag.HoldRequisitionComments = commentsList.Count(c => c.Status == "Hold");
            }

            return(View());
        }