private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && FormLoaded)
            {
                var FromWhse = (TLADM_WhseStore)cmboFromwarehouse.SelectedItem;
                if (FromWhse == null)
                {
                    MessageBox.Show("Please select a warehouse from which to transfer");
                    return;
                }

                var ToWhse = (TLADM_WhseStore)cmboTowareHouse.SelectedItem;
                if (ToWhse == null)
                {
                    MessageBox.Show("Please select a warehousewhich to transfer too");
                    return;
                }

                if (FromWhse.WhStore_Id == ToWhse.WhStore_Id)
                {
                    MessageBox.Show("Please select a different warehouse to transfer too");
                    return;
                }

                if (!TransferMode)
                {
                    TransferMode        = !TransferMode;
                    btnSubmit.Text      = "Transfer";
                    QueryParms.FromWhse = FromWhse.WhStore_Id;

                    //This function needs to be modified for Bought in Fabric purposes
                    //===========================================================================
                    var Existing = repo.FromWareHouse(QueryParms);
                    if (Existing.Count() == 0)
                    {
                        MessageBox.Show("No Records found for selection made", FromWhse.WhStore_Description);
                        return;
                    }

                    using (var context = new TTI2Entities())
                    {
                        foreach (var Record in Existing)
                        {
                            var index = dataGridView1.Rows.Add();
                            dataGridView1.Rows[index].Cells[0].Value = Record.TLSOH_Pk;
                            dataGridView1.Rows[index].Cells[1].Value = false;
                            dataGridView1.Rows[index].Cells[2].Value = Record.TLSOH_BoxNumber;
                            dataGridView1.Rows[index].Cells[3].Value = context.TLADM_Styles.Find(Record.TLSOH_Style_FK).Sty_Description;
                            dataGridView1.Rows[index].Cells[4].Value = context.TLADM_Colours.Find(Record.TLSOH_Colour_FK).Col_Display;
                            dataGridView1.Rows[index].Cells[5].Value = context.TLADM_Sizes.Find(Record.TLSOH_Size_FK).SI_Description;
                            dataGridView1.Rows[index].Cells[6].Value = Record.TLSOH_BoxedQty;
                        }
                    }
                }
                else
                {
                    var CountSelected = (from Rows in dataGridView1.Rows.Cast <DataGridViewRow>()
                                         where (bool)Rows.Cells[1].Value == true
                                         select Rows).Count();

                    if (CountSelected == 0)
                    {
                        MessageBox.Show("Please tick at least one box to be transferred");
                        return;
                    }



                    TransferMode   = !TransferMode;
                    btnSubmit.Text = "Submit";
                    using (var context = new TTI2Entities())
                    {
                        //Need to create a Header Record in the file
                        //=======================================================
                        TLCSV_WhseTransfer WhseTransfer = new TLCSV_WhseTransfer();

                        var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode == "CSV").FirstOrDefault();
                        if (Dept != null)
                        {
                            var LNU = context.TLADM_LastNumberUsed.Where(x => x.LUN_Department_FK == Dept.Dep_Id).FirstOrDefault();
                            if (LNU != null)
                            {
                                WhseTransfer.TLCSVWHT_Date         = DateTime.Now;
                                WhseTransfer.TLCSVWHT_PickList     = true;
                                WhseTransfer.TLCSVWHT_FromWhse_Fk  = FromWhse.WhStore_Id;
                                WhseTransfer.TLCSVWHT_ToWhse_Fk    = ToWhse.WhStore_Id;
                                WhseTransfer.TLCSVWHT_PickListDate = DateTime.Now;
                                WhseTransfer.TLCSVWHT_PickListNo   = LNU.col6;

                                LNU.col6 += 1;

                                context.TLCSV_WhseTransfer.Add(WhseTransfer);

                                try
                                {
                                    context.SaveChanges();
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show(ex.Message);
                                    return;
                                }


                                foreach (DataGridViewRow Row in dataGridView1.Rows)
                                {
                                    if ((bool)Row.Cells[1].Value == false)
                                    {
                                        continue;
                                    }

                                    TLCSV_WhseTransferDetail WhDetail = new TLCSV_WhseTransferDetail();

                                    WhDetail.TLCSVWHTD_WhseTranfer_FK = WhseTransfer.TLCSVWHT_Pk;
                                    WhDetail.TLCSVWHTD_TLSOH_Fk       = (int)Row.Cells[0].Value;
                                    WhDetail.TLCSVWHTD_PickList       = true;

                                    context.TLCSV_WhseTransferDetail.Add(WhDetail);
                                }

                                try
                                {
                                    context.SaveChanges();
                                    MessageBox.Show("Records successfully updated to database");

                                    FormLoaded = false;

                                    frmCutViewRep vRep = new frmCutViewRep(16, WhseTransfer.TLCSVWHT_Pk);
                                    int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                                    int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                                    vRep.ClientSize = new Size(w, h);
                                    vRep.ShowDialog(this);

                                    this.Close();
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show(ex.Message);
                                }
                            }
                        }
                    }
                }
            }
        }