private void btnSave_Click(object sender, EventArgs e) { try { objMR.MRDepartmentFrom = objDepDL.Get(Convert.ToInt64(cmbDepartment.SelectedValue)); objMR.MREnterdBy = CurrentUser.UserEmp.EmployeeID; if (txtDescription.Text != "") { objMR.MRRemarks = txtDescription.Text; } else { objMR.MRRemarks = "No"; } objMR.MRStore = objStore; objMR.MRStatus = MR.Status.Initial; objMR.MRType = MR.Type.BasicProduct; objMR.OriginType = MR.Origin.ToStore; if (objMRBasicProductCollec.Count > 0) { long MRNO = objMRDL.Add_M(objMR); if (MRNO > 0) { objMR.MRNO = MRNO; foreach (MRBasicProduct obj in objMRBasicProductCollec) { obj.MR = objMR; objMRBasicProduct_DL.Add(obj); } MessageBox.Show(this, "Successfully Added to Database", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearItem(); ClearMR(); } } else { MessageBox.Show(this, "Item List is Empty,Please add Items before continue", "Item List is Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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 btnSave_Click(object sender, EventArgs e) { try { objMR.MRDepartmentFrom = objDepartment; objMR.MREnterdBy = CurrentUser.UserEmp.EmployeeID; objMR.MRRemarks = "No"; objMR.MRStore = objStore; objMR.MRStatus = MR.Status.Initial; objMR.MRType = MR.Type.Material; objMR.OriginType = MR.Origin.ToBatch; if (objMRMaterialCollec.Count > 0) { long MRNO = objMRDL.Add_M(objMR); if (MRNO > 0) { objMR.MRNO = MRNO; foreach (MRMaterial obj in objMRMaterialCollec) { obj.MR = objMR; objMRMaterialDL.Add(obj); } MessageBox.Show(this, "Successfully Added to Database", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearItem(); ClearMR(); } } else { MessageBox.Show(this, "Item List is Empty,Please add Items before continue", "Item List is Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { try { objMR.MRDate = DateTime.Now; objMR.MRDepartmentFrom = objDepDL.Get(Convert.ToInt64(cmbDepartment.SelectedValue)); objMR.MREnterdBy = CurrentUser.UserEmp.EmployeeID; objMR.MRRemarks = txtRemarks.Text; objMR.MRStatus = MR.Status.Initial; objMR.MRStore = (Store)cmbStore.SelectedItem; if (cbSection.Checked) { objMR.SectionID = Convert.ToInt64(cmbSection.SelectedValue); } else { objMR.SectionID = null; } if (cmbMRType.SelectedItem.Equals("Material")) { objMR.MRType = MR.Type.Material; if (objMRMaterialCollec.Count > 0) { long MRNO = objMRDL.Add_M(objMR); if (MRNO > 0) { objMR.MRNO = MRNO; foreach (MRMaterial obj in objMRMaterialCollec) { obj.MR = objMR; objMRMaterialDL.Add(obj); } MessageBox.Show(this, "Successfully Added to Database", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearItem(); ClearMR(); } } else { MessageBox.Show(this, "Item List is Empty,Please add Items before continue", "Item List is Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (cmbMRType.SelectedItem.Equals("Basic Products")) { objMR.MRType = MR.Type.BasicProduct; if (objMRBasicProductCollec.Count > 0) { long MRNO = objMRDL.Add_M(objMR); if (MRNO > 0) { objMR.MRNO = MRNO; foreach (MRBasicProduct obj in objMRBasicProductCollec) { obj.MR = objMR; objMRBasicProductDL.Add(obj); } MessageBox.Show(this, "Successfully Added to Database", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearItem(); ClearMR(); } } else { MessageBox.Show(this, "Item List is Empty,Please add Items before continue", "Item List is Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (cmbMRType.SelectedItem.Equals("Finish Products")) { objMR.MRType = MR.Type.FinishProduct; if (objMRFinishhProductCollec.Count > 0) { long MRNO = objMRDL.Add_M(objMR); if (MRNO > 0) { objMR.MRNO = MRNO; foreach (MRFinishProduct obj in objMRFinishhProductCollec) { obj.MR = objMR; objMRFinishProductDL.Add(obj); } MessageBox.Show(this, "Successfully Added to Database", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearItem(); ClearMR(); objMRMaterialCollec.Clear(); } } else { MessageBox.Show(this, "Item List is Empty,Please add Items before continue", "Item List is Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }