protected void SubmitRegisterBtn_Click(object sender, EventArgs e)
        {
            Regist mregist = new Regist();
               int mFlag4 = mregist.CheckUserRegist(txtEmail.Text);
               if (mFlag4 == 0)
               {

                   int mFlag3 = mregist.UserRegist(txtName.Text, txtEmail.Text, txtPassword1.Text, txtRemark.Text);

                      if (mFlag3 == 0)
                      {
                          Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('注册成功!')</script>");
                          Response.Redirect("ChatLogin.aspx");
                      }
                      else
                      {
                          Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('注册失败')</script>");
                          return;
                      }
               }
               else
               {
                   Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('该邮箱已被注册!请重新注册!')</script>");
                   return;

               }
        }
Exemple #2
0
        protected void SubmitRegisterBtn_Click(object sender, EventArgs e)
        {
            Regist mregister = new Regist();

               CheckRegist mckregist = new CheckRegist();
               int mFlag4 = mckregist.CheckUserRegist(TextBox3.Text);
               if (mFlag4 == 0)
               {

                      int mFlag3 = mregister.UserRegist(TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox6.Text);
                      Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('注册成功!')</script>");
                      if (mFlag3 == 0)
                      {
                          Response.Redirect("Login.aspx");
                      }
                      else
                      {
                          Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('注册失败')</script>");
                      }
               }
               else
               {
                   Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('该邮箱已被注册!请重新注册!')</script>");

               }
        }
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            Regist mregist = new Regist();
            int mFlag4 = mregist.CheckUserRegist(TextBox1.Text);

            if (mFlag4 == 1)                                              //判断是否存在此用户
            {
                AddFriend mAddFriend = new AddFriend();
                int mAgine = mAddFriend.CheckAddFriendMessage(Session["UserID"].ToString(), TextBox1.Text);
                if (mAgine == 1)                                          //判断是否已为好友
                {

                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('该用户已为好友')</script>");

                }
                else
                {
                    int mWork = mAddFriend.AddFriends(Session["UserID"].ToString(), TextBox1.Text);
                    if (mWork == 1)                                       //添加好友
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('等待对方回应')</script>");
                    }
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "<script Language='javascript'>alert('您输入的邮箱不存在,请重新输入!')</script>");

            }
        }