示例#1
0
        public JsonResult SystemAccount()
        {
            var sReturnModel = new ReturnMessageModel();

            string UserName = RequestParameters.Pstring("UserName");
            string Password = RequestParameters.Pstring("Password");
            string newPwd   = new AESCrypt().Encrypt(Password);

            td_User userInfo = new td_User();

            //userInfo.user_Id = 141;
            userInfo.user_Name = UserName;
            userInfo.user_Pwd  = newPwd;
            userInfo.user_Sign = 1;
            //userInfo.user_TrueName = "test";
            //userInfo.user_Purview = 1;
            //userInfo.user_Dept = "hlw";

            try
            {
                var usersBll = new BLL_User();
                var item     = usersBll.GetObjectByUserAccount(UserName);//, HashEncrypt.BgPassWord(Password));
                if (item == null)
                {
                    if (usersBll.AddAccount(userInfo))
                    {
                        sReturnModel.ErrorType      = 1;
                        sReturnModel.MessageContent = "注册成功.";
                    }
                    else
                    {
                        sReturnModel.ErrorType      = 2;
                        sReturnModel.MessageContent = "注册失败.";
                    }
                    return(Json(sReturnModel));
                }
                else
                {
                    sReturnModel.ErrorType      = 2;
                    sReturnModel.MessageContent = "账号名称已存在.";
                    return(Json(sReturnModel));
                }
            }
            catch (Exception ex)
            {
                sReturnModel.ErrorType      = 2;
                sReturnModel.MessageContent = "系统异常:" + ex.Message;
                return(Json(sReturnModel));
            }
        }