コード例 #1
0
ファイル: WorkerForm.cs プロジェクト: ismoil92/GameClubAdmin
 private void buttonUpdateExpenses_Click(object sender, EventArgs e)
 {
     expense = ExpensesModel.SelectAll();
     if (expense.Count != 0)
     {
         var index = dataGridViewExpenses.CurrentRow.Index;
         UpdatePriceExpenses updatePrice = new UpdatePriceExpenses();
         updatePrice.eModel = expense[index];
         updatePrice.ShowDialog();
         ShowExpenses();
         Show();
     }
     else
     {
         MessageBox.Show("Таблица пустая");
     }
 }
コード例 #2
0
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (eModel != null)
     {
         eModel.Price = Convert.ToInt32(textBoxPrice.Text);
         eModel.Date  = textBoxDate.Text;
         eModel.Name  = textBoxName.Text;
         bool isUpdate = ExpensesModel.Update(eModel);
         if (isUpdate)
         {
             Close();
         }
         else
         {
             MessageBox.Show("Ошибка");
         }
     }
 }
コード例 #3
0
ファイル: WorkerForm.cs プロジェクト: ismoil92/GameClubAdmin
 private void buttonAddExpenses_Click(object sender, EventArgs e)
 {
     if (textBoxExpenses.Text != "" && textBoxPrice.Text != "")
     {
         expenses       = new ExpensesModel();
         expenses.Name  = textBoxExpenses.Text;
         expenses.Price = int.Parse(textBoxPrice.Text);
         var hour  = DateTime.Now.Hour;
         var day   = DateTime.Now.Day;
         var month = DateTime.Now.Month;
         var year  = DateTime.Now.Year;
         if (hour >= 0 && hour <= 6)
         {
             var date = new DateTime(year, month, day - 1, hour, dateTimePicker1.Value.Minute, dateTimePicker1.Value.Second);
             dateTimePicker1.Value = date;
         }
         else if (hour >= 9 && hour <= 23)
         {
             var date = new DateTime(year, month, day, hour, dateTimePicker1.Value.Minute, dateTimePicker1.Value.Second);
             dateTimePicker1.Value = date;
         }
         else
         {
             MessageBox.Show("Рабочий день закончился");
         }
         expenses.Date = dateTimePicker1.Value.ToString("dd-MM-yyyy HH:mm");
         int lastId = ExpensesModel.Insert(expenses);
         if (lastId > 0)
         {
             ShowExpenses();
             ClearTextBox();
         }
         else
         {
             MessageBox.Show("Ошибка при добавление");
         }
     }
     else
     {
         MessageBox.Show("Заполните поля");
     }
 }
コード例 #4
0
ファイル: WorkerForm.cs プロジェクト: ismoil92/GameClubAdmin
 private void ShowExpenses()
 {
     expense = ExpensesModel.SelectAll();
     dataGridViewExpenses.DataSource = expense;
 }
コード例 #5
0
 public static bool Update(ExpensesModel expenses)
 {
     return(DBManager.UpdateExpenses(expenses));
 }
コード例 #6
0
 public static int Insert(ExpensesModel expenses)
 {
     return(DBManager.InsertExpenses(expenses));
 }