private void InventorybBgWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            //GetEthiopianDate() Why is it so difficult and Complicated we just need a fluent Api for EthiopianDate DateTime.ToEthiopianDate(),DateTime.ToShortEthiopianDate(),
            DateTime dtCurrent;

            using (var dtDate = ConvertDate.GetCurrentEthiopianDateText())
            {
                dtCurrent = ConvertDate.DateConverter(dtDate.Text);
            }
            // Do validation


            int userId          = CurrentContext.UserId;
            int physicalStoreID = Convert.ToInt32(lkInventoryStore.EditValue);
            int periodId        = Convert.ToInt32(lkPeriod.EditValue);
            int activityID      = Convert.ToInt32(lkInventoryAccount.EditValue);

            TransferService transferService = new TransferService();

            try
            {
                InventoryService.CommitInventory(periodId, activityID, physicalStoreID, dtCurrent, userId, InventoryBgWorker);
                XtraMessageBox.Show("Your changes have been applied.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception exp)
            {
                XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                InventoryBgWorker.CancelAsync();
            }
        }
        private void btnCommit_Click(object sender, EventArgs e)
        {
            if (!ValidateBeforeCommit(false))
            {
                return;
            }
            if (gridLocationRelatedInventory.DataSource != null)
            {
                if ((gridLocationRelatedInventory.DataSource as DataTable).GetChanges() != null)
                {
                    XtraMessageBox.Show("Some Change have not been save,please save before commiting",
                                        "Pending Changes...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (XtraMessageBox.Show("Are you sure you want to commit this change? You will not be able to undo this.",
                                        "Confirmation...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                int physicalStoreID = Convert.ToInt32(lkInventoryStore.EditValue);
                int periodId        = Convert.ToInt32(lkPeriod.EditValue);
                int activityID      = Convert.ToInt32(lkInventoryAccount.EditValue);

                Inventory inventory = new Inventory();
                inventory.LoadByStoreAndActivity(activityID, physicalStoreID, periodId);
                InitializeProgressBar();

                lblDescription.Text =
                    string.Format(
                        "HCMIS is commiting inventory on <b>{0}-{1}</b>. Please do not close this window until this operation is complete.",
                        lkInventoryStore.Text, lkInventoryAccount.Text);

                labelTotalActivity.Text =
                    string.Format("HCMIS is processing Inventory for  <b>{0}</b> Entries.", inventory.RowCount);

                progressBarActivities.Properties.Maximum = inventory.RowCount;
                InventoryBgWorker.RunWorkerAsync();
            }
            else
            {
                XtraMessageBox.Show(
                    "No Record is available to commit,please Select a Warehouse and Activity to Continue",
                    "No Record...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }