Exemplo n.º 1
0
        protected override void List(BusinessContext context)
        {
            ListRequest listRequest = context.Request as ListRequest;
            bool        forceBase   = listRequest.Parameters.GetValue <bool>(EventHelper.FORCE_BASE_PARAM, false);

            if (!forceBase)
            {
                #region Test area
                //FilterElementCollection filterCollection = new FilterElementCollection();
                //filterCollection.Add(new FilterElement(CalendarEventEntity.FieldStart,
                //                                       FilterElementType.Greater, new DateTime(2009, 1, 15)));
                //OrBlockFilterElement orBlock = new OrBlockFilterElement();
                //orBlock.ChildElements.Add(new FilterElement(CalendarEventEntity.FieldStart, FilterElementType.Less, new DateTime(2009, 1, 16)));
                //orBlock.ChildElements.Add(new FilterElement(CalendarEventEntity.FieldStart, FilterElementType.Less, new DateTime(2009, 1, 17)));
                //filterCollection.Add(orBlock);

                //CalendarEventListRequest calListRequest = new CalendarEventListRequest(listRequest.Target, filterCollection.ToArray(),
                //                                                                       listRequest.Sorting);
                #endregion

                CalendarEventListRequest calListRequest = new CalendarEventListRequest(listRequest.Target, listRequest.Filters,
                                                                                       listRequest.Sorting);
                ListResponse response = CalendarEventListMethod.ListEvent(calListRequest);
                context.SetResponse(response);
            }
            else
            {
                base.List(context);
            }
        }
Exemplo n.º 2
0
        protected override void CustomMethod(BusinessContext context)
        {
            switch (context.Request.Method)
            {
            case CalendarEventListMethod.METHOD_NAME:
                context.SetResponse(CalendarEventListMethod.ListEvent(context.Request as CalendarEventListRequest));
                break;

            case CalendarResourcesUpdateMethod.METHOD_NAME:
                CalendarResourcesUpdateMethod.UpdateResources(context.Request as CalendarEventUpdateResourcesRequest);
                break;

            default:
                base.CustomMethod(context);
                break;
            }
            base.CustomMethod(context);
        }