private void btnRowCommit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (!ValidateBeforeCommit(true)) { return; } DataRow dr = gridLocationRelatedInventoryView.GetFocusedDataRow(); DateTime dtCurrent; using (var dtDate = ConvertDate.GetCurrentEthiopianDateText()) { dtCurrent = ConvertDate.DateConverter(dtDate.Text); } if (dr.RowState == DataRowState.Modified) { XtraMessageBox.Show("Your Change have not been saved,please save before commiting", "Pending Changes...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } try { if (XtraMessageBox.Show("You are about To commit change For item: " + dr["FullItemName"].ToString(), "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { InventoryService.CommitSingle(Convert.ToInt32(dr["ID"]), dtCurrent, CurrentContext.UserId); XtraMessageBox.Show("Your changes have been applied.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exp) { XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } btnLoadInventory_Click(null, null); }
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(); } }