private void BindAppaisalInfoGrid() { dvNewAppraisalPay.Visible = false; try { DataTable dt = ConservationAppraisalsData.GetConservationAppraisalInfoList(DataUtils.GetInt(hfAppraisalID.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvAppraisalInfoGrid.Visible = true; gvAppraisalInfo.DataSource = dt; gvAppraisalInfo.DataBind(); Session["dtAppraisalInfoList"] = dt; } else { dvAppraisalInfoGrid.Visible = false; gvAppraisalInfo.DataSource = null; gvAppraisalInfo.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindOccupantsGrid", "", ex.Message); } }
private void BindPayGrid() { try { DataTable dt = ConservationAppraisalsData.GetConservationAppraisalPayList(DataUtils.GetInt(hfAppraisalInfoID.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvAppraisalPayGrid.Visible = true; gvAppraisalPay.DataSource = dt; gvAppraisalPay.DataBind(); Label lblFooterTotalPayAmount = (Label)gvAppraisalPay.FooterRow.FindControl("lblFooterTotalPayAmount"); decimal totPayAmountFromDB = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (DataUtils.GetBool(dt.Rows[i]["RowIsActive"].ToString())) { totPayAmountFromDB += DataUtils.GetDecimal(dt.Rows[i]["PayAmt"].ToString()); } } lblFooterTotalPayAmount.Text = CommonHelper.myDollarFormat(totPayAmountFromDB); decimal TotalCost = DataUtils.GetDecimal(hfSelectedAppraisalTotalCost.Value); hfPayWarning.Value = "0"; if (TotalCost - totPayAmountFromDB != 0) { hfPayWarning.Value = "1"; WarningMessage(dvPayWarning, lblPayWarning, "The Responsible Parties' amount(s) must equal the Total Cost of the Appraisal " + CommonHelper.myDollarFormat(TotalCost)); } else { dvPayWarning.Visible = false; lblPayWarning.Text = ""; } } else { dvAppraisalPayGrid.Visible = false; gvAppraisalPay.DataSource = null; gvAppraisalPay.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindPayGrid", "", ex.Message); } }
protected void gvAppraisalPay_RowUpdating(object sender, GridViewUpdateEventArgs e) { int rowIndex = e.RowIndex; int AppraisalPayID = DataUtils.GetInt(((Label)gvAppraisalPay.Rows[rowIndex].FindControl("lblAppraisalPayID")).Text); int WhoPaid = DataUtils.GetInt(((DropDownList)gvAppraisalPay.Rows[rowIndex].FindControl("ddlPayParty")).SelectedValue.ToString()); decimal Amount = DataUtils.GetDecimal(((TextBox)gvAppraisalPay.Rows[rowIndex].FindControl("txtPayAmount")).Text); bool RowIsActive = Convert.ToBoolean(((CheckBox)gvAppraisalPay.Rows[rowIndex].FindControl("chkActive")).Checked);; ConservationAppraisalsData.UpdateConservationAppraisalPay(AppraisalPayID, Amount, WhoPaid, RowIsActive); gvAppraisalPay.EditIndex = -1; BindPayGrid(); LogMessage("Payment Updated successfully"); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtTotalAcres.Text.ToString()) == true) { LogMessage("Enter Total Acres"); txtTotalAcres.Focus(); return; } //if (ddlAddress.SelectedIndex == 0) //{ // LogMessage("Select Address"); // ddlAddress.Focus(); // return; //} decimal Easementvalue = DataUtils.GetDecimal(txtValueBefore.Text) - DataUtils.GetDecimal(txtValueafter.Text); decimal EasementValuePerAcre = Easementvalue / DataUtils.GetInt(txtTotalAcres.Text); if (btnSubmit.Text == "Submit") { ConservationAppraisalsData.AddConservationAppraisalValue(DataUtils.GetInt(hfProjectId.Value), DataUtils.GetInt(txtTotalAcres.Text), DataUtils.GetDecimal(txtValueBefore.Text), DataUtils.GetDecimal(txtValueafter.Text), DataUtils.GetDecimal(txtValueofLandWithOption.Text), DataUtils.GetDecimal(txtEnhancedExclusionValue.Text), Easementvalue, EasementValuePerAcre); BindAppraisalValueForm(); BindGrids(); LogMessage("Appraisal Value Added Successfully"); } else { ConservationAppraisalsData.UpdateConservationAppraisalValue(DataUtils.GetInt(hfProjectId.Value), DataUtils.GetInt(txtTotalAcres.Text), DataUtils.GetDecimal(txtValueBefore.Text), DataUtils.GetDecimal(txtValueafter.Text), DataUtils.GetDecimal(txtValueofLandWithOption.Text), DataUtils.GetDecimal(txtEnhancedExclusionValue.Text), Easementvalue, EasementValuePerAcre, true); gvAppraisalInfo.EditIndex = -1; BindAppraisalValueForm(); BindGrids(); LogMessage("Appraisal Value Updated Successfully"); } }
private void BindAppraisalValueForm() { DataRow drAppraisalValue = ConservationAppraisalsData.GetConservationAppraisalValueById(DataUtils.GetInt(hfProjectId.Value)); dvNewAppraisalInfo.Visible = false; if (drAppraisalValue != null) { btnSubmit.Text = "Update"; hfAppraisalID.Value = drAppraisalValue["AppraisalID"].ToString(); txtTotalAcres.Text = drAppraisalValue["TotAcres"].ToString(); txtValueBefore.Text = DataUtils.GetDecimal(drAppraisalValue["Apbef"].ToString()).ToString("#.##"); txtValueafter.Text = DataUtils.GetDecimal(drAppraisalValue["Apaft"].ToString()).ToString("#.##"); txtValueofLandWithOption.Text = DataUtils.GetDecimal(drAppraisalValue["Aplandopt"].ToString()).ToString("#.##"); txtEnhancedExclusionValue.Text = DataUtils.GetDecimal(drAppraisalValue["Exclusion"].ToString()).ToString("#.##"); spEasementValue.InnerText = DataUtils.GetDecimal(drAppraisalValue["EaseValue"].ToString()).ToString("#.##"); spEasementValuePerAcre.InnerText = DataUtils.GetDecimal(drAppraisalValue["Valperacre"].ToString()).ToString("#.##"); dvNewAppraisalInfo.Visible = true; BindGrids(); } }
protected void gvAppraisalInfo_RowDataBound(object sender, GridViewRowEventArgs e) { try { if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); btnAddAppraisalInfo.Text = "Update"; cbAddAppraisalInfo.Checked = true; //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[8].Controls[0].Visible = false; Label lblAppraisalInfoID = e.Row.FindControl("lblAppraisalInfoID") as Label; DataRow dr = ConservationAppraisalsData.GetConservationAppraisalInfoById(DataUtils.GetInt(lblAppraisalInfoID.Text)); hfAppraisalInfoID.Value = lblAppraisalInfoID.Text; PopulateDropDown(ddlAppraiser, dr["LkAppraiser"].ToString()); txtDateOrdered.Text = dr["AppOrdered"].ToString() == "" ? "" : Convert.ToDateTime(dr["AppOrdered"].ToString()).ToShortDateString(); txtDateReceived.Text = dr["AppRecd"].ToString() == "" ? "" : Convert.ToDateTime(dr["AppRecd"].ToString()).ToShortDateString(); txtEffectiveDate.Text = dr["EffDate"].ToString() == "" ? "" : Convert.ToDateTime(dr["EffDate"].ToString()).ToShortDateString(); txtTotalCost.Text = DataUtils.GetDecimal(dr["AppCost"].ToString()).ToString("#.##"); txtNotes.Text = dr["Comment"].ToString(); txtDateNRCS.Text = dr["NRCSSent"].ToString() == "" ? "" : Convert.ToDateTime(dr["NRCSSent"].ToString()).ToShortDateString(); cbReviewApproved.Checked = DataUtils.GetBool(dr["RevApproved"].ToString()); txtReviewApprovedDate.Text = dr["ReviewDate"].ToString() == "" ? "" : Convert.ToDateTime(dr["ReviewDate"].ToString()).ToShortDateString(); chkAppraisalInfoActive.Enabled = true; } } } catch (Exception ex) { LogError(Pagename, "gvAppraisalInfo_RowDataBound", "", ex.Message); } }
protected void btnAddPay_Click(object sender, EventArgs e) { if (ddlPayParty.SelectedIndex == 0) { LogMessage("Select Responsible Party"); ddlPayParty.Focus(); return; } if (string.IsNullOrWhiteSpace(txtPayAmount.Text.ToString()) == true) { LogMessage("Enter Amount"); txtPayAmount.Focus(); return; } ConservationAppraisalsData.AddConservationAppraisalPay((DataUtils.GetInt(hfAppraisalInfoID.Value)), DataUtils.GetDecimal(txtPayAmount.Text), DataUtils.GetInt(ddlPayParty.SelectedValue.ToString())); ClearPayForm(); BindPayGrid(); LogMessage("Payment Added Successfully"); }
protected void btnAddAppraisalInfo_Click(object sender, EventArgs e) { if (ddlAppraiser.SelectedIndex == 0) { LogMessage("Select Appraiser"); ddlAppraiser.Focus(); return; } if (txtDateOrdered.Text.Trim() == "") { LogMessage("Enter Date Ordered"); txtDateOrdered.Focus(); return; } else { if (!DataUtils.IsDateTime(txtDateOrdered.Text.Trim())) { LogMessage("Enter valid Date Ordered"); txtDateOrdered.Focus(); return; } } if (btnAddAppraisalInfo.Text == "Add") { AppraisalResult objAppraisalResult = ConservationAppraisalsData.AddConservationAppraisalInfo((DataUtils.GetInt(hfAppraisalID.Value)), DataUtils.GetInt(ddlAppraiser.SelectedValue.ToString()), DataUtils.GetDate(txtDateOrdered.Text), DataUtils.GetDate(txtDateReceived.Text), DataUtils.GetDate(txtEffectiveDate.Text), DataUtils.GetDecimal(txtTotalCost.Text), txtNotes.Text, DataUtils.GetDate(txtDateNRCS.Text), cbReviewApproved.Checked, DataUtils.GetDate(txtReviewApprovedDate.Text)); ClearAppraisalInfoForm(); BindGrids(); if (objAppraisalResult.IsDuplicate && !objAppraisalResult.IsActive) { LogMessage("Appraisal Info already exist as in-active"); } else if (objAppraisalResult.IsDuplicate) { LogMessage("Appraisal Info already exist"); } else { LogMessage("Appraisal Info Added Successfully"); } } else { ConservationAppraisalsData.UpdateConservationAppraisalInfo((DataUtils.GetInt(hfAppraisalInfoID.Value)), DataUtils.GetInt(ddlAppraiser.SelectedValue.ToString()), DataUtils.GetDate(txtDateOrdered.Text), DataUtils.GetDate(txtDateReceived.Text), DataUtils.GetDate(txtEffectiveDate.Text), DataUtils.GetDecimal(txtTotalCost.Text), txtNotes.Text, DataUtils.GetDate(txtDateNRCS.Text), cbReviewApproved.Checked, DataUtils.GetDate(txtReviewApprovedDate.Text), chkAppraisalInfoActive.Checked); gvAppraisalInfo.EditIndex = -1; BindGrids(); //hfLeadBldgID.Value = ""; ClearAppraisalInfoForm(); btnAddAppraisalInfo.Text = "Add"; LogMessage("Appraisal Info Updated Successfully"); } }