Ejemplo n.º 1
0
        // GET: Purchase
        public ActionResult Index()
        {
            var list = (from o in db.Orders
                        where o.Employee.Email == User.Identity.Name
                        join s in db.SupervisorApprovals
                        on o.ID equals s.ID
                        into ThisList
                        from s in ThisList.DefaultIfEmpty()
                        select new
            {
                EmployeeName = o.Employee.FirstName + " " + o.Employee.LastName,
                SupervisorName = s.Employee.FirstName + " " + s.Employee.LastName,
                StatusName = o.Status.StatusName,
                CategoryName = o.Category.CategoryName,
                BudgetCodeName = o.BudgetCode.BudgetCodeName,
                DateMade = o.DateMade,
                DateOrdered = o.DateOrdered,
                StateContract = o.StateContract,
                BusinessJustification = o.BusinessJustification
            }).ToList()
                       .Select(x => new PurchaseReqWithReqestViewModels()
            {
                EmployeeName          = x.EmployeeName,
                SupervisorName        = x.SupervisorName,
                StatusName            = x.StatusName,
                CategoryName          = x.CategoryName,
                BudgetCodeName        = x.BudgetCodeName,
                DateMade              = x.DateMade,
                DateOrdered           = x.DateOrdered,
                StateContract         = x.StateContract,
                BusinessJustification = x.BusinessJustification
            });

            return(View(list));
        }
        // GET: CampusAndAddress
        public ActionResult Index()
        {
            var list = (from c in db.Campuses
                        join a in db.Addresses
                        on c.ID equals a.ID into ThisList
                        from a in ThisList.DefaultIfEmpty()
                        select new
            {
                CampusName = c.CampusName,
                Active = c.Active,
                City = a.City,
                State = a.State,
                StreetAddress = a.StreetAddress,
                ZIP = a.ZIP
            }).ToList()
                       .Select(x => new CampusWithAddressViewModels()
            {
                CampusName    = x.CampusName,
                Active        = x.Active,
                City          = x.City,
                State         = x.State,
                StreetAddress = x.StreetAddress,
                ZIP           = x.ZIP
            });

            return(View(list));
        }
Ejemplo n.º 3
0
        // Display BudgetCodes with Amount
        public ActionResult Index()
        {
            var list = (from c in db.BudgetCodes
                        join a in db.BudgetAmounts
                        on c.ID equals a.ID into ThisList
                        from a in ThisList.DefaultIfEmpty()
                        select new
            {
                DA_CODE = c.DA_CODE,
                BudgetCodeName = c.BudgetCodeName,
                Type = c.Type,
                Active = c.Active,
                TotalAmount = a.TotalAmount
            }).ToList()
                       .Select(x => new BudgetCodeWithAmountViewModels()
            {
                DA_CODE        = x.DA_CODE,
                BudgetCodeName = x.BudgetCodeName,
                Type           = x.Type,
                Active         = x.Active,
                TotalAmount    = x.TotalAmount
            });

            return(View(list));
        }
Ejemplo n.º 4
0
        // GET: Vendors
        public ActionResult Index()
        {
            //var vendors = db.Vendors.Include(v => v.Address);
            //return View(vendors.ToList());

            var list = (from v in db.Vendors
                        join a in db.Addresses
                        on v.AddressID equals a.ID into ThisList
                        from a in ThisList.DefaultIfEmpty()
                        select new
            {
                VendorName = v.VendorName,
                Phone = v.Phone,
                Fax = v.Fax,
                Website = v.Website,
                City = a.City,
                State = a.State,
                StreetAddress = a.StreetAddress,
                ZIP = a.ZIP
            }).ToList()
                       .Select(x => new VendorWithAddressViewModels()
            {
                VendorName    = x.VendorName,
                Phone         = x.Phone,
                Fax           = x.Fax,
                Website       = x.Website,
                City          = x.City,
                State         = x.State,
                StreetAddress = x.StreetAddress,
                ZIP           = x.ZIP
            });

            return(View(list));
        }
Ejemplo n.º 5
0
        // GET: Rooms
        public ActionResult Index()
        {
            //var rooms = db.Rooms.Include(r => r.Campus);
            //return View(rooms.ToList());

            var list = (from r in db.Rooms
                        join c in db.Campuses
                        on r.CampusID equals c.ID into ThisList
                        from c in ThisList.DefaultIfEmpty()
                        select new
            {
                RoomCode = r.RoomCode,
                RoomName = r.RoomName,
                Active = r.Active,
                CampusName = c.CampusName,
            }).ToList()
                       .Select(x => new RoomWithCampusViewModels()
            {
                RoomCode   = x.RoomCode,
                RoomName   = x.RoomName,
                Active     = x.Active,
                CampusName = x.CampusName,
            });

            return(View(list));
        }
Ejemplo n.º 6
0
        //Renders view with the selected livestock's images
        public ActionResult ViewLivestockImage(int id)
        {
            //joins livestock with the respective images that have that livestock's ID
            var listWthEmpty = from l in db.LivesStocks
                               where l.LivestockID == id
                               join li in db.LivestockImages
                               on l.LivestockID equals li.LivestockID
                               into ThisList
                               from li in ThisList.DefaultIfEmpty()
                               select new LivestockImagesVM
            {
                ImageId       = li.ImageId,
                LivestockCode = l.Code,
                UploadDate    = li.UploadtDate
            };

            return(View(listWthEmpty));
        }
Ejemplo n.º 7
0
        // GET: Supervisor
        public ActionResult Index()
        {
            var list = (from a in db.SupervisorApprovals
                        join e in db.Employees
                        on a.SupervisorID equals e.Id into ThisList
                        from e in ThisList.DefaultIfEmpty()
                        select new
            {
                ApprovalName = a.Approval.ApprovalName,
                SupervisorName = e.FirstName + " " + e.LastName,
                DeniedJustification = a.DeniedJustification
            }).ToList()
                       .Select(x => new SupervisorApprovalWithApprovalViewModels()
            {
                ApprovalName        = x.ApprovalName,
                SupervisorName      = x.SupervisorName,
                DeniedJustification = x.DeniedJustification
            });

            return(View(list));
        }
Ejemplo n.º 8
0
        public ActionResult viewDepartments()
        {
            var list = (from d in db.Departments
                        join div in db.Divisions
                        on d.ID equals div.ID into ThisList
                        from div in ThisList.DefaultIfEmpty()
                        select new
            {
                DepartmentName = d.DepartmentName,
                Active = d.Active,
                DivisionName = div.DivisionName
            }).ToList()
                       .Select(x => new DepartmentWithDivisionViewModels()
            {
                DepartmentName = x.DepartmentName,
                Active         = x.Active,
                DivisionName   = x.DivisionName
            });

            return(View(list));
        }
Ejemplo n.º 9
0
        public ActionResult ItemWithVendor()
        {
            var list = (from r in db.Requests
                        join v in db.Vendors
                        on r.VendorID equals v.ID
                        into ThisList
                        from v in ThisList.DefaultIfEmpty()
                        select new
            {
                QuantityRequested = r.QuantityRequested,
                EstimatedCost = r.EstimatedCost,
                EstimatedTotal = r.EstimatedTotal,
                PaidCost = r.PaidCost,
                PaidTotal = r.PaidTotal,
                Chosen = r.Chosen,
                orderID = r.OrderID,
                Attachments = r.Attachments,
                ItemName = r.Item.ItemName,
                Description = r.Item.Description,
                ReasonChosen = r.ReasonChosen,
                VendorName = v.VendorName
            }).ToList()
                       .Select(x => new RequestWithVendorViewModels()
            {
                QuantityRequested = x.QuantityRequested,
                EstimatedCost     = x.EstimatedCost,
                EstimatedTotal    = x.EstimatedTotal,
                PaidCost          = x.PaidCost,
                PaidTotal         = x.PaidTotal,
                Chosen            = x.Chosen,
                orderID           = x.orderID,
                Attachments       = x.Attachments,
                ItemName          = x.ItemName,
                Description       = x.Description,
                ReasonChosen      = x.ReasonChosen,
                VendorName        = x.VendorName
            });

            return(View(list));
        }
Ejemplo n.º 10
0
        // GET: Divisions
        public ActionResult Index()
        {
            //var divisions = db.Divisions.Include(d => d.Supervisor);
            //return View(divisions.ToList());

            var list = (from d in db.Divisions
                        join e in db.Employees
                        on d.SupervisorID equals e.Id into ThisList
                        from e in ThisList.DefaultIfEmpty()
                        select new
            {
                DivisionName = d.DivisionName,
                Active = d.Active,
                SupervisorName = e.FirstName + " " + e.LastName,
            }).ToList()
                       .Select(x => new DivisionWithSupervisorViewModels()
            {
                DivisionName   = x.DivisionName,
                Active         = x.Active,
                SupervisorName = x.SupervisorName
            });

            return(View(list));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Display all of the restaurants based on the provided parameters
        /// </summary>
        /// <param name="sort">Obtain the type of sorting</param>
        /// <param name="cuisineType">Obtainthe cuisine type</param>
        /// <param name="searchWord">Obtain the word that the user wants to search</param>
        /// <returns></returns>
        public IActionResult Index(int?sort, string cuisineType, string searchWord, string serviceType)
        {
            // Bypass parameters if necessary, using character x
            if (cuisineType == "x")
            {
                cuisineType = "";
            }
            if (searchWord == "x")
            {
                searchWord = "";
            }
            if (serviceType == "x")
            {
                serviceType = "";
            }
            else if (!string.IsNullOrEmpty(cuisineType) && cuisineType != "undefined")
            {
                ViewBag.Message = "You are viewing " + cuisineType + " cuisine . . .";
            }
            // Obtain the filtering sort
            ViewBag.Sort = sort;
            // Obtain cuisines as a list
            ViewData["Cuisine"] = _goEats.ReadAllTypes();
            var restList = (from p in _db.Restaurants
                            join f in _db.Covid19
                            on p.id equals f.restaurant_id into ThisList
                            from f in ThisList.DefaultIfEmpty()
                            select new
            {
                Id = p.id,
                CID = f.id,
                Name = p.name,
                Address = p.address,
                City = p.city,
                State = p.state_code,
                ZipCode = p.zip_code,
                Phone = p.telephone,
                CovidPolicy = f.comments,
                Covid_I = f.indoor_dining,
                Covid_L = f.limit_seating,
                Covid_T = f.take_out,
                Covid_C = f.curbside,
                Food = p.cuisines,
                Delivery = p.has_delivery,
                TakeOut = p.has_takeaway,
                PriceRange = p.price_range,
                Time = p.timings,
                Menu = p.menu_url
            }).ToList()
                           .Select(x => new RestaurantInfoVM()
            {
                Rest_Id             = x.Id,
                Rest_COVID_Id       = x.CID,
                Rest_Name           = x.Name,
                Rest_Address        = x.Address,
                Rest_City           = x.City,
                Rest_State          = x.State,
                Rest_ZipCode        = x.ZipCode,
                Rest_Phone          = x.Phone,
                Rest_CurbSide       = x.Covid_C,
                Rest_Delivery       = x.Delivery,
                Rest_IndoorSeating  = x.Covid_I,
                Rest_LimitedSeating = x.Covid_L,
                Rest_TakeOut        = x.Covid_T,
                Rest_CovidPolicy    = x.CovidPolicy,
                Rest_PriceRange     = x.PriceRange,
                Rest_Time           = x.Time,
                Rest_Cuisine        = x.Food,
                Rest_Menu           = x.Menu
            });

            // Adjust results via parameters
            if (!string.IsNullOrEmpty(searchWord))
            {
                return(View(restList.Where(x => x.Rest_Name.Contains(searchWord.ToString())).OrderByDescending(x => x.Rest_Name)));
            }
            if (!string.IsNullOrEmpty(cuisineType) && sort == 0)
            {
                return(View(restList.Where(x => x.Rest_Cuisine.Contains(cuisineType.ToString())).OrderByDescending(x => x.Rest_Name)));
            }
            else if (!string.IsNullOrEmpty(cuisineType) && sort == 1)
            {
                return(View(restList.Where(x => x.Rest_Cuisine.Contains(cuisineType.ToString())).OrderBy(x => x.Rest_Name)));
            }
            else if (string.IsNullOrEmpty(cuisineType) && sort == 0)
            {
                return(View(restList.OrderByDescending(x => x.Rest_Name)));
            }
            else if (string.IsNullOrEmpty(cuisineType) && sort == 1)
            {
                return(View(restList.OrderBy(x => x.Rest_Name)));
            }
            else
            {
                return(View(restList));
            }
        }