private bool validateall()
 {
     RequiredFieldValidator1.Validate();
     RequiredFieldValidator2.Validate();
     RequiredFieldValidator3.Validate();
     RequiredFieldValidator4.Validate();
     RequiredFieldValidator5.Validate();
     RequiredFieldValidator6.Validate();
     RequiredFieldValidator7.Validate();
     RequiredFieldValidator8.Validate();
     RequiredFieldValidator9.Validate();
     RegularExpressionValidator1.Validate();
     RegularExpressionValidator2.Validate();
     RegularExpressionValidator3.Validate();
     RegularExpressionValidator4.Validate();
     RegularExpressionValidator5.Validate();
     RegularExpressionValidator6.Validate();
     RegularExpressionValidator7.Validate();
     CompareValidator1.Validate();
     CompareValidator2.Validate();
     CompareValidator3.Validate();
     if (!RequiredFieldValidator1.IsValid || !RequiredFieldValidator2.IsValid || !RequiredFieldValidator3.IsValid || !RequiredFieldValidator4.IsValid || !RequiredFieldValidator5.IsValid || !RequiredFieldValidator6.IsValid || !RequiredFieldValidator7.IsValid || !RequiredFieldValidator8.IsValid || !RequiredFieldValidator9.IsValid ||
         !RegularExpressionValidator1.IsValid || !RegularExpressionValidator2.IsValid || !RegularExpressionValidator3.IsValid || !RegularExpressionValidator4.IsValid || !RegularExpressionValidator5.IsValid || !RegularExpressionValidator6.IsValid || !RegularExpressionValidator7.IsValid || !CompareValidator1.IsValid || !CompareValidator2.IsValid || !CompareValidator3.IsValid)
     {
         return(false);
     }
     return(true);
 }
    protected void create_account_L_Click(object sender, EventArgs e)
    {
        RequiredFieldValidator4.Validate();
        RequiredFieldValidator5.Validate();
        RequiredFieldValidator6.Validate();
        RegularExpressionValidator4.Validate();
        RequiredFieldValidator7.Validate();
        RegularExpressionValidator5.Validate();
        RequiredFieldValidator8.Validate();
        newTextComp7.Validate();

        if (RequiredFieldValidator4.IsValid == false ||
            RequiredFieldValidator5.IsValid == false ||
            RequiredFieldValidator6.IsValid == false ||
            RegularExpressionValidator4.IsValid == false ||
            RegularExpressionValidator5.IsValid == false ||
            RequiredFieldValidator7.IsValid == false ||
            RequiredFieldValidator8.IsValid == false ||
            newTextComp7.IsValid == false)
        {
            login_users.Visible             = true;
            current_users_panel.Visible     = false;
            new_users_panel.Visible         = true;
            user_account_panel.Visible      = false;
            recover_password.Visible        = false;
            New_Current_Users.SelectedIndex = 1;
            return;
        }

        List <User> allUsersList = Application["AllUsersList"] as List <User>;

        String name        = name_T.Text;
        String company     = company_T.Text;
        String address     = addr_T.Text;
        String phone       = phone_T.Text;
        String email_id    = email_id_T.Text;
        int    code_system = Int32.Parse(acc_code_T.Text);
        int    code        = Int32.Parse(code_T.Text);

        if ((Application["AllUsersList"] != null) && (check_Existing_User(allUsersList, email_id)))
        {
            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "alert('Your Email-Address is already registered in our database. Please Login!');", true);

            login_users.Visible             = true;
            current_users_panel.Visible     = false;
            new_users_panel.Visible         = true;
            user_account_panel.Visible      = false;
            recover_password.Visible        = false;
            New_Current_Users.SelectedIndex = 1;
            return;
        }
        else
        {
            User aUser = new User();

            aUser.FullName       = name;
            aUser.Company        = company;
            aUser.MailingAddress = address;
            aUser.PhoneNumber    = phone;
            aUser.EmailAddress   = email_id;
            aUser.AccessCode     = code;

            allUsersList.Add(aUser);
            Application["AllUsersList"] = allUsersList;

            // Storing into table Users.
            String        connStr = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
            SqlConnection conn    = new SqlConnection(connStr);

            String insert = "Insert into ParabA2_WADsp16_users(accessCode, fullName, company, mailingAddress, phoneNumber, emailAddress) " +
                            "values(" + code + ", '" +
                            name + "', '" +
                            company + "', '" +
                            address + "', '" +
                            phone + "', '" +
                            email_id + "')";
            SqlCommand command = new SqlCommand(insert, conn);

            //SqlTransaction trans = conn.BeginTransaction("User_trans");
            try
            {
                conn.Open();
                command.BeginExecuteNonQuery();
            }
            finally
            {
                //trans.Commit();
                conn.Close();
            }

            String header  = "Registeration";
            String subject = "T & P Delivery Service - Registration Confirmation";
            String body    = "Valued Customer " + aUser.FullName + ",<br/>Thank you for registering with T & P Delivery Service Name. You can now start using your account to " +
                             "request us to deliver your goods.<br/><br/>" +
                             "Looking forward to business with you.<br/>" +
                             "Thank You again for keeping trust on us.<br/><br/>T & P Delivery Service – Security Team";
            if (send_mail_to_user(aUser.EmailAddress, header, subject, body))
            {
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "alert('Thank You for registering. You can now Login!');", true);

                login_users.Visible             = true;
                current_users_panel.Visible     = true;
                new_users_panel.Visible         = false;
                user_account_panel.Visible      = false;
                recover_password.Visible        = false;
                New_Current_Users.SelectedIndex = 0;
            }
        }
    }