示例#1
0
 private void buttonDeleteByIdEncash_Click(object sender, EventArgs e)
 {
     if (encash.Count != 0)
     {
         var          index  = dataGridViewEncash.CurrentRow.Index;
         int          Id     = encash[index].Id;
         DialogResult result = MessageBox.Show("Удалить?", "Удаление", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             bool delete = EncashModel.Delete(Id);
             if (delete)
             {
                 ShowEncash();
             }
             else
             {
                 MessageBox.Show("Ошибка");
             }
         }
     }
     else
     {
         MessageBox.Show("Таблица пустая");
     }
 }
示例#2
0
        private void buttonAddEncash_Click(object sender, EventArgs e)
        {
            EncashModel encashModel = new EncashModel();

            encashModel.Price = Convert.ToInt32(textBoxPriceEncash.Text);
            encashModel.Date  = dateTimePicker1.Value.ToString("dd-MM-yyyy");
            int lastId = EncashModel.Insert(encashModel);

            if (lastId > 0)
            {
                ShowEncash();
                textBoxPriceEncash.Text = "";
            }
            else
            {
                MessageBox.Show("Ошибка");
            }
        }
示例#3
0
 private void ShowEncash()
 {
     encash = EncashModel.SelectAll();
     dataGridViewEncash.DataSource = encash;
 }
示例#4
0
 public static int Insert(EncashModel encash)
 {
     return(DBManager.InsertEncash(encash));
 }