//CRUD Operation
        //Create, Read, Update And Delete
        //when user wants to add new blood stock info
        private void btnAddBlockStock_Click(object sender, RoutedEventArgs e)
        {
            AddBlockStockForm absf = new AddBlockStockForm();

            absf.btnUpdate.Visibility = Visibility.Hidden;
            absf.Show();
        }
        //when user wants to upadte any data
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            string selectedId = "";

            //checking user has selected the row to be updated
            //else display error message
            if (bloodStockDataGrid.SelectedIndex != -1)
            {
                //getting id
                DataGrid     dataGrid  = sender as DataGrid;
                DataGridRow  row       = (DataGridRow)bloodStockDataGrid.ItemContainerGenerator.ContainerFromIndex(bloodStockDataGrid.SelectedIndex);
                DataGridCell RowColumn = bloodStockDataGrid.Columns[0].GetCellContent(row).Parent as DataGridCell;
                selectedId = ((TextBlock)RowColumn.Content).Text;

                int bId = Int32.Parse(selectedId);

                //creating object for update form
                AddBlockStockForm ab = new AddBlockStockForm();
                ab.btnSave.Visibility = Visibility.Hidden;
                //call to update form and passing id
                ab.UpdateShow(bId);
            }
            else
            {
                MessageBox.Show("Please Select any Row to Update", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }