示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtMemberName.Text.Trim().Length == 0)
            {
                strErr += "MemberName不能为空!\\n";
            }
            if (this.txtPassword.Text.Trim().Length == 0)
            {
                strErr += "Password不能为空!\\n";
            }
            if (this.txtLinkphoto.Text.Trim().Length == 0)
            {
                strErr += "Linkphoto不能为空!\\n";
            }
            if (this.txtEmail.Text.Trim().Length == 0)
            {
                strErr += "Email不能为空!\\n";
            }
            if (this.txtQQMSN.Text.Trim().Length == 0)
            {
                strErr += "QQMSN不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string MemberName = this.txtMemberName.Text;
            string Password   = this.txtPassword.Text;
            bool   Sex        = this.chkSex.Checked;
            string Linkphoto  = this.txtLinkphoto.Text;
            string Email      = this.txtEmail.Text;
            string QQMSN      = this.txtQQMSN.Text;

            Maticsoft.Model.MemberInfo model = new Maticsoft.Model.MemberInfo();
            model.MemberName = MemberName;
            model.Password   = Password;
            model.Sex        = Sex;
            model.Linkphoto  = Linkphoto;
            model.Email      = Email;
            model.QQMSN      = QQMSN;

            Maticsoft.BLL.MemberInfo bll = new Maticsoft.BLL.MemberInfo();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
示例#2
0
        protected void btnok_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.MemberInfo   menbll   = new Maticsoft.BLL.MemberInfo();
            Maticsoft.Model.MemberInfo menmodel = new Maticsoft.Model.MemberInfo();
            if (txtname.Text.Trim() == "")
            {
                lblusername.Text = "请填写用户名";
                return;
            }
            if (menbll.GetExists(txtname.Text.Trim()))
            {
                lblusername.Text = "用户已存在";
                return;
            }
            menmodel.MemberName = txtname.Text.Trim();
            lblusername.Text    = "";
            if (txtpass.Text.Trim() == "")
            {
                lblpass.Text = "请填写密码";
                return;
            }
            if (txtpassord.Text.Trim() == "")
            {
                lblpassword.Text = "请填写确认密码";
                return;
            }
            if (txtpass.Text.Trim() != txtpassord.Text.Trim())
            {
                lblpassword.Text = "前后密码不相同";
                return;
            }
            menmodel.Password = txtpassord.Text.Trim();
            lblpass.Text      = "";
            lblpassword.Text  = "";
            if (drpsex.SelectedIndex == 0)
            {
                lblsex.Text = "请选择您的性别";
            }
            else if (drpsex.SelectedIndex == 1)
            {
                menmodel.Sex = 1;
            }
            else
            {
                menmodel.Sex = 0;
            }

            if (txtlinkphoto.Text.Trim() == "")
            {
                lblLinkphoto.Text = "请填写联系电话";
                return;
            }
            menmodel.Linkphoto = txtlinkphoto.Text.Trim();
            lblLinkphoto.Text  = "";
            if (txtemail.Text.Trim() == "")
            {
                lblemail.Text = "请填写电子邮箱";
                return;
            }
            menmodel.Email = txtemail.Text.Trim();
            lblemail.Text  = "";
            menmodel.QQMSN = txtqq.Text.Trim();
            menbll.Add(menmodel);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
            txtname.Text      = string.Empty;
            txtpass.Text      = string.Empty;
            txtpassord.Text   = string.Empty;
            txtlinkphoto.Text = string.Empty;
            txtemail.Text     = string.Empty;
            txtqq.Text        = string.Empty;
        }