Пример #1
0
        public ActionResult AssignDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Requsition requisition    = _requisitionManager.GetById((int)id);
            var        userEmployeeId = GetEmployeeId();

            ViewBag.UserEmployeeId = userEmployeeId;
            var driverId = driverStatusManager.Get(c => c.RequsitionId == id).Select(c => c.EmployeeId).FirstOrDefault();

            if (userEmployeeId != driverId)
            {
                TempData["msg"] = "Sorry, you have no permission to access this type of data!";
                return(RedirectToAction("MyDutyList"));
            }
            var vehicleId = vehicleStatusManager.Get(c => c.RequsitionId == id).Select(c => c.VehicleId).FirstOrDefault();

            AssignedListViewModel assignVm = new AssignedListViewModel
            {
                Requisition = requisition,
                Employee    = _employeeManager.GetById((int)requisition.EmployeeId),
                Driver      = _employeeManager.GetById(driverId),
                Vehicle     = vehicleManager.GetById(vehicleId)
            };

            GetCommentViewModelForInsertComment(requisition, userEmployeeId, assignVm);

            //Collect the list of comment to display the list under comment
            GetCommentList(requisition, assignVm);
            return(View(assignVm));
        }
        // GET: Requsition/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Requsition requsition = _requsitionManager.GetById((int)id);
            var        employee   = _employeeManager.Get(c => c.IsDriver == true && c.IsDeleted == false);
            var        manager    = _managerManager.GetAll();

            RequsitionViewModel requsitionViewModel = new RequsitionViewModel();

            requsitionViewModel.Id          = requsition.Id;
            requsitionViewModel.Form        = requsition.Form;
            requsitionViewModel.To          = requsition.To;
            requsitionViewModel.Description = requsition.Description;
            requsitionViewModel.Employee    = employee.Where(c => c.Id == requsition.EmployeeId).FirstOrDefault();
            requsitionViewModel.Manager     = manager.Where(c => c.RequsitionId == requsition.Id).FirstOrDefault();

            if (requsition == null)
            {
                return(HttpNotFound());
            }
            return(View(requsitionViewModel));
        }
        // GET: Requsition/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Requsition requsition = _requsitionManager.GetById((int)id);

            if (requsition == null)
            {
                return(HttpNotFound());
            }
            return(View(requsition));
        }
Пример #4
0
        }//details

        public ActionResult View(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var employee   = _employeeManager.GetAll();
            var requsition = _requsitionManager.GetById((int)id);

            RequsitionViewModel requsitionVM = new RequsitionViewModel()
            {
                Id           = requsition.Id,
                Form         = requsition.Form,
                To           = requsition.To,
                Description  = requsition.Description,
                JourneyStart = requsition.JourneyStart,
                JouneyEnd    = requsition.JouneyEnd,
                Employee     = employee.Where(x => x.Id == requsition.EmployeeId).FirstOrDefault()
            };

            requsition.Status = "Seen";
            _requsitionManager.Update(requsition);
            return(View(requsitionVM));
        }
Пример #5
0
        // GET: Requsition/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            int requsitionId = (int)id;

            Requsition requsition = _requisitionManager.GetById(requsitionId);

            if (requsition == null)
            {
                return(HttpNotFound());
            }
            var employee = _employeeManager.Get(c => c.IsDriver == true && c.IsDeleted == false);
            var manager  = _managerManager.GetAll();
            RequsitionViewModel requsitionViewModel = new RequsitionViewModel();

            requsitionViewModel.Id           = requsition.Id;
            requsitionViewModel.Form         = requsition.Form;
            requsitionViewModel.To           = requsition.To;
            requsitionViewModel.JourneyStart = requsition.JourneyStart;
            requsitionViewModel.JouneyEnd    = requsition.JouneyEnd;
            requsitionViewModel.Description  = requsition.Description;
            requsitionViewModel.Employee     = requsition.Employee;
            requsitionViewModel.Manager      = manager.FirstOrDefault(c => c.RequsitionId == requsition.Id);

            int?   emplId      = requsition.EmployeeId;
            string employeeNam = requsition.Employee.Name;

            requsitionViewModel.CommentViewModel = new CommentViewModel
            {
                EmployeeId   = (int)emplId,
                EmployeName  = employeeNam,
                RequsitionId = requsitionId
            };

            //Collect the list of comment to display the list under comment
            List <CommentViewModel> commentListViewModel = new List <CommentViewModel>();
            var commentListView = commentManager.GetCommentsByRequisition(requsitionId);

            foreach (var item in commentListView.ToList())
            {
                commentListViewModel.Add
                (
                    new CommentViewModel
                {
                    RequsitionId = requsitionId,
                    Comments     = item.Comments,
                    EmployeeId   = item.EmployeeId,
                    EmployeName  = item.Employee.Name,
                    UserName     = item.UserName,
                    CommentTime  = item.CommentTime
                }
                );
            }
            requsitionViewModel.CommentViewModels = commentListViewModel;

            return(View(requsitionViewModel));
        }