private void buttonDelete_Click(object sender, EventArgs e) { if (proGrid1.SelectedRows.Count <= 0) { return; } DialogResult confurmDelete = MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (confurmDelete != DialogResult.Yes) { return; } DAL.Country countryDelete = new DAL.Country(); string ids = ""; for (int i = 0; i < proGrid1.SelectedRows.Count; i++) { ids += proGrid1.SelectedRows[i].Cells["ColId"].Value.ToString() + ", "; } ids = ids.Substring(0, ids.Length - 2); if (countryDelete.Delete(ids)) { MessageBox.Show("Data deleted"); buttonSearch.PerformClick(); } else { MessageBox.Show(countryDelete.Error); } }
/// <summary> /// Create a new Country object. /// </summary> /// <param name="countryID">Initial value of the CountryID property.</param> /// <param name="countryName">Initial value of the CountryName property.</param> public static Country CreateCountry(global::System.Int32 countryID, global::System.String countryName) { Country country = new Country(); country.CountryID = countryID; country.CountryName = countryName; return country; }
/// <summary> /// Deprecated Method for adding a new object to the Country EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCountry(Country country) { base.AddObject("Country", country); }