private void btnDispose_Click(object sender, EventArgs e) { if (!dxValidationProvider1.Validate()) return; TransferService transferService = new TransferService(); IssueService issueService = new IssueService(); if (XtraMessageBox.Show("Please Confirm that you want to dispose the selected items", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { int activityID = Convert.ToInt32(glkActivity.EditValue); var dt = (DataView)grdSelectedExpiredItemsView.DataSource; Order order = OrderForDisposal(activityID); PickList picklist = PickList.GeneratePickList(order.ID); BLL.Issue stvLog = issueService.CreateSTVLog(null, false, picklist, order, null, activityID, false, CurrentContext.UserId); foreach (DataRow row in dt.Table.Rows) { ReceiveDoc rd = new ReceiveDoc(); ReceivePallet rp = new ReceivePallet(); rd.LoadByPrimaryKey((int)row["ReceiveDocID"]); rp.LoadByReceiveDocID((int)row["ReceiveDocID"]); var picklistDetail = transferService.GeneratePickListDetail(rd, rp, order, picklist); issueService.CreateIssueFromPicklist(picklistDetail, order, DateTime.Now, stvLog, CurrentContext.LoggedInUser); } HCMIS.Reports.Workflow.Activities.Disposal disposalPrintout = new HCMIS.Reports.Workflow.Activities.Disposal(glkActivity.Text, txtLicenseNo.Text, DateTime.Now, ((DataView)grdSelectedExpiredItemsView.DataSource).Table); disposalPrintout.PrintDialog(); RefreshSelection(); txtLicenseNo.ResetText(); } }
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(); } }