コード例 #1
0
ファイル: CtrController.cs プロジェクト: SweetieXu/lhzw
        public ActionResult AddControllerInfo()
        {
            ControllerAddModel model = new ControllerAddModel();

            model.AreasSelectList = new SelectList(AreaBLL.GetAreas(), "ID", "AreaName");
            return(PartialView("_AddControllerInfo", model));
        }
コード例 #2
0
 private void CargarComboBox()
 {
     Area_Cbx.DataValueField = "AreaId";
     Area_Cbx.DataTextField  = "Descripcion";
     Area_Cbx.DataSource     = AreaBLL.GetAreas();
     Area_Cbx.DataBind();
 }
コード例 #3
0
ファイル: ActionController.cs プロジェクト: SweetieXu/lhzw
        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
ファイル: CtrController.cs プロジェクト: SweetieXu/lhzw
        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
ファイル: CtrController.cs プロジェクト: SweetieXu/lhzw
 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
ファイル: ActionController.cs プロジェクト: SweetieXu/lhzw
        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
ファイル: ActionController.cs プロジェクト: SweetieXu/lhzw
 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
ファイル: CtrController.cs プロジェクト: SweetieXu/lhzw
        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
ファイル: ActionController.cs プロジェクト: SweetieXu/lhzw
        /// <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
ファイル: ActionController.cs プロジェクト: SweetieXu/lhzw
 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 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));
        }
コード例 #13
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));
        }
コード例 #14
0
 private void CargarLista()
 {
     ListaAreas_GV.DataSource = AreaBLL.GetAreas();
     ListaAreas_GV.DataBind();
 }