예제 #1
0
        public ActionResult Edit(string id, string Title, string ParentId, string Url, string Status = "1")
        {
            T_Permissions model = bll.GetById(id);

            model.Title      = Title;
            model.ParentId   = ParentId;
            model.Status     = int.Parse(Status);//默认正常
            model.Url        = Url;
            model.CreateDate = DateTime.Now;
            try
            {
                if (bll.Update(model))
                {
                    return(Json(new { success = true, msg = "操作成功" }));
                }
                else
                {
                    return(Json(new { success = false, msg = "操作失败" }));
                }
            }
            catch
            {
                return(Json(new { success = false, msg = "操作失败" }));
            }
        }
예제 #2
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(string id)
        {
            var list = bll.GetAllList().Where(m => m.ParentId == "0").ToList();//获取一级权限列表

            ViewBag.list = list;
            T_Permissions model = bll.GetById(id);

            return(View(model));
        }
예제 #3
0
 /// <summary>
 ///  添加权限
 /// </summary>
 /// <param name="permission">权限对象</param>
 /// <returns></returns>
 public bool AddLimit(T_Permissions permission)
 {
     if (null == permission)
     {
         return(false);
     }
     permission.creator_date = DateTime.Now;
     permission.creator_id   = OperateContext.Current.Usr.user_id;
     permission.creator_name = OperateContext.Current.Usr.user_name;
     DBSession.IT_PermissionsDAL.Add(permission);
     return(true);
 }
예제 #4
0
        public ActionResult Add(string Title, string ParentId, string Url, string Status = "1")
        {
            T_Permissions model = new T_Permissions();

            model.id         = StringHelper.GetGuid();
            model.ParentId   = ParentId;
            model.Title      = Title;
            model.Status     = int.Parse(Status);//默认正常
            model.Url        = Url;
            model.CreateDate = DateTime.Now;
            try
            {
                bll.Add(model);
                return(Json(new { success = true, msg = "操作成功" }));
            }
            catch
            {
                return(Json(new { success = false, msg = "操作失败" }));
            }
        }
예제 #5
0
 public ActionResult AddLimit(T_Permissions permission)
 {
     if (!ModelState.IsValid)
     {
         return(operateContext.RedirectAjax(1, "数据验证失败~", "", ""));
     }
     try
     {
         bool Isback = base.operateContext.bllSession.T_Permissions.AddLimit(permission);
         if (Isback)
         {
             return(operateContext.RedirectAjax(0, "添加权限成功~", "", ""));
         }
         return(operateContext.RedirectAjax(1, "添加权限失败~", "", ""));
     }
     catch (Exception ex)
     {
         return(operateContext.RedirectAjax(1, ex.Message, "", ""));
     }
 }
예제 #6
0
        public ActionResult EditLimit(T_Permissions permission)
        {
            if (!ModelState.IsValid)
            {
                return(operateContext.RedirectAjax(1, "数据验证失败~", "", ""));
            }
            int per_id = HCQ2_Common.Helper.ToInt(Request["per_id"]);

            if (per_id <= 0)
            {
                return(operateContext.RedirectAjax(1, "权限主键值为空~", "", ""));
            }
            bool IsBack = base.operateContext.bllSession.T_Permissions.EditLimit(permission, per_id);

            //清理权限缓存
            SessionHelper.RemoveSession(CacheConstant.loginUserCachePermiss);
            if (IsBack)
            {
                return(operateContext.RedirectAjax(0, "编辑权限成功~", "", ""));
            }
            return(operateContext.RedirectAjax(1, "编辑权限失败~", "", ""));
        }
예제 #7
0
 /// <summary>
 ///  编辑权限对象
 /// </summary>
 /// <param name="permission">权限对象</param>
 public void EditLimit(T_Permissions permission)
 {
     base.Modify(permission, "per_type", "per_code", "creator_date", "creator_id", "creator_name", "per_name",
                 "per_note", "sm_code");
 }
예제 #8
0
 /// <summary>
 /// 更新实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(T_Permissions model)
 {
     return(dal.Update(model));
 }
예제 #9
0
 /// <summary>
 /// 删除实体
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Delete(T_Permissions model)
 {
     return(dal.Delete(model));
 }
예제 #10
0
 /// <summary>
 /// 插入一条记录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Add(T_Permissions model)
 {
     dal.Add(model);
 }