public long GenerateMR(PRPDBatch objPRPD) { MR objMR = new MR(); MRMaterialCollec objMRMatCollec = new MRMaterialCollec(); MRFinishProductCollec objMRFinishProductCollec = new MRFinishProductCollec(); MRBasicProductCollec objMRBasicProductCollec = new MRBasicProductCollec(); BatchMR objBatchMR = new BatchMR(); Department_DL objDepDL = new Department_DL(ConnectionStringClass.GetConnection()); MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection()); MRMaterial_DL objMRMaterialDL = new MRMaterial_DL(ConnectionStringClass.GetConnection()); Store_DL objStoreDL = new Store_DL(ConnectionStringClass.GetConnection()); try { objMR.MRDate = DateTime.Now; objMR.MRDepartmentFrom = objDepDL.GetByDepType("PRPD"); objMR.MREnterdBy = CurrentUser.EmployeeID; objMR.MRStatus = MR.Status.Initial; objMR.MRStore = objStore; objMR.MRType = MR.Type.Material; objMR.MRRemarks = "Material Requition(Materials) for PRPD Batch NO " + objPRPD.PRPDBatchID.ToString(); objMR.OriginType = MR.Origin.ToBatch; MRMaterial obj = new MRMaterial(); obj.Description = "PRPD Batch Material Requition"; obj.Material = objPRPD.PRPDBatchMaterial; obj.MRBINNo = ""; obj.ReqdQty = objPRPD.PRPDBatchQty; long MRNO = objMRDL.Add_M(objMR); if (MRNO > 0) { objMR.MRNO = MRNO; obj.MR = objMR; objMRMaterialDL.Add(obj); } return(MRNO); } catch (Exception ex) { return(0); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (objRPDBatch != null) { DialogResult dr = MessageBox.Show(this, "Are you sure you want to delete Selected RPD batch?\n\nClick Yes to delete", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection()); if (objRPDBatch.RPDBatchMR.MRStatus == MR.Status.Initial || objRPDBatch.RPDBatchMR.MRStatus == MR.Status.Reject) { if (objRPDBatch.RPDBatchMR.MRStatus == MR.Status.Initial) { objMRDL.Delete(objRPDBatch.RPDBatchMR.MRNO); } int res = objRPDBatchDL.Delete(objRPDBatch.RPDBatchID); if (res > 0) { bindRPDBatch.DataSource = objRPDBatchDL.GetDataViewByState(Status, true); ClearForm(); objRPDBatch = null; } } else { MessageBox.Show(this, "Material Requsition In Prograss, You can't delete this RPD Batch File\nReject the Material Requsition and Try again.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show(this, "Please select the RPD Batch file you want to delete", "Empty Selection", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception) { MessageBox.Show(this, "Error occured while deleting", "Error", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
void Work() { MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection()); Stock_DL objStockDL = new Stock_DL(ConnectionStringClass.GetConnection()); try { int count = objMRDL.GET_Approval_Count(CurrentUser.EmployeeID, MR.Status.Initial); if (count > 0) { TipType = 1; TipText = TipText + "-- " + count + " Material Requisition(s) for approval.\n"; } int count1 = objMRDL.GET_Issue_Count(CurrentUser.EmployeeID, MR.Status.Approved); if (count1 > 0) { TipType = 2; TipText = TipText + "-- " + count1 + " Material Requisition(s) for Item Issue.\n"; } int count2 = objStockDL.Get_ReorderLevel_Below_Count(CurrentUser.EmployeeID); if (count2 > 0) { TipType = 3; TipText = TipText + "-- Quantity of " + count2 + " item(s) in the store low than reorder level.\n"; } } catch (Exception ex) { } finally { objMRDL = null; } }
private void dgvPRPDbatchByState_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { objSourceInstructions.DataSource = null; txtPRPDBatch.Text = dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString(); objPRPDBatch = objPRPDBatch_DL.Get(txtPRPDBatch.Text); dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text); dgvActivityInstructions.AutoGenerateColumns = false; dgvActivityInstructions.DataSource = objSourceInstructions; objSourceInstructions.DataSource = dtPRPDBatchInstructions; objSourceInstructions.ResetBindings(true); MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection()); if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Approved) { if (objMRDL.Get(objPRPDBatch.MRIN).MRStatus == MR.Status.Reject) { btnSendMR.Enabled = true; btnSendMR.Visible = true; btnBatchDelete.Enabled = true; btnApprove.Enabled = false; } else { btnSendMR.Enabled = false; btnBatchDelete.Enabled = false; btnApprove.Enabled = false; } } else if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Created) { btnSendMR.Enabled = false; btnSendMR.Visible = false; btnBatchDelete.Enabled = true; btnApprove.Enabled = true; } else { btnSendMR.Enabled = false; btnSendMR.Visible = false; btnBatchDelete.Enabled = false; btnApprove.Enabled = false; } if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Started) { if (dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value != null) { objQCReport = objQCReport_DL.Get_PRPD_Quality_Passed(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString()); if (objQCReport == null) { btnEditMode.Enabled = true; } else { btnEditMode.Enabled = false; } } } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }