private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                shelfBLL = new ShelfBLL();

                int shelfId = GetShelfId(txtMaterialLocationDelete.Text);

                if (shelfId > 0)
                {
                    int i = shelfBLL.Delete(shelfId);
                    if (i == 0)
                    {
                        MessageBox.Show("Shelf deleted successfully", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (i == 1)
                    {
                        MessageBox.Show("Shelf is not deleted, there are still books on this shelf, please kindly change their location", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Shelf is not deleted, Please contact your administrator", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            shelfBLL.Delete(shelf.ShelfId);
            //little code because Delete Operation is not yet implemented in DAL for Shelf!
        }
 private void BindShelf(Shelf shelf)
 {
     try
     {
         shelfBLLList = new ShelfBLL();
         Shelf sh = new Shelf();
         shelfList = shelfBLLList.GetAll();
         if (shelfList.Count > 0)
         {
             sh           = shelfList[0];
             shelfList[0] = shelf;
             shelfList.Add(sh);
             comboMaterialLocation.DataSource    = shelfList;
             comboMaterialLocation.DisplayMember = "Location";
         }
     }
     catch (Exception)
     {
         shelfList = new List <Shelf>();
         shelfList.Add(new Shelf()
         {
             ShelfId = 0, Location = "Other"
         });
         comboMaterialLocation.DataSource    = shelfList;
         comboMaterialLocation.DisplayMember = "Location";
     }
 }
        public MaterialLocation()
        {
            InitializeComponent();

            shelf       = new Shelf();
            shelfBLL    = new ShelfBLL();
            storedShelf = new List <Shelf>();
        }