private void ShowDataToControl(int ID) { RW_COMPONENT_BUS busCom = new RW_COMPONENT_BUS(); RW_COMPONENT com = busCom.getData(ID); txtTankDiameter.Text = com.NominalDiameter.ToString(); txtCurrentThickness.Text = com.CurrentThickness.ToString(); txtCurrentCorrosionRate.Text = com.CurrentCorrosionRate.ToString(); txtShellCourseHeight.Text = com.ShellHeight.ToString(); txtNominalThickness.Text = com.NominalThickness.ToString(); chkDamageFoundDuringInspection.Checked = com.DamageFoundInspection == 1 ? true : false; chkConcreteAsphalt.Checked = com.ConcreteFoundation == 1 ? true : false; chkPresenceCracks.Checked = com.CracksPresent == 1 ? true : false; chkPreventionBarrier.Checked = com.ReleasePreventionBarrier == 1 ? true : false; chkTrampElements.Checked = com.TrampElements == 1 ? true : false; txtMinRequiredThickness.Text = com.MinReqThickness.ToString(); for (int i = 0; i < itemsBrinnellHardness.Length; i++) { if (itemsBrinnellHardness[i] == com.BrinnelHardness) { cbMaxBrillnessHardness.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsComplexityProtrusion.Length; i++) { if (itemsComplexityProtrusion[i] == com.ComplexityProtrusion) { cbComplexityProtrusion.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsSeverity.Length; i++) { if (itemsSeverity[i] == com.SeverityOfVibration) { cbSeverityVibration.SelectedIndex = i + 1; break; } } }
private void ShowDataToControl(int ID, string diameter, string thickness, string corrosionRate, string volumeUnit, string stressUnit) { RW_COMPONENT_BUS busCom = new RW_COMPONENT_BUS(); RW_COMPONENT comp = busCom.getData(ID); BUS_UNITS convUnit = new BUS_UNITS(); if (diameter == "INCH") { txtTankDiameter.Text = (comp.NominalDiameter / convUnit.inch).ToString(); // converst mm sang in } else if (diameter == "MM") { txtTankDiameter.Text = comp.NominalDiameter.ToString(); // giữ nguyên } if (thickness == "MM") { txtNominalThickness.Text = comp.NominalThickness.ToString(); //giữ nguyên txtMinRequiredThickness.Text = comp.MinReqThickness.ToString(); // giữ nguyên txtCurrentThickness.Text = comp.CurrentThickness.ToString(); txtBrittleFractureThickness.Text = comp.BrittleFractureThickness.ToString(); txtStructuralThickness.Text = comp.StructuralThickness.ToString(); } else if (thickness == "INCH") { txtNominalThickness.Text = (comp.NominalThickness / convUnit.inch).ToString(); //converst mm sang in txtMinRequiredThickness.Text = (comp.MinReqThickness / convUnit.inch).ToString(); //convert mm sang in txtCurrentThickness.Text = (comp.CurrentThickness / convUnit.inch).ToString(); txtBrittleFractureThickness.Text = (comp.BrittleFractureThickness / convUnit.inch).ToString(); txtStructuralThickness.Text = (comp.StructuralThickness / convUnit.inch).ToString(); } if (corrosionRate == "MMYR") { txtCurrentCorrosionRate.Text = comp.CurrentCorrosionRate.ToString(); // converst mm sang mm } else { txtCurrentCorrosionRate.Text = (comp.CurrentCorrosionRate / convUnit.mil).ToString(); // converst mm sang mil } if (stressUnit == "KSI") { txtAllowableStress.Text = (comp.AllowableStress / convUnit.ksi).ToString(); } else if (stressUnit == "PSI") { txtAllowableStress.Text = (comp.AllowableStress / convUnit.psi).ToString(); } else if (stressUnit == "MPA") { txtAllowableStress.Text = (comp.AllowableStress).ToString(); } else if (stressUnit == "BAR") { txtAllowableStress.Text = (comp.AllowableStress / convUnit.bar).ToString(); } else if (stressUnit == "NM2") { txtAllowableStress.Text = (comp.AllowableStress / convUnit.NpM2).ToString(); } else { txtAllowableStress.Text = (comp.AllowableStress / convUnit.NpCM2).ToString(); } if (volumeUnit == "M3") { txtComponentVolume.Text = comp.ComponentVolume.ToString(); } else { txtComponentVolume.Text = (comp.ComponentVolume / convUnit.ft3).ToString(); } chkConcreteAsphalt.Checked = comp.ConcreteFoundation == 1 ? true : false; chkPresenceCracks.Checked = comp.CracksPresent == 1 ? true : false; chkPreventionBarrier.Checked = comp.ReleasePreventionBarrier == 1 ? true : false; for (int i = 0; i < itemsBrinnellHardness.Length; i++) { if (itemsBrinnellHardness[i] == comp.BrinnelHardness) { cbMaxBrillnessHardness.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsComplexityProtrusion.Length; i++) { if (itemsComplexityProtrusion[i] == comp.ComplexityProtrusion) { cbComplexityProtrusion.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsSeverity.Length; i++) { if (itemsSeverity[i] == comp.SeverityOfVibration) { cbSeverityVibration.SelectedIndex = i + 1; break; } } }
private void ShowDataToControl(int ID, string diameter, string thickness, string corrosionRate) { RW_COMPONENT_BUS busCom = new RW_COMPONENT_BUS(); RW_COMPONENT com = busCom.getData(ID); BUS_UNITS convUnit = new BUS_UNITS(); if (diameter == "in") { txtTankDiameter.Text = (com.NominalDiameter / convUnit.inch).ToString(); // converst mm sang in } else if (diameter == "mm") { txtTankDiameter.Text = com.NominalDiameter.ToString(); // giữ nguyên } else { txtTankDiameter.Text = (com.NominalDiameter / 1000).ToString(); // converst mm sang m } if (thickness == "mm") { txtNominalThickness.Text = com.NominalThickness.ToString(); //giữ nguyên txtCurrentThickness.Text = com.CurrentThickness.ToString(); // giữ nguyên txtMinRequiredThickness.Text = com.MinReqThickness.ToString(); // giữ nguyên } else if (thickness == "in") { txtNominalThickness.Text = (com.NominalThickness / convUnit.inch).ToString(); //converst mm sang in txtCurrentThickness.Text = (com.CurrentThickness / convUnit.inch).ToString(); //converst mm sang in txtMinRequiredThickness.Text = (com.MinReqThickness / convUnit.inch).ToString(); //converst mm sang in } else { txtNominalThickness.Text = (com.NominalThickness / 1000).ToString(); // converst mm sang m txtCurrentThickness.Text = (com.CurrentThickness / 1000).ToString(); // converst mm sang m txtMinRequiredThickness.Text = (com.MinReqThickness / 1000).ToString(); // converst mm sang m } if (corrosionRate == "mm/yr") { txtCurrentCorrosionRate.Text = com.CurrentCorrosionRate.ToString(); // converst mm sang mm } else { txtCurrentCorrosionRate.Text = (com.CurrentCorrosionRate / convUnit.mil).ToString(); // converst mm sang mil } txtShellCourseHeight.Text = com.ShellHeight.ToString(); chkDamageFoundDuringInspection.Checked = com.DamageFoundInspection == 1 ? true : false; chkConcreteAsphalt.Checked = com.ConcreteFoundation == 1 ? true : false; chkPresenceCracks.Checked = com.CracksPresent == 1 ? true : false; chkPreventionBarrier.Checked = com.ReleasePreventionBarrier == 1 ? true : false; chkTrampElements.Checked = com.TrampElements == 1 ? true : false; for (int i = 0; i < itemsBrinnellHardness.Length; i++) { if (itemsBrinnellHardness[i] == com.BrinnelHardness) { cbMaxBrillnessHardness.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsComplexityProtrusion.Length; i++) { if (itemsComplexityProtrusion[i] == com.ComplexityProtrusion) { cbComplexityProtrusion.SelectedIndex = i + 1; break; } } for (int i = 0; i < itemsSeverity.Length; i++) { if (itemsSeverity[i] == com.SeverityOfVibration) { cbSeverityVibration.SelectedIndex = i + 1; break; } } }