예제 #1
0
        public ActionResult DeleteCtr(FormCollection fc)
        {
            string[] ids    = fc["ctrid"].Split(',');
            var      result = ControllerBLL.DeleteControllers(ids);

            base.DoLog(OperationTypeEnum.Delete, result, fc["ctrid"]);
            return(Json(result));
        }
예제 #2
0
        private ActionResult GetControllerPagedGridPV(ControllerSearchModel model, int searchPage)
        {
            SearchDataWithPagedDatas <ControllerSearchModel, ControllerListModel> result = new SearchDataWithPagedDatas <ControllerSearchModel, ControllerListModel>();

            result.SearchModel = model;
            result.SearchPage  = searchPage;
            result.PagedDatas  = ControllerBLL.GetPagedControllerInfo(result.SearchModel, result.SearchPage, this.PageSize);
            return(PartialView("_ControllerPagedGrid", result));
        }
예제 #3
0
        public ActionResult AddActionInfo()
        {
            Asiatek.Model.ActionAddModel model = new Asiatek.Model.ActionAddModel();
            var aList = AreaBLL.GetAreas();

            model.AreasSelectList = new SelectList(aList, "ID", "AreaName");
            var cList = ControllerBLL.GetControllersByAreaID(aList.First().ID);

            model.ControllersSelectList = new SelectList(cList, "ID", "ControllerName");
            return(PartialView("_AddActionInfo", model));
        }
예제 #4
0
        public ActionResult EditControllerInfo(int id)
        {
            var obj = ControllerBLL.GetControllerInfoByID(id);

            if (obj == null)
            {
                return(Content(obj.Message));
            }
            obj.DataResult.AreasSelectList = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName");
            return(PartialView("_EditControllerInfo", obj.DataResult));
        }
예제 #5
0
 public ActionResult AddControllerInfo(ControllerAddModel model)
 {
     if (ModelState.IsValid)
     {
         var result = ControllerBLL.AddController(model, base.UserIDForLog);
         base.DoLog(OperationTypeEnum.Add, result, "ControllerName:" + model.ControllerName);
         return(Json(result));
     }
     else
     {
         model.AreasSelectList = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName");
         return(PartialView("_AddControllerInfo", model));
     }
 }
예제 #6
0
        public ActionResult EditActionInfo(int id)
        {
            var obj = ActionBLL.GetActionByID(id);

            if (obj.DataResult == null)
            {
                return(Content(obj.Message));
            }

            int areaID = obj.DataResult.AreaID;

            obj.DataResult.AreasSelectList       = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName", areaID);
            obj.DataResult.ControllersSelectList = new SelectList(ControllerBLL.GetControllersByAreaID(areaID), "ID", "ControllerName");
            return(PartialView("_EditActionInfo", obj.DataResult));
        }
예제 #7
0
 public ActionResult EditActionInfo(Asiatek.Model.ActionEditModel model)
 {
     if (ModelState.IsValid)
     {
         var result = ActionBLL.ModifyAction(model, base.UserIDForLog);
         base.DoLog(Model.OperationTypeEnum.Edit, result, "ActionID:" + model.ID);
         return(Json(result));
     }
     else
     {
         int areaID = model.AreaID;
         model.AreasSelectList       = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName", areaID);
         model.ControllersSelectList = new SelectList(ControllerBLL.GetControllersByAreaID(areaID), "ID", "ControllerName", model.ControllerID);
         return(PartialView("_EditActionInfo", model));
     }
 }
예제 #8
0
        public ActionResult ControllerInfo()
        {
            SearchDataWithPagedDatas <ControllerSearchModel, ControllerListModel> model = new SearchDataWithPagedDatas <ControllerSearchModel, ControllerListModel>();

            model.SearchPage = 1;

            model.SearchModel                = new ControllerSearchModel();
            model.SearchModel.AreaID         = -1;
            model.SearchModel.ControllerName = string.Empty;
            var areaList = AreaBLL.GetAreas();

            model.SearchModel.AreasSelectList = areaList.ToSelectListWithAll(m => GetSelectListItem(m.ID, m.AreaName));

            model.PagedDatas = ControllerBLL.GetPagedControllerInfo(model.SearchModel, model.SearchPage, this.PageSize);
            return(PartialView("_ControllerInfo", model));
        }
예제 #9
0
        public ActionResult EditFunctionInfo(FunctionEditModel model)
        {
            if (ModelState.IsValid)
            {
                var result = FunctionBLL.EditFunction(model, base.UserIDForLog);
                base.DoLog(OperationTypeEnum.Edit, result, "FunctionID:" + model.ID);
                return(Json(result));
            }
            else
            {
                if (model.FunctionIsMenu)
                {
                    var aList = AreaBLL.GetAreas();
                    model.AreasSelectList = new SelectList(aList, "ID", "AreaName");
                    var cList = ControllerBLL.GetControllersByAreaID(aList.First().ID);
                    model.ControllersSelectList = new SelectList(cList, "ID", "ControllerName");

                    var actionList = ActionBLL.GetActionsByControllerID(cList.First().ID);
                    model.ActionsSelectList = actionList.ToSelectList(m => GetSelectListItem(m.ID, m.ActionName));

                    var parentFuncList = FunctionBLL.GetFunctions();
                    model.ParentFunctionsSelectList = new SelectList(FunctionBLL.GetFunctions(model.ID), "ID", "FunctionName");
                    return(PartialView("_EditFunctionInfo", model));
                }
                else
                {
                    int areaID       = model.AreaID.Value;
                    int controllerID = model.ControllerID.Value;
                    int?parentID     = model.ParentID;
                    int actionID     = model.ActionID.Value;
                    model.IsTopFunction = model.ParentID == null;


                    model.AreasSelectList = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName", areaID);

                    model.ControllersSelectList = new SelectList(ControllerBLL.GetControllersByAreaID(areaID), "ID", "ControllerName", controllerID);

                    model.ActionsSelectList = ActionBLL.GetActionsByControllerID(controllerID).ToSelectList(m => GetSelectListItem(m.ID, m.ActionName));

                    model.ParentFunctionsSelectList = new SelectList(FunctionBLL.GetFunctions(model.ID), "ID", "FunctionName");

                    return(PartialView("_EditFunctionInfo", model));
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 动作设定
        /// </summary>
        public ActionResult ActionSetting()
        {
            ActionSettingModel model = new ActionSettingModel();
            var areaList             = AreaBLL.GetAreas();

            model.AreasSelectList = areaList.ToSelectListWithAll(m => GetSelectListItem(m.ID, m.AreaName));

            var ctrList = ControllerBLL.GetControllers();

            model.ControllersSelectList = ctrList.ToSelectListWithAll(m => GetSelectListItem(m.ID, m.ControllerName));

            model.SearchPage   = 1;
            model.AreaID       = -1;
            model.ControllerID = -1;
            model.PagedDatas   = ActionBLL.GetPagedActions(model, PageSize);

            return(PartialView("_ActionSetting", model));
        }
예제 #11
0
 public ActionResult AddActionInfo(ActionAddModel model)
 {
     if (ModelState.IsValid)
     {
         var result = ActionBLL.AddAction(model, base.UserIDForLog);
         base.DoLog(Model.OperationTypeEnum.Add, result, "ActionName:" + model.ActionName);
         return(Json(result));
     }
     else
     {
         int areaID = model.AreaID;
         var aList  = AreaBLL.GetAreas();
         model.AreasSelectList = new SelectList(aList, "ID", "AreaName", areaID);
         var cList = ControllerBLL.GetControllersByAreaID(areaID);
         model.ControllersSelectList = new SelectList(cList, "ID", "ControllerName", model.ControllerID);
         return(PartialView("_AddActionInfo", model));
     }
 }
예제 #12
0
        public ActionResult GetControllerDDLWithDefaultByAreaID(int areaID)
        {
            List <Asiatek.Model.ControllerDDLModel> list;

            if (areaID == -1)
            {
                list = ControllerBLL.GetControllers();
            }
            else
            {
                list = ControllerBLL.GetControllersByAreaID(areaID);
            }
            list.Insert(0, new Model.ControllerDDLModel()
            {
                ID = -1, ControllerName = Asiatek.Resource.UIText.All
            });
            return(Json(list, JsonRequestBehavior.AllowGet));
        }
예제 #13
0
        //public ActionResult AddFunctionInfo()
        //{
        //    var aList = AreaBLL.GetAreas();
        //    FunctionAddModel model = new FunctionAddModel();
        //    model.AreasSelectList = new SelectList(aList, "ID", "AreaName");

        //    var cList = ControllerBLL.GetControllersByAreaID(aList.First().ID);
        //    model.ControllersSelectList = new SelectList(cList, "ID", "ControllerName");

        //    var actionList = ActionBLL.GetActionsByControllerID(cList.First().ID);
        //    model.ActionsSelectList = new SelectList(actionList, "ID", "ActionName");


        //    var parentFuncList = FunctionBLL.GetFunctions();
        //    model.ParentFunctionsSelectList = new SelectList(parentFuncList, "ID", "FunctionName");


        //    return PartialView("_AddFunctionInfo", model);
        //}

        public ActionResult AddFunctionInfo()
        {
            var aList = AreaBLL.GetAreas();
            FunctionAddModel model = new FunctionAddModel();

            model.OrderIndex = Int32.MaxValue;//默认新增的处于最后的位置

            model.AreasSelectList = new SelectList(aList, "ID", "AreaName");

            var cList = ControllerBLL.GetControllersByAreaID(aList.First().ID);

            model.ControllersSelectList = new SelectList(cList, "ID", "ControllerName");

            var actionList = ActionBLL.GetActionsByControllerID(cList.First().ID);

            //model.ActionsSelectList = actionList.ToSelectListWithEmpty(m => GetSelectListItem(m.ID, m.ActionName));
            model.ActionsSelectList = actionList.ToSelectList(m => GetSelectListItem(m.ID, m.ActionName));
            var parentFuncList = FunctionBLL.GetFunctions();

            model.ParentFunctionsSelectList = new SelectList(parentFuncList, "ID", "FunctionName", parentFuncList.First().ID);

            return(PartialView("_AddFunctionInfo", model));
        }
예제 #14
0
        //public ActionResult EditFunctionInfo(int id)
        //{
        //    string message = string.Empty;
        //    var obj = FunctionBLL.GetFunctionByID(id);
        //    if (obj.DataResult == null)
        //    {
        //        return Content(obj.Message);
        //    }


        //    var model = obj.DataResult;

        //    model.IsTopFunction = model.ParentID == null;

        //    model.AreasSelectList = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName");

        //    model.ControllersSelectList = new SelectList(ControllerBLL.GetControllersByAreaID(model.AreaID), "ID", "ControllerName");

        //    model.ActionsSelectList = new SelectList(ActionBLL.GetActionsByControllerID(model.ControllerID), "ID", "ActionName");

        //    model.ParentFunctionsSelectList = new SelectList(FunctionBLL.GetFunctions(), "ID", "FunctionName");

        //    return PartialView("_EditFunctionInfo", model);
        //}

        //[HttpPost, ValidateAntiForgeryToken]
        //public ActionResult EditFunctionInfo(FunctionEditModel model)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        var result = FunctionBLL.EditFunction(model);
        //        base.DoLog(OperationTypeEnum.Edit, result, "FunctionID:" + model.ID);
        //        return Json(result);
        //    }
        //    else
        //    {
        //        int areaID = model.AreaID;
        //        int controllerID = model.ControllerID;
        //        int? parentID = model.ParentID;
        //        int actionID = model.ActionID;
        //        model.IsTopFunction = model.ParentID == null;


        //        model.AreasSelectList = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName", areaID);

        //        model.ControllersSelectList = new SelectList(ControllerBLL.GetControllersByAreaID(areaID), "ID", "ControllerName", controllerID);

        //        model.ActionsSelectList = new SelectList(ActionBLL.GetActionsByControllerID(controllerID), "ID", "ActionName", actionID);

        //        model.ParentFunctionsSelectList = new SelectList(FunctionBLL.GetFunctions(), "ID", "FunctionName", parentID);

        //        return PartialView("_EditFunctionInfo", model);
        //    }
        //}



        public ActionResult EditFunctionInfo(int id)
        {
            var obj = FunctionBLL.GetFunctionByID(id);

            if (obj.DataResult == null)
            {
                return(Content(obj.Message));
            }


            var model = obj.DataResult;

            model.IsTopFunction  = model.ParentID == null;
            model.FunctionIsMenu = model.ActionID == null;

            var areas = AreaBLL.GetAreas();

            model.AreasSelectList = new SelectList(areas, "ID", "AreaName");


            List <ControllerDDLModel> controllers;

            if (!model.AreaID.HasValue)//没有与Action绑定过的功能
            {
                controllers = ControllerBLL.GetControllersByAreaID(areas.First().ID);
            }
            else
            {
                controllers = ControllerBLL.GetControllersByAreaID(model.AreaID.Value);
            }
            model.ControllersSelectList = new SelectList(controllers, "ID", "ControllerName");

            List <ActionDDLModel> actions;

            if (!model.ControllerID.HasValue)//没有与Action绑定过的功能
            {
                actions = ActionBLL.GetActionsByControllerID(controllers.First().ID);
            }
            else
            {
                actions = ActionBLL.GetActionsByControllerID(model.ControllerID.Value);
            }

            model.ActionsSelectList = actions.ToSelectList(m => GetSelectListItem(m.ID, m.ActionName));

            var parentFunctions = FunctionBLL.GetFunctions(model.ID);

            //如果是顶级功能,则没有上级功能,所以默认选一个
            if (model.IsTopFunction)
            {
                var tempPid = parentFunctions.First().ID;
                model.ParentFunctionsSelectList = new SelectList(parentFunctions, "ID", "FunctionName", tempPid);
                model.ParentID = tempPid;
            }
            else
            {
                model.ParentFunctionsSelectList = new SelectList(parentFunctions, "ID", "FunctionName", model.ParentID);
            }

            return(PartialView("_EditFunctionInfo", model));
        }
예제 #15
0
        public ActionResult CheckAddControllerNameExists(string controllerName, int areaID)
        {
            bool result = ControllerBLL.CheckControllerNameExists(controllerName, areaID);

            return(Json(!result));
        }
예제 #16
0
        public ActionResult GetControllerDDLByAreaID(int areaID)
        {
            var list = ControllerBLL.GetControllersByAreaID(areaID);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }