コード例 #1
0
 public Profile_win(Main_win super, string name, string login)
 {
     InitializeComponent();
     this.super      = super;
     l_name.Content  = name;
     l_login.Content = "Логин: " + login;
 }
コード例 #2
0
 private void B_ent_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string           conn_param = "Server=127.0.0.1;Port=5432;User Id=Training_login;Password=0000;Database=Training;";
         string           sql        = "select login_admin('" + tb_log.Text + "', '" + tb_pass.Password + "')";
         NpgsqlConnection conn       = new NpgsqlConnection(conn_param);
         NpgsqlCommand    comm       = new NpgsqlCommand(sql, conn);
         conn.Open();
         int result = (int)comm.ExecuteScalar();
         conn.Close();
         if (result == -1)
         {
             MessageBox.Show("Пользователя с таким логином не существует", "Ошибка авторизации", MessageBoxButton.OK, MessageBoxImage.Asterisk);
         }
         else
         {
             if (result == -2)
             {
                 MessageBox.Show("Пара логин-пароль не совпадают", "Ошибка авторизации", MessageBoxButton.OK, MessageBoxImage.Warning);
             }
             else
             {
                 Main_win main = new Main_win(this, result, tb_log.Text, tb_pass.Password);
                 main.Show();
                 Hide();
             }
         }
     }catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
コード例 #3
0
        }                                   //true - добавление на счёт, false - снятие со счёта

        public Money_win(bool adding, Main_win super)
        {
            InitializeComponent();
            this.adding = adding;
            this.super  = super;
            list        = super.dg_customer.SelectedItem as CustomList;
            try
            {
                NpgsqlCommand comm = new NpgsqlCommand("select sname||' '||fname||' '||pname from my_own_admin(" + super.user_id + ")", super.conn);
                super.conn.Open();
                string admin = comm.ExecuteScalar().ToString();
                comm = new NpgsqlCommand("select sname||' '||fname||' '||pname from customer_view where id = " + list.id + "", super.conn);
                string cust = comm.ExecuteScalar().ToString();
                super.conn.Close();
                l_admin.Content += admin;
                l_cust.Content  += cust;
            }
            catch (NpgsqlException ex)
            {
                MessageBox.Show(ex.Message, "Ошибка на сервере", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
            finally
            {
                super.conn.Close();
            }
        }
コード例 #4
0
 public Log_win(Main_win super)
 {
     InitializeComponent();
     this.super = super;
     FillTransTable();
     FillLogTable();
 }
コード例 #5
0
 public Passreq_win(Main_win super, Profile_win profile, int id)
 {
     InitializeComponent();
     this.profile = profile;
     this.super   = super;
     user_id      = id;
 }
コード例 #6
0
 public View_win(Main_win super, Type type, int id)
 {
     InitializeComponent();
     this.super = super;
     this.id    = id;
     if (type == typeof(CustomList))
     {
         dg_customer.Visibility = Visibility.Visible;
         FillTableCustomer();
     }
     else if (type == typeof(TrainerList))
     {
         dg_trainer.Visibility = Visibility.Visible;
         FillTableTrainer();
     }
     else if (type == typeof(GroupList))
     {
         dg_group.Visibility = Visibility.Visible;
         FillTableGroup();
     }
 }
コード例 #7
0
 public Newtrainer_win(Main_win super)
 {
     InitializeComponent();
     this.super = super;
 }