示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddRole role = new AddRole();

            //this.Hide();
            //role.Show();
            Countries_Cities c        = new Countries_Cities();
            string           email    = SplitSpaces(emailSignIn.Text);
            string           password = SplitSpaces(passSignIn.Text);

            foreach (var user in users)
            {
                user.Email    = SplitSpaces(user.Email);
                user.Password = SplitSpaces(user.Password);
                if (user.Email == email)
                {
                    if (user.Password == password)
                    {
                        CurrentUser.Name     = SplitSpaces(user.Name);
                        CurrentUser.Email    = user.Email;
                        CurrentUser.Password = user.Password;
                        CurrentUser          = user;
                        this.Hide();
                        c.Show();
                        return;
                    }
                }
            }
            MessageBox.Show("Enter Valid Mail or Password");
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Countries_Cities c = new Countries_Cities();

            if (Regestration.CurrentUser != null)
            {
                button1.BackColor = Color.DarkRed;
                button1.ForeColor = Color.White;
                this.Hide();
                c.Show();
            }
            else
            {
                MessageBox.Show("You Should regester or login first");
            }
        }
示例#3
0
        private void SignUp_Click(object sender, EventArgs e)
        {
            Countries_Cities c            = new Countries_Cities();
            string           UserEmail    = SplitSpaces(EmailSignUp.Text);
            string           UserName     = SplitSpaces(NameSignUp.Text);
            string           UserPassword = SplitSpaces(PasswordSignUp.Text);
            int role = Int32.Parse(comboBox1.SelectedValue.ToString());

            if (UserName.Length != 0)
            {
                if (UserEmail.Length != 0)
                {
                    if (UserPassword.Length != 0)
                    {
                        UserSL.Add(UserName, UserEmail, UserPassword, role);
                        CurrentUser.Name     = UserName;
                        CurrentUser.Email    = UserEmail;
                        CurrentUser.Password = UserPassword;
                        CurrentUser.Id       = users.Count + 1;
                        CurrentUser.Role_Id  = role;
                        MessageBox.Show("Account Created Successfully");

                        this.Hide();
                        c.Show();
                        return;
                    }
                    else
                    {
                        MessageBox.Show("password is required");
                    }
                }
                else
                {
                    MessageBox.Show("Email is required");
                }
            }
            else
            {
                MessageBox.Show("UserName Is Required");
            }
        }