private void cmbPRPDBatch_SelectedIndexChanged(object sender, EventArgs e) { if (cmbPRPDBatch.SelectedValue != null) { try { objPRPDBatch = objPRPDBatch_DL.Get(cmbPRPDBatch.SelectedValue.ToString()); dtPRPDBatchActivity = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(cmbPRPDBatch.SelectedValue.ToString()); dgvActivities.AutoGenerateColumns = false; dgvActivities.DataSource = objSourcePRPDBatchActivity; objSourcePRPDBatchActivity.DataSource = dtPRPDBatchActivity; objSourcePRPDBatchActivity.ResetBindings(true); txtAddedUnitCost.Text = objPRPDBatch_DL.UnitPrice(objPRPDBatch.PRPDBatchID).ToString(); txtBatchState.Text = Enum.GetName(typeof(PRPDBatch.PRPDBatchStatus), objPRPDBatch.Status); txtMRNo.Text = objPRPDBatch.MRIN.ToString(); txtUnitPrice.Text = objMRMaterial_DL.Get(objPRPDBatch.MRIN, objPRPDBatch.PRPDBatchMaterial.MaterialCode).UniRate.ToString(); txtMaterialCode.Text = objPRPDBatch.PRPDBatchMaterial.MaterialCode; txtMaterialName.Text = objPRPDBatch.PRPDBatchMaterial.MaterialNameCode; txtStartDate.Text = objPRPDBatch.PRPDBatchInstructedDate.ToShortDateString(); txtStopDate.Text = objPRPDBatch.PRPDBatchEndDate.ToShortDateString(); txtPRPDBatchQty.Text = objPRPDBatch.PRPDBatchFinalQty.ToString(); txtInstructedBy.Text = objPRPDBatch.PRPDBatchInstructedBy.EmployeeName; txtAfterReworkQty.Text = objPRPDBatch.PRPDBatchFinalQty.ToString(); txtDescription.Text = objPRPDBatch.PRPDBatchComments; lblUnit.Text = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode; lblUnit1.Text = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode; if (objPRPDBatch.Type == PRPDBatch.PRPDType.Rework) { objProcessed = objMaterial_DL.GetDryMaterial(objPRPDBatch.PRPDBatchMaterial.MaterialCode); txtMaterial.Text = objProcessed.MaterialCode + " - " + objProcessed.MaterialDescription; } else { objProcessed = objMaterial_DL.GetProcessdMaterial(objPRPDBatch.PRPDBatchMaterial.MaterialCode); txtMaterial.Text = objProcessed.MaterialCode + " - " + objProcessed.MaterialDescription; } if (objProcessed.MaterialCode == null) { btnTransfer.Enabled = false; } else { btnTransfer.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } }