Esempio n. 1
0
        public PartialViewResult useradd()
        {
            UCHome_User user = new UCHome_User();

            user.PKID  = Guid.NewGuid();
            user.State = 1;
            return(PartialView(user));
        }
Esempio n. 2
0
        public JsonResult AddUser(UCHome_User user)
        {
            user.UserPwd = EncryptUtils.MD5Encrypt(user.UserPwd);
            UCHome_UserBLL userbll  = new UCHome_UserBLL();
            int            result   = userbll.AddUser(user);
            string         errormsg = "提交的数据异常或者网络异常";

            if (result == 1)
            {
                int result2 = userbll.AddRelationOrgAndUser(user.PKID, new Guid(UCHomeBasePage.GetConfig("MainSchoolID")));
                if (result2 == 1)
                {
                    var jrs = new {
                        StatusCode = 200,
                        data       = user
                    };
                    return(Json(jrs, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    userbll.RemoveUser(user);
                    errormsg = "添加组织关系失败";
                }
            }
            else if (result == 2)
            {
                errormsg = "账号已经存在";
            }
            else
            {
                errormsg = "提交的数据异常或者网络异常";
            }
            var jr = new {
                StatusCode = 500,
                data       = new UCHome_User {
                    PKID = Guid.NewGuid()
                },
                msg = errormsg
            };

            return(Json(jr, JsonRequestBehavior.AllowGet));
        }