Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ClientsForms re = new ClientsForms();

            this.Hide();
            re.Show();
        }
Ejemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (SecurityContext.autovxod == 1) //клиент
     {
         ClientsForms re = new ClientsForms();
         this.Hide();
         re.Show();
     }
     if (SecurityContext.autovxod == 3)
     {
         Realtors re = new Realtors();
         this.Hide();
         re.Show();
     }
 }
Ejemplo n.º 3
0
        private void aut_Click(object sender, RoutedEventArgs e) //авторизация
        {
            try
            { if (SecurityContext.autovxod == 1) //клиент
              {
                  RealtorEntities db = new RealtorEntities();
                  if (password.Password != "")
                  {
                      if (login.Text != "")
                      {
                          var rol = db.Client.Where(us => us.Login == login.Text && us.Password == password.Password).FirstOrDefault().id;

                          ClientsForms cli = new ClientsForms();
                          this.Hide();
                          cli.Show();
                          SecurityContext.idClient = rol;
                      }
                      else

                      {
                          MessageBox.Show("Поле логин не введено");
                      }
                  }
                  else

                  {
                      MessageBox.Show("Поле пароль не введено");
                  }
              }
              if (SecurityContext.autovxod == 2)   //realtor
              {
                  RealtorEntities db = new RealtorEntities();
                  if (password.Password != "")
                  {
                      if (login.Text != "")
                      {
                          var rol = db.Realtor.Where(us => us.Login == login.Text && us.Password == password.Password).FirstOrDefault().id;

                          FormsRealtors realtor = new FormsRealtors();
                          this.Hide();
                          realtor.Show();
                          SecurityContext.idRealtor = rol;
                      }
                      else

                      {
                          MessageBox.Show("Поле логин не введено");
                      }
                  }
                  else

                  {
                      MessageBox.Show("Поле пароль не введено");
                  }
              }
              if (SecurityContext.autovxod == 3)   //менеджер
              {
                  RealtorEntities db = new RealtorEntities();
                  if (password.Password != "")
                  {
                      if (login.Text != "")
                      {
                          var rol = db.Manager.Where(us => us.Login == login.Text && us.Password == password.Password).FirstOrDefault().rol;
                          if (rol == "Manager")
                          {
                              Realtors realtor = new Realtors();
                              this.Hide();
                              realtor.Show();
                          }
                      }
                      else

                      {
                          MessageBox.Show("Поле логин не введено");
                      }
                  }
                  else

                  {
                      MessageBox.Show("Поле пароль не введено");
                  }
              }
            }
            catch
            {
                MessageBox.Show("Логин или пароль не верны");
            }
        }