예제 #1
0
        private void AddUser()
        {
            string    PassSalt = StringHelper.RandomString(4);
            string    PassWord = StringHelper.MD5string(HttpContext.Current.Request.Params["psys_user_txtPassWord"] + PassSalt);
            string    UserName = HttpContext.Current.Request.Params["psys_user_txtUserName"];
            Hashtable ht       = new Hashtable();

            ht.Add("UserName", $" and UserName ='******'");
            var          TempUser     = Bll_Sys_User.Instance.getSysUserList(ht);
            Mod_Com_Json mod_Com_Json = new Mod_Com_Json();

            if (TempUser == null)
            {
                Mod_Sys_User mod_Sys_User = new Mod_Sys_User();
                mod_Sys_User.PassSalt = PassSalt;
                mod_Sys_User.PassWord = PassWord;
                mod_Sys_User.RoleId   = -1;
                mod_Sys_User.UserName = UserName;
                int result = Bll_Sys_User.Instance.Add(mod_Sys_User);

                if (result == 1)
                {
                    mod_Com_Json.Data      = "";
                    mod_Com_Json.Message   = "成功";
                    mod_Com_Json.StatuCode = "200";
                }
                else
                {
                    mod_Com_Json.Data      = "";
                    mod_Com_Json.Message   = "失败";
                    mod_Com_Json.StatuCode = "-1";
                }
            }
            else
            {
                mod_Com_Json.Data      = "";
                mod_Com_Json.Message   = "失败,用户名重复";
                mod_Com_Json.StatuCode = "-1";
            }
            HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
            HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json));
        }
예제 #2
0
        /// <summary>
        /// 删除菜单
        /// </summary>
        public void DeleteSys_Menue()
        {
            Mod_Sys_Menu _Sys_Menu = new Mod_Sys_Menu();

            BindDataToModel(ref _Sys_Menu);
            bool         rval         = Bll_Sys_Menu.Instance.Delete(_Sys_Menu.MenuId);
            Mod_Com_Json mod_Com_Json = new Mod_Com_Json();

            if (rval)
            {
                mod_Com_Json.Message   = "删除成功";
                mod_Com_Json.StatuCode = "200";
            }
            else
            {
                mod_Com_Json.Message   = "删除失败";
                mod_Com_Json.StatuCode = "-1";
            }
            HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json));
        }
예제 #3
0
        /// <summary>
        /// 新增菜单
        /// </summary>
        public void AddSys_Menue()
        {
            Mod_Sys_Menu _Sys_Menu = new Mod_Sys_Menu();

            BindDataToModel(ref _Sys_Menu);
            int          rval         = Bll_Sys_Menu.Instance.Add(_Sys_Menu);
            Mod_Com_Json mod_Com_Json = new Mod_Com_Json();

            if (rval >= 0)
            {
                mod_Com_Json.Message   = "新增成功";
                mod_Com_Json.StatuCode = "200";
            }
            else
            {
                mod_Com_Json.Message   = "新增失败";
                mod_Com_Json.StatuCode = "-1";
            }
            HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json));
        }
예제 #4
0
        private void UpdateUser()
        {
            Hashtable ht         = new Hashtable();
            string    UserId     = HttpContext.Current.Request.Params["psys_user_hidUserId"];
            string    UserName   = HttpContext.Current.Request.Params["psys_user_txtUserName"];
            string    IsDisabled = HttpContext.Current.Request.Params["psys_user_chkIsDisabled"] == null ? "false" : "true";

            ht.Add("UserId", $" and UserId ='{UserId}'");
            var TempUser = Bll_Sys_User.Instance.getSysUserList(ht);

            Mod_Com_Json mod_Com_Json = new Mod_Com_Json();

            if (TempUser.Count > 0)
            {
                TempUser[0].UserName   = UserName;
                TempUser[0].IsDisabled = IsDisabled == "false" ? false : true;
                int resultNum = Bll_Sys_User.Instance.Update(TempUser[0]);
                if (resultNum != 1)
                {
                    mod_Com_Json.Data      = "";
                    mod_Com_Json.Message   = "失败,用户名重复";
                    mod_Com_Json.StatuCode = "-1";
                }
                else
                {
                    mod_Com_Json.Data      = "";
                    mod_Com_Json.Message   = "修改成功";
                    mod_Com_Json.StatuCode = "200";
                }
            }
            else
            {
                mod_Com_Json.Data      = "";
                mod_Com_Json.Message   = "失败,用户名重复";
                mod_Com_Json.StatuCode = "-1";
            }
            HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
            HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json));
        }