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

            foreach (DataGridViewRow row in rows)
            {
                listIDs.Add(db.LocationExist(row.Cells[2].Value.ToString()));  //populate id list by call LocationsExist. Cell[2] is the cell contains the province
            }
            if (update)
            {
                insLocation = new InsertLocationForm(db, updateType.update, int.Parse(listIDs[0]));
                insLocation.ShowDialog();
            }
            else  //delete
            {
                if (LastDeleteNotice(rows.Count))
                {
                    int    n   = 0;
                    string res = "";
                    foreach (var item in listIDs)
                    {
                        res = db.InsertLocation(null, null, null, updateType.delete, item.ToString());
                        if (res == "4")
                        {
                            n++;
                        }
                    }
                    ShowItemsDeletedMessage(n);
                }
                else
                {
                    return;
                }
            }
        }
Beispiel #2
0
        private void btnAddLocation_Click(object sender, EventArgs e)
        {
            insLocation = new InsertLocationForm(_db, updateType.insert);
            insLocation.ShowDialog();

            StoreComboBoxProvince();
        }
Beispiel #3
0
 private void menuStripInsLocations_Click(object sender, EventArgs e)
 {
     insLocation = new InsertLocationForm(db, updateType.insert);
     insLocation.ShowDialog();
 }