/// <summary>
        /// Get allday instance list.
        /// To get allday instance list, InstanceLocaltimeBook uri must be used.
        /// Range is set from the first day of selected date to the last day of selected data.
        /// <param name="dt">The selected datetime</param>
        /// </summary>
        private TPC.CalendarList GetAlldayInstances(DateTime dt)
        {
            TPC.CalendarList list = null;

            TPC.CalendarTime from = new TPC.CalendarTime(dt.Year, dt.Month, dt.Day, 0, 0, 0);
            TPC.CalendarTime to   = new TPC.CalendarTime(dt.AddDays(1).Year, dt.AddDays(1).Month, dt.AddDays(1).Day, 0, 0, 0);

            TPC.CalendarQuery  query  = new TPC.CalendarQuery(InstanceLocaltimeBook.Uri);
            TPC.CalendarFilter filter = new TPC.CalendarFilter(InstanceLocaltimeBook.Uri,
                                                               InstanceLocaltimeBook.Start, TPC.CalendarFilter.IntegerMatchType.GreaterThanOrEqual, from);
            filter.AddCondition(TPC.CalendarFilter.LogicalOperator.And,
                                InstanceLocaltimeBook.Start, TPC.CalendarFilter.IntegerMatchType.LessThan, to);
            query.SetFilter(filter);
            try
            {
                list = manager.Database.GetRecordsWithQuery(query, 0, 0);
            }
            catch (Exception)
            {
            }
            filter.Dispose();
            query.Dispose();

            return(list);
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the filter for a query.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="filter">The filter</param>
        /// <feature>http://tizen.org/feature/calendar</feature>
        /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
        /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
        public void SetFilter(CalendarFilter filter)
        {
            int error = Interop.Query.SetFilter(_queryHandle, filter._filterHandle);

            if (CalendarError.None != (CalendarError)error)
            {
                Log.Error(Globals.LogTag, "SetFilter Failed with error " + error);
                throw CalendarErrorFactory.GetException(error);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Adds a child filter to a parent filter.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <feature>http://tizen.org/feature/calendar</feature>
        /// <param name="logicalOperator">The operator type.</param>
        /// <param name="filter">The child filter.</param>
        /// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
        /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid.</exception>
        public void AddFilter(LogicalOperator logicalOperator, CalendarFilter filter)
        {
            int error = Interop.Filter.AddOperator(_filterHandle, logicalOperator);

            if (CalendarError.None != (CalendarError)error)
            {
                Log.Error(Globals.LogTag, "AddCondition Failed with error " + error);
                throw CalendarErrorFactory.GetException(error);
            }

            error = Interop.Filter.AddFilter(_filterHandle, filter._filterHandle);
            if (CalendarError.None != (CalendarError)error)
            {
                Log.Error(Globals.LogTag, "AddFilter Failed with error " + error);
                throw CalendarErrorFactory.GetException(error);
            }
        }
        /// <summary>
        /// Get utc instance list.
        /// To get not-allday instance list, InstanceUtimeBook uri must be used.
        /// This does not include allday instances.
        /// Range is set from the first day of selected date to the last day of selected data.
        /// <param name="dt">The selected datetime</param>
        /// </summary>
        private TPC.CalendarList GetUtcInstances(DateTime dt)
        {
            TPC.CalendarList list;

            DateTime firstDate = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0, DateTimeKind.Local);

            TPC.CalendarTime from = new TPC.CalendarTime(firstDate.ToUniversalTime().Ticks);
            TPC.CalendarTime to   = new TPC.CalendarTime(from.UtcTime.AddDays(1).Ticks);

            TPC.CalendarQuery  query  = new TPC.CalendarQuery(InstanceUtimeBook.Uri);
            TPC.CalendarFilter filter = new TPC.CalendarFilter(InstanceUtimeBook.Uri,
                                                               InstanceUtimeBook.Start, TPC.CalendarFilter.IntegerMatchType.GreaterThanOrEqual, from);
            filter.AddCondition(TPC.CalendarFilter.LogicalOperator.And,
                                InstanceUtimeBook.Start, TPC.CalendarFilter.IntegerMatchType.LessThan, to);
            query.SetFilter(filter);
            list = manager.Database.GetRecordsWithQuery(query, 0, 0);
            filter.Dispose();
            query.Dispose();

            return(list);
        }