//TODO: Definitly going to BLL but i don't have time to do a clean job here. #region Void Process private void btnVoid_Click(object sender, EventArgs e) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); if (BLL.Receipt.AreThereIssues(receiptID)) { if (CurrentContext.LoggedInUser.UserType == UserType.Constants.FINANCE) //Allow only the manager to void the GRV. { if (XtraMessageBox.Show("There are issues with this GRV. Are you sure you want to void it anyway?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } } else { XtraMessageBox.Show("There are issues with this GRV. You can't void it."); return; } } ReceiptConfirmationPrintout grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); if (!grv.VoidRequest) { XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { while (!grv.EOF) { grv.IsVoided = true; grv.VoidApprovedByUserID = CurrentContext.UserId; grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); ReturnToStoreForQuantityEdit(); } }
private void btnCancelVoidRequest_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to request void for this Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); ReceiptConfirmationPrintout grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); while (!grv.EOF) { grv.SetColumnNull("VoidRequestUserID"); grv.VoidRequest = true; grv.SetColumnNull("VoidRequestDateTime"); grv.MoveNext(); } grv.Save(); XtraMessageBox.Show("Void request cancelled.", "Success"); } }