private void BindAct250InfoGrid() { dvNewDeveloperPayments.Visible = false; dvNewlandUsePermitFinancials.Visible = false; dvNewVHCBProjects.Visible = false; try { DataTable dt = ConservationAct250Data.GetAct250FarmsList(cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvAct250InfoGrid.Visible = true; gvAct250Info.DataSource = dt; gvAct250Info.DataBind(); } else { dvAct250InfoGrid.Visible = false; gvAct250Info.DataSource = null; gvAct250Info.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindAct250InfoGrid", "", ex.Message); } }
private void BindVHCBProjectsGrid() { try { DataTable dt = ConservationAct250Data.GetAct250ProjectsList(DataUtils.GetInt(hfAct250FarmID.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvVHCBProjectsgrid.Visible = true; gvVHCBProjects.DataSource = dt; gvVHCBProjects.DataBind(); Label lblFooterAnticipatedFunds = (Label)gvVHCBProjects.FooterRow.FindControl("lblFooterAnticipatedFunds"); decimal totAnticipatedFunds = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (DataUtils.GetBool(dt.Rows[i]["RowIsActive"].ToString())) { totAnticipatedFunds += DataUtils.GetDecimal(dt.Rows[i]["AmtFunds"].ToString()); } } lblFooterAnticipatedFunds.Text = CommonHelper.myDollarFormat(totAnticipatedFunds); hfProjectsWarning.Value = "0"; if (totAnticipatedFunds > DataUtils.GetDecimal(hfLandUsePermitFinancialsBalance.Value)) { hfProjectsWarning.Value = "1"; WarningMessage(dvVHCBProjectsWarning, lblVHCBProjectsWarning, "Total of Anticpated funds cannot be greater than " + CommonHelper.myDollarFormat(hfLandUsePermitFinancialsBalance.Value)); } else { dvVHCBProjectsWarning.Visible = false; lblVHCBProjectsWarning.Text = ""; } } else { dvVHCBProjectsgrid.Visible = false; gvVHCBProjects.DataSource = null; gvVHCBProjects.DataBind(); } } catch (Exception ex) { LogError(Pagename, "BindVHCBProjectsGrid", "", ex.Message); } }
protected void btnAddAct250Info_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtLandUsePermit.Text.ToString()) == true) { LogMessage("Enter Land Use Permit"); txtLandUsePermit.Focus(); return; } if (btnAddAct250Info.Text == "Submit") { ConservationAct250Result objConservationAct250Result = ConservationAct250Data.AddAct250Farm(txtLandUsePermit.Text, DataUtils.GetInt(ddlTown.SelectedValue.ToString()), DataUtils.GetInt(txtDistrictNo.Text), DataUtils.GetInt(ddlFarmType.SelectedValue.ToString()), txtDevname.Text, DataUtils.GetInt(txtPrimeSoilsAcresLost.Text), DataUtils.GetInt(txtStateSoilsAcresLost.Text), DataUtils.GetInt(txtTotAcresLost.Text), DataUtils.GetInt(txtAcresDeveloped.Text), DataUtils.GetInt(ddlDeveloper.SelectedValue.ToString()), DataUtils.GetDecimal(txtAnticipatedFunds.Text), DataUtils.GetDate(txtMitigationDate.Text)); BindGrids(); ClearAct250InfoForm(); if (objConservationAct250Result.IsDuplicate && !objConservationAct250Result.IsActive) { LogMessage("Act250 Info already exist as in-active"); } else if (objConservationAct250Result.IsDuplicate) { LogMessage("Act250 Info already exist"); } else { LogMessage("Act250 Info added successfully"); } } else { ConservationAct250Data.UpdateAct250Farm(DataUtils.GetInt(hfAct250FarmID.Value), DataUtils.GetInt(ddlTown.SelectedValue.ToString()), DataUtils.GetInt(txtDistrictNo.Text), DataUtils.GetInt(ddlFarmType.SelectedValue.ToString()), txtDevname.Text, DataUtils.GetInt(txtPrimeSoilsAcresLost.Text), DataUtils.GetInt(txtStateSoilsAcresLost.Text), DataUtils.GetInt(txtTotAcresLost.Text), DataUtils.GetInt(txtAcresDeveloped.Text), DataUtils.GetInt(ddlDeveloper.SelectedValue.ToString()), DataUtils.GetDecimal(txtAnticipatedFunds.Text), DataUtils.GetDate(txtMitigationDate.Text), chkAct250Active.Checked); gvAct250Info.EditIndex = -1; ClearAct250InfoForm(); BindGrids(); btnAddAct250Info.Text = "Submit"; LogMessage("Act250 Info Updated Successfully"); } }
protected void gvVHCBProjects_RowUpdating(object sender, GridViewUpdateEventArgs e) { int rowIndex = e.RowIndex; int Act250ProjectID = DataUtils.GetInt(((Label)gvVHCBProjects.Rows[rowIndex].FindControl("lblAct250ProjectID")).Text); decimal AnticipatedFunds = DataUtils.GetDecimal(((TextBox)gvVHCBProjects.Rows[rowIndex].FindControl("txtAnticipatedFunds")).Text); //DateTime ProjectDateClosed = DataUtils.GetDate(((TextBox)gvVHCBProjects.Rows[rowIndex].FindControl("txtProjectDateClosed")).Text); bool RowIsActive = Convert.ToBoolean(((CheckBox)gvVHCBProjects.Rows[rowIndex].FindControl("chkActive")).Checked);; ConservationAct250Data.UpdateAct250Projects(Act250ProjectID, AnticipatedFunds, RowIsActive); gvVHCBProjects.EditIndex = -1; BindVHCBProjectsGrid(); LogMessage("Potential VHCB Project updated successfully"); }
protected void gvDeveloperPayments_RowUpdating(object sender, GridViewUpdateEventArgs e) { int rowIndex = e.RowIndex; int Act250PayID = DataUtils.GetInt(((Label)gvDeveloperPayments.Rows[rowIndex].FindControl("lblAct250PayID")).Text); decimal PaymentAmount = DataUtils.GetDecimal(((TextBox)gvDeveloperPayments.Rows[rowIndex].FindControl("txtpaymentAmount")).Text); DateTime PayReceivedDate = DataUtils.GetDate(((TextBox)gvDeveloperPayments.Rows[rowIndex].FindControl("txtDevPayReceived")).Text); bool RowIsActive = Convert.ToBoolean(((CheckBox)gvDeveloperPayments.Rows[rowIndex].FindControl("chkActive")).Checked);; ConservationAct250Data.UpdateAct250DevPay(Act250PayID, PaymentAmount, PayReceivedDate, RowIsActive); gvDeveloperPayments.EditIndex = -1; BindDeveloperPaymentsGrid(); LogMessage("Developer Payment updated successfully"); }
protected void gvAct250Info_RowDataBound(object sender, GridViewRowEventArgs e) { try { if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); btnAddAct250Info.Text = "Update"; cbAddAct250Info.Checked = true; //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[6].Controls[0].Visible = false; Label lblAct250FarmID = e.Row.FindControl("lblAct250FarmID") as Label; DataRow dr = ConservationAct250Data.GetAct250FarmById(DataUtils.GetInt(lblAct250FarmID.Text)); hfAct250FarmID.Value = lblAct250FarmID.Text; txtLandUsePermit.Text = dr["UsePermit"].ToString(); PopulateDropDown(ddlTown, dr["LkTownDev"].ToString()); PopulateDropDown(ddlFarmType, dr["Type"].ToString()); PopulateDropDown(ddlDeveloper, dr["Developer"].ToString()); txtDevname.Text = dr["DevName"].ToString(); txtDistrictNo.Text = dr["CDist"].ToString(); txtPrimeSoilsAcresLost.Text = dr["Primelost"].ToString(); txtStateSoilsAcresLost.Text = dr["Statelost"].ToString(); txtTotAcresLost.Text = dr["TotalAcreslost"].ToString(); txtAcresDeveloped.Text = dr["AcresDevelop"].ToString(); txtAnticipatedFunds.Text = dr["AntFunds"].ToString(); txtMitigationDate.Text = dr["MitDate"].ToString(); chkAct250Active.Checked = DataUtils.GetBool(dr["RowIsActive"].ToString()); txtLandUsePermit.Enabled = false; chkAct250Active.Enabled = true; } } } catch (Exception ex) { LogError(Pagename, "gvBldgInfo_RowDataBound", "", ex.Message); } }
private void BindDeveloperPaymentsGrid() { try { hfTotalDevPayments.Value = "0"; DataTable dt = ConservationAct250Data.GetAct250DevPayList(DataUtils.GetInt(hfAct250FarmID.Value), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvDeveloperPaymentsGrid.Visible = true; gvDeveloperPayments.DataSource = dt; gvDeveloperPayments.DataBind(); Label lblFooterTotalAmt = (Label)gvDeveloperPayments.FooterRow.FindControl("lblFooterTotalAmtRec"); decimal totAmt = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (DataUtils.GetBool(dt.Rows[i]["RowIsActive"].ToString())) { totAmt += Convert.ToDecimal(dt.Rows[i]["AmtRec"].ToString()); } } hfTotalDevPayments.Value = totAmt.ToString(); lblFooterTotalAmt.Text = CommonHelper.myDollarFormat(totAmt); } else { dvDeveloperPaymentsGrid.Visible = false; gvDeveloperPayments.DataSource = null; gvDeveloperPayments.DataBind(); } BindLandUsePermitFinancialsGrid(); BindVHCBProjectsGrid(); } catch (Exception ex) { LogError(Pagename, "BindDeveloperPaymentsGrid", "", ex.Message); } }
private void LoadConservationTown(string ProjectId) { try { DataTable dt = ConservationAct250Data.GetConservationTownList(DataUtils.GetInt(ProjectId)); ddlConservationTown.Items.Clear(); ddlConservationTown.DataSource = dt; ddlConservationTown.DataValueField = "TypeID"; ddlConservationTown.DataTextField = "town"; ddlConservationTown.DataBind(); if (dt.Rows.Count > 1) { ddlConservationTown.Items.Insert(0, new ListItem("Select", "NA")); } } catch (Exception ex) { LogError(Pagename, "LoadConservationTown", "", ex.Message); } }
protected void btnAddDevPayments_Click(object sender, EventArgs e) { ConservationAct250Result objConservationAct250Result = ConservationAct250Data.AddAct250DevPay(DataUtils.GetInt(hfAct250FarmID.Value), DataUtils.GetDecimal(txtDevPaymentAmount.Text), DataUtils.GetDate(txtDevPaymentReceived.Text)); ClearDeveloperPaymentsForm(); BindDeveloperPaymentsGrid(); if (objConservationAct250Result.IsDuplicate && !objConservationAct250Result.IsActive) { LogMessage("Developer Payment already exist as in-active"); } else if (objConservationAct250Result.IsDuplicate) { LogMessage("Developer Payment already exist"); } else { LogMessage("Developer Payment Added Successfully"); } }
private void BindLandUsePermitFinancialsGrid() { DataTable dtLandUsePermitFinacials = ConservationAct250Data.GetLandUsePermitFinancialsList(hfUsePermit.Value); hfLandUsePermitFinancialsBalance.Value = "0"; if (dtLandUsePermitFinacials.Rows.Count > 0) { dvNewlandUsePermitFinancials.Visible = true; headingForLandUsePermitFinancials.InnerHtml = "Commitments from Mitigation Fund - Permit #: " + hfUsePermit.Value; dvLandUsePermitFinancialsGrid.Visible = true; gvLandUsePermitFinancials.DataSource = dtLandUsePermitFinacials; gvLandUsePermitFinancials.DataBind(); Label lblFooterTotalAmount = (Label)gvLandUsePermitFinancials.FooterRow.FindControl("lblFooterTotalAmount"); Label lblFooterBalanceAmount = (Label)gvLandUsePermitFinancials.FooterRow.FindControl("lblFooterBalanceAmount"); decimal totAmount = 0; for (int i = 0; i < dtLandUsePermitFinacials.Rows.Count; i++) { totAmount += Convert.ToDecimal(dtLandUsePermitFinacials.Rows[i]["Amount"].ToString()); } lblFooterTotalAmount.Text = CommonHelper.myDollarFormat(totAmount); lblFooterBalanceAmount.Text = CommonHelper.myDollarFormat(DataUtils.GetDecimal(hfTotalDevPayments.Value) - totAmount); hfLandUsePermitFinancialsBalance.Value = (DataUtils.GetDecimal(hfTotalDevPayments.Value) - totAmount).ToString(); } else { dvNewlandUsePermitFinancials.Visible = false; dvLandUsePermitFinancialsGrid.Visible = false; gvLandUsePermitFinancials.DataSource = null; gvLandUsePermitFinancials.DataBind(); } }
protected void btnAddVHCBProject_Click(object sender, EventArgs e) { ConservationAct250Result objConservationAct250Result = ConservationAct250Data.AddAct250Projects(DataUtils.GetInt(hfAct250FarmID.Value), DataUtils.GetInt(ddlProjects.SelectedValue.ToString()), DataUtils.GetInt(ddlConservationTown.SelectedValue.ToString()), DataUtils.GetDecimal(txtAntFunds.Text), DataUtils.GetDate(txtDateClosed.Text)); ClearVHCBProjectsForm(); BindVHCBProjectsGrid(); if (objConservationAct250Result.IsDuplicate && !objConservationAct250Result.IsActive) { LogMessage("Potential VHCB Project already exist as in-active"); } else if (objConservationAct250Result.IsDuplicate) { LogMessage("Potential VHCB Project already exist"); } else { LogMessage("Potential VHCB Project Added Successfully"); } cbAddVHCBProjects.Checked = false; }