protected void gvHOAddress_RowDataBound(object sender, GridViewRowEventArgs e) { try { if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); btnAddAddress.Text = "Update"; cbAddAddress.Checked = true; //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[7].Controls[0].Visible = false; Label lblHomeOwnershipID = e.Row.FindControl("lblHomeOwnershipID") as Label; DataRow dr = HomeOwnershipData.GetHomeOwnershipById(DataUtils.GetInt(lblHomeOwnershipID.Text)); hfHomeOwnershipID.Value = lblHomeOwnershipID.Text; PopulateDropDown(ddlAddress, dr["AddressID"].ToString()); cbMH.Checked = DataUtils.GetBool(dr["MH"].ToString()); cbSFD.Checked = DataUtils.GetBool(dr["SFD"].ToString()); cbCondo.Checked = DataUtils.GetBool(dr["Condo"].ToString()); chkAddressActive.Enabled = true; } } } catch (Exception ex) { LogError(Pagename, "gvHOAddress_RowDataBound", "", ex.Message); } }
private void BindAddressGrid() { dvNewHomeOwnerInfo.Visible = false; try { DataTable dt = HomeOwnershipData.GetHomeOwnershipList(DataUtils.GetInt(hfProjectId.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvHOAddressGrid.Visible = true; gvHOAddress.DataSource = dt; gvHOAddress.DataBind(); } else { dvHOAddressGrid.Visible = false; gvHOAddress.DataSource = null; gvHOAddress.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindBuildings", "", ex.Message); } }
protected void btnAddOwner_Click(object sender, EventArgs e) { if (IsOwnerFormValid()) { if (btnAddOwner.Text == "Submit") { HomeOwnershipResult objHomeOwnershipResult = HomeOwnershipData.AddProjectHomeOwnership(DataUtils.GetInt(hfHomeOwnershipID.Value), DataUtils.GetInt(ddlOwner.SelectedValue.ToString()), DataUtils.GetInt(ddlLender.SelectedValue.ToString()), cbVHFAInv.Checked, cbRDLoan.Checked, DataUtils.GetDecimal(txtVHCBGrant.Text), DataUtils.GetDecimal(txtOwnerAppAtResale.Text), DataUtils.GetDecimal(txtCapitalImpAtResale.Text), DataUtils.GetDecimal(txtFeeAtPurchase.Text), DataUtils.GetDecimal(txtFeeAtResale.Text), DataUtils.GetDecimal(txtStewardCont.Text), DataUtils.GetDecimal(txtVHCBAsstLoan.Text), DataUtils.GetDecimal(txtVHCBRehabLoan.Text)); ClearOwnerForm(); BindHomeOwnersGrid(); if (objHomeOwnershipResult.IsDuplicate && !objHomeOwnershipResult.IsActive) { LogMessage("Owner already exist as in-active"); } else if (objHomeOwnershipResult.IsDuplicate) { LogMessage("Owner already exist"); } else { LogMessage("Owner Added Successfully"); } } else { HomeOwnershipData.UpdateProjectHomeOwnership(DataUtils.GetInt(hfProjectHomeOwnershipID.Value), DataUtils.GetInt(ddlOwner.SelectedValue.ToString()), DataUtils.GetInt(ddlLender.SelectedValue.ToString()), cbVHFAInv.Checked, cbRDLoan.Checked, DataUtils.GetDecimal(txtVHCBGrant.Text), DataUtils.GetDecimal(txtOwnerAppAtResale.Text), DataUtils.GetDecimal(txtCapitalImpAtResale.Text), DataUtils.GetDecimal(txtFeeAtPurchase.Text), DataUtils.GetDecimal(txtFeeAtResale.Text), DataUtils.GetDecimal(txtStewardCont.Text), DataUtils.GetDecimal(txtVHCBAsstLoan.Text), DataUtils.GetDecimal(txtVHCBRehabLoan.Text), chkOwnerActive.Checked); gvOwner.EditIndex = -1; BindHomeOwnersGrid(); ClearOwnerForm(); hfProjectHomeOwnershipID.Value = ""; btnAddOwner.Text = "Submit"; LogMessage("Owner Updated Successfully"); } } }
protected void gvOwner_RowDataBound(object sender, GridViewRowEventArgs e) { try { if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); btnAddOwner.Text = "Update"; cbAddOwner.Checked = true; //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[5].Controls[0].Visible = false; Label lblProjectHomeOwnershipID = e.Row.FindControl("lblProjectHomeOwnershipID") as Label; DataRow dr = HomeOwnershipData.GetProjectHomeOwnershipById(DataUtils.GetInt(lblProjectHomeOwnershipID.Text)); hfProjectHomeOwnershipID.Value = lblProjectHomeOwnershipID.Text; PopulateDropDown(ddlOwner, dr["Owner"].ToString()); PopulateDropDown(ddlLender, dr["LkLender"].ToString()); cbVHFAInv.Checked = DataUtils.GetBool(dr["vhfa"].ToString());; cbRDLoan.Checked = DataUtils.GetBool(dr["RDLoan"].ToString());; txtVHCBGrant.Text = dr["VHCBGrant"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["VHCBGrant"].ToString()).ToString("#.00"); txtOwnerAppAtResale.Text = dr["OwnerApprec"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["OwnerApprec"].ToString()).ToString("#.00"); txtCapitalImpAtResale.Text = dr["CapImprove"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["CapImprove"].ToString()).ToString("#.00"); txtFeeAtPurchase.Text = dr["InitFee"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["InitFee"].ToString()).ToString("#.00"); txtFeeAtResale.Text = dr["ResaleFee"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["ResaleFee"].ToString()).ToString("#.00"); txtStewardCont.Text = dr["StewFee"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["StewFee"].ToString()).ToString("#.00"); txtVHCBAsstLoan.Text = dr["AssistLoan"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["AssistLoan"].ToString()).ToString("#.00"); txtVHCBRehabLoan.Text = dr["RehabLoan"].ToString() == "0.0000" ? "" : DataUtils.GetDecimal(dr["RehabLoan"].ToString()).ToString("#.00"); chkOwnerActive.Enabled = true; } } } catch (Exception ex) { LogError(Pagename, "gvOwner_RowDataBound", "", ex.Message); } }
protected void btnAddAddress_Click(object sender, EventArgs e) { if (IsAddressFormValid()) { if (btnAddAddress.Text == "Add") { HomeOwnershipResult objHomeOwnershipResult = HomeOwnershipData.AddHomeOwnershipAddress((DataUtils.GetInt(hfProjectId.Value)), DataUtils.GetInt(ddlAddress.SelectedValue.ToString()), cbMH.Checked, cbCondo.Checked, cbSFD.Checked); ClearAddressForm(); BindGrids(); if (objHomeOwnershipResult.IsDuplicate && !objHomeOwnershipResult.IsActive) { LogMessage("Address already exist as in-active"); } else if (objHomeOwnershipResult.IsDuplicate) { LogMessage("Address already exist"); } else { LogMessage("Address Added Successfully"); } } else { HomeOwnershipData.UpdateHouseOwnership((DataUtils.GetInt(hfHomeOwnershipID.Value)), DataUtils.GetInt(ddlAddress.SelectedValue.ToString()), cbMH.Checked, cbCondo.Checked, cbSFD.Checked, chkAddressActive.Checked); gvHOAddress.EditIndex = -1; BindGrids(); hfHomeOwnershipID.Value = ""; ClearAddressForm(); btnAddAddress.Text = "Add"; LogMessage("Address Updated Successfully"); } } }
private void BindHomeOwnersGrid() { try { DataTable dt = HomeOwnershipData.GetProjectHomeOwnershipList(DataUtils.GetInt(hfHomeOwnershipID.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvOwnerGrid.Visible = true; gvOwner.DataSource = dt; gvOwner.DataBind(); } else { dvOwnerGrid.Visible = false; gvOwner.DataSource = null; gvOwner.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindUnitsGrid", "", ex.Message); } }