Ejemplo n.º 1
0
    private void BindProperty(int i)
    {
        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = from b in wDataContext.properties.Where(w => w.pk_property == i) select b;
            fvProperty.DataKeyNames = new string[] { "pk_property" };
            fvProperty.DataSource   = a;
            fvProperty.DataBind();
            if (fvProperty.CurrentMode == FormViewMode.ReadOnly)
            {
                if (i > 0)
                {
                    WACUT_Associations  assoc = fvProperty.FindControl("WACUT_Associations") as WACUT_Associations;
                    List <WACParameter> parms = new List <WACParameter>();
                    parms.Add(new WACParameter("pk_property", i, WACParameter.ParameterType.SelectedKey));
                    parms.Add(new WACParameter("pk_property", i, WACParameter.ParameterType.PrimaryKey));
                    assoc.InitControl(parms);
                    parms = null;
                }
            }

            if (fvProperty.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_StatesUS_DDL(fvProperty, "ddlState", "NY");
                WACGlobal_Methods.PopulateControl_DatabaseLists_Zipcode_DDL(fvProperty, "ddlZip", null, "NY");
            }

            if (fvProperty.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_StatesUS_DDL(fvProperty, "ddlState", a.Single().state);
                WACGlobal_Methods.PopulateControl_DatabaseLists_Zipcode_DDL(fvProperty, "ddlZip", a.Single().fk_zipcode, a.Single().state);
                WACGlobal_Methods.PopulateControl_DatabaseLists_CountyNY_DDL(fvProperty.FindControl("ddlCounty") as DropDownList, false, a.Single().fk_list_countyNY);
                if (a.Single().fk_list_countyNY != null)
                {
                    WACGlobal_Methods.PopulateControl_DatabaseLists_TownshipNY_DDL(fvProperty.FindControl("ddlTownshipNY") as DropDownList, a.Single().fk_list_countyNY, a.Single().fk_list_townshipNY);
                    WACGlobal_Methods.PopulateControl_DatabaseLists_Basin_DDL(fvProperty.FindControl("ddlBasin") as DropDownList, null, null, null, a.Single().fk_list_countyNY, a.Single().fk_basin_code, true);
                    if (!string.IsNullOrEmpty(a.Single().fk_basin_code))
                    {
                        WACGlobal_Methods.PopulateControl_DatabaseLists_Subbasin_DDL(fvProperty.FindControl("ddlSubbasin") as DropDownList, a.Single().fk_basin_code, a.Single().fk_subbasin_code);
                    }
                }
            }
        }

        upProperty.Update();
    }
Ejemplo n.º 2
0
    private 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.ReadOnly)
            {
                // this needs to be replaced when page is converted
                WACUT_Associations assoc = fvOrganization.FindControl("WACUT_Associations") as WACUT_Associations;

                List <WACParameter> parms = new List <WACParameter>();
                parms.Add(new WACParameter("pk_participant", i, WACParameter.ParameterType.SelectedKey));
                parms.Add(new WACParameter("pk_participant", i, WACParameter.ParameterType.PrimaryKey));
                assoc.InitControl(parms);
            }

            if (fvOrganization.CurrentMode == FormViewMode.Edit)
            {
                DropDownList ddl     = fvOrganization.FindControl("UC_DropDownListByAlphabet").FindControl("ddl") as DropDownList;
                Label        lbl     = fvOrganization.FindControl("UC_DropDownListByAlphabet").FindControl("lblLetter") as Label;
                string       contact = string.Empty;
                string       sLetter = string.Empty;
                if (a.Any())
                {
                    WACGlobal_Methods.PopulateControl_Property_EditInsert_UserControl(fvOrganization.FindControl("UC_Property_EditInsert1") as UserControl, a.Single().property);
                    if (a.Single().fk_participant_contact != null)
                    {
                        contact = a.Single().participant.fullname_LF_dnd;
                    }
                    sLetter = string.IsNullOrEmpty(contact) ? null : contact[0].ToString();
                    WACGlobal_Methods.EventControl_Custom_DropDownListByAlphabet(ddl, lbl, sLetter, "PARTICIPANT", "ALL", a.Single().fk_participant_contact);
                }
                ;
            }
        }
        upOrganization.Update();
    }