public virtual void ExecuteAdd(object obj)
        {
            if (TrnProdObj == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(SelectedProductMCODE))
            {
                MessageBox.Show("please select the item first to add...", "Alert Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                // FocusedElement = (short)FocusElements.ItemCode;

                return;
            }

            if (TrnProdObj.Quantity <= 0)
            {
                MessageBox.Show("Please enter the valid Quantity for the item", "Alert Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                //  FocusedElement = (short)FocusElements.quantity;

                return;
            }

            if (string.IsNullOrEmpty(SelectedWarehouse))
            {
                MessageBox.Show("Please select the warehouse from the list", "Alert Message", MessageBoxButton.OK, MessageBoxImage.Error);
                //FocusedElement = (short)FocusElements.warehouse;
                return;
            }

            if (TrnMainBaseModelObj.ProdList.Any((item) => item.MCODE == SelectedProductMCODE))
            {
                var product = TrnMainBaseModelObj.ProdList.Where((item) => item.MCODE == SelectedProductMCODE);
                if (product.Any((i) => i.UNIT == SelectedAltUnit.ALTUNIT))
                {
                    MessageBox.Show("Item  is already in the Table below", "Duplicate Data", MessageBoxButton.OK, MessageBoxImage.Error);
                    // FocusedElement = (short)FocusElements.ItemCode;
                    return;
                }
            }



            TrnProdObj.WAREHOUSE   = SelectedWarehouse;
            TrnProdObj.UNIT        = SelectedAltUnit.ALTUNIT;
            TrnProdObj.VoucherType = VoucherTypeEnum.StockSettlement;
            TrnProdObj.REALRATE    = SelectedAltUnit.CONFACTOR * TrnProdObj.RATE;
            TrnProdObj.PRATE       = productObj.PRATE_A;
            TrnMainBaseModelObj.ProdList.Add(TrnProdObj);
            TrnMainBaseModelObj.ReCalculateBill();
            // GetMultiWarehousePerTransactionSetting(TrnMainBaseModelObj.ProdList, SelectedWarehouse);
            TrnProdObj           = null;
            SelectedProductMCODE = null;
            SelectedAltUnit      = null;
            BARCODE = null;
            //SelectedWarehouse = null;
            // FocusedElement = (short)FocusElements.ItemCode;
        }
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                DataTable dt = RequisitionEntryViewModel.getExcelDataToDataTable();
                if (dt.Columns["Barcode"] == null || dt.Columns["Quantity"] == null || dt.Columns["Warehouse"] == null)
                {
                    MessageBox.Show("Invalid excel format.", "Stock Settlement", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                using (SqlConnection conn = new SqlConnection(GlobalClass.DataConnectionString))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        if (row["Barcode"] == null || row["Barcode"].ToString() == string.Empty)
                        {
                            continue;
                        }
                        var     Product = conn.Query(@"SELECT A.BCODE, A.MCODE, A.UNIT, A.SUPCODE, A.SRATE, B.DESCA, B.MENUCODE, B.BASEUNIT, B.PRATE_A, B.PRATE_B, B.RATE_A, B.VAT
FROM BARCODE A inner join Menuitem B on A.mcode = B.mcode WHERE A.BCODE = '" + row["Barcode"] + "'").FirstOrDefault();
                        TrnProd tPod    = new TrnProd
                        {
                            MCODE     = Product.MCODE,
                            MENUCODE  = Product.MENUCODE,
                            ITEMDESC  = Product.DESCA,
                            BC        = Product.BCODE,
                            UNIT      = Product.UNIT,
                            RATE      = Product.SRATE,
                            REALRATE  = Product.SRATE,
                            ISVAT     = Product.VAT,
                            Quantity  = Convert.ToDecimal(row["Quantity"]),
                            WAREHOUSE = row["Warehouse"].ToString(),
                        };
                        tPod.CalculateNormal();
                        App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE
                        {
                            TrnMainBaseModelObj.ProdList.Add(tPod);
                        });
                    }
                    TrnMainBaseModelObj.ReCalculateBill();
                }
            }
            catch (Exception ex)
            {
                GlobalClass.ProcessError(ex, "Report Load Failure");
            }
        }