private void BindAg_WFP3_PaymentBMP() { FormView fv = fvAg_WFP3_PaymentBMP; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = from b in wDataContext.form_wfp3_paymentBMPs.Where(w => w.pk_form_wfp3_paymentBMP == PK_Wfp3PaymentBMP) select b; fv.DataKeyNames = new string[] { "pk_form_wfp3_paymentBMP" }; fv.DataSource = a; fv.DataBind(); if (fv.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", Convert.ToInt32(FK_Wfp3), null); WACGlobal_Methods.PopulateControl_DatabaseLists_PaymentStatus_DDL(fv.FindControl("ddlPaymentStatus") as DropDownList, null, true); WACGlobal_Methods.PopulateControl_DatabaseLists_AgencyFunding_DDL(fv.FindControl("ddlFundingAgency") as DropDownList, null, "Y", null, true); WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3PaymentBMP_ByWFP3Specification_DDL(fv.FindControl("ddlBMPPractice") as DropDownList, Convert.ToInt32(FK_Wfp3), null, true, true); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv, "ddlReimbursementYN", "N", true); } if (fv.CurrentMode == FormViewMode.Edit) { decimal?bmp = a.Any() ? a.Single().fk_bmpPractice_code : null; WACGlobal_Methods.PopulateControl_DatabaseLists_PaymentStatus_DDL(fv.FindControl("ddlPaymentStatus") as DropDownList, a.Single().fk_paymentStatus_code, true); WACGlobal_Methods.PopulateControl_DatabaseLists_AgencyFunding_DDL(fv.FindControl("ddlFundingAgency") as DropDownList, null, "Y", a.Single().fk_agencyFunding_code, true); //WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3PaymentBMP_ByWFP3Specification_DDL(fv.FindControl("ddlBMPPractice") as DropDownList, Convert.ToInt32(FK_Wfp3), null, true, true); //WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3PaymentBMP_ByWFP3Specification_DDL(fv.FindControl("ddlBMPPractice") as DropDownList, Convert.ToInt32(FK_Wfp3), a.Single().fk_bmpPractice_code, true, true); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL((DropDownList)fv.FindControl("ddlBMPPractice"), bmp, true, true, false); DropDownList ddlReimbursementYN = fv.FindControl("ddlReimbursementYN") as DropDownList; WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlReimbursementYN") as DropDownList, a.Single().reimbursement, true); } } }
private void BindAg_WFP3_Specification() { FormView fv = fvAg_WFP3_Specification; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.form_wfp3_specifications.Where(w => w.pk_form_wfp3_specification == PK_Wfp3Spec).Select(s => s); fv.DataKeyNames = new string[] { "pk_form_wfp3_specification" }; fv.DataSource = a; fv.DataBind(); if (fv.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", FK_Wfp3, null); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fv.FindControl("ddlPractice") as DropDownList, null, true, true, false); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlBidRequired") as DropDownList, null, true); } if (fv.CurrentMode == FormViewMode.Edit) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", FK_Wfp3, a.Single().fk_form_wfp3_bmp); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fv.FindControl("ddlPractice") as DropDownList, a.Single().fk_bmpPractice_code, true, true, false); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlBidRequired") as DropDownList, a.Single().bid_reqd, true); } } }
private void BindData_BMPPlanning_FormView(decimal iPK_BMP_AG) { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { var a = wac.bmp_ags.Where(w => w.pk_bmp_ag == iPK_BMP_AG).Select(s => new { s.pk_bmp_ag, s.fk_farmBusiness, s.bmp_nbr, s.fk_BMPSource_code, s.list_BMPSource, s.location, s.description, s.list_statusBMP, s.fk_pollutant_category_code, s.list_pollutant_category, s.fk_bmpPractice_code, s.list_bmpPractice, s.fk_revisionDescription_code, s.list_revisionDescription, s.units_planned, s.fk_unit_code, s.est_plan_prior, s.est_plan_rev, s.CREP, s.fk_SAAssignType_code, s.list_SAAssignType, s.fk_supplementalAgreementTaxParcel, s.supplementalAgreementTaxParcel, s.issueStatement_wfp2, FARMID = s.farmBusiness.farmID, FARMNAME = s.farmBusiness.farm_name, FARMOWNER = s.farmBusiness.ownerStr_dnd, s.created, s.created_by, s.modified, s.modified_by }); fvBMPPlanning.DataKeyNames = new string[] { "pk_bmp_ag" }; fvBMPPlanning.DataSource = a; fvBMPPlanning.DataBind(); if (fvBMPPlanning.CurrentMode == FormViewMode.ReadOnly && a.Count() == 1) { WACGlobal_Methods.PopulateControl_DatabaseLists_Year_DDL(fvBMPPlanning.FindControl("ddlBMPPlanning_ImplementationYears_Insert") as DropDownList, null); } if (fvBMPPlanning.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_Farm_DDL(fvBMPPlanning.FindControl("ddlFarm") as DropDownList, null, false, true, true); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPSource_DDL(fvBMPPlanning, "ddlBMPSource", "N", false); WACGlobal_Methods.PopulateControl_DatabaseLists_RevisionDescription_DDL(fvBMPPlanning, "ddlRevisionDescription", null, null); WACGlobal_Methods.PopulateControl_DatabaseLists_PollutantCategory_DDL(fvBMPPlanning.FindControl("ddlPollutantCategory") as DropDownList, null, false, true); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fvBMPPlanning.FindControl("ddlBMPPractice") as DropDownList, null, true, true, false); WACGlobal_Methods.PopulateControl_DatabaseLists_Year_DDL(fvBMPPlanning.FindControl("ddlImplementationYear") as DropDownList, DateTime.Now.Year); WACGlobal_Methods.PopulateControl_DatabaseLists_SupplementalAgreementAssignment_DDL(fvBMPPlanning.FindControl("ddlSAA") as DropDownList, null, true); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvBMPPlanning.FindControl("ddlCREP") as DropDownList, "N", true); WACGlobal_Methods.PopulateControl_DatabaseLists_NMCPType_DDL(fvBMPPlanning, "ddlNMCPType", null, true); HandleSupplementalAgreementsBasedOnFarm(null); } if (fvBMPPlanning.CurrentMode == FormViewMode.Edit) { WACGlobal_Methods.PopulateControl_DatabaseLists_BMPSource_DDL(fvBMPPlanning, "ddlBMPSource", a.Single().fk_BMPSource_code, false); WACGlobal_Methods.PopulateControl_DatabaseLists_RevisionDescription_DDL(fvBMPPlanning, "ddlRevisionDescription", a.Single().fk_revisionDescription_code, a.Single().list_revisionDescription.active); WACGlobal_Methods.PopulateControl_DatabaseLists_PollutantCategory_DDL(fvBMPPlanning.FindControl("ddlPollutantCategory") as DropDownList, a.Single().fk_pollutant_category_code, false, false); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fvBMPPlanning.FindControl("ddlBMPPractice") as DropDownList, a.Single().fk_bmpPractice_code, true, false, false); WACGlobal_Methods.PopulateControl_DatabaseLists_SupplementalAgreementAssignment_DDL(fvBMPPlanning.FindControl("ddlSAA") as DropDownList, a.Single().fk_SAAssignType_code, true); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvBMPPlanning.FindControl("ddlCREP") as DropDownList, a.Single().CREP, true); //WACGlobal_Methods.PopulateControl_DatabaseLists_NMCPType_DDL(fvBMPPlanning, "ddlNMCPType", a.Single().fk_NMCPType_code, true); HandleSupplementalAgreementsBasedOnFarm(a.Single().fk_supplementalAgreementTaxParcel); DropDownList ddlPractice = fvBMPPlanning.FindControl("ddlBMPPractice") as DropDownList; Label lblUnits = fvBMPPlanning.FindControl("lblUnits") as Label; if (!string.IsNullOrEmpty(ddlPractice.SelectedValue)) { lblUnits.Text = WACGlobal_Methods.SpecialQuery_Agriculture_Unit_By_BMPPractice(ddlPractice.SelectedValue); } } } }
protected void ddlAg_WFP3_PaymentBMP_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlBMP = (DropDownList)sender; FormView fv = fvAg_WFP3_PaymentBMP; DropDownList ddlPaymentStatus = fv.FindControl("ddlPaymentStatus") as DropDownList; DropDownList ddlBMPPractice = fv.FindControl("ddlBMPPractice") as DropDownList; if (!string.IsNullOrEmpty(ddlBMP.SelectedValue)) { int?iPK_BMP = WACGlobal_Methods.SpecialQuery_Agriculture_PK_BMP_By_PK_WFP3BMP(ddlBMP.SelectedValue); if (iPK_BMP != null) { string sStatus = WACGlobal_Methods.SpecialQuery_Agriculture_BMPStatus_By_BMP(iPK_BMP); if (!string.IsNullOrEmpty(sStatus)) { WACGlobal_Methods.PopulateControl_DatabaseLists_PaymentStatus_DDL(ddlPaymentStatus, null, true); } //WACGlobal_Methods.PopulateControl_DatabaseLists_StatusBMP_DDL(fv, "ddlPaymentStatus", sStatus, true, false, true); else { ddlPaymentStatus.Items.Clear(); } decimal?d = WACGlobal_Methods.SpecialQuery_Agriculture_BMPPracticeCode_By_BMP(iPK_BMP); if (d != null) { WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(ddlBMPPractice, d, true, true, false); } else { ddlBMPPractice.Items.Clear(); } } } }