Beispiel #1
0
 private void buttonAddGood_Click(object sender, EventArgs e)
 {
     if (income == null)
     {
         income = new IncomesModel();
         if (textBoxAmount.Text != "" && textBoxName.Text != "" && textBoxPrice.Text != "")
         {
             income.Name        = textBoxName.Text;
             income.Price       = Convert.ToInt32(textBoxPrice.Text);
             income.Amount      = Convert.ToInt32(textBoxAmount.Text);
             income.DateIncomes = dateTimePicker1.Value.ToString("dd-MM-yyyy HH:mm");
             int id = IncomesModel.Insert(income);
             if (id >= 0)
             {
                 Close();
             }
             else
             {
                 MessageBox.Show("ошибка");
             }
         }
         else
         {
             MessageBox.Show("Заполните поля");
         }
     }
 }
Beispiel #2
0
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     if (incomes == null)
     {
         incomes = new IncomesModel();
         if (textBoxName.Text != "" && textBoxPrice.Text != "" && textBoxAmount.Text != "")
         {
             incomes.Name        = textBoxName.Text;
             incomes.Price       = int.Parse(textBoxPrice.Text);
             incomes.Amount      = int.Parse(textBoxAmount.Text);
             incomes.DateIncomes = dateTimePickerAddGoods.Value.ToString("dd-MM-yyyy HH:mm");
             int lastId = IncomesModel.Insert(incomes);
             if (lastId > 0)
             {
                 MessageBox.Show("Успешно добавлен");
                 Close();
             }
             else
             {
                 MessageBox.Show("Ошибка при добавлений");
             }
         }
         else
         {
             MessageBox.Show("Заполните поля");
         }
     }
     else
     {
         MessageBox.Show("Ошибка");
     }
 }