private void button1_Click(object sender, EventArgs e)
        {
            int Id = Int32.Parse(CityId.Text);
            //var x = UserBLL.GetById(1);

            User user = UserSL.GetUser(UserSL.GetById(Regestration.CurrentUser.Id));

            SL.Role User_Role = (SL.Role)Regestration.CurrentUser.Role_Id;
            City    city      = CitySL.GetById(Id, User_Role);

            if (city == null)
            {
                richTextBox1.Text = string.Format("Its Not Allowed for You to get any city ");
            }
            else
            {
                richTextBox1.Text = string.Format("City Id : {0} \nCity Name : {1}", city.ID, city.City_Name);
            }
        }
Esempio n. 2
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");
            }
        }