Exemplo n.º 1
0
        private void gridView4_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            DevExpress.XtraGrid.Columns.GridColumn column = e.Column;
            GridView view = sender as GridView;

            if (column.Name == "btnDeletePassDay")
            {
                object       _name  = view.GetRowCellValue(e.RowHandle, "Name");
                DialogResult dialog = XtraMessageBox.Show($"{_name} Seçili satır silinsin mi*", "Sil", MessageBoxButtons.YesNo);
                if (dialog == DialogResult.Yes)
                {
                    try
                    {
                        object _Id = view.GetRowCellValue(e.RowHandle, "Id");

                        Customer deleteModel = new Customer()
                        {
                            Id = Convert.ToInt32(_Id.ToString())
                        };

                        getBusiness = new CustomerBusinessLayer();
                        getBusiness.Delete(deleteModel);
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show("Veri silinemedi tekrar deneyiniz!");
                    }
                    finally
                    {
                        FillGrid();
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void Delete(Customer model)
 {
     try
     {
         getBusiness = new CustomerBusinessLayer();
         getBusiness.Delete(model);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
 }