コード例 #1
0
        protected void btnregister_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtphoneno.MaxLength == 10)
                {
                    string landlordtenant = "";


                    if (rdblandlord.Checked == true)
                    {
                        landlordtenant = "Landlord";
                    }
                    else if (rdbtenant.Checked == true)
                    {
                        landlordtenant = "Tenant";
                    }
                    else
                    {
                        landlordtenant = "Admin";
                    }
                    //dsregister = loginDA.InsertregistrationDetailsAdmin(txtfirstname.Text, txtlastname.Text, txtusername.Text, txtpassword.Text, txtphoneno.Text, txtaddress.Text, txtcity.Text, txtstate.Text, txtzipcode.Text, txtemail.Text, TextBox1.Text,lblsecurity.Text,txtanswer.Text,landlordtenant);

                    //dsregister = loginDA.InsertregistrationDetails(txtfirstname.Text, txtlastname.Text, txtusername.Text, txtpassword.Text, txtphoneno.Text, txtaddress.Text, txtcity.Text, txtstate.Text, txtzipcode.Text, txtemail.Text);

                    dsregister = loginDA.InsertregistrationDetailsAdmin(txtfirstname.Text, txtlastname.Text, txtusername.Text, txtpassword.Text, txtphoneno.Text, txtemail.Text, TextBox1.Text, lblsecurity.Text, txtanswer.Text, landlordtenant);
                    if (dsregister.Tables[0].Rows[0]["COUNT"].ToString() == "0")
                    {
                        lblmessage.InnerHtml = "Registration Completed Successfully.";
                        txtfirstname.Text    = "";
                        txtlastname.Text     = "";
                        txtemail.Text        = "";
                        txtpassword.Text     = "";
                        txtphoneno.Text      = "";
                        //txtaddress.Text = "";
                        //txtcity.Text = "";
                        //txtstate.Text = "";
                        //txtzipcode.Text = "";
                        txtusername.Text    = "";
                        txtanswer.Text      = "";
                        TextBox1.Text       = "";
                        rdbtenant.Checked   = false;
                        rdblandlord.Checked = false;
                    }
                    else
                    {
                        lblmessage.InnerHtml = "This User id is already exist. Please try again";
                        txtusername.Text     = "";
                        txtpassword.Text     = "";
                    }
                }
                else
                {
                    lblmessage.InnerHtml = "Your contact number should be of 10 digits";
                }
            }
            catch (Exception ex)
            {
                lblmessage.InnerHtml = "This User id is already exist. Please try again";
                txtusername.Text     = "";
                txtpassword.Text     = "";
            }
            finally
            {
            }
        }