예제 #1
0
    private void BindAg_WFP3_Payment()
    {
        FormView fv = fvAg_WFP3_Payment;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = from b in wDataContext.form_wfp3_payments.Where(w => w.pk_form_wfp3_payment == PK_Wfp3Payment) select b;
            fv.DataKeyNames = new string[] { "pk_form_wfp3_payment" };
            fv.DataSource   = a;
            fv.DataBind();

            ListView lv = lvAg_WFP3_PaymentBMPs;

            var c = from b in wDataContext.form_wfp3_paymentBMPs.Where(w => w.fk_form_wfp3_payment == PK_Wfp3Payment) select b;
            lv.DataKeyNames = new string[] { "pk_form_wfp3_paymentBMP" };
            lv.DataSource   = c;
            lv.DataBind();

            string sRegionWAC = WACGlobal_Methods.SpecialQuery_Agriculture_GetWACRegion_ByFarmBusinessPK(FK_FarmBusiness);

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                int?iBidWinningContractor = WACGlobal_Methods.SpecialQuery_Agriculture_BidWinningContractor_ByWFP3Package(FK_Wfp3);

                WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlPayee") as DropDownList, iBidWinningContractor, new string[] { "A", "C" }, null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false, WACGlobal_Methods.Enum_Participant_Forms.ALL, true);
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3_InvoiceByWFP3(fv.FindControl("ddlInvoice") as DropDownList, FK_Wfp3, null);
                WACGlobal_Methods.PopulateControl_DatabaseLists_Encumbrance_DDL(fv, "ddlEncumbrance", string.Empty, true);
                WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv, "ddlIsContractor", string.Empty);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlPayee") as DropDownList, a.Single().fk_participant_payee, new string[] { "A", "C" }, null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false, WACGlobal_Methods.Enum_Participant_Forms.ALL, true);
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3_InvoiceByWFP3(fv.FindControl("ddlInvoice") as DropDownList, a.Single().fk_form_wfp3, a.Single().fk_form_wfp3_invoice);
                WACGlobal_Methods.PopulateControl_DatabaseLists_Encumbrance_DDL(fv, "ddlEncumbrance", a.Single().fk_encumbrance_code, false);
                //WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv, "ddlIsContractor", a.Single().is_contractor);
                //WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv, "ddlFlood2006", a.Single().flood_2006);
            }
        }
    }