Exemplo n.º 1
0
        private void AddUser()
        {
            string str     = LSRequest.qq("userName").ToLower().Trim();
            string str2    = LSRequest.qq("userPassword");
            string str3    = LSRequest.qq("userNicker");
            string str4    = LSRequest.qq("qx");
            string message = "";

            if (!base.ValidParamByUserAdd("child", ref message, null, null, null))
            {
                base.Response.Write(base.ShowDialogBox(message, null, 400));
                base.Response.End();
            }
            if (!Regexlib.IsValidPassword(str2.Trim(), base.get_GetPasswordLU()))
            {
                if (base.get_GetPasswordLU().Equals("1"))
                {
                    base.Response.Write(base.ShowDialogBox("密碼要8-20位,且必需包含大寫字母、小寫字母和数字!", null, 400));
                }
                else
                {
                    base.Response.Write(base.ShowDialogBox("密碼要8-20位,且必需包含字母、和数字!", null, 400));
                }
                base.Response.End();
            }
            cz_users_child model = new cz_users_child();

            model.set_u_id(Guid.NewGuid().ToString().ToUpper());
            model.set_u_name(str.Trim());
            model.set_u_nicker(str3.Trim());
            model.set_u_skin(base.GetUserSkin("agent"));
            string ramSalt = Utils.GetRamSalt(6);

            model.set_u_psw(DESEncrypt.EncryptString(str2, ramSalt));
            model.set_salt(ramSalt);
            model.set_parent_u_name(this.Session["user_name"].ToString());
            model.set_add_date(new DateTime?(DateTime.Now));
            model.set_status(0);
            model.set_permissions_name(str4.Trim());
            if (CallBLL.cz_users_child_bll.AddUser(model))
            {
                base.user_add_children_log(model);
                base.Response.Write(base.ShowDialogBox("添加子帳號成功!", base.UserReturnBackUrl, 0));
                base.Response.End();
            }
            else
            {
                base.Response.Write(base.ShowDialogBox("添加子帳號失敗!", base.UserReturnBackUrl, 400));
                base.Response.End();
            }
        }