private void btnApprove_Click(object sender, EventArgs e) { MTNMaterial_DL objMTNMatDL = new MTNMaterial_DL(ConnectionStringClass.GetConnection()); MTNBasicProduct_DL objMTNBasicDL = new MTNBasicProduct_DL(ConnectionStringClass.GetConnection()); MTNFinishProduct_DL objMTNFinishDL = new MTNFinishProduct_DL(ConnectionStringClass.GetConnection()); try { DialogResult dr = MessageBox.Show(this, "Do you want to Approve Selected MTN? Click Yes to Approve", "Approve MTN?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { objMTN.MTNStatus = MTN.Status.Approved; objMTN.MTNApprovedBy = CurrentUser.UserEmp; objMTNDL.Update(objMTN); Load_MTN(); DataGridViewCellEventArgs er = new DataGridViewCellEventArgs(1, 0); gvMTNList_CellClick(sender, er); } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private int Approve() { MTNMaterial_DL objMTNMatDL = new MTNMaterial_DL(ConnectionStringClass.GetConnection()); MTNBasicProduct_DL objMTNBasicDL = new MTNBasicProduct_DL(ConnectionStringClass.GetConnection()); MTNFinishProduct_DL objMTNFinishDL = new MTNFinishProduct_DL(ConnectionStringClass.GetConnection()); try { objMTN.MTNStatus = MTN.Status.Approved; objMTN.MTNApprovedBy = CurrentUser.UserEmp; objMTN.MTNApprovedDate = DateTime.Now; if (objMTN.MTNType == MTN.Type.Dispose) { int result = 0; #region if (objMTN.MTNItemType == MTN.ItemType.Material) { result = objMTNDL.Approve((int)MR.Status.Approved, CurrentUser.UserEmp.EmployeeID, objMTN.MTNStore.StoreID, objMTN.MTNNo); if (result == 1) { } else if (result == -1) { MessageBox.Show(this, "Cannot perform the Request, Stock level is low than Requested. Please Check the Stock Levels and GRN Quantity", "Stock Level is Low", MessageBoxButtons.OK, MessageBoxIcon.Information); } } #endregion #region else if (objMTN.MTNItemType == MTN.ItemType.Basic_Product) { result = objMTNDL.Approve((int)MR.Status.Approved, CurrentUser.UserEmp.EmployeeID, objMTN.MTNStore.StoreID, objMTN.MTNNo); if (result == 1) { } else if (result == -1) { MessageBox.Show(this, "Cannot perform the Request, Stock level is low than Requested. Please Check the Stock Levels and GRN Quantity", "Stock Level is Low", MessageBoxButtons.OK, MessageBoxIcon.Information); } } #endregion #region else if (objMTN.MTNItemType == MTN.ItemType.Finish_Product) { //result = objMTNFinishDL.Issue_GRN(objMTN); if (result == 1) { } else if (result == -1) { MessageBox.Show(this, "Cannot perform the Request, Stock level is low than Requested. Please Check the Stock Levels and GRN Quantity", "Stock Level is Low", MessageBoxButtons.OK, MessageBoxIcon.Information); } } #endregion return(1); } return(0); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(0); } }