private void BindAg_WFP3_Encumbrance()
    {
        FormView fv = fvAg_WFP3_Encumbrance;

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

            string sRegionWAC = WACGlobal_Methods.SpecialQuery_Agriculture_GetWACRegion_ByFarmBusinessPK(FK_FarmBusiness);

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                TextBox tbAmount = fv.FindControl("tbAmount") as TextBox;
                try
                {
                    var x = wDataContext.form_wfp3_get_encumbranceAmt_all(FK_Wfp3);
                    tbAmount.Text = x.Single().amt_encumbrance.ToString();
                }
                catch { }
                WACGlobal_Methods.PopulateControl_DatabaseLists_Encumbrance_DDL(fv, "ddlEncumbrance", null);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_Encumbrance_DDL(fv, "ddlEncumbrance", a.Single().fk_encumbrance_code);
                WACGlobal_Methods.PopulateControl_DatabaseLists_EncumbranceType_DDL(fv.FindControl("ddlType") as DropDownList, a.Single().fk_encumbranceType_code, true);
            }
        }
    }
    protected void lbBMPPlanning_ImplementationYears_Delete_Click(object sender, EventArgs e)
    {
        bool b = WACGlobal_Methods.Security_UserObjectCustom(Session["userID"], WACGlobal_Methods.Enum_Security_UserObjectCustom.A_PLAN);

        if (b)
        {
            LinkButton lb = (LinkButton)sender;

            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.bmp_ag_implementation_delete(Convert.ToInt32(lb.CommandArgument), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        BindData_BMPPlanning_FormView(Convert.ToInt32(fvBMPPlanning.DataKey.Value));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
            }
        }
        else
        {
            WACAlert.Show("You do not have permission to insert into the BMP Planning Implementation Year table.", 0);
        }
    }
示例#3
0
 protected void ddlInsert_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "I", "GlobalData", "GlobalData", "msgInsert"))
     {
         if (!string.IsNullOrEmpty(ddlInsert.SelectedValue))
         {
             int?i     = null;
             int iCode = 0;
             try
             {
                 using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
                 {
                     iCode = wac.participantType_add(Convert.ToInt32(hfPK_Participant.Value), ddlInsert.SelectedValue, Session["userName"].ToString(), ref i);
                     if (iCode == 0)
                     {
                         object[] oArgs = new object[] { Convert.ToInt32(hfPK_Participant.Value) };
                         Page.GetType().InvokeMember("InvokedMethod_ControlGroup_RebindRecord", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                     }
                     else
                     {
                         WACAlert.Show("Error Returned from Database.", iCode);
                     }
                 }
             }
             catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
         }
     }
 }
    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);
            }
        }
    }
示例#5
0
    private void BindAg_WFP3_BMP()
    {
        FormView fv = fvAg_WFP3_BMP;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.vw_form_wfp3_BMPs.Where(w => w.pk_form_wfp3_bmp == PK_Wfp3Bmp).Select(s => s);
            fv.DataKeyNames = new string[] { "pk_form_wfp3_bmp" };
            fv.DataSource   = a;
            fv.DataBind();

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                // JWJ 9/17/2012 changes parameter 3 from { 0,1 } to { 0 } re: BA934
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByFarmBusiness_DDL(fv.FindControl("ddlBMP") as DropDownList, Convert.ToInt32(FK_FarmBusiness), null, new int?[] { 0 }, true);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                // JWJ 9/17/2012 changes parameter 3 from { 0,1 } to { 0 } re: BA934
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByFarmBusiness_DDL(fv.FindControl("ddlBMP") as DropDownList, Convert.ToInt32(FK_FarmBusiness), a.Single().pk_bmp_ag, new int?[] { 0 }, true);
                //var b = wDataContext.bmp_ags.Where(w => w.pk_bmp_ag == a.Single().pk_bmp_ag).Select(s => s);
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_Units_By_BMPPractice(a.Single().fk_bmpPractice_code, fv.FindControl("lblAg_WFP3_BMP_Units") as Label);
            }
        }
    }
    protected void ddl_Search_State_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl    = sender as DropDownList;
        object       target = WACGlobal_Methods.ContainingObject(ddl.Page, "ChangeIndex2Zero4SearchDDLs");

        try
        {
            object[] oArgs = new object[] { ddl.SelectedValue };
            //target.GetType().InvokeMember("ChangeIndex2Zero4SearchDDLs", System.Reflection.BindingFlags.InvokeMethod, null, target, oArgs);
            //Page.GetType().InvokeMember("ChangeIndex2Zero4SearchDDLs", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, null);
            ddl_Search_City.Items.Clear();
            ddl_Search_AddressType.Items.Clear();
            pnl_Search_Base.Visible = false;
            ddl_Search_Address.Items.Clear();
            ddl_Search_AddressNumber.Items.Clear();
            if (!string.IsNullOrEmpty(ddl_Search_State.SelectedValue))
            {
                PopulateDDL4Search_City(ddl_Search_State.SelectedValue);
            }
        }
        catch (Exception Exception)
        {
            //WACAlert.Show(Exception.Message, 0);
        }
    }
    protected void fvSA_Note_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        FormView fv     = fvSA.FindControl("fvSA_Note") as FormView;
        TextBox  tbNote = fv.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.supplementalAgreementNotes.Where(w => w.pk_supplementalAgreementNote == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                a.modified    = DateTime.Now;
                a.modified_by = Session["userName"].ToString();

                wDataContext.SubmitChanges();
                fv.ChangeMode(FormViewMode.ReadOnly);
                Populate_SA_Note_FormView(fv, Convert.ToInt32(fv.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#8
0
 protected void lbVenue_EventVenueType_Delete_Click(object sender, EventArgs e)
 {
     if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
     {
         LinkButton lb    = (LinkButton)sender;
         int        i     = Convert.ToInt32(lb.CommandArgument);
         int        iCode = 0;
         using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
         {
             try
             {
                 iCode = wDataContext.eventVenueType_delete(i);
                 if (iCode == 0)
                 {
                     BindVenue(Convert.ToInt32(fvVenue.DataKey.Value));
                 }
                 else
                 {
                     WACAlert.Show("Error Returned from Database.", iCode);
                 }
             }
             catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
         }
     }
 }
    protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = (DropDownList)sender;

        WACGlobal_Methods.PopulateControl_DatabaseLists_Zipcode_DDL(fvProperty, "ddlZip", null, ddl.SelectedValue);

        if (fvProperty.CurrentMode == FormViewMode.Edit)
        {
            Label        lblCity       = fvProperty.FindControl("lblCity") as Label;
            DropDownList ddlCountyNY   = fvProperty.FindControl("ddlCounty") as DropDownList;
            DropDownList ddlTownshipNY = fvProperty.FindControl("ddlTownshipNY") as DropDownList;
            DropDownList ddlBasin      = fvProperty.FindControl("ddlBasin") as DropDownList;
            DropDownList ddlSubbasin   = fvProperty.FindControl("ddlSubbasin") as DropDownList;
            if (ddl.SelectedValue == "NY")
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_CountyNY_DDL(ddlCountyNY, false, null);
                ddlTownshipNY.Items.Clear();
                ddlBasin.Items.Clear();
                ddlSubbasin.Items.Clear();
            }
            else
            {
                ddlCountyNY.Items.Clear();
                ddlTownshipNY.Items.Clear();
                ddlBasin.Items.Clear();
                ddlSubbasin.Items.Clear();
            }

            if (lblCity != null)
            {
                lblCity.Text = "";
            }
        }
    }
示例#10
0
    private void BindHR_WACEmployee_TrainingCost(int i)
    {
        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            FormView fvHR_WACEmployee_TrainingCost = fvHR_WACEmployee_Training.FindControl("fvHR_WACEmployee_TrainingCost") as FormView;
            var      x = wac.participantWAC_trainingCosts.Where(w => w.pk_participantWAC_trainingCost == i).
                         Select(s => s).OrderByDescending(o => o.created);
            fvHR_WACEmployee_TrainingCost.DataSource   = x;
            fvHR_WACEmployee_TrainingCost.DataKeyNames = new string[] { "pk_participantWAC_trainingCost" };
            fvHR_WACEmployee_TrainingCost.DataBind();

            if (fvHR_WACEmployee_TrainingCost.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_TrainingCost_DDL(fvHR_WACEmployee_TrainingCost.FindControl("ddlTrainingCostCode") as DropDownList, null, true);
            }

            if (fvHR_WACEmployee_TrainingCost.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_TrainingCost_DDL(fvHR_WACEmployee_TrainingCost.FindControl("ddlTrainingCostCode") as DropDownList, x.Single().fk_trainingCost_code, false);
                if (x.Single().date != null)
                {
                    TextBox tbDate = fvHR_WACEmployee_TrainingCost.FindControl("AjaxCalendar_TrCostDate").FindControl("tb") as TextBox;
                    tbDate.Text = Convert.ToDateTime(x.Single().date).ToShortDateString();
                }
            }
        }
    }
示例#11
0
 protected void ddlVenue_EventVenueType_Add_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "I", "GlobalData", "GlobalData", "msgInsert"))
     {
         DropDownList ddl = (DropDownList)sender;
         if (!string.IsNullOrEmpty(ddl.SelectedValue))
         {
             int?i     = null;
             int iCode = 0;
             using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
             {
                 try
                 {
                     iCode = wDataContext.eventVenueType_add(Convert.ToInt32(fvVenue.DataKey.Value), ddl.SelectedValue, ref i);
                     if (iCode == 0)
                     {
                         BindVenue(Convert.ToInt32(fvVenue.DataKey.Value));
                     }
                     else
                     {
                         WACAlert.Show("Error Returned from Database.", iCode);
                     }
                 }
                 catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
             }
         }
     }
 }
示例#12
0
    private void BindData_Ag_BMPPractice(decimal d)
    {
        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            var a = wac.list_bmpPractices.Where(w => w.pk_bmpPractice_code == d).Select(s => s);

            fvList_Ag_BMPPractice.DataKeyNames = new string[] { "pk_bmpPractice_code" };
            fvList_Ag_BMPPractice.DataSource   = a;
            fvList_Ag_BMPPractice.DataBind();

            if (fvList_Ag_BMPPractice.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_Agency_DDL(fvList_Ag_BMPPractice, "ddlAgency", null);
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_Lifespan_DDL(fvList_Ag_BMPPractice.FindControl("ddlLifespan") as DropDownList, null, false);
                WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvList_Ag_BMPPractice, "ddlAgronomic", null);
                WACGlobal_Methods.PopulateControl_DatabaseLists_Unit_DDL(fvList_Ag_BMPPractice, "ddlUnit", null);
                WACGlobal_Methods.PopulateControl_DatabaseLists_WACPracticeCategory_DDL(fvList_Ag_BMPPractice.FindControl("ddlWACPracticeCategory") as DropDownList, null);
            }
            if (fvList_Ag_BMPPractice.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_Agency_DDL(fvList_Ag_BMPPractice, "ddlAgency", a.Single().fk_agency_code);
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_Lifespan_DDL(fvList_Ag_BMPPractice.FindControl("ddlLifespan") as DropDownList, a.Single().life_reqd_yr, false);
                WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvList_Ag_BMPPractice, "ddlAgronomic", a.Single().agronomic);
                WACGlobal_Methods.PopulateControl_DatabaseLists_Unit_DDL(fvList_Ag_BMPPractice, "ddlUnit", a.Single().fk_unit_code);
                WACGlobal_Methods.PopulateControl_DatabaseLists_WACPracticeCategory_DDL(fvList_Ag_BMPPractice.FindControl("ddlWACPracticeCategory") as DropDownList, a.Single().fk_list_wacPracticeCategory);
                WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvList_Ag_BMPPractice, "ddlActive", a.Single().active, false);
            }
        }
    }
示例#13
0
    protected void fvList_Ag_BMPPractice_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        bool b = WACGlobal_Methods.Security_UserObjectCustom(Session["userID"], WACGlobal_Methods.Enum_Security_UserObjectCustom.A_ABC);

        if (b)
        {
            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.list_bmpPractice_delete(Convert.ToDecimal(fvList_Ag_BMPPractice.DataKey.Value), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        lbList_Ag_BMPPracticePopUp_Close_Click(null, null);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
            }
        }
        else
        {
            WACAlert.Show("You do not have permission to delete BMP Practice data.", 0);
        }

        //if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        //{

        //}
    }
示例#14
0
    protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl           = (DropDownList)sender;
        TextBox      tbCity        = pnlGlobal_Insert_Properties.FindControl("tbCity") as TextBox;
        DropDownList ddlCounty     = pnlGlobal_Insert_Properties.FindControl("ddlCounty") as DropDownList;
        DropDownList ddlTownshipNY = pnlGlobal_Insert_Properties.FindControl("ddlTownshipNY") as DropDownList;
        DropDownList ddlBasin      = pnlGlobal_Insert_Properties.FindControl("ddlBasin") as DropDownList;
        DropDownList ddlSubbasin   = pnlGlobal_Insert_Properties.FindControl("ddlSubbasin") as DropDownList;
        DropDownList ddlZip        = (DropDownList)pnlGlobal_Insert_Properties.FindControl("ddlZip");

        WACGlobal_Methods.PopulateControl_DatabaseLists_Zipcode_DDL(ddlZip, null, ddl.SelectedValue, true);
        if (ddl.SelectedValue == "NY")
        {
            WACGlobal_Methods.PopulateControl_DatabaseLists_CountyNY_DDL(ddlCounty, false, null);
            ddlTownshipNY.Items.Clear();
            ddlBasin.Items.Clear();
            ddlSubbasin.Items.Clear();
        }
        else
        {
            ddlCounty.Items.Clear();
            ddlTownshipNY.Items.Clear();
            ddlBasin.Items.Clear();
            ddlSubbasin.Items.Clear();
        }

        if (tbCity != null)
        {
            tbCity.Text = string.Empty;
        }
    }
示例#15
0
    private void BindParticipant_Property(int i)
    {
        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = from b in wDataContext.participantProperties.Where(w => w.pk_participantProperty == i) select b;
            fvParticipant_Property.DataKeyNames = new string[] { "pk_participantProperty" };
            fvParticipant_Property.DataSource   = a;
            fvParticipant_Property.DataBind();

            if (fvParticipant_Property.CurrentMode == FormViewMode.Insert)
            {
                DropDownList ddlZipCode = (DropDownList)fvParticipant_Property.FindControl("ddlZipCode");
                WACGlobal_Methods.ZipCodesFromExistingAddresses(ddlZipCode);
            }

            if (fvParticipant_Property.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_Property_EditInsert_UserControl(fvParticipant_Property.FindControl("UC_Property_EditInsert_Participant_Property") as UserControl, a.Single().property);

                //WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvParticipant_Property, "ddlMaster", a.Single().master, false);
                //DropDownList ddl = fvParticipant_Property.FindControl("UC_DropDownListByAlphabet_Participant_Property").FindControl("ddl") as DropDownList;
                //Label lblLetter = fvParticipant_Property.FindControl("UC_DropDownListByAlphabet_Participant_Property").FindControl("lblLetter") as Label;
                //string sLetter = null;
                //try { sLetter = a.Single().participant1.lname.Substring(0, 1); }
                //catch { }
                //WACGlobal_Methods.EventControl_Custom_DropDownListByAlphabet(ddl, lblLetter, sLetter, "PARTICIPANT", "ALL", a.Single().fk_participant_cc);
            }
        }
    }
示例#16
0
    protected void ddlCounty_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddlCounty     = (DropDownList)sender;
        DropDownList ddlTownshipNY = (DropDownList)fvProperty.FindControl("ddlTownshipNY");
        DropDownList ddlBasin      = (DropDownList)fvProperty.FindControl("ddlbasin");
        DropDownList ddlSubbasin   = (DropDownList)fvProperty.FindControl("ddlSubbasin");

        if (!string.IsNullOrEmpty(ddlCounty.SelectedValue))
        {
            WACGlobal_Methods.PopulateControl_DatabaseLists_TownshipNY_DDL(ddlTownshipNY, Convert.ToInt32(ddlCounty.SelectedValue), null);
            if (_CountyControlsBasin)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_Basin_DDL(ddlBasin, null, null, null, Convert.ToInt32(ddlCounty.SelectedValue), null, true);
                if (_BoolShowSubbasin)
                {
                    ddlSubbasin.Items.Clear();
                }
            }
        }
        else
        {
            if (_BoolShowTownship)
            {
                ddlTownshipNY.Items.Clear();
            }
            if (_CountyControlsBasin)
            {
                ddlBasin.Items.Clear();
                if (_BoolShowSubbasin)
                {
                    ddlSubbasin.Items.Clear();
                }
            }
        }
    }
示例#17
0
    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);
            }
        }
    }
    public void BindOrganization(int i)
    {
        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.organizations.Where(w => w.pk_organization == i).Select(s => s);
            fvOrganization.DataKeyNames = new string[] { "pk_organization" };
            fvOrganization.DataSource   = a;
            fvOrganization.DataBind();

            if (fvOrganization.CurrentMode != FormViewMode.Insert)
            {
                hfOrganizationPK.Value = a.Single().pk_organization.ToString();
            }

            if (fvOrganization.CurrentMode == FormViewMode.Edit)
            {
                DropDownList ddl     = fvOrganization.FindControl("UC_DropDownListByAlphabet_Organization").FindControl("ddl") as DropDownList;
                Label        lbl     = fvOrganization.FindControl("UC_DropDownListByAlphabet_Organization").FindControl("lblLetter") as Label;
                string       sLetter = null;
                try { sLetter = a.Single().participant.lname[0].ToString(); }
                catch { }
                WACGlobal_Methods.EventControl_Custom_DropDownListByAlphabet(ddl, lbl, sLetter, "PARTICIPANT", "ALL", a.Single().fk_participant_contact);

                WACGlobal_Methods.PopulateControl_Property_EditInsert_UserControl(fvOrganization.FindControl("UC_Property_EditInsert_Organization") as UserControl, a.Single().property);
            }
        }
    }
示例#19
0
 private void _connect(Control _control, ConnectorFactory _factory, WACViewModel _containerViewModel)
 {
     if (ViewModel == null)
     {
         ViewModel = GetViewModel(_control, _factory);
     }
     if (String.IsNullOrEmpty(ViewModel.UserName))
     {
         ViewModel.UserName = _control.Page.Session["userName"] as string;
         ViewModel.UserID   = WACGlobal_Methods.KeyAsInt(_control.Page.Session["userID"]);
     }
     if (_containerViewModel == null)
     {
         ViewModel.DataProvider = GetDataProvider(_control, _factory);
     }
     else
     {
         ViewModel.DataProvider = _containerViewModel.DataProvider;
         ViewModel.ListSource   = _containerViewModel.ListSource;
     }
     if (SessionID == null)
     {
         SessionID = _control.Page.Session.SessionID;
     }
     else if (!_control.Page.Session.SessionID.Equals(SessionID, StringComparison.OrdinalIgnoreCase))
     {
         throw new Exception("Connector / Control SessionID mismatch");
     }
     ConnectControlSpecific(_control, _factory);
 }
示例#20
0
 public override IList GetFilteredList(List <WACParameter> parms)
 {
     try
     {
         using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
         {
             int pk_participant = WACGlobal_Methods.KeyAsInt(WACParameter.GetPrimaryKey(parms).ParmValue);
             var e = wac.participants.Where(w => w.pk_participant == pk_participant).Select(s =>
                                                                                            new Participant(s.pk_participant, s.lname, s.fname, s.email, s.fk_gender_code, s.list_gender.gender, s.fk_ethnicity_code,
                                                                                                            s.list_ethnicity.ethnicity, s.fk_race_code, s.list_race.race, s.fk_diversityData_code, s.list_diversityData.dataSetVia,
                                                                                                            s.fk_mailingStatus_code, s.list_mailingStatus.status, s.fk_property, s.fk_organization, s.organization.org, s.active,
                                                                                                            s.form_W9_signed_date, s.fk_regionWAC_code, s.list_regionWAC.regionWAC, s.fk_prefix_code, s.list_prefix.prefix, s.mname,
                                                                                                            s.nickname, s.fk_suffix_code, s.list_suffix.suffix, s.fullname_LF_dnd, s.fullname_FL_dnd, s.web, s.fk_dataReview_code,
                                                                                                            s.dataReview_note, s.fk_participant_split));
             if (e.Any())
             {
                 return(e.ToList <Participant>());
             }
             else
             {
                 return(new List <Participant>());
             }
         }
     }
     catch (Exception ex)
     {
         throw new WACEX_GeneralDatabaseException("Error loading Participant. " + ex.Message, -1);
     }
 }
    protected void fvSA_Note_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        FormView fv = fvSA.FindControl("fvSA_Note") as FormView;

        if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "A", "supplementalAgreementNote", "msgDelete"))
        {
            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.supplementalAgreementNote_delete(Convert.ToInt32(fv.DataKey.Value), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        lbSA_Note_Close_Click(null, null);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
            }
        }
    }
 public override IList GetFilteredList(List <WACParameter> parms)
 {
     try
     {
         using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
         {
             int pk_participantCommunication = WACGlobal_Methods.KeyAsInt(WACParameter.GetSelectedKey(parms).ParmValue);
             var e = wac.participantCommunications.Where(w => w.pk_participantCommunication == pk_participantCommunication).Select(s =>
                                                                                                                                   new ParticipantCommunication(s.pk_participantCommunication, s.fk_participant, s.fk_communication, s.fk_communicationType_code,
                                                                                                                                                                s.fk_communicationUsage_code, s.fk_organization, s.extension, s.note, s.source, s.created, s.created_by, s.modified, s.modified_by));
             if (e.Any())
             {
                 return(e.ToList <ParticipantCommunication>());
             }
             else
             {
                 return(new List <ParticipantCommunication>());
             }
         }
     }
     catch (Exception ex)
     {
         throw new WACEX_GeneralDatabaseException("Error loading ParticipantCommunication. " + ex.Message, -1);
     }
 }
示例#23
0
    private void BindAg_WFP3_Bid()
    {
        FormView fv = fvAg_WFP3_Bid;

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

            string sRegionWAC = WACGlobal_Methods.SpecialQuery_Agriculture_GetWACRegion_ByFarmBusinessPK(FK_FarmBusiness);

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlContractor") as DropDownList, null, new string[] { "C" },
                                                                         null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false,
                                                                         WACGlobal_Methods.Enum_Participant_Forms.ALL, true);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlContractor") as DropDownList, a.Single().fk_participant_contractor,
                                                                         new string[] { "C" }, null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false,
                                                                         WACGlobal_Methods.Enum_Participant_Forms.ALL, true);
            }
        }
    }
        public override IList GetItem(List <WACParameter> parms, IList list)
        {
            List <ParticipantCommunication> ilist = list as List <ParticipantCommunication>;
            int key = WACGlobal_Methods.KeyAsInt(WACParameter.GetSelectedKey(parms).ParmValue);

            return(ilist.Where(w => w.pk_participantCommunication == key).ToList());
        }
    //private void HandleSupplementalAgreementsBasedOnFarm(int iPK_FarmBusiness, int? iPK_SupplementalAgreementTaxParcel)
    private void HandleSupplementalAgreementsBasedOnFarm(int?iPK_SupplementalAgreementTaxParcel)
    {
        Panel        pnlSA_Available = fvBMPPlanning.FindControl("pnlSA_Available") as Panel;
        Panel        pnlSA_Message   = fvBMPPlanning.FindControl("pnlSA_Message") as Panel;
        Label        lblSA_Message   = fvBMPPlanning.FindControl("lblSA_Message") as Label;
        DropDownList ddlSAA          = fvBMPPlanning.FindControl("ddlSAA") as DropDownList;
        DropDownList ddlSA           = fvBMPPlanning.FindControl("ddlSA") as DropDownList;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            //var a = wac.bmp_ag_SAs.Where(w => w.bmp_ag.fk_farmBusiness == iPK_FarmBusiness).Select(s => s.pk_bmp_ag_SA);
            //if (a.Count() > 0)
            //{
            //if (fvBMPPlanning.CurrentMode == FormViewMode.Insert) WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_FarmBusiness, null, true);
            //else WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_FarmBusiness, iPK_SupplementalAgreementTaxParcel, true);
            if (fvBMPPlanning.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, null, true);
            }
            else
            {
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_SupplementalAgreementTaxParcel, true);
            }
            pnlSA_Message.Visible   = false;
            pnlSA_Available.Visible = true;
            //}
            //else
            //{
            //    lblSA_Message.Text = "No Supplemental Agreements have been assigned to this farm";
            //    pnlSA_Available.Visible = false;
            //    pnlSA_Message.Visible = true;
            //}
        }
    }
示例#26
0
    protected void fvOrganization_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            TextBox tbOrg = fvOrganization.FindControl("tbOrg") as TextBox;
            try
            {
                string sOrg = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbOrg.Text, 96).Trim();

                iCode = wDataContext.organization_add(sOrg, Session["userName"].ToString(), ref i);
                if (iCode == 0)
                {
                    fvOrganization.ChangeMode(FormViewMode.ReadOnly);
                    BindOrganization(Convert.ToInt32(i));
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
示例#27
0
        public override IList GetItem(List <WACParameter> parms, IList list)
        {
            List <FarmBusiness> ilist = list as List <FarmBusiness>;
            int key = WACGlobal_Methods.KeyAsInt(WACParameter.GetSelectedKey(parms).ParmValue);

            return(ilist.Where(w => w.pk_farmBusiness == key).ToList());
        }
示例#28
0
    protected void fvOrganization_Note_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        //if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        //{
        int iCode = 0;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                if (WACGlobal_Methods.Security_UserCanModifyDeleteNote(Session["userName"], "organizationNote", Convert.ToInt32(fvOrganization_Note.DataKey.Value)))
                {
                    iCode = wDataContext.organizationNote_delete(Convert.ToInt32(fvOrganization_Note.DataKey.Value), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        lbOrganization_Note_Close_Click(null, null);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
        //}
    }
示例#29
0
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        LinkButton lb = (LinkButton)sender;

        if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        {
            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.participantType_delete(Convert.ToInt32(lb.CommandArgument), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        object[] oArgs = new object[] { Convert.ToInt32(hfPK_Participant.Value) };
                        Page.GetType().InvokeMember("InvokedMethod_ControlGroup_RebindRecord", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
            }
        }
    }
示例#30
0
        public override IList GetItem(List <WACParameter> parms, IList list)
        {
            List <SupplementalAgreement> ilist = list as List <SupplementalAgreement>;
            int key = WACGlobal_Methods.KeyAsInt(WACParameter.GetSelectedKey(parms).ParmValue);

            return(ilist.Where(w => w.pk_supplementalAgreement == key).ToList());
        }