Esempio n. 1
0
 private void UpdateData(int id)
 {
     //int temp_b;
     try
     {
         MySqlCommand    cmd = new MySqlCommand("SELECT * FROM koszty_dodatkowe WHERE id_uzytkownik='" + id + "';", Form1.connection);
         MySqlDataReader rdr = null;
         rdr = cmd.ExecuteReader();
         if (rdr.Read())
         {
             if (rdr.GetInt16(5) == 0)
             {
                 topay += rdr.GetDecimal(2);
             }
             id_cost = rdr.GetInt32(0);
             IDComboBox.Items.Add(id_cost);
             //id_user = rdr.GetInt16(1);
             //money = rdr.GetFloat(2);
             //MoneyBox.Value = (decimal)money;
             //date_temp = rdr.GetString(3);
             //MessageBox.Show(date_temp);
             //description = rdr.GetString(4);
             //DescriptionBox.Text = description;
             //temp_b = rdr.GetInt16(5);
             //if (temp_b == 0) NoRButton.Checked = true;
             //else YesRButton.Checked = true;
             while (rdr.Read())
             {
                 IDComboBox.Items.Add(rdr.GetString(0));
                 if (rdr.GetInt16(5) == 0)
                 {
                     topay += rdr.GetDecimal(2);
                 }
             }
             rdr.Close();
             ToPayLabel.Text          = "Do zapłacenia przez użytkownika: " + topay.ToString();
             IDComboBox.SelectedIndex = IDComboBox.FindStringExact(id_cost.ToString());
         }
         else
         {
             rdr.Close();
             MessageBox.Show("Brak kosztów dodatkowych użytkownika", "Informacja");
             //Close();
         }
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(ex.ToString(), "ERROR");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "ERROR");
     }
 }
Esempio n. 2
0
 public AddPaymentForm(int id, string n, decimal m)
 {
     InitializeComponent();
     id_user              = id;
     name                 = n;
     old_money            = m;
     UserLogin.Text      += name;
     DateCheckBox.Checked = true;
     HourBox.Hide();
     MinuteBox.Hide();
     TimeLabel.Hide();
     IDLabel.Hide();
     IDComboBox.Hide();
     hLabel.Hide();
     mLabel.Hide();
 }
Esempio n. 3
0
 public AddECostForm(int id, string n, string formname)
 {
     InitializeComponent();
     id_user   = id;
     login     = n;
     this.Text = formname;
     if (formname == "Dodawanie kosztu dodatkowego")
     {
         NoRButton.Checked = true;
         paid = false;
         IDComboBox.Hide();
         IDLabel.Hide();
         PayInfo(id);
         DateCheckBox.Checked = true;
         choice = 1;
     }
     else if (formname == "Wyświetlanie kosztów dodatkowych")
     {
         UpdateData(id);
         DescriptionBox.Enabled = false;
         MoneyBox.Enabled       = false;
         DateBox.Enabled        = false;
         YesRButton.Enabled     = false;
         NoRButton.Enabled      = false;
         ApplyButton.Hide();
         OKButton.Hide();
         CancelButton.Text = "OK";
         DateCheckBox.Hide();
         DateBox.Format       = DateTimePickerFormat.Custom;
         DateBox.CustomFormat = "dd.MM.yyyy HH:mm";
         choice = 2;
     }
     else if (formname == "Edycja kosztów dodatkowych")
     {
         UpdateData(id);
         ApplyButton.Text = "Zastosuj zmiany";
         now = false;
         DateCheckBox.Checked = false;
         choice = 3;
     }
 }