Esempio n. 1
0
        //用户角色设置
        public ActionResult UserRoleOperation()
        {
            string ugid  = Request["ugid"] ?? string.Empty;
            string rgid  = Request["rgid"] ?? string.Empty;
            int    oType = Request["oType"].ToInt32(-1); //1:新增;0:删除

            int result = 0;

            if (oType == 1)
            {
                User_Role_Mapping obj = new User_Role_Mapping();
                obj.u_gid          = ugid;
                obj.r_gid          = rgid;
                obj.u_r_CreateTime = DateTime.Now;
                obj.u_r_CreateUser = SiteHelp.CurrentUserName;
                obj.u_r_gid        = Entity.GenerateGUID();

                result = SystemSeviceClass.User_Role_Mapping_Insert(obj);
            }
            else if (oType == 0)
            {
                result = SystemSeviceClass.User_Role_Mapping_DeleteByr_gidAndu_gid(rgid, ugid);
            }

            if (result > 0)
            {
                return(Json(new { success = true, errors = new { text = "操作成功" } }));
            }
            else
            {
                return(Json(new { success = false, errors = new { text = "操作失败" } }));
            }
        }