public ActionResult DeleteConfirmed(Guid id) { WaitList waitList = db.WaitLists.Find(id); db.WaitLists.Remove(waitList); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,EventId,UserId,IsActive")] WaitList waitList) { if (ModelState.IsValid) { db.Entry(waitList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EventId = new SelectList(db.Events, "Id", "Name", waitList.EventId); return(View(waitList)); }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
public ActionResult Create([Bind(Include = "Id,EventId,UserId,IsActive")] WaitList waitList) { if (ModelState.IsValid) { waitList.Id = Guid.NewGuid(); db.WaitLists.Add(waitList); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EventId = new SelectList(db.Events, "Id", "Name", waitList.EventId); return(View(waitList)); }
// GET: WaitLists/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WaitList waitList = db.WaitLists.Find(id); if (waitList == null) { return(HttpNotFound()); } return(View(waitList)); }
// GET: WaitLists/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WaitList waitList = db.WaitLists.Find(id); if (waitList == null) { return(HttpNotFound()); } ViewBag.EventId = new SelectList(db.Events, "Id", "Name", waitList.EventId); return(View(waitList)); }
public async Task <bool> Create([Bind("WaitListId,UserId,LectureId")] WaitList waitlist) { if (ModelState.IsValid) { _context.Add(waitlist); await _context.SaveChangesAsync(); return(true); //return RedirectToAction(nameof(Index)); } return(false); //ViewData["LectureId"] = new SelectList(_context.Lecture, "LectureId", "Title", booking.LectureId); //ViewData["UserId"] = new SelectList(_context.User, "UserId", "Email", booking.UserId); //return View(booking); }
/// <summary> /// Method that checks how long the first guest as been waiting for. If the waittime equals the set wait duration the guest can go on. /// </summary> /// <param name="guestList">List of guests in the hotel, the waiting guest is added to this.</param> public void Assigned_Room(List <Entity> guestList) { if (WaitList.Any()) { if (Waittime == waitduration) { Waittime = 0; guestList.Add(WaitList.First()); WaitList.Dequeue(); } else { Waittime++; } } }
public void WaitlistUserToBooking() { //Arrange var user1 = new User(1); var user2 = new User(2); var lecture = new Lecture(1); var userWL = new WaitList(user2.UserId, lecture.LectureId); var waitlist = new Queue <WaitList>(); lecture.Bookings.Add(new Booking(1, 1)); lecture.WaitList.Enqueue(userWL); Booking bookingValue = new Booking(); //Act bookingValue = user1.Cancel(lecture); //Assert Assert.AreEqual(bookingValue.UserId, 2); }
private List <WaitList> GetListFromDB(int _postalNumber) { List <WaitList> _tempList = new List <WaitList>(); WaitList _tempListObj; CMD.CommandText = string.Format("SELECT ventelister.AntalPaaVenteliste, afdelinger.AfdPostBy, afdelinger.AfdId FROM ventelister INNER JOIN afdelinger ON ventelister.FK_AfdId = afdelinger.AfdId WHERE AfdPostBy = {0};", _postalNumber); CMD.CommandType = CommandType.Text; CMD.Connection = Conn; Reader = CMD.ExecuteReader(); while (Reader.Read()) { _tempListObj = new WaitList((int)Reader[2], (int)Reader[1], (int)Reader[0]); _tempList.Add(_tempListObj); } Reader.Close(); return(_tempList); }
public ActionResult SelectFlawWithTable() { int pageindex = int.Parse(Request.Params["pageindex"]); int userid = int.Parse(Session["userid"].ToString()); var user = (from u in mecd.ps_user where u.id == userid select u).FirstOrDefault(); var role = (from r in mecd.ps_role where r.id == user.roleId select r).FirstOrDefault(); List <WaitList> list = new List <WaitList>(); //分情况判断 if (role.roleName == "系统管理员") { //则可以查看所有任务 //缺陷管理 var solvemanage = (from a in mecd.ps_inspectiontask_main join b in mecd.ps_inspectiontask_detail on a.id equals b.taskid where b.isBugLevel == 0 && b.taskStatus == 4 && a.taskStatus == 4 && b.isBug == 1 && b.isSolve == 0 select new { id = b.id, tasktype = "缺陷管理", taskname = a.lineName + "杆塔编号" + b.poleCode + "缺陷等级确认", finishtime = a.issuedTime, type = 1 }).ToList(); if (solvemanage.Count() > 0) { foreach (var v in solvemanage) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } //巡检任务 var inspectortask = (from a in mecd.ps_inspectiontask_main where a.taskStatus == 2 || a.taskStatus == 3 select new { id = a.id, tasktype = "巡检任务", taskname = a.inspectionTaskName, finishtime = a.issuedTime, type = 2 }).ToList(); if (inspectortask.Count() > 0) { foreach (var v in inspectortask) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } //消缺任务 var solvetask = (from a in mecd.ps_solvetask_main where a.taskStatus == 2 || a.taskStatus == 3 select new { id = a.id, tasktype = "消缺任务", taskname = a.solveTaskName, finishtime = a.issuedTime, type = 3 }).ToList(); if (solvetask.Count() > 0) { foreach (var v in solvetask) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } //消缺审查 var solveexamine = (from a in mecd.ps_solvetask_main where a.taskStatus == 4 select new { id = a.id, tasktype = "消缺审查", taskname = a.solveTaskName, finishtime = a.finishTime, type = 4 }).ToList(); if (solveexamine.Count() > 0) { foreach (var v in solveexamine) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } } else if (role.roleName == "线路管理员") { //如果登录的角色为线路管理员那则只显示缺陷管理 任务 var solvemanage = (from a in mecd.ps_inspectiontask_main join b in mecd.ps_inspectiontask_detail on a.id equals b.taskid where a.issuedByCode == user.userCode && a.taskStatus == 4 && b.taskStatus == 4 && b.isBugLevel == 0 && b.isBug == 1 && b.isSolve == 0 select new { id = b.id, tasktype = "缺陷管理", taskname = a.lineName + "杆塔编号" + b.poleCode + "缺陷等级确认", finishtime = a.issuedTime, type = 1 }).ToList(); if (solvemanage.Count() > 0) { foreach (var v in solvemanage) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } //消缺审查 var solveexamine = (from a in mecd.ps_solvetask_main where a.taskStatus == 4 && (a.taskManagerCode == user.userCode || a.issuedByCode == user.userCode) select new { id = a.id, tasktype = "消缺审查", taskname = a.solveTaskName, finishtime = a.finishTime, type = 4 }).ToList(); if (solveexamine.Count() > 0) { foreach (var v in solveexamine) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } } else if (role.roleName == "巡检员") { //巡检任务 var inspectortask = (from a in mecd.ps_inspectiontask_main join c in mecd.ps_inspector_detail on a.id equals c.taskId where (a.taskStatus == 2 || a.taskStatus == 3) && c.inspectorCode == user.userCode select new { id = a.id, tasktype = "巡检任务", taskname = a.inspectionTaskName, finishtime = a.issuedTime, type = 2 }).ToList(); if (inspectortask.Count() > 0) { foreach (var v in inspectortask) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } } else if (role.roleName == "消缺员") { //消缺任务 var solvetask = (from a in mecd.ps_solvetask_main join c in mecd.ps_solver_detail on a.id equals c.taskId where (a.taskStatus == 2 || a.taskStatus == 3) && c.solverCode == user.userCode select new { id = a.id, tasktype = "消缺任务", taskname = a.solveTaskName, finishtime = a.issuedTime, type = 3 }).ToList(); if (solvetask.Count() > 0) { foreach (var v in solvetask) { WaitList wl = new WaitList() { id = v.id, WaitType = v.tasktype, WaitName = v.taskname, WaitDate = v.finishtime, Type = v.type }; list.Add(wl); } } } DataSource ds = new DataSource(); if (list.Count() > 0) { int skip = (pageindex - 1) * 6; ds.list = list.Skip(skip).Take(6).ToList(); ds.pagecount = list.Count(); } string jsonstr = JsonConvert.SerializeObject(ds); return(Content(jsonstr)); }