public Driver(DriverId id, string firstName, string lastName, string description, UserGroupId userGroupId, DriverGroup group) { Id = id; FirstName = firstName; LastName = lastName; Description = description; UserGroupId = userGroupId; Group = group; }
// GET: /DriveGroup/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DriverGroup drivergroup = db.DriverGroups.Find(id); if (drivergroup == null) { return(HttpNotFound()); } return(View(drivergroup)); }
// GET: /DriveGroup/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DriverGroup drivergroup = db.DriverGroups.Find(id); if (drivergroup == null) { return(HttpNotFound()); } ViewBag.DriverTeamID = new SelectList(db.DriverTeams, "DriverTeamID", "TeamName", drivergroup.DriverTeamID); return(View(drivergroup)); }
public ActionResult DeleteConfirmed(int id) { try { DriverGroup drivergroup = db.DriverGroups.Find(id); db.DriverGroups.Remove(drivergroup); db.SaveChanges(); } catch (DataException /* dex */) { return(RedirectToAction("Delete", new { id = id, saveChangesError = true })); } return(RedirectToAction("Index")); }
public void RegisterDriverGroups() { DriverGroup webDriverGroup = new DriverGroup() { Name = "Web", Description = "Drivers intended to test web UI", Drivers = new System.Collections.Generic.List <ISplintDriver>() { new ChromeSplintDriver(), new FirefoxSplintDriver(), new InternetExplorerSplintDriver() } }; //TODO: Add mobile driver group DriverGroupProvider.AddDriverGroup(webDriverGroup); }
public void RegisterDriverGroups() { DriverGroup webDriverGroup = new DriverGroup() { Name = "Web", Description = "Drivers intended to test web UI", Drivers = new System.Collections.Generic.List<ISplintDriver>() { new ChromeSplintDriver(), new FirefoxSplintDriver(), new InternetExplorerSplintDriver() } }; //TODO: Add mobile driver group DriverGroupProvider.AddDriverGroup(webDriverGroup); }
// GET: /DriveGroup/Delete/5 public ActionResult Delete(int?id, bool?saveChangesError = false) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (saveChangesError.GetValueOrDefault()) { ViewBag.ErrorMessage = "Delete failed. Try again, and if theproblem persists see your system administrator."; } DriverGroup drivergroup = db.DriverGroups.Find(id); if (drivergroup == null) { return(HttpNotFound()); } return(View(drivergroup)); }
public ActionResult Edit([Bind(Include = "DriverGroupID,DriverTeamID,DriverGroupName,GroupPeople")] DriverGroup drivergroup) { try { if (ModelState.IsValid) { db.Entry(drivergroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } ViewBag.DriverTeamID = new SelectList(db.DriverTeams, "DriverTeamID", "TeamName", drivergroup.DriverTeamID); return(View(drivergroup)); }
public ActionResult Create([Bind(Include = "DriverTeamID,DriverGroupName,GroupPeople")] DriverGroup drivergroup) { try { if (ModelState.IsValid) { db.DriverGroups.Add(drivergroup); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (DataException /*dex*/) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Tryagain, and if the problem persists see your system administrator."); } ViewBag.DriverTeamID = new SelectList(db.DriverTeams, "DriverTeamID", "TeamName", drivergroup.DriverTeamID); return(View(drivergroup)); }
public ActionResult NewRequest(TransportationRequest_View_DemoForSymposium transRequest) { if (ModelState.IsValid) { try { // Grabs current logged on user ID as they will be the requester //Note: This Lambda function is using the logged in user as the requester so if html is edited the validation is still correct var RequesterId = transportationContext.Users.Where(u => u.BannerId == _LoggedInUser.userInfo.EmployeeId.Substring(1)).Select(i => i.UserId).FirstOrDefault(); if (RequesterId != null) { TransportationRequest newRequest = new TransportationRequest(); newRequest.RequesterUserId = RequesterId; newRequest.LeaveDate = transRequest.LeaveDate.GetValueOrDefault(); newRequest.LeaveTime = transRequest.LeaveTime.GetValueOrDefault(); newRequest.ReturnDate = transRequest.ReturnDate.GetValueOrDefault(); newRequest.ReturnTime = transRequest.ReturnTime.GetValueOrDefault(); newRequest.Destination = transRequest.Destination; newRequest.TripPurpose = transRequest.TripPurpose; newRequest.NumOfStudents = transRequest.NumOfStudents.GetValueOrDefault(); //Create Empty Int Object var transReqId = new ObjectParameter("TranReqId", typeof(int)); //Save Request and Get transportation request Id transportationContext.p_TransReq_Add(newRequest.RequesterUserId, newRequest.LeaveDate, newRequest.LeaveTime, newRequest.ReturnDate, newRequest.ReturnTime, newRequest.Destination, newRequest.TripPurpose, newRequest.NumOfStudents, transReqId); //Save to Driver Group Table DriverGroup driverGroup = new DriverGroup(); driverGroup.NeedGasCard = transRequest.NeedGasCard.GetValueOrDefault(); driverGroup.TranRequestId = Convert.ToInt16(transReqId.Value); driverGroup.UserId = transRequest.UserId; driverGroup.VehicleAddOnId = transRequest.VehicleAddOnId; driverGroup.VehicleTypeId = transRequest.VehicleTypeId; //Add new driver associated with request transportationContext.DriverGroups.Add(driverGroup); //save transportationContext.SaveChanges(); return(RedirectToAction("RequestConfirmation")); } // Will require a foreach loop to grab all drivers listed on request //var DriverId = transportationContext.Users.Where(u => u.UserId == transRequest.UserId).Select(i => i.UserId).FirstOrDefault(); // Will require a foreach loop to grab all passangers listed on the request //var PassangerId = transportationContext.Users.Where(u => u.UserId == transRequest.UserId).Select(i => i.UserId).FirstOrDefault(); // Add all drivers to DriverGroup Table //foreach ( /* Driver listed on form (may need to make an array) */) //{ // DriverGroup Driver = new DriverGroup(); // Driver.RequestId = 0/*Transportation Request primary key*/; // Driver.UserId = transportationContext.Users.Where(u => u.UserId == 0/*Current Driver Id*/).Select(i => i.UserId).FirstOrDefault(); // if (true /*Driver requires a vehicle*/) // { // //Driver.VehicleType // } // transportationContext.DriverGroups.Add(Driver); //} } catch { return(new HttpStatusCodeResult(Response.StatusCode = 400)); } } return(View()); }