protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             CountryBLL countryBLL = new CountryBLL();
             Countries  country    = new Countries();
             country.CountryId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (country.CountryId > 0)
             {
                 if (countryBLL.Delete(country))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var     rowIndex = dgvCountryList.SelectedRows[0].Index;
            Country country  = Get(rowIndex);

            if (country != null)
            {
                if (MessageBox.Show("A je i sigurte", "Jeni duke fshire",
                                    MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    _countryService.Delete(country.ID);
                    RefreshCountryList();
                }
            }
        }
Beispiel #3
0
 static public int Delete(int id)
 {
     return(CountryBLL.Delete(id));
 }