コード例 #1
0
        private List <MyRequsitionListViewModel> MyRequisitionListView()
        {
            //GetRequisitionComplete();
            var employeeId = GetEmployeeId();

            var allRequisitions = _requisitionManager.Get(r => r.RequestedBy == employeeId || r.EmployeeId == employeeId).OrderByDescending(c => c.Id);


            //var requstionStatus = _requsitionStatusManager.GetAll();

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

            foreach (var requisition in allRequisitions)
            {
                var requisitionVM = new MyRequsitionListViewModel();
                requisitionVM.Id          = requisition.Id;
                requisitionVM.RequestType = requisition.RequestType;

                requisitionVM.RequestedBy  = requisition.RequestedBy == employeeId ? "Me" : GetEmployeeName(requisition.RequestedBy);
                requisitionVM.EmployeeName = requisition.EmployeeId == employeeId ? "Me" : GetEmployeeName(requisition.EmployeeId);


                requisitionVM.Form         = requisition.Form;
                requisitionVM.To           = requisition.To;
                requisitionVM.Description  = requisition.Description;
                requisitionVM.JourneyStart = requisition.JourneyStart;
                requisitionVM.JouneyEnd    = requisition.JouneyEnd;

                requisitionVM.Status = requisition.Status;
                requisitionViewList.Add(requisitionVM);
            }
            return(requisitionViewList);
        }
コード例 #2
0
        //[Authorize(Roles = "Driver")]
        public ActionResult MyDutyList()
        {
            var userEmployeeId = GetEmployeeId();

            ViewBag.UserEmployeeId = userEmployeeId;
            List <DriverDutyViewModel> assignedList = new List <DriverDutyViewModel>();

            if (userEmployeeId != 0)
            {
                var vehicle       = vehicleManager.GetAll();
                var vehicleStatus = vehicleStatusManager.Get(c => c.Status == "Assign").OrderByDescending(c => c.Id);
                var driverStatus  = driverStatusManager.Get(c => c.Status == "Assign").Where(e => e.EmployeeId == userEmployeeId).OrderByDescending(c => c.Id);
                var requsition    = _requisitionManager.Get(c => c.Status == "Assign").OrderByDescending(c => c.Id);

                var driverWithRequisition = from r in requsition
                                            join v in vehicleStatus on r.Id equals v.RequsitionId
                                            join driver in driverStatus on r.Id equals driver.RequsitionId
                                            select new
                {
                    r.Id,
                    r.RequsitionNumber,
                    r.Form,
                    r.To,
                    //Requestor = r.EmployeeId,
                    r.JourneyStart,
                    r.JouneyEnd,
                    v.VehicleId,
                    //Driver = driver.EmployeeId
                };

                foreach (var allData in driverWithRequisition)
                {
                    var assignVM = new DriverDutyViewModel();
                    assignVM.Id = allData.Id;
                    assignVM.RequsitionNumber = allData.RequsitionNumber;
                    assignVM.From             = allData.Form;
                    assignVM.To           = allData.To;
                    assignVM.JourneyStart = allData.JourneyStart;
                    assignVM.JouneyEnd    = allData.JouneyEnd;
                    assignVM.Vehicle      = vehicle.Where(c => c.Id == allData.VehicleId).FirstOrDefault();
                    assignedList.Add(assignVM);
                }
            }
            return(View(assignedList));
        }
コード例 #3
0
        private void GetMyRequisitionComments(int userEmployeeId)
        {
            var myRequsition = _requisitionManager.Get(c => c.EmployeeId == userEmployeeId).OrderByDescending(c => c.Id);
            var comments     = commentManager.Get(c => c.IsReceiverSeen == false).Where(c => c.ReceiverEmployeeId == userEmployeeId);

            var commentsWithRequisition = from r in myRequsition
                                          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> myUnseenCommentsList = new List <CountCommentViewModel>();

            foreach (var item in commentsWithRequisition)
            {
                var comment = new CountCommentViewModel();
                comment.Id = item.Id;
                comment.ReceiverEmployeeId = item.ReceiverEmployeeId;
                comment.Status             = item.Status;
                myUnseenCommentsList.Add(comment);
            }
            if (myUnseenCommentsList.Count(c => c.Status == null) == 0)
            {
                ViewBag.MyNewRequisitionComments = 0;
            }
            if (myUnseenCommentsList.Count(c => c.Status == null) > 0)
            {
                ViewBag.MyNewRequisitionComments = myUnseenCommentsList.Count(c => c.Status == null);
            }
            if (myUnseenCommentsList.Count(c => c.Status == "Assign") == 0)
            {
                ViewBag.MyAssignRequisitionComments = 0;
            }
            if (myUnseenCommentsList.Count(c => c.Status == "Assign") > 0)
            {
                ViewBag.MyAssignRequisitionComments = myUnseenCommentsList.Count(c => c.Status == "Assign");
            }
            if (myUnseenCommentsList.Count(c => c.Status == "Hold") == 0)
            {
                ViewBag.MyHoldRequisitionComments = 0;
            }
            if (myUnseenCommentsList.Count(c => c.Status == "Hold") > 0)
            {
                ViewBag.MyHoldRequisitionComments = myUnseenCommentsList.Count(c => c.Status == "Hold");
            }
        }
コード例 #4
0
        public ActionResult Complete()
        {
            var requsition = _requsitionManager.Get(c => c.Status == "Complete" && c.IsDeleted == false);
            var employee   = _employeeManager.Get(c => c.IsDriver == false);


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

            foreach (var Data in requsition)
            {
                var requsitionVM = new RequsitionViewModel();
                requsitionVM.Id           = Data.Id;
                requsitionVM.Employee     = employee.Where(c => c.Id == Data.EmployeeId).FirstOrDefault();
                requsitionVM.Description  = Data.Description;
                requsitionVM.JourneyStart = Data.JourneyStart;
                requsitionVM.JouneyEnd    = Data.JouneyEnd;
                requsitionVM.Form         = Data.Form;
                requsitionVM.To           = Data.To;
                requsitionViewModels.Add(requsitionVM);
            }

            return(View(requsitionViewModels));
        }