private void UpdateJobs(DataGridViewSelectedRowCollection rows, bool update) { List <string> listIDs = new List <string>(); //id list foreach (DataGridViewRow row in rows) { DateTime d; DateTime.TryParse(row.Cells[1].Value.ToString().ToString(), out d); listIDs.Add(db.JobExist(row.Cells[0].Value.ToString(), d.ToString("yyyy-MM-dd"))); //populate id list. } if (update) { insjob = new InsertJobForm(db, updateType.update, int.Parse(listIDs[0])); insjob.ShowDialog(); } else //delete { if (LastDeleteNotice(rows.Count)) { int n = 0; string res = ""; foreach (var item in listIDs) { res = db.InsertJob("", "", updateType.delete, item.ToString()); if (res == "4") { n++; } } ShowItemsDeletedMessage(n); } else { return; } } }
private void btnAddJob_Click(object sender, EventArgs e) { insJob = new InsertJobForm(_db, updateType.insert); insJob.ShowDialog(); StoreComboBox(comboJobName, _db.AllJobsByDate(dateTimePicker.Value.ToString("yyyy-MM-dd"))); }
private void menuStripInsJob_Click(object sender, EventArgs e) { insjob = new InsertJobForm(db, updateType.insert); insjob.ShowDialog(); }