예제 #1
0
 public vPermission(Permission p)
 {
     this.ID = p.ID;
     this.PName = p.PName;
     this.FID = p.ParentID;
     this.PAreaName = p.PAreaName;
     this.PActionName = p.PActionName;
     this.PControllerName = p.PActionName;
     this.PFormMethod = p.PFormMethod;
     this.PURL = p.PURL;
     this.Remark = p.Remark;
     this.IsDelete = p.IsDelete;
     this.IsShow = p.IsShow;
     this.AddTime = p.AddTime.ToString();
 }
예제 #2
0
 /// <summary>
 /// 彻底删除
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult CompleteDelete(int id)
 {
     AjaxModel ajaxModle = new AjaxModel();
     Permission permission = new Permission();
     try
     {
         IPermissionBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetPermissionBLL;
         bll.DelBy(p => p.ID == id);
         ajaxModle.Statu = "ok";
         ajaxModle.Msg = "删除成功";
     }
     catch
     {
         ajaxModle.Statu = "err";
         ajaxModle.Msg = "删除失败";
     }
     return Json(ajaxModle);
 }
예제 #3
0
        public ActionResult Delete(int id)
        {
            AjaxModel ajaxModel = new AjaxModel();
            try
            {
                IPermissionBLL bll = DI.SpringHelper.GetObject<IBLL.IBLLSessionFactory>("BLLSessionFactory").GetBLLSession().GetPermissionBLL;
                Permission permission = new Permission();
                permission = bll.GetListBy(p => p.ID == id).SingleOrDefault();
                permission.IsDelete = true;
                bll.Modify(permission, "IsDelete");

                ajaxModel.Statu = "ok";
                ajaxModel.Msg = "删除成功!";
            }
            catch
            {
                ajaxModel.Statu = "err";
                ajaxModel.Msg = "删除失败!";
            }
            return Json(ajaxModel);
        }
예제 #4
0
        public ActionResult DoAdd(Permission model)
        {
            AjaxModel ajaxModel = new AjaxModel();

            try
            {
                IPermissionBLL bll = DI.SpringHelper.GetObject<IBLL.IBLLSessionFactory>("BLLSessionFactory").GetBLLSession().GetPermissionBLL;
                model.AddTime = DateTime.Now;
                model.IsDelete = false;
                bll.Add(model);
                ajaxModel.Statu = "ok";
                ajaxModel.Msg = "添加成功!";
                ajaxModel.BackUrl = "/Admin/Permission/Index";
            }
            catch
            {
                ajaxModel.Statu = "err";
                ajaxModel.Msg = "添加失败!";
            }
            return Json(ajaxModel);
        }
예제 #5
0
        /// <summary>
        /// 修改权限
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Update(int id)
        {
            IPermissionBLL bll = DI.SpringHelper.GetObject<IBLL.IBLLSessionFactory>("BLLSessionFactory").GetBLLSession().GetPermissionBLL;
            Permission permission = new Permission();
            permission = bll.GetListBy(p => p.ID == id).SingleOrDefault();
            List<SelectListItem> formLst = new List<SelectListItem>();
            formLst.Add(new SelectListItem { Text = "POST", Value = "0", Selected = permission.PFormMethod == 0 ? true : false });
            formLst.Add(new SelectListItem { Text = "GET", Value = "1", Selected = permission.PFormMethod == 1 ? true : false });

            ViewBag.FormLst = formLst;

            ViewBag.Permission = permission;
            return View();
        }
예제 #6
0
 /// <summary>
 /// 将回收箱 的权限还原
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Return(int id)
 {
     AjaxModel ajaxModle = new AjaxModel();
     Permission permission = new Permission();
     try
     {
         IPermissionBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetPermissionBLL;
         permission = bll.GetListBy(p => p.ID == id).SingleOrDefault();
         permission.IsDelete = false;
         bll.Modify(permission, "IsDelete");
         ajaxModle.Statu = "ok";
         ajaxModle.Msg = "还原成功";
     }
     catch
     {
         ajaxModle.Statu = "err";
         ajaxModle.Msg = "还原失败";
     }
     return Json(ajaxModle);
 }
예제 #7
0
 /// <summary>
 /// 修改权限
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ActionResult DoUpdate(Permission model)
 {
     AjaxModel ajaxModel = new AjaxModel();
     try
     {
         IPermissionBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetPermissionBLL;
         bll.Modify(model, "PName", "PAreaName", "PControllerName", "PActionName", "PFormMethod", "PURL", "IsShow", "Remark");
         ajaxModel.Statu = "ok";
         ajaxModel.Msg = "增加成功!";
         ajaxModel.BackUrl = "/Admin/Permission/Index";
     }
     catch
     {
         ajaxModel.Statu = "err";
         ajaxModel.Msg = "增加失败!";
     }
     return Json(ajaxModel);
 }