//Margo
 private void dataGridView1_SelectionChanged(object sender, EventArgs e)
 {
     try
     {
         if (dataGridView1.SelectedRows.Count >= 1)
         {
             using (DataGridViewRow item = this.dataGridView1.SelectedRows[0])
             {
                 BookOutMain bo = new BookOutMain();
                 bo                = bom[this.dataGridView1.SelectedRows[0].Index];
                 current           = bo;
                 storeName.Text    = bo.StoreName;
                 StoreLoc.Text     = bo.StoreLocation;
                 barcode.Text      = bo.BarcodeNumber;
                 productName.Text  = bo.ProductName;
                 ProductDesc.Text  = bo.ProductDescription;
                 ProductBrand.Text = bo.BrandName;
                 ProductCat.Text   = bo.CategoryName;
                 EPC.Text          = bo.EPC;
                 label15.Text      = bo.Reason;
                 label12.Text      = bo.Project;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorry Something went wrong, the action was not completed!");
     }
 }
 //Margo
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         lblerrorEPC.Visible = false;
         if (txtEPC.Text != "")
         {
             BookOutMain boo = new BookOutMain();
             boo = bom.Where(u => u.EPC == txtEPC.Text).FirstOrDefault();
             if (boo != null)
             {
                 int index = bom.IndexOf(boo);
                 if (dataGridView1.SelectedRows.Count != 0)
                 {
                     dataGridView1.ClearSelection();
                 }
                 dataGridView1.Rows[index].Selected = true;
             }
             else
             {
                 lblerrorEPC.Visible = true;
             }
         }
         else
         {
             lblerrorEPC.Visible = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorry Something went wrong, the action was not completed!");
     }
 }
        //Margo
        private void StockBookOutRemoval_Load(object sender, EventArgs e)
        {
            try
            {
                st = DAT.DataAccess.GetStore().ToList();
                List <string> S = new List <string>();

                for (int x = 0; x < st.Count; x++)
                {
                    S.Add(st[x].StoreName);
                }
                comboBoxStore.DataSource = S;

                List <LTS.BookOut> bo = new List <LTS.BookOut>();
                bo = DAT.DataAccess.GetBookOut().ToList();

                for (int i = 0; i < bo.Count; i++)
                {
                    BookOutMain b = new BookOutMain();
                    b.BookOutID = bo[i].BookOutID;
                    b.itemID    = bo[i].ItemID;
                    b.UserID    = bo[i].UserID;
                    b.Reason    = bo[i].Reason;
                    b.Project   = bo[i].Project;
                    b.Date      = bo[i].Date;

                    LTS.Item it = new LTS.Item();
                    it           = DAT.DataAccess.GetItem().Where(u => u.ItemID == b.itemID).FirstOrDefault();
                    b.ItemStatus = it.ItemStatus;
                    b.EPC        = it.TagEPC;
                    b.ProductID  = it.ProductID;
                    b.StoreID    = it.StoreID;

                    //get the specific product and assign the info to the ItemMain object
                    LTS.Product p = new LTS.Product();
                    p                    = DAT.DataAccess.GetProduct().Where(h => h.ProductID == b.ProductID).FirstOrDefault();
                    b.ProductName        = p.ProductName;
                    b.ProductDescription = p.ProductDescription;
                    b.BrandID            = p.BrandID;
                    b.CategoryID         = p.CategoryID;
                    b.BarcodeID          = p.BarcodeID;

                    //get the specific store and assign the info to the ItemMain object
                    LTS.Store s = new LTS.Store();
                    s               = DAT.DataAccess.GetStore().Where(j => j.StoreID == b.StoreID).FirstOrDefault();
                    b.StoreName     = s.StoreName;
                    b.StoreLocation = s.StoreLocation;

                    //get the specific brand and assign the info to the ItemMain object
                    LTS.Brand br = new LTS.Brand();
                    br                 = DAT.DataAccess.GetBrand().Where(y => y.BrandID == b.BrandID).FirstOrDefault();
                    b.BrandName        = br.BrandName;
                    b.BrandDescription = br.BrandDescription;

                    //get the sepcific category and assign the info to the ItemMain object
                    LTS.Category c = new LTS.Category();
                    c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == b.CategoryID).FirstOrDefault();
                    b.CategoryName        = c.CategoryName;
                    b.CategoryDescription = c.CategoryDescription;

                    //get the sepcific category and assign the info to the ItemMain object
                    LTS.Barcode ba = new LTS.Barcode();
                    ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == b.BarcodeID).FirstOrDefault();
                    b.BarcodeNumber = ba.BarcodeNumber;

                    LTS.User us = new LTS.User();
                    us = DAT.DataAccess.GetUser().Where(h => h.UserID == b.UserID).FirstOrDefault();
                    b.UserIdentityNumber = us.UserIdentityNumber;
                    b.UserName           = us.UserName;
                    b.UserSurname        = us.UserSurname;

                    bom.Add(b);

                    dataGridView1.Rows.Add(b.BookOutID, b.EPC, b.BarcodeNumber, b.ProductName, b.Reason, b.Project, b.Date, b.UserName, b.UserSurname);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sorry Something went wrong, the action was not completed!");
            }
        }