Exemplo n.º 1
0
        public string GetCurrentRole()
        {
            string roleid = Request.QueryString["id"];

            SM.YuQing.BLL.Role bll = new SM.YuQing.BLL.Role();
            return(bll.GetModel(Convert.ToInt32(roleid)).Name);
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            string id = context.Request.Form["id"];

            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetNoStore();

            SM.YuQing.BLL.Role   bll  = new SM.YuQing.BLL.Role();
            SM.YuQing.Model.Role role = bll.GetModel(Convert.ToInt32(id));

            //删除与人员相关
            bll.DeleteRolePerson(id);
            //删除与菜单相关
            bll.DeleteRoleMenuOperation(id);
            //删除角色
            bool      success = bll.Delete(Convert.ToInt32(id));
            Hashtable ht      = new Hashtable();

            if (success)
            {
                ht.Add("success", true);
                string clientip = context.Request.UserHostAddress;
                SM.YuQing.BLL.Log.Add("操作", context.User.Identity.Name + " 删除角色[" + role.Name + "]", 0, 0, clientip);
            }
            else
            {
                ht.Add("errorMsg", "Some errors occured.");
            }
            context.Response.Write(JsonConvert.SerializeObject(ht));
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetNoStore();
            SM.YuQing.BLL.Role bll = new SM.YuQing.BLL.Role();
            DataTable          dt  = bll.GetAllList().Tables[0];

            context.Response.Write(JsonConvert.SerializeObject(dt));
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetNoStore();
            int id = Convert.ToInt32(context.Request.QueryString["id"]);

            SM.YuQing.BLL.Role bll = new SM.YuQing.BLL.Role();
            context.Response.Write(JsonConvert.SerializeObject(bll.GetMenuOperation(id)));
        }
Exemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            string id          = context.Request.QueryString["id"];
            string Name        = context.Request.Form["Name"];
            string Description = context.Request.Form["Description"];
            bool   success;

            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetNoStore();
            string clientip = context.Request.UserHostAddress;

            if (id == null)
            {
                SM.YuQing.BLL.Role   bll   = new SM.YuQing.BLL.Role();
                SM.YuQing.Model.Role model = new SM.YuQing.Model.Role();
                model.Name         = Name;
                model.Description  = Description;
                model.CreateTime   = DateTime.Now;
                model.CreatePerson = "";
                model.UpdateTime   = DateTime.Now;
                model.UpdatePerson = "";

                success = bll.Add(model);
                SM.YuQing.BLL.Log.Add("操作", context.User.Identity.Name + " 创建角色[" + Name + "]", 0, 0, clientip);
            }
            else
            {
                SM.YuQing.BLL.Role   bll   = new SM.YuQing.BLL.Role();
                SM.YuQing.Model.Role model = bll.GetModel(Convert.ToInt32(id));
                model.Name         = Name;
                model.Description  = Description;
                model.UpdatePerson = "";
                model.UpdateTime   = DateTime.Now;

                success = bll.Update(model);
                SM.YuQing.BLL.Log.Add("操作", context.User.Identity.Name + " 修改角色[" + Name + "]", 0, 0, clientip);
            }
            Hashtable ht = new Hashtable();

            if (success)
            {
                ht.Add("success", true);
            }
            else
            {
                ht.Add("errorMsg", "Some errors occured.");
            }
            context.Response.Write(JsonConvert.SerializeObject(ht));
        }
Exemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetNoStore();

            string returnValue = "";

            string[] ids = context.Request.Form["ids"].Split(',');
            string   id  = context.Request.Form["id"];

            SM.YuQing.BLL.Role bll = new SM.YuQing.BLL.Role();
            if (bll.SaveRoleMenuOperation(id, ids))
            {
                returnValue = "OK";
                string clientip           = context.Request.UserHostAddress;
                SM.YuQing.Model.Role role = bll.GetModel(Convert.ToInt32(id));
                SM.YuQing.BLL.Log.Add("操作", context.User.Identity.Name + " 给角色[" + role.Name + "]分配权限", 0, 0, clientip);
            }
            context.Response.Write(returnValue);
        }