public ActionResult Edit(FormCollection collection) { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { GroupModel theGroup = new GroupModel(); theGroup.ID = Convert.ToInt32(collection["ID"]); theGroup.Name = collection["Name"]; theGroup.BranchID = Convert.ToInt32(collection["BranchID"]); if (theGroup.BranchID == 0) { UserModel theUser = new UserModel(); theGroup.BranchID = theUser.FindByID(UserModel.CurrentUserId).BrancheID; } theGroup.Update(collection["gr_abon_add"], collection["gr_abon_del"]); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(RedirectToAction("Index")); } }
public ActionResult Edit(int id, FormCollection collection) { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add update logic here AbonentModel theAbonent = new AbonentModel(); theAbonent.ID = id; theAbonent.Name = collection["Name"]; theAbonent.Phone = collection["Phone"]; theAbonent.Description = collection["Description"]; theAbonent.Email = collection["Email"]; theAbonent.BranchID = Convert.ToInt32(collection["BranchID"]); if (theAbonent.BranchID == 0) { UserModel theUser = new UserModel(); theAbonent.BranchID = theUser.FindByID(UserModel.CurrentUserId).BrancheID; } theAbonent.Update(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }
public ActionResult EditRole(string rl_act_add, string rl_act_del, FormCollection collection) { if (!AccessActions.IsAccess("RoleAction::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { RoleModel theRole = new RoleModel(); theRole.ID = Convert.ToInt32(collection["ID"]); theRole.Name = collection["Name"]; theRole.Description = collection["Description"]; //theRole.UserId = UserModel.CurrentUserId; theRole.Update(collection["rl_act_add"], collection["rl_act_del"]); //theRole.Update(rl_act_add, rl_act_del); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(RedirectToAction("Index")); } }
// // GET: /User/Edit/5 public ActionResult Edit(int id) { if (!AccessActions.IsAccess("User::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "��� �������!"); return(RedirectToAction("Error", "User", route)); } UserModel user = new UserModel(); RoleModel role = new RoleModel(); BrancheModel branch = new BrancheModel(); ActionModel action = new ActionModel(); TypeModel type = new TypeModel(); //заполнение списка ролей ViewBag.Roles = role.FindAll(); //Заполнение списка филиалов ViewBag.AllBranches = branch.FindAll(); ViewBag.UserBranches = branch.UserBranches(id); ViewBag.UserActions = action.UserActions(id); ViewBag.AllActions = action.FindAll(); ViewBag.UserTypes = type.UserTypes(id); ViewBag.AllTypes = type.FindAll(); user.FindByID(id); ViewBag.UsName = user.Name; return(View(user)); }
public ActionResult Create(FormCollection collection) { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add insert logic here AbonentModel theAbonent = new AbonentModel(); //theAbonent.ID = Convert.ToInt32(collection["ID"]); theAbonent.Name = collection["Name"]; theAbonent.Phone = collection["Phone"]; theAbonent.Description = collection["Description"]; theAbonent.Email = collection["Email"]; theAbonent.Create(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }
// // GET: /Branches/Create public ActionResult Create() { if (!AccessActions.IsAccess("Branches::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } return(View()); }
// // GET: /RoleAction/Create public PartialViewResult CreateAction() { if (!AccessActions.IsAccess("RoleAction::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } ActionModel theAction = new ActionModel(); return(PartialView("_ActionCreate", theAction)); }
// // GET: /UserWishes/Details/5 public ActionResult Details(int id) { if (!AccessActions.IsAccess("UserWishes::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } UserWishesModel Wish = new UserWishesModel(); return(View(Wish.DetailWish(id))); }
// // GET: /User/ public ActionResult Index() { if (!AccessActions.IsAccess("User::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "��� �������!"); return(RedirectToAction("Error", "User", route)); } UserModel theUser = new UserModel(); return(View(theUser.ListUsers())); }
// // GET: /Abonents/Create public ActionResult Create() { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } NewAbonentModel theAbonent = new NewAbonentModel(); return(View(theAbonent)); }
// // GET: /Groups/ public ActionResult Index() { if (!AccessActions.IsAccess("Groups::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } List <GroupModel> model = (new GroupModel()).FindAll(); return(View(model)); }
// // GET: /Branches/Edit/5 public ActionResult Edit(int id) { if (!AccessActions.IsAccess("Branches::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } BrancheModel model = new BrancheModel(); model.FindOne(id); return(View(model)); }
// // GET: /Abonents/ public ActionResult Index() { if (!AccessActions.IsAccess("Abonents::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); //Add Parameter //route.Add("descr", "Закатай губу, доступа к этой форме не имеешь доступа"); //Add Parameter return(RedirectToAction("Error", "User", route)); } List <AbonentModel> model = (new AbonentModel()).Abonents(); return(View(model)); }
// // GET: /Abonents/Details/5 public ActionResult Details(int id) { if (!AccessActions.IsAccess("Abonents::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } AbonentModel theAbonent = new AbonentModel(); theAbonent.FindOne(id); return(View(theAbonent)); }
// // GET: /Abonents/Edit/5 public ActionResult Edit(int id) { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } AbonentModel theAbonent = new AbonentModel(); BrancheModel branch = new BrancheModel(); ViewBag.AllBranches = branch.FindAll(); return(View(theAbonent.FindOne(id))); }
// // GET: /User/Delete/5 public ActionResult Delete(int id) { if (!AccessActions.IsAccess("User::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "��� �������!"); return(RedirectToAction("Error", "User", route)); } UserModel user = new UserModel(); user.FindByID(id); user.Delete(); return(RedirectToAction("Index")); }
// // GET: /Groups/Details/5 public PartialViewResult Details(int GroupID) { if (!AccessActions.IsAccess("Groups::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } GroupModel Group = new GroupModel(); Group = Group.FindOne(Convert.ToInt32(GroupID)); ViewBag.ID = GroupID; ViewBag.NameGr = Group.Name; return(PartialView("_Abonents", Group.Abonents())); }
// // GET: /RoleAction/EditRole/5 public PartialViewResult EditRoleIndex(int RoleID) { if (!AccessActions.IsAccess("RoleAction::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } RoleModel Role = new RoleModel(); Role = Role.FindByID(RoleID); ViewBag.RoleActions = Role.Actions(); ViewBag.AllActions = Role.ActionsAll(); return(PartialView("_RoleEdit", Role)); }
// GET: /User/Create public ActionResult Create() { if (!AccessActions.IsAccess("User::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "��� �������!"); return(RedirectToAction("Error", "User", route)); } RoleModel role = new RoleModel(); BrancheModel branch = new BrancheModel(); //заполнение списка ролей ViewBag.Roles = role.FindAll(); //Заполнение списка филиалов ViewBag.Branches = branch.FindAll(); return(View()); }
// // GET: /RoleAction/Details/5 public PartialViewResult Details(int RoleID) { if (!AccessActions.IsAccess("RoleAction::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } RoleModel Role = new RoleModel(); Role = Role.FindByID(Convert.ToInt32(RoleID)); ViewData["r_id"] = Role.ID; ViewData["r_name"] = Role.Name; ViewData["r_description"] = Role.Description; ViewData["r_update_at"] = Role.Update_at; ViewData["r_updater"] = Role.UserName; return(PartialView("_RoleDetail", Role.Actions())); }
// // GET: /Groups/Edit/5 public PartialViewResult EditIndex(int GroupID) { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } GroupModel Group = new GroupModel(); Group = Group.FindOne(GroupID); ViewBag.GroupAbonents = Group.Abonents(); ViewBag.AllAbonents = Group.AbonentsAll(); BrancheModel branch = new BrancheModel(); ViewBag.AllBranches = branch.FindAll(); return(PartialView("_AbonentsGroupEdit", Group)); }
// // GET: /RoleAction/Create public PartialViewResult CreateRole() { if (!AccessActions.IsAccess("RoleAction::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } RoleModel theRole = new RoleModel(); try { theRole.UserId = UserModel.CurrentUserId; } catch (Exception ex) { ViewBag.Error = ex.Message; } return(PartialView("_RoleCreate", theRole)); }
public ActionResult Delete(int id, FormCollection collection) { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add delete logic here AbonentModel theAbonent = new AbonentModel(); theAbonent.FindOne(id); theAbonent.Delete(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }
// // POST: /RoleAction/DeleteAction/5 public ActionResult DeleteAction(int id) { if (!AccessActions.IsAccess("RoleAction::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add delete logic here ActionModel theAction = new ActionModel(); theAction.FindByID(id); theAction.Delete(); return(RedirectToAction("IndexActions")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View("IndexActions")); } }
// // GET: /Groups/Create public PartialViewResult Create() { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } GroupModel theGroup = new GroupModel(); try { theGroup.User = (new UserModel()).FindByID(UserModel.CurrentUserId); } catch (Exception ex) { ViewBag.Error = ex.Message; } return(PartialView("_GroupCreate")); }
public ActionResult CreateRole(FormCollection collection) { if (!AccessActions.IsAccess("RoleAction::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { RoleModel theRole = new RoleModel(); theRole.Name = collection["Name"]; theRole.Description = collection["Description"]; theRole.Create(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(RedirectToAction("Index")); } }
public ActionResult Create(FormCollection collection) { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { GroupModel theGroup = new GroupModel(); theGroup.Name = collection["Name"]; theGroup.BranchID = Convert.ToInt32(collection["BranchID"]); theGroup.Create(); return(RedirectToAction("Index")); } catch { //return View("Index"); return(RedirectToAction("Index")); } }
public ActionResult Create(FormCollection collection) { if (!AccessActions.IsAccess("Branches::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add insert logic here BrancheModel model = new BrancheModel(); model.name_full = collection["name_full"]; model.name_short = collection["name_short"]; model.Create(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }
public ActionResult Index(FormCollection collection) { if (!AccessActions.IsAccess("SmsInfo::Index")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { string smsnumber = collection["Smsnumber"]; string smsmsg = collection["Msg"]; SmsModel.SendSms(smsnumber, smsmsg); return(View()); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }
public ActionResult Create(FormCollection collection) { if (!AccessActions.IsAccess("User::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "��� �������!"); return(RedirectToAction("Error", "User", route)); } try { UserModel user = new UserModel(); user.Login = collection["Login"]; user.Name = collection["Name"]; user.Role_Id = Convert.ToInt32(collection["Role_Id"]); user.BrancheID = Convert.ToInt32(collection["BrancheID"]); user.Create(); return(RedirectToAction("Index")); } catch { return(View()); } }