/// <summary> /// Delete function /// </summary> public void Delete() { PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); try { decimal decResult1 = 0; for (int inI = 0; inI < dgvPurchaseOrder.Rows.Count - 1; inI++) { if (Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value) != 0) { decResult1 = BllPurchaseOrder.PurchaseOrderDetailsDelete(Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value)); } } decimal decResult2 = BllPurchaseOrder.PurchaseOrderMasterDelete(decPurchaseOrderMasterId); if (decResult1 > 0 && decResult2 > 0) { Messages.DeletedMessage(); if (frmPurchaseOrderRegisterObj != null) { this.Close(); frmPurchaseOrderRegisterObj.GridFill(); } if (frmPurchaseOrderReportObj != null) { this.Close(); frmPurchaseOrderReportObj.GridFill(); } if (objVoucherSearch != null) { this.Close(); objVoucherSearch.GridFill(); } if (frmDayBookObj != null) { this.Close(); } } else { Messages.ReferenceExistsMessage(); } } catch (Exception ex) { MessageBox.Show("PO16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Remove Product and details in editing mode /// </summary> public void RemovePurchaseOrderDetails() { try { PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); foreach (var strId in lstArrOfRemove) { decimal decDeleteId = Convert.ToDecimal(strId); BllPurchaseOrder.PurchaseOrderDetailsDelete(decDeleteId); } } catch (Exception ex) { MessageBox.Show("PO9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }