Exemplo n.º 1
0
        public static void GetConfigurationTemplates(int typeId, int configurationTemplateId, HttpRequest.RequestResult <List <Rock.Client.DefinedValue> > resultHandler)
        {
            string oDataFilter = string.Format("?LoadAttributes=simple&$filter=DefinedTypeId eq {0}", typeId);

            // if a SPECIFIC templateId was requested, append it
            if (configurationTemplateId > 0)
            {
                oDataFilter += string.Format(" and Id eq " + configurationTemplateId.ToString( ));
            }

            RockApi.Get_DefinedValues(oDataFilter, resultHandler);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Defined Values are the "Values" of Defined Types.
        /// Example, Marital Status is a Defined Type.
        /// Its Values are "Married" and "Single".
        /// Starting with a GUID representing the DefinedType, we get the DefinedType's ID
        /// which can then be used to query the values.
        /// </summary>
        public static void GetDefinedValuesForDefinedType(string definedTypeGuid, HttpRequest.RequestResult <List <Rock.Client.DefinedValue> > resultHandler)
        {
            GetDefinedTypeIdForGuid(definedTypeGuid,
                                    delegate(HttpStatusCode statusCode, string statusDescription, List <Rock.Client.DefinedType> model)
            {
                if (model != null && model.Count > 0)
                {
                    string oDataFilter = string.Format("?LoadAttributes=simple&$filter=DefinedTypeId eq {0}", model[0].Id);

                    // it worked, so now use its Id to get the defined VALUE, which is what we really want.
                    RockApi.Get_DefinedValues(oDataFilter, resultHandler);
                }
                else
                {
                    resultHandler(HttpStatusCode.NotFound, "", null);
                }
            });
        }