public ActionResult Delete(int EventID) { var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); var model = service.GetScheduleUserById(EventID); return(View(model)); }
//GET DETAIL DOUBLE CHECK THIS public ActionResult Details(int id) { var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); var model = service.GetScheduleUserById(id); return(View(model)); }
// GET: ScheduleUser public ActionResult Index(int ShopID)//This is for the shop keeper to view all appointments for a single shop. { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new ScheduleUserService(userId); var model = service.GetAllScheduleUser(ShopID); //var model = new ScheduleUserListItem[0]; return(View(model)); }
public ActionResult DeletePost(int EventID, ScheduleUserDetail model) //added in ShopDetail Model { var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); service.DeleteScheduleUser(EventID); //added in ShopDetail Model TempData["SaveResult"] = "Your Appointment was deleted"; return(RedirectToAction("Index2", "ScheduleUser", new { id = model.UserID })); //figure this out send to shop schedule!!!!!!! // complete redirections //complete views }
public ActionResult Index2()//This is for the user view of their appointments. { //added in from elevenNote section 4.04 then removed in 6.02 //var model = new ShopListItem[0]; //return View(model); // added elevenNote 6.02 var userId = Guid.Parse(User.Identity.GetUserId()); var service = new ScheduleUserService(userId); var model = service.GetScheduleUser(); return(View(model)); }
//删除上下级关系 public ActionResult DelUpOrDown() { int id = Convert.ToInt32(Request["id"]); var temp = ScheduleUserService.LoadEntities(x => x.ID == id).FirstOrDefault(); if (ScheduleUserService.DeleteEntity(temp)) { return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = "no", msg = "删除失败!" }, JsonRequestBehavior.AllowGet)); } }
// GET: ScheduleAdmin public ActionResult Index(int ShopID) { ViewBag.ShopID = ShopID; var service = new ScheduleAdminService(ShopID); var model = service.GetScheduleAdmin(); var service2 = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); ViewBag.ScheduleUser = service2.GetAllScheduleUser(ShopID); return(View(model)); }
public ActionResult Edit(int id) { var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); var detail = service.GetScheduleUserById(id); var model = new ScheduleUserEdit { ServiceID = detail.ServiceID, EventID = detail.EventID, UserName = detail.UserName, UserNumber = detail.UserNumber, StartTime = detail.StartTime, ServicesVariable = detail.ServicesVariable }; return(View(model)); }
//获取上下级信息 public ActionResult GetScheduleUser() { int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1; int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5; int totalCount; var temp = ScheduleUserService.LoadPageEntities(pageIndex, pageSize, out totalCount, x => x.ID > 0, a => a.ID, true); var rtmp = from a in temp select new { ID = a.ID, UserID = a.UserInfo.PerSonName, UpID = a.UserInfo1.PerSonName }; return(Json(new { rows = rtmp, total = totalCount }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(ScheduleUserCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); if (service.CreateScheduleUser(model)) { TempData["SaveResult"] = "Your Appointment was created."; return(RedirectToAction("Index2", "ScheduleUser", new { id = model.UserID })); //figure this out send to shop schedule!!!!!!! } ; ModelState.AddModelError("", "Appointment could not be created."); return(View(model)); }
public ActionResult Edit(int id, ScheduleUserEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.EventID != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); if (service.UpdateScheduleUser(model)) { TempData["SaveResult"] = "Your Appointment was updated."; return(RedirectToAction("Details", "ScheduleUser", new { id = model.EventID }));//figure this out send to shop schedule!!!!!!! } ModelState.AddModelError("", "Your Appointment could not be updated."); return(View(model)); }
//添加上下级关系 public ActionResult AddUpOrDown(ScheduleUser su) { var temp = ScheduleUserService.LoadEntities(x => x.UserID == su.UserID).DefaultIfEmpty().ToList(); if (temp.Count > 0) { if (temp[0] == null) { var rtmp = ScheduleUserService.LoadEntities(x => x.UserID == su.UpID).DefaultIfEmpty().ToList(); if (rtmp.Count > 0) { if (rtmp[0] == null) { ScheduleUserService.AddEntity(su); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } else { foreach (var a in rtmp) { if (a.UpID == su.UserID) { return(Json(new { ret = "no", msg = "您所添加的下级是您所添加上级的上级,请仔细核对数据库!" }, JsonRequestBehavior.AllowGet)); } } ScheduleUserService.AddEntity(su); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } } else { ScheduleUserService.AddEntity(su); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } } else { var rtmp = ScheduleUserService.LoadEntities(x => x.UserID == su.UpID).DefaultIfEmpty().ToList(); foreach (var a in temp) { if (a.UpID == su.UpID) { return(Json(new { ret = "no", msg = "您所添加的上下级关系已经存在!" }, JsonRequestBehavior.AllowGet)); } } foreach (var b in rtmp) { if (b.UpID == su.UserID) { return(Json(new { ret = "no", msg = "您所添加的下级是您所添加上级的上级,请仔细核对数据库!" }, JsonRequestBehavior.AllowGet)); } } ScheduleUserService.AddEntity(su); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } } else { ScheduleUserService.AddEntity(su); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } }