private void btnSelectUnit_Click(object sender, EventArgs e) { if (cmbBlock.SelectedIndex == -1) { cmbBlock.Focus(); return; } if (cmbProject.SelectedIndex == -1) { cmbProject.Focus(); return; } if (txtRegistrationNo.Text == "") { txtRegistrationNo.Focus(); return; } frmUnitsLookUp lookup = new frmUnitsLookUp(); lookup.strProject = cmbProject.Text; lookup.strBlock = cmbBlock.Text; lookup.strSizeCode = txtSizeCode.Text; if (lookup.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtUnit.Text = lookup.strunitID; } }
private void btnUnitSelect_Click(object sender, EventArgs e) { frmUnitsLookUp lookup = new frmUnitsLookUp(); lookup.strProject = cmbProjects.Text; lookup.strBlock = cmbSector.Text; lookup.strSizeCode = cmbSizeCode.Text; if (lookup.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtUnit.Text = lookup.strunitID; clsUnit unit = da.GetUnitByUnitID(txtUnit.Text); if (unit == null) { return; } decimal decPlotPrice = 0, decPlotCharges = 0, decPlotChargesPerc = 0; decPlotPrice = unit.decPrice; txtPlotPrice.Text = decPlotPrice.ToString("N2"); txtUnitType.Text = unit.strUnitTypeID; txtUnitCategory.Text = unit.strUnitCategoryID; if (unit.strUnitTypeID == "GENERAL") { txtChargesPercentage.Text = 0.ToString("N2"); } else if (unit.strUnitTypeID == "PARK FACE" || unit.strUnitTypeID == "WIDE ROAD" || unit.strUnitTypeID == "CORNER") { decPlotChargesPerc = 10; txtChargesPercentage.Text = 10.ToString("N2"); } else if (unit.strUnitTypeID == "P. F. CORNER" || unit.strUnitTypeID == "WIDE ROAD +PARK FACE" || unit.strUnitTypeID == "WD.ROAD+CORNER") { decPlotChargesPerc = 20; txtChargesPercentage.Text = 20.ToString("N2"); } txtPlotPrice.Text = decPlotPrice.ToString("N2"); decPlotCharges = decPlotPrice * decPlotChargesPerc / 100; txtPlotTypeCharges.Text = decPlotCharges.ToString("N2"); txtTotalPrice.Text = (decPlotPrice + decPlotCharges).ToString("N2"); SetNetPrice(); } }