private void butDelete_Click(object sender, System.EventArgs e) { if (tbZips.SelectedRow == -1) { MessageBox.Show(Lan.g(this, "Please select an item first.")); return; } ZipCode ZipCur = ZipCodes.List[tbZips.SelectedRow]; if (MessageBox.Show(Lan.g(this, "Delete Zipcode?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } changed = true; ZipCodes.Delete(ZipCur); FillTable(); }
private void butDelete_Click(object sender, System.EventArgs e) { if (gridZipCode.SelectedIndices.Length == 0) { MessageBox.Show(Lan.g(this, "Please select an item first.")); return; } ZipCode ZipCur = gridZipCode.SelectedTag <ZipCode>(); if (MessageBox.Show(Lan.g(this, "Delete Zipcode?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } changed = true; ZipCodes.Delete(ZipCur); FillGrid(); }
//public static Hashtable HList; ///<summary>Refresh done on startup and then whenever a change is made.</summary> public static void Refresh() { string command = "SELECT * from zipcode ORDER BY zipcodedigits"; DataTable table = General.GetTable(command);; //HList=new Hashtable(); ALFrequent = new ArrayList(); List = new ZipCode[table.Rows.Count]; for (int i = 0; i < List.Length; i++) { List[i] = new ZipCode(); List[i].ZipCodeNum = PIn.PInt(table.Rows[i][0].ToString()); List[i].ZipCodeDigits = PIn.PString(table.Rows[i][1].ToString()); List[i].City = PIn.PString(table.Rows[i][2].ToString()); List[i].State = PIn.PString(table.Rows[i][3].ToString()); List[i].IsFrequent = PIn.PBool(table.Rows[i][4].ToString()); if (List[i].IsFrequent) { ALFrequent.Add(List[i]); } //HList.Add(List[i].ZipCodeNum,List[i]); } }
///<summary></summary> public static void Delete(ZipCode Cur) { string command = "DELETE from zipcode WHERE zipcodenum = '" + POut.PInt(Cur.ZipCodeNum) + "'"; General.NonQ(command); }