private void btnSendMR_Click(object sender, EventArgs e) { try { int NewMRNO = 0; if (rdbMaterial.Checked == true) { NewMRNO = objMRDL.Add_BatchMR_Partial(cmbPart.Text, cmbBatchNo.SelectedValue.ToString(), objStore.StoreID, CurrentUser.EmployeeID, DepID, "MR For Batch No " + cmbBatchNo.SelectedValue.ToString(), MR.Status.Initial, MR.Type.Material, (int)MR.Origin.ToBatch); } else { NewMRNO = objMRDL.Add_BatchMR_Partial(cmbPart.Text, cmbBatchNo.SelectedValue.ToString(), objStore.StoreID, CurrentUser.EmployeeID, DepID, "MR For Batch No " + cmbBatchNo.SelectedValue.ToString(), MR.Status.Initial, MR.Type.BasicProduct, (int)MR.Origin.ToBatch); } if (rdbMaterial.Checked == true) { foreach (MRMaterial obj in objMRMaterialCollec) { obj.MR = objMRDL.Get(NewMRNO); objMRMaterialDL.Add(obj); } objMRMaterialCollec.Clear(); } if (rdbSemiFinished.Checked == true) { foreach (MRBasicProduct obj in objMRBasicProductCollec) { obj.MR = objMRDL.Get(NewMRNO); objMRBasicProductDL.Add(obj); } objMRBasicProductCollec.Clear(); } if (NewMRNO > 0) { MessageBox.Show(this, "MR is sent to RPD Stores. MRNO is : " + NewMRNO.ToString(), "Successful", MessageBoxButtons.OK); if (rdbMaterial.Checked == true) { LoadMaterialList(); } else { LoadSemiFinishedList(); } this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }