示例#1
0
        private void UpdateTask(DataGridViewSelectedRowCollection rows, bool update)
        {
            List <string> listIDs = new List <string>();  //id list

            foreach (DataGridViewRow row in rows)
            {
                DateTime d;
                DateTime.TryParse(row.Cells[11].Value.ToString(), out d);
                listIDs.Add(db.TaskExist(row.Cells[0].Value.ToString(), db.JobExist(row.Cells[10].Value.ToString(), d.ToString("yyyy-MM-dd")), db.NewsStandExist(row.Cells[5].Value.ToString())));  //populate id list.
            }
            if (update)
            {
                insTask = new InsertTaskForm(db, updateType.update, int.Parse(listIDs[0]));
                insTask.ShowDialog();
            }
            else  //delete
            {
                if (LastDeleteNotice(rows.Count))
                {
                    int    n   = 0;
                    string res = "";
                    foreach (var item in listIDs)
                    {
                        res = db.InsertTask("", (-1).ToString(), "", "", (-1).ToString(), "", "", "", "", "", updateType.delete, item.ToString());
                        if (res == "9")
                        {
                            n++;
                        }
                    }
                    ShowItemsDeletedMessage(n);
                }
                else
                {
                    return;
                }
            }
        }
示例#2
0
 private void menuStripInsTask_Click(object sender, EventArgs e)
 {
     insTask = new InsertTaskForm(db, updateType.insert);
     insTask.ShowDialog();
 }