Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.Member Mmember = new Model.Member();
            BLL.Member   Bmember = new BLL.Member();

            Mmember.memberNo    = Bmember.CreateNo();
            Mmember.memPassword = txtPassword.Text.Trim();
            Mmember.memName     = txtName.Text.Trim();
            Mmember.sex         = transfer(this.ddlSex.SelectedItem.Text);
            Mmember.birthday    = DateTime.Now;
            Mmember.telephone   = txtPhone.Text.Trim();
            Mmember.email       = txtEmail.Text.Trim();
            Mmember.address     = txtAddress.Text.Trim();
            Mmember.zipCode     = txtPostCode.Text.Trim();
            Mmember.totalAmount = 0;
            Mmember.memLevel    = "1";
            Mmember.discount    = 0;
            //判断是否输入必要的信息
            if (this.txtPostCode.Text.Trim() == "" && this.txtPhone.Text.Trim() == "" && this.txtEmail.Text.Trim() == "")
            {
                Response.Write(ccObj.MessageBoxPage("请输入必要的信息!"));
            }
            else
            {
                bool flag = Bmember.Add(Mmember);
                if (flag)
                {
                    Response.Write(ccObj.MessageBox("恭喜您,注册成功!" + "会员账号为:" + Mmember.memberNo + "  密码为:" + Mmember.memPassword, "Default.aspx"));
                }
                else
                {
                    Response.Write(ccObj.MessageBox("注册失败,该名字已存在!"));
                }
            }
        }