Пример #1
0
        public async Task <ActionResult> AssignEmployeedToQuote(ManagerQuoteManagmentModel request)
        {
            var serviceRequest = await WeedHackersContext
                                 .ServiceRequests
                                 .SingleAsync(sr => sr.Id == request.ServiceRequest.Id);

            serviceRequest.LeadEmployeeId = request.ServiceRequest.LeadEmployeeId;

            foreach (int requestAssignedEmployeeId in request.AssignedEmployeeIds)
            {
                serviceRequest.AssignedEmployees.Add(await WeedHackersContext.Employees.SingleAsync(e => e.Id == requestAssignedEmployeeId));
            }

            WeedHackersContext.ServiceRequests.AddOrUpdate(sr => sr.Id, serviceRequest);
            var serviceStatus = await WeedHackersContext.ServiceStatuses.SingleAsync(ss => ss.Name == "In Progress");

            var serviceStatusUpdate = new ServiceRequestStatusUpdate
            {
                ServiceRequestId = serviceRequest.Id,
                Message          = "The Job is assigned and is in progress",
                ServiceStatusId  = serviceStatus.Id
            };


            WeedHackersContext.ServiceRequestStatusUpdates.Add(serviceStatusUpdate);
            await WeedHackersContext.SaveChangesAsync();

            return(RedirectToAction("QuotesManagement", new { Id = request.ServiceRequest.Id }));
        }
Пример #2
0
        public async Task <ActionResult> QuotesManagement(int Id)
        {
            ManagerQuoteManagmentModel model = new ManagerQuoteManagmentModel();

            var WeedHackSesh = System.Web.HttpContext.Current.Request.Cookies["WeedHackersSession"].Value;
            var UserDetails  = MvcApplication.Sessions[WeedHackSesh].User;
            var updateQuote  = await WeedHackersContext
                               .ServiceRequests
                               .Include(srsu => srsu.ServiceRequestStatusUpdates.Select(sv => sv.ServiceStatus))
                               .Include(s => s.Service)
                               .Include(e => e.LeadEmployee)
                               .Include(ea => ea.AssignedEmployees)
                               .Include(c => c.Customer)
                               .SingleAsync(sr => sr.Id == Id);

            model.ServiceRequest = updateQuote;
            model.Employees      =
                await WeedHackersContext.Employees.Where(
                    e => !e.Deleted && e.DepartmentId == updateQuote.Service.DepartmentId && e.EmployeeType.Name != "Manager" && e.EmployeeType.Name != "Service Advisor").ToListAsync();

            #region NavigationsForDepartmentManager

            //Navigation for an Employee
            model.SideNavModels.Add(new NavigationModel
            {
                Link  = Url.Action("ManagerHome", "Employee"),
                Title = "Profile Information",
                Icon  = "fa fa-user-circle-o",
                Class = ""
            });
            model.SideNavModels.Add(new NavigationModel
            {
                Link  = Url.Action("QuotesForManager", "Employee"),
                Title = "Accepted Quotes",
                Icon  = "fa fa-file-text",
                Class = "active"
            });
            model.SideNavModels.Add(new NavigationModel
            {
                Link  = Url.Action("Logout", "Security"),
                Title = "Sign Out",
                Icon  = "fa fa-plus",
                Class = ""
            });
            #endregion

            return(View(model));
        }