Пример #1
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            if (tbxCaptcha.Text != Session["CaptchaImageText"].ToString())
            {
                Alert.ShowInTop("验证码错误!");
                return;
            }
            //检验账号是否被注册
            Demo.BLL.tb_SYS_Account bll = new Demo.BLL.tb_SYS_Account();

            if (bll.GetModelList("AccountName = '" + tbxUserName + "'").Count > 0)
            {
                //该用户已经被注册
                Alert.ShowInTop("该用户已经被注册!", MessageBoxIcon.Error);
            }
            else
            {
                //注册该用户

                Demo.Model.tb_SYS_Account model = new Demo.Model.tb_SYS_Account();

                model.ID          = Guid.NewGuid().ToString();
                model.AccountName = tbxUserName.Text.Trim();
                model.CreateID    = Guid.NewGuid().ToString();
                model.Password    = tbxPassword.Text.ToString();
                model.CreateTime  = DateTime.Now;
                model.RoleID      = "a58ed217-31b5-48fe-b8ed-b28d452a797d";

                if (bll.Add(model))
                {
                    Alert.ShowInTop("注册成功!", MessageBoxIcon.Information);
                    Session["AccountName"] = tbxUserName.Text;
                    Session["AccountID"]   = model.ID;
                    Session["RoleName"]    = "未认证角色";
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    Alert.ShowInTop("注册失败!", MessageBoxIcon.Error);
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Demo.Model.tb_SYS_Account model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Demo.Model.tb_SYS_Account model)
 {
     return(dal.Add(model));
 }