protected void btnAddBldgInfoSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtBldgnumber.Text.ToString()) == true) { LogMessage("Enter Bldg #"); txtBldgnumber.Focus(); return; } if (ddlAddress.SelectedIndex == 0) { LogMessage("Select Address"); ddlAddress.Focus(); return; } if (ddlType.SelectedIndex == 0) { LogMessage("Select Type"); ddlType.Focus(); return; } if (btnAddBldgInfoSubmit.Text == "Submit") { LeadBuildResult objLeadBuildResult = ProjectLeadBuildingsData.AddProjectLeadBldg((DataUtils.GetInt(hfProjectId.Value)), DataUtils.GetInt(txtBldgnumber.Text), DataUtils.GetInt(ddlAddress.SelectedValue.ToString()), DataUtils.GetInt(txtAge.Text), DataUtils.GetInt(ddlType.SelectedValue.ToString()), DataUtils.GetInt(txtLHCUnits.Text), cbFloodHazardArea.Checked, cbFloodInsurance.Checked, DataUtils.GetInt(ddlverifiedBy.SelectedValue.ToString()), txtInsuredby.Text, DataUtils.GetInt(ddlHistoricStatus.SelectedValue.ToString()), DataUtils.GetInt(ddlAppendixA.SelectedValue.ToString())); ClearBldgInfoForm(); BindGrids(); if (objLeadBuildResult.IsDuplicate && !objLeadBuildResult.IsActive) { LogMessage("Building Info already exist as in-active"); } else if (objLeadBuildResult.IsDuplicate) { LogMessage("Building Info already exist"); } else { LogMessage("Building Info Added Successfully"); } } else { ProjectLeadBuildingsData.UpdateProjectLeadBldg((DataUtils.GetInt(hfLeadBldgID.Value)), DataUtils.GetInt(txtBldgnumber.Text), DataUtils.GetInt(ddlAddress.SelectedValue.ToString()), DataUtils.GetInt(txtAge.Text), DataUtils.GetInt(ddlType.SelectedValue.ToString()), DataUtils.GetInt(txtLHCUnits.Text), cbFloodHazardArea.Checked, cbFloodInsurance.Checked, DataUtils.GetInt(ddlverifiedBy.SelectedValue.ToString()), txtInsuredby.Text, DataUtils.GetInt(ddlHistoricStatus.SelectedValue.ToString()), DataUtils.GetInt(ddlAppendixA.SelectedValue.ToString()), chkBldgActive.Checked); gvBldgInfo.EditIndex = -1; BindGrids(); hfLeadBldgID.Value = ""; ClearBldgInfoForm(); btnAddBldgInfoSubmit.Text = "Submit"; LogMessage("Building Info Updated Successfully"); } }
private void BindBuildingsGrid() { dvNewUnitInfo.Visible = false; try { DataTable dt = ProjectLeadBuildingsData.GetProjectLeadBldgList(DataUtils.GetInt(hfProjectId.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvBldgInfoGrid.Visible = true; gvBldgInfo.DataSource = dt; gvBldgInfo.DataBind(); } else { dvBldgInfoGrid.Visible = false; gvBldgInfo.DataSource = null; gvBldgInfo.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindBuildings", "", ex.Message); } }
protected void gvUnitInfo_RowDataBound(object sender, GridViewRowEventArgs e) { try { if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); btnAddUnitInfo.Text = "Update"; cbAddUnitInfo.Checked = true; //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[6].Controls[0].Visible = false; Label lblLeadUnitID = e.Row.FindControl("lblLeadUnitID") as Label; DataRow dr = ProjectLeadBuildingsData.GetProjectLeadUnitById(DataUtils.GetInt(lblLeadUnitID.Text)); hfLeadUnitID.Value = lblLeadUnitID.Text; txtUnitNumber.Text = dr["Unit"].ToString(); PopulateDropDown(ddlEBlStatus, dr["EBLStatus"].ToString()); ; txtHouseholdCount.Text = dr["HHCount"].ToString(); txtRooms.Text = dr["Rooms"].ToString(); txtHouseholdIncome.Text = Decimal.Parse(dr["HHIncome"].ToString()).ToString("#.00"); cbThirdPartyVerified.Checked = DataUtils.GetBool(dr["PartyVerified"].ToString()); PopulateDropDown(ddlIncomeStatus, dr["IncomeStatus"].ToString()); txtMatchingFund.Text = Decimal.Parse(dr["MatchFunds"].ToString()).ToString("#.00"); txtClearanceDate.Text = dr["ClearDate"].ToString() == "" ? "" : Convert.ToDateTime(dr["ClearDate"].ToString()).ToShortDateString(); txtCertifiedBy.Text = dr["CertDate"].ToString() == "" ? "" : Convert.ToDateTime(dr["CertDate"].ToString()).ToShortDateString(); if (dr["CertDate"].ToString() != "") { labelRectDate.InnerText = Get6MonthsPlusDate(dr["CertDate"].ToString()); } else { labelRectDate.InnerText = ""; } txtUnitNumber.Enabled = false; chkUnitActive.Enabled = true; } } } catch (Exception ex) { LogError(Pagename, "gvBldgInfo_RowDataBound", "", ex.Message); } }
protected void btnAddUnitInfo_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtUnitNumber.Text.ToString()) == true) { LogMessage("Enter Unit #"); txtUnitNumber.Focus(); return; } if (btnAddUnitInfo.Text == "Submit") { LeadBuildResult objLeadBuildResult = ProjectLeadBuildingsData.AddProjectLeadUnit((DataUtils.GetInt(hfLeadBldgID.Value)), DataUtils.GetInt(txtUnitNumber.Text), DataUtils.GetInt(ddlEBlStatus.SelectedValue.ToString()), DataUtils.GetInt(txtHouseholdCount.Text), DataUtils.GetInt(txtRooms.Text), DataUtils.GetDecimal(txtHouseholdIncome.Text), cbThirdPartyVerified.Checked, DataUtils.GetInt(ddlIncomeStatus.SelectedValue.ToString()), DataUtils.GetDecimal(txtMatchingFund.Text), DataUtils.GetDate(txtClearanceDate.Text), DataUtils.GetDate(txtCertifiedBy.Text), DataUtils.GetDate(txtCertifiedBy.Text)); ClearUnitInfoForm(); BindUnitsGrid(); if (objLeadBuildResult.IsDuplicate && !objLeadBuildResult.IsActive) { LogMessage("Unit Info already exist as in-active"); } else if (objLeadBuildResult.IsDuplicate) { LogMessage("Unit Info already exist"); } else { LogMessage("Unit Info Added Successfully"); } } else { ProjectLeadBuildingsData.UpdateProjectLeadUnit((DataUtils.GetInt(hfLeadUnitID.Value)), DataUtils.GetInt(ddlEBlStatus.SelectedValue.ToString()), DataUtils.GetInt(txtHouseholdCount.Text), DataUtils.GetInt(txtRooms.Text), DataUtils.GetDecimal(txtHouseholdIncome.Text), cbThirdPartyVerified.Checked, DataUtils.GetInt(ddlIncomeStatus.SelectedValue.ToString()), DataUtils.GetDecimal(txtMatchingFund.Text), DataUtils.GetDate(txtClearanceDate.Text), DataUtils.GetDate(txtCertifiedBy.Text), DataUtils.GetDate(txtCertifiedBy.Text), chkUnitActive.Checked); ClearUnitInfoForm(); BindUnitsGrid(); gvUnitInfo.EditIndex = -1; BindUnitsGrid(); hfLeadUnitID.Value = ""; ClearUnitInfoForm(); btnAddUnitInfo.Text = "Submit"; LogMessage("Unit Info Updated Successfully"); } }
private void BindAddresses() { try { ddlAddress.Items.Clear(); ddlAddress.DataSource = ProjectLeadBuildingsData.GetProjectAddressListByProjectID(DataUtils.GetInt(hfProjectId.Value)); ddlAddress.DataValueField = "AddressId"; ddlAddress.DataTextField = "Address"; ddlAddress.DataBind(); ddlAddress.Items.Insert(0, new ListItem("Select", "NA")); } catch (Exception ex) { LogError(Pagename, "BindAddresses", "Control ID:" + ddlAddress.ID, ex.Message); } }
protected void gvBldgInfo_RowDataBound(object sender, GridViewRowEventArgs e) { try { if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); btnAddBldgInfoSubmit.Text = "Update"; cbAddBldgInfo.Checked = true; //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[5].Controls[0].Visible = false; Label lblLeadBldgID = e.Row.FindControl("lblLeadBldgID") as Label; DataRow dr = ProjectLeadBuildingsData.GetProjectLeadBldgById(DataUtils.GetInt(lblLeadBldgID.Text)); hfLeadBldgID.Value = lblLeadBldgID.Text; txtBldgnumber.Text = dr["Building"].ToString(); PopulateDropDown(ddlAddress, dr["AddressID"].ToString()); txtAge.Text = dr["Age"].ToString(); PopulateDropDown(ddlType, dr["Type"].ToString()); txtLHCUnits.Text = dr["LHCUnits"].ToString(); cbFloodHazardArea.Checked = DataUtils.GetBool(dr["FloodHazard"].ToString()); cbFloodInsurance.Checked = DataUtils.GetBool(dr["FloodIns"].ToString()); PopulateDropDown(ddlverifiedBy, dr["VerifiedBy"].ToString()); txtInsuredby.Text = dr["InsuredBy"].ToString(); PopulateDropDown(ddlHistoricStatus, dr["HistStatus"].ToString()); PopulateDropDown(ddlAppendixA, dr["AppendA"].ToString()); txtBldgnumber.Enabled = false; chkBldgActive.Enabled = true; } } } catch (Exception ex) { LogError(Pagename, "gvBldgInfo_RowDataBound", "", ex.Message); } }