public void butOk_Click(object sender, EventArgs e)
 {
     if (WorkWithDataGridView.CheckDataGridViewRow(dataGridView1)) //якщо заповнено правильно
     {
         Task task = new Task();                                   //(description, priority, false, year, month, day);
         task.User        = User.userLogin;
         task.Description = dataGridView1.Rows[0].Cells["Description"].Value.ToString();
         task.Priority    = dataGridView1.Rows[0].Cells["Priority"].Value.ToString();
         task.Status      = false;
         task.Year        = Convert.ToInt32(dataGridView1.Rows[0].Cells["Year"].Value);
         task.Month       = Convert.ToInt32(dataGridView1.Rows[0].Cells["Month"].Value);
         task.Day         = Convert.ToInt32(dataGridView1.Rows[0].Cells["Day"].Value);
         WorkWithDatabase.client.AddRowsToDb(task); //віддали данні сервісу
         this.Close();                              //форма для додавання рядка вже не потрібна
         AddRowOK = true;
     }
     else
     {
         MessageBox.Show("Fill all empty fields and fields Year, Month and Day should be only numbers");
     }
 }
Exemplo n.º 2
0
 public void SaveChangesFromDataGridViewToDb()
 {
     WorkWithDatabase.client.SaveChangesToDb(WorkWithDataGridView.GetAllFromDataGridView(DataGridView1).ToArray());
     RefreshdataGridView();
 }