示例#1
0
 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"));
     }
 }
示例#2
0
        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"));
            }
        }
示例#4
0
        //
        // 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));
        }
示例#5
0
        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());
            }
        }
示例#6
0
        //
        // 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));
        }
示例#8
0
        //
        // 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)));
        }
示例#9
0
        //
        // 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()));
        }
示例#10
0
        //
        // 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));
        }
示例#11
0
        //
        // 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));
        }
示例#12
0
        //
        // 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));
        }
示例#13
0
        //
        // 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));
        }
示例#14
0
        //
        // 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));
        }
示例#15
0
        //
        // 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)));
        }
示例#16
0
        //
        // 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"));
        }
示例#17
0
        //
        // 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()));
        }
示例#18
0
        //
        // 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));
        }
示例#19
0
        // 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());
        }
示例#20
0
        //
        // 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()));
        }
示例#21
0
        //
        // 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));
        }
示例#22
0
        //
        // 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));
        }
示例#23
0
 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());
     }
 }
示例#24
0
        //
        // 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"));
            }
        }
示例#25
0
        //
        // 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"));
        }
示例#26
0
 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"));
     }
 }
示例#27
0
 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"));
     }
 }
示例#28
0
 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());
     }
 }
示例#29
0
        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());
            }
        }
示例#30
0
 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());
     }
 }