示例#1
0
 public ODataServiceQuery(
     IODataServiceMetadata metadata,
     IODataServiceContext queryContext)
 {
     this._metadata     = metadata;
     this._queryContext = queryContext;
 }
        public PrestamosPendientesForm() : base()
        {
            service = ODataServiceContext.Instance;

            string serviceURL = ReadSetting("webServiceURL");

            if (string.IsNullOrEmpty(serviceURL))
            {
                // TODO: fix this
                serviceURL = "http://192.168.1.174:8080/odataexample/odata/appexample.svc/";
            }
            //com.carione
            bool rst = service.Connect <com.cairone.odataexample.ODataExample>(serviceURL);

            if (!rst)
            {
                return;
            }

            this.SetGridColumns(this.GenerateGridColumns());

            this.SetGridItems(this.LoadAllPrestamos());

            this.SetDefaultSkin(DEFAULT_SKIN);
        }
示例#3
0
        internal static object GetAnnotation(this IODataServiceContext context, params object[] customs)
        {
            if (false == (null != customs && customs.Count() <= 3))
            {
                return(null);
            }

            var serviceUri = customs[0] as Uri;
            var requestUri = customs[1] as Uri;
            var metadata   = customs[2] as IODataServiceMetadata;

            IEdmModel     edmModel     = EdmxReader.Parse(XmlReader.Create(serviceUri + "/$metadata"));
            IEdmEntitySet edmEntitySet = edmModel.EntityContainers()
                                         .First()
                                         .EntitySets()
                                         .FirstOrDefault(es =>
                                                         es.Name.ToLower() == requestUri.Segments.Last().ToLower() ||
                                                         requestUri.Segments.Last().ToLower().StartsWith(es.Name.ToLower() + "(")
                                                         );
            IEdmEntityType edmEntityType  = edmEntitySet.ElementType;
            ODataUriParser internalParser = new ODataUriParser(edmModel, serviceUri);

            var odataParser = new ODataParser()
            {
                EdmModel       = edmModel,
                EdmEntitySet   = edmEntitySet,
                EdmEntityType  = edmEntityType,
                InternalParser = internalParser,
                Metadata       = metadata,
            };

            return(odataParser);
        }
示例#4
0
        internal static IEnumerable <int> FilterAndOrderContentQuery(this IODataServiceContext context, ISession session)
        {
            var odataParser = context.CustomState as ODataParser;
            var ids         = new List <int>()
            {
            } as IEnumerable <int>;

            if (null == odataParser)
            {
                return(ids);
            }

            var contentItemVersionRecordCriteria = session.CreateCriteria <ContentItemVersionRecord>();

            contentItemVersionRecordCriteria.Add(Restrictions.Eq("Published", true));

            string contentTypeName           = odataParser.EdmEntityType.Name;
            var    contentItemRecordCriteria = contentItemVersionRecordCriteria.BindCriteriaByPath("ContentItemRecord");
            var    contentTypeCriteria       = contentItemRecordCriteria.BindCriteriaByPath("ContentType");

            contentTypeCriteria.Add(Restrictions.Eq("Name", contentTypeName));

            if (null != odataParser.Metadata && !string.IsNullOrEmpty(context.Filter))
            {
                var filterClause = odataParser.InternalParser.ParseFilter(context.Filter, odataParser.EdmEntityType, odataParser.EdmEntitySet);
                contentItemVersionRecordCriteria = contentItemVersionRecordCriteria.FilterContentQuery(filterClause, odataParser.Metadata);
            }

            if (null != odataParser.Metadata && !string.IsNullOrEmpty(context.OrderBy))
            {
                var orderByClause = odataParser.InternalParser.ParseOrderBy(context.OrderBy, odataParser.EdmEntityType, odataParser.EdmEntitySet);
                contentItemVersionRecordCriteria = contentItemVersionRecordCriteria.OrderContentQuery(orderByClause, odataParser.Metadata);
            }

            if (0 < context.FirstResults)
            {
                contentItemVersionRecordCriteria.SetFirstResult(context.FirstResults);
            }

            if (0 < context.MaxResults)
            {
                contentItemVersionRecordCriteria.SetMaxResults(context.MaxResults);
            }

            var hQueryResults = contentItemVersionRecordCriteria.List();

            if (1 > hQueryResults.Count)
            {
                return(ids);
            }

            ids = hQueryResults
                  .Cast <ContentItemVersionRecord>()
                  .Select(civr => civr.ContentItemRecord.Id)
                  .Distinct();
            return(ids);
        }
示例#5
0
        public Paises() : base()
        {
            service = ODataServiceContext.Instance;

            //com.carione
            bool rst = service.Connect <com.cairone.odataexample.ODataExample>(ODATA_SERVICE_URL_JAVA);

            if (!rst)
            {
                return;
            }

            this.SetGridColumns(this.GenerateGridColumns());

            this.SetGridItems(this.LoadAllPaises());
        }
示例#6
0
        public LocalidadesForm() : base()
        {
            service = ODataServiceContext.Instance;

            bool rst = service.Connect <com.cairone.odataexample.ODataExample>(WEB_SERVICE_URL);

            if (!rst)
            {
                return;
            }

            this.SetGridColumns(this.GenerateGridColumns());

            this.SetGridItems(this.LoadAllLocalidades());

            this.SetDefaultSkin(DEFAULT_SKIN);
        }
示例#7
0
 public PivotCollection(IODataServiceContext oDataServiceContext)
 {
     this.oDataServiceContext = oDataServiceContext;
 }
示例#8
0
 public ODataServiceMetadata(IODataServiceContext queryEntityService)
 {
     this._queryEntityService = queryEntityService;
     this.InitializeResources();
 }