Exemplo n.º 1
0
        private void UpdatePhoneNumber(DataGridViewSelectedRowCollection rows, bool update)
        {
            List <string> listIDs = new List <string>();  //id list

            foreach (DataGridViewRow row in rows)
            {
                listIDs.Add(db.PhoneExist(row.Cells[0].Value.ToString()));  //populate id list.
            }
            if (update)
            {
                insPhone = new InsertPhoneForm(db, updateType.update, int.Parse(listIDs[0]));
                insPhone.ShowDialog();
            }
            else  //delete
            {
                if (LastDeleteNotice(rows.Count))
                {
                    int    n   = 0;
                    string res = "";
                    foreach (var item in listIDs)
                    {
                        res = db.InsertPhoneNumber("", "", "", updateType.delete, item.ToString());
                        if (res == "5")
                        {
                            n++;
                        }
                    }
                    ShowItemsDeletedMessage(n);
                }
                else
                {
                    return;
                }
            }
        }
Exemplo n.º 2
0
 private void menuStripInsPhoneN_Click(object sender, EventArgs e)
 {
     insPhone = new InsertPhoneForm(db, updateType.insert);
     insPhone.ShowDialog();
 }