public static CatalogFilterDuration BuildFilterDurations(System.Collections.Generic.List <CatalogExcursionMinPrice> catalog)
 {
     System.TimeSpan?min = null;
     System.TimeSpan?max = null;
     if (catalog != null)
     {
         foreach (CatalogExcursionMinPrice item in catalog)
         {
             if (item.excursion != null && item.excursion.duration.HasValue)
             {
                 if (!min.HasValue || item.excursion.duration < min)
                 {
                     min = item.excursion.duration;
                 }
                 if (!max.HasValue || item.excursion.duration > max)
                 {
                     max = item.excursion.duration;
                 }
             }
         }
     }
     return((min.HasValue && max.HasValue) ? new CatalogFilterDuration
     {
         min = min.Value,
         max = max.Value
     } : null);
 }
Beispiel #2
0
        /// <summary>
        /// Resets the time after the specified time interval.
        /// </summary>
        /// <param name="currentTime">The date time to be set.</param>
        /// <param name="resetTime">The reset time interval.</param>
        private static void ResetTime(DateTime currentTime, System.TimeSpan?resetTime)
        {
            if (null == resetTime)
            {
                return;
            }

            Thread.Sleep(resetTime.Value);

            currentTime = currentTime.Add(resetTime.Value);

            SYSTEMTIME systemTime = new SYSTEMTIME
            {
                Year         = (short)currentTime.Year,
                Month        = (short)currentTime.Month,
                DayOfWeek    = (short)currentTime.DayOfWeek,
                Day          = (short)currentTime.Day,
                Hour         = (short)currentTime.Hour,
                Minute       = (short)currentTime.Minute,
                Second       = (short)currentTime.Second,
                Milliseconds = (short)currentTime.Millisecond
            };

            SetSystemTime(ref systemTime);
        }
Beispiel #3
0
        public async Task <bool> StringSetAsync(string cacheKey, string cacheValue, System.TimeSpan?expiration)
        {
            ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));

            bool flag = await _cache.StringSetAsync(cacheKey, cacheValue, expiration);

            return(flag);
        }
Beispiel #4
0
        public bool StringSet(string cacheKey, string cacheValue, System.TimeSpan?expiration)
        {
            ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));

            bool flag = _cache.StringSet(cacheKey, cacheValue, expiration);

            return(flag);
        }
Beispiel #5
0
        public override System.Web.Mvc.ActionResult LegacyPageRoute(int meetingId, System.TimeSpan?st)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.LegacyPageRoute);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "meetingId", meetingId);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "st", st);
            LegacyPageRouteOverride(callInfo, meetingId, st);
            return(callInfo);
        }
Beispiel #6
0
 /// <summary>
 /// Stop the timer.
 /// </summary>
 /// <returns>Return the cumulated running time of the timer.</returns>
 public System.TimeSpan Stop()
 {
     stop = DateTime.UtcNow;
     if (runtime == null)
     {
         runtime = stop - start;
     }
     else
     {
         runtime += stop - start;
     }
     return((System.TimeSpan)runtime);
 }
Beispiel #7
0
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(Coalesce.Domain.Case obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.CaseKey           = obj.CaseKey;
            this.Title             = obj.Title;
            this.Description       = obj.Description;
            this.OpenedAt          = obj.OpenedAt;
            this.AssignedToId      = obj.AssignedToId;
            this.ReportedById      = obj.ReportedById;
            this.Attachment        = obj.Attachment;
            this.Severity          = obj.Severity;
            this.Status            = obj.Status;
            this.DevTeamAssignedId = obj.DevTeamAssignedId;
            this.Duration          = obj.Duration;
            var propValCaseProducts = obj.CaseProducts;

            if (propValCaseProducts != null && (tree == null || tree[nameof(this.CaseProducts)] != null))
            {
                this.CaseProducts = propValCaseProducts
                                    .AsQueryable().OrderBy("CaseProductId ASC").AsEnumerable <Coalesce.Domain.CaseProduct>()
                                    .Select(f => f.MapToDto <Coalesce.Domain.CaseProduct, CaseProductDtoGen>(context, tree?[nameof(this.CaseProducts)])).ToList();
            }
            else if (propValCaseProducts == null && tree?[nameof(this.CaseProducts)] != null)
            {
                this.CaseProducts = new CaseProductDtoGen[0];
            }


            this.DevTeamAssigned = obj.DevTeamAssigned.MapToDto <Coalesce.Domain.External.DevTeam, DevTeamDtoGen>(context, tree?[nameof(this.DevTeamAssigned)]);

            if (!(includes == "PersonListGen"))
            {
                if (tree == null || tree[nameof(this.AssignedTo)] != null)
                {
                    this.AssignedTo = obj.AssignedTo.MapToDto <Coalesce.Domain.Person, PersonDtoGen>(context, tree?[nameof(this.AssignedTo)]);
                }

                if (tree == null || tree[nameof(this.ReportedBy)] != null)
                {
                    this.ReportedBy = obj.ReportedBy.MapToDto <Coalesce.Domain.Person, PersonDtoGen>(context, tree?[nameof(this.ReportedBy)]);
                }
            }
        }
Beispiel #8
0
        public override void Set(string key, object value, System.TimeSpan?slidingExpireTime = null)
        {
            if (value == null)
            {
                throw new BdfException("Can not insert null values to the cache!");
            }

            _memoryCache.Set(
                key,
                value,
                new CacheItemPolicy
            {
                SlidingExpiration = slidingExpireTime ?? DefaultSlidingExpireTime
            });
        }
        public async Task <MqMessage> GetMessage(System.TimeSpan?nextVisibilityTimeSpan = null, CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            Models.ExchangeModel model = new Models.ExchangeModel()
            {
                NextVisibleInMs = nextVisibilityTimeSpan.HasValue ? (int?)(nextVisibilityTimeSpan.Value.TotalMilliseconds) : null
            };

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.ExchangeWithHttpMessagesAsync(id, model, null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }
      public void Play(System.TimeSpan?OffsetStart = null)
      {
          if (!(my_uAudioStreamer.PlaybackState == uAudio_backend.PlayBackState.Playing))
          {
              halt = false;
              loadLinkFile(targetFilePath);
              my_uAudioStreamer.Play();


              if (Buffer != null)
              {
                  updateBufferLoop = updateBuffer();
              }
          }
      }
Beispiel #11
0
        public void PlayAudioStream(string FileNameIN, System.TimeSpan?OffsetStart)
        {
            if (!TheAudioStream.IsPlaying)
            {
#if uAudio_debug
                UnityEngine.Debug.Log("5");
#endif
                LoadFile(FileNameIN);
                Play(OffsetStart);
                theAudioStream_sendStartLoopPump();
#if uAudio_debug
                UnityEngine.Debug.Log("6");
#endif
            }
        }
Beispiel #12
0
        private void AnnounceTimeBeforeShutdown(System.TimeSpan time, bool automatic)
        {
            string str = automatic ? "Automatic reboot in <b>{0:mm\\:ss}</b>" : "Reboot in <b>{0:mm\\:ss}</b>";

            if (!automatic && !string.IsNullOrEmpty(base.ScheduledShutdownReason))
            {
                str = str + " : " + base.ScheduledShutdownReason;
            }
            if (WorldServer.SaveMessage)
            {
                Singleton <World> .Instance.SendAnnounce(TextInformationTypeEnum.TEXT_INFORMATION_ERROR, 15, new object[]
                {
                    time
                });
            }
            this.m_lastAnnouncedTime = new System.TimeSpan?(time);
        }
Beispiel #13
0
 public TimeRule(
     string id,
     string lotteryId,
     string weekday,
     System.TimeSpan?startTime,
     System.TimeSpan?endTime,
     System.TimeSpan?tick,
     string createBy
     ) : base(id)
 {
     LotteryId  = lotteryId;
     Weekday    = weekday;
     StartTime  = startTime;
     EndTime    = endTime;
     Tick       = tick;
     CreateBy   = createBy;
     CreateTime = DateTime.Now;
 }
Beispiel #14
0
 public void FillFreightInfo(FreightReservationOrder freight, DataRow row)
 {
     if (row != null)
     {
         System.TimeSpan?freightDepartureTime = row.ReadNullableUnspecifiedTime("stime");
         FreightPoint    freightPoint         = new FreightPoint();
         FreightPoint    arg_5C_0             = freightPoint;
         System.DateTime dateTime             = row.ReadUnspecifiedDateTime("sdate");
         dateTime          = dateTime.Date;
         arg_5C_0.date     = dateTime.Add(freightDepartureTime ?? System.TimeSpan.FromTicks(0L));
         freightPoint.port = new Airport
         {
             id    = row.ReadInt("sport$inc"),
             alias = row.ReadNullableTrimmedString("sport$alias"),
             name  = row.ReadNullableTrimmedString("sport$name"),
             town  = new Town
             {
                 id   = row.ReadInt("stown$inc"),
                 name = row.ReadNullableString("stown$name")
             }
         };
         freight.departure = freightPoint;
         System.TimeSpan?freightArrivalTime = row.ReadNullableUnspecifiedTime("dtime");
         FreightPoint    freightPoint2      = new FreightPoint();
         FreightPoint    arg_147_0          = freightPoint2;
         dateTime           = freight.departure.date;
         dateTime           = dateTime.Date;
         dateTime           = dateTime.AddDays((double)row.ReadInt("daysinway"));
         arg_147_0.date     = dateTime.Add(freightArrivalTime ?? System.TimeSpan.FromTicks(0L));
         freightPoint2.port = new Airport
         {
             id    = row.ReadInt("dport$inc"),
             alias = row.ReadNullableTrimmedString("dport$alias"),
             name  = row.ReadNullableTrimmedString("dport$name"),
             town  = new Town
             {
                 id   = row.ReadInt("dtown$inc"),
                 name = row.ReadNullableString("dtown$name")
             }
         };
         freight.arrival = freightPoint2;
     }
 }
Beispiel #15
0
        public void Play(System.TimeSpan?OffsetStart = null)
        {
#if !RemoveThread_uAudio
            if (!betaNativeThreadBuffering)
            {
#endif
            RunPlay();
            //hot = true;
            callUpdateNeeded = true;

#if !RemoveThread_uAudio
        }

        else
        {
            loadAudio();
        }
#endif
        }
        public async Task <bool> StringSetAsync(string cacheKey, string cacheValue, System.TimeSpan?expiration, string when)
        {
            ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));

            When w = When.Always;

            if (when.Equals("nx", StringComparison.OrdinalIgnoreCase))
            {
                w = When.NotExists;
            }
            else if (when.Equals("xx", StringComparison.OrdinalIgnoreCase))
            {
                w = When.Exists;
            }

            bool flag = await _cache.StringSetAsync(cacheKey, cacheValue, expiration, w);

            return(flag);
        }
Beispiel #17
0
        /// <summary>
        /// Sets the system time to the specified date time value.
        /// </summary>
        /// <param name="dateTime">Time to be set.</param>
        /// <param name="resetTime">The amount of time to reset the changed time.</param>
        /// <returns>true if the date time is set, else false.</returns>
        public static bool SetSystemTime(DateTime dateTime, System.TimeSpan?resetTime = null)
        {
            dateTime = dateTime.ToUniversalTime();

            DateTime currentTime = DateTime.UtcNow;

            SYSTEMTIME systemTime = new SYSTEMTIME
            {
                Year         = (short)dateTime.Year,
                Month        = (short)dateTime.Month,
                DayOfWeek    = (short)dateTime.DayOfWeek,
                Day          = (short)dateTime.Day,
                Hour         = (short)dateTime.Hour,
                Minute       = (short)dateTime.Minute,
                Second       = (short)dateTime.Second,
                Milliseconds = (short)dateTime.Millisecond
            };

            uint result = SetSystemTime(ref systemTime);

            int errorNumber = Marshal.GetLastWin32Error();

            if (result == 0)
            {
                Logger.LogInfo("Failed to set system time to {0}".FormatWith(dateTime.ToLocalTime()));
                return(false);
            }
            else
            {
                Logger.LogInfo("Successfully set the system time to: {0}".FormatWith(dateTime.ToLocalTime()));
            }

            if (null != resetTime)
            {
                Thread resetThread = new Thread(() => ResetTime(currentTime, resetTime));
                resetThread.Start();
            }

            return(true);
        }
Beispiel #18
0
        System.Collections.IEnumerator firePlay(System.TimeSpan?OffsetStart)
        {
#if uAudio_debug
            UnityEngine.Debug.Log(System.Environment.NewLine + "1");
#endif
            yield return(new UnityEngine.WaitForSeconds(.1f));

#if uAudio_debug
            UnityEngine.Debug.Log(System.Environment.NewLine + "build clip");
#endif
            my_uAudioPlayer.myAudioSource.clip = UnityEngine.AudioClip.Create("uAudio_song", int.MaxValue,
                                                                              TheAudioStream.reader.WaveFormat.Channels,
                                                                              TheAudioStream.reader.WaveFormat.SampleRate,
                                                                              true, new UnityEngine.AudioClip.PCMReaderCallback(TheAudioStream.ReadData));

#if uAudio_debug
            UnityEngine.Debug.Log(System.Environment.NewLine + "done build clip");
#endif
            yield return(new UnityEngine.WaitForSeconds(.1f));

            TheAudioStream.callPlay(OffsetStart);
        }
Beispiel #19
0
        /// <summary>
        /// 将对象插入到缓存管理器中。
        /// </summary>
        /// <typeparam name="T">缓存对象的类型。</typeparam>
        /// <param name="cacheKey">用于引用对象的缓存键。</param>
        /// <param name="value">要插入到缓存的对象。</param>
        /// <param name="expire">对象存放于缓存中的有效时间,到期后将从缓存中移除。如果此值为 null,则默认有效时间为 30 分钟。</param>
        /// <param name="removeCallback">当对象从缓存中移除时,使用该回调方法通知应用程序。</param>
        public T Add <T>(string cacheKey, T value, System.TimeSpan?expire = null, CacheItemRemovedCallback removeCallback = null)
        {
            try
            {
                using (var client = manager.GetClient())
                {
                    if (expire == null)
                    {
                        client.Set <T>(cacheKey, value);
                    }
                    else
                    {
                        client.Set <T>(cacheKey, value, DateTime.Now + (TimeSpan)expire);
                    }
                }
            }
            catch (Exception exp)
            {
                throw new InvalidOperationException("无法完成缓存操作。", exp);
            }

            return(value);
        }
Beispiel #20
0
        protected override void CheckScheduledShutdown()
        {
            System.TimeSpan timeSpan  = System.TimeSpan.FromMinutes((double)ServerBase.AutomaticShutdownTimer) - base.UpTime;
            bool            automatic = true;

            if (base.IsShutdownScheduled && timeSpan > base.ScheduledShutdownDate - System.DateTime.Now)
            {
                timeSpan  = base.ScheduledShutdownDate - System.DateTime.Now;
                automatic = false;
            }
            if (timeSpan < System.TimeSpan.FromMinutes(30.0))
            {
                System.TimeSpan?timeSpan2 = this.m_lastAnnouncedTime.HasValue ? new System.TimeSpan?(System.TimeSpan.MaxValue) : (this.m_lastAnnouncedTime - timeSpan);
                if (timeSpan > System.TimeSpan.FromMinutes(10.0) && timeSpan2 >= System.TimeSpan.FromMinutes(5.0))
                {
                    this.AnnounceTimeBeforeShutdown(System.TimeSpan.FromMinutes(timeSpan.TotalMinutes.RoundToNearest(5.0)), automatic);
                }
                if (timeSpan > System.TimeSpan.FromMinutes(5.0) && timeSpan <= System.TimeSpan.FromMinutes(10.0) && timeSpan2 >= System.TimeSpan.FromMinutes(1.0))
                {
                    this.AnnounceTimeBeforeShutdown(System.TimeSpan.FromMinutes(timeSpan.TotalMinutes), automatic);
                }
                if (timeSpan > System.TimeSpan.FromMinutes(1.0) && timeSpan <= System.TimeSpan.FromMinutes(5.0) && timeSpan2 >= System.TimeSpan.FromSeconds(30.0))
                {
                    this.AnnounceTimeBeforeShutdown(new System.TimeSpan(0, 0, 0, (int)timeSpan.TotalSeconds.RoundToNearest(30.0)), automatic);
                }
                if (timeSpan > System.TimeSpan.FromSeconds(10.0) && timeSpan <= System.TimeSpan.FromMinutes(1.0) && timeSpan2 >= System.TimeSpan.FromSeconds(10.0))
                {
                    this.AnnounceTimeBeforeShutdown(new System.TimeSpan(0, 0, 0, (int)timeSpan.TotalSeconds.RoundToNearest(10.0)), automatic);
                }
                if (timeSpan <= System.TimeSpan.FromSeconds(10.0) && timeSpan > System.TimeSpan.Zero)
                {
                    this.AnnounceTimeBeforeShutdown(System.TimeSpan.FromSeconds(timeSpan.Seconds.RoundToNearest(5)), automatic);
                }
            }
            base.CheckScheduledShutdown();
        }
        public static System.Collections.Generic.List <CatalogExcursionMinPrice> FindExcursions(string lang, int partner, System.DateTime?startDate, System.DateTime?endDate, int?topLimit, int?startPoint, string searchText, int[] categories, int[] departures, int[] destinations, int[] languages, System.TimeSpan?minDuration, System.TimeSpan?maxDuration, ExcursionProvider.ExcursionSorting?sorting, bool withoutPrice)
        {
            try
            {
                System.DateTime _startDate = startDate.HasValue ? startDate.Value : System.DateTime.Now.Date;
                System.DateTime _endDate   = endDate.HasValue ? endDate.Value : _startDate.AddMonths(6);
                XName           arg_261_0  = "excursionFilters";
                object[]        array      = new object[8];
                array[0] = ((!topLimit.HasValue) ? null : new XAttribute("topLimit", topLimit.Value));
                array[1] = ((searchText == null) ? null : new XElement("name", searchText));


                XElement categoriesEl;
                if (categories != null)
                {
                    categoriesEl = new XElement("categories",
                                                from c in categories
                                                select new XElement("category", c));
                }
                else
                {
                    categoriesEl = null;
                }

                array[2] = categoriesEl;


                XElement   departuresEl;
                List <int> allowedIds = new List <int>();
                if (departures != null)
                {
                    //делаем фильтр экскурсий по id региона
                    DataSet set = DatabaseOperationProvider.Query("select inc from excurs where region = " + departures[0], "regions", new { });

                    foreach (DataRow row in set.Tables["regions"].Rows)
                    {
                        allowedIds.Add(row.ReadInt("inc"));
                    }
                }

                departuresEl = null;

                array[3] = departuresEl;

                XElement destEl;

                if (destinations != null)
                {
                    destEl = new XElement("destinationpoints",
                                          from d in destinations
                                          select new XElement("destinationpoint", d));
                }
                else
                {
                    destEl = null;
                }

                array[4] = destEl;

                XElement langEl;
                if (languages != null)
                {
                    langEl = new XElement("languages",
                                          from l in languages
                                          select new XElement("language", l));
                }
                else
                {
                    langEl = null;
                }

                array[5] = langEl;

                array[6] = new XElement("duration", new object[]
                {
                    (!minDuration.HasValue) ? null : new XAttribute("minDuration", new System.DateTime(1900, 1, 1).Add(minDuration.Value)),
                    (!maxDuration.HasValue) ? null : new XAttribute("maxDuration", new System.DateTime(1900, 1, 1).Add(maxDuration.Value))
                });
                array[7] = ((!sorting.HasValue) ? null : new XElement("sorting", sorting.ToString()));
                XElement xml = new XElement(arg_261_0, array);
                DataSet  ds  = DatabaseOperationProvider.QueryProcedure("up_guest_findExcursions", "excursions", new
                {
                    language      = lang,
                    partner       = partner,
                    startpoint    = startPoint,
                    startdate     = _startDate,
                    enddate       = _endDate,
                    filters       = xml,
                    withpriceonly = !withoutPrice
                });

                if (allowedIds.Count > 0)
                {
                    return((
                               from DataRow row in ds.Tables["excursions"].Rows
                               where allowedIds.Contains(row.ReadInt("excurs$inc")) //> 0
                               select new CatalogExcursionMinPrice
                    {
                        excursion = ExcursionProvider.factory.CatalogExcursion(row),
                        minPrice = ExcursionProvider.factory.CatalogExcursionMinPrice(row)
                    }).ToList <CatalogExcursionMinPrice>());
                }
                else
                {
                    return((
                               from DataRow row in ds.Tables["excursions"].Rows
                               select new CatalogExcursionMinPrice
                    {
                        excursion = ExcursionProvider.factory.CatalogExcursion(row),
                        minPrice = ExcursionProvider.factory.CatalogExcursionMinPrice(row)
                    }).ToList <CatalogExcursionMinPrice>());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Beispiel #22
0
 /// <summary>
 /// Reset the timer.
 /// </summary>
 public void Reset()
 {
     start   = null;
     stop    = null;
     runtime = null;
 }
Beispiel #23
0
 public void PlayAudioFile(UnityEngine.UI.InputField FileNameIN, System.TimeSpan?OffsetStart)
 {
     PlayAudioStream(FileNameIN.text, OffsetStart);
 }
Beispiel #24
0
 /// <summary>
 /// Constructor method.
 /// </summary>
 public Timer()
 {
     start   = null;
     stop    = null;
     runtime = null;
 }
 /// <summary>
 /// Converts a TimeSpan into a string (format HH:MM)
 /// </summary>
 /// <param name="value">Il timespan da convertire.</param>
 /// <returns>Una stringa nel formato 'HH:MM' se il TimeSpan e not null, empty altrimenti.</returns>
 public static string ToHHMM(this System.TimeSpan?value)
 {
     return(value.HasValue ? ((System.TimeSpan)value).ToHHMM() : "");
 }
Beispiel #26
0
        public static System.Collections.Generic.List <CatalogExcursionMinPrice> FindExcursions(string lang, int partner, System.DateTime?startDate, System.DateTime?endDate, int?topLimit, int?startPoint, string searchText, int[] categories, int[] departures, int[] destinations, int[] languages, System.TimeSpan?minDuration, System.TimeSpan?maxDuration, ExcursionProvider.ExcursionSorting?sorting, bool withoutPrice)
        {
            try
            {
                System.DateTime _startDate = startDate.HasValue ? startDate.Value : System.DateTime.Now.Date;
                System.DateTime _endDate   = endDate.HasValue ? endDate.Value : _startDate.AddMonths(6);
                XName           arg_261_0  = "excursionFilters";
                object[]        array      = new object[8];
                array[0] = ((!topLimit.HasValue) ? null : new XAttribute("topLimit", topLimit.Value));
                array[1] = ((searchText == null) ? null : new XElement("name", searchText));


                XElement categoriesEl;

                bool searchInd   = false;
                bool searchGroup = false;

                var listCatalog = new List <int>();

                if (categories != null)
                {
                    foreach (int category in categories)
                    {
                        if (category == 3)
                        {
                            searchInd = true;
                        }
                        else if (category == 4)
                        {
                            searchGroup = true;
                        }
                        else
                        {
                            listCatalog.Add(category);
                        }
                    }
                }

                List <int> allowedByGroup = new List <int>();

                if (searchInd != searchGroup)
                {
                    try
                    {
                        var query = "select excurs from excatlist where excurscategory = " + (searchInd ? 3:4);

                        //делаем фильтр экскурсий по id региона
                        DataSet set = DatabaseOperationProvider.Query(query, "category", new { });

                        foreach (DataRow row in set.Tables["category"].Rows)
                        {
                            allowedByGroup.Add(row.ReadInt("excurs"));
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                categories = listCatalog.ToArray();

                if (categories != null)
                {
                    categoriesEl = new XElement("categories",
                                                from c in categories
                                                select new XElement("category", c));
                }
                else
                {
                    categoriesEl = null;
                }

                array[2] = categoriesEl;

                XElement departuresEl;

                List <int> allowedIds = new List <int>();
                //по полученому региону начала экскурсии получаем список айдишников экскурсий
                if (departures != null)
                {
                    try
                    {
                        var query = "select inc from excurs where region = " + departures[0] +
                                    " union select excurs as inc from exdetplan where region = " + departures[0] +
                                    " union select excurs as inc from exprice   where region = " + departures[0] + " or region < 0";

                        //делаем фильтр экскурсий по id региона
                        DataSet set = DatabaseOperationProvider.Query(query, "regions", new { });

                        foreach (DataRow row in set.Tables["regions"].Rows)
                        {
                            allowedIds.Add(row.ReadInt("inc"));
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                departuresEl = null;

                array[3] = departuresEl;

                XElement destEl;

                if (destinations != null)
                {
                    destEl = new XElement("destinationpoints",
                                          from d in destinations
                                          select new XElement("destinationpoint", d));
                }
                else
                {
                    destEl = null;
                }

                array[4] = destEl;

                XElement langEl;
                if (languages != null)
                {
                    langEl = new XElement("languages",
                                          from l in languages
                                          select new XElement("language", l));
                }
                else
                {
                    langEl = null;
                }

                array[5] = langEl;

                array[6] = new XElement("duration", new object[]
                {
                    (!minDuration.HasValue) ? null : new XAttribute("minDuration", new System.DateTime(1900, 1, 1).Add(minDuration.Value)),
                    (!maxDuration.HasValue) ? null : new XAttribute("maxDuration", new System.DateTime(1900, 1, 1).Add(maxDuration.Value))
                });
                array[7] = ((!sorting.HasValue) ? null : new XElement("sorting", sorting.ToString()));
                XElement xml = new XElement(arg_261_0, array);
                DataSet  ds  = DatabaseOperationProvider.QueryProcedure("up_guest_findExcursions", "excursions", new
                {
                    language      = lang,
                    partner       = partner,
                    startpoint    = startPoint,
                    startdate     = _startDate,
                    enddate       = _endDate,
                    filters       = xml,
                    withpriceonly = !withoutPrice
                });


                return((
                           from DataRow row in ds.Tables["excursions"].Rows
                           where ((allowedIds.Contains(row.ReadInt("excurs$inc")) || allowedIds.Count == 0)
                                  &&
                                  (allowedByGroup.Contains(row.ReadInt("excurs$inc")) || allowedByGroup.Count == 0))

                           select new CatalogExcursionMinPrice
                {
                    excursion = ExcursionProvider.factory.CatalogExcursion(row),
                    minPrice = ExcursionProvider.factory.CatalogExcursionMinPrice(row)
                }).ToList <CatalogExcursionMinPrice>());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Beispiel #27
0
 partial void LegacyPageRouteOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int meetingId, System.TimeSpan?st);
Beispiel #28
0
 public BeforeGetRequestEventData(string cacheType, string name, string operation, string[] cacheKeys, System.TimeSpan?expiration = null)
     : base(cacheType, name, operation)
 {
     this.CacheKeys  = cacheKeys;
     this.Expiration = expiration;
 }
Beispiel #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CTimeCreated"/> class.
 /// </summary>
 /// <param name="last">The last.</param>
 public CTimeCreated(TimeSpan last)
 {
     span = last;
 }
Beispiel #30
0
        /// <summary>
        /// Updates the device status.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="selectedDeviceID">The selected device identifier.</param>
        /// <param name="buttonState">if set to <c>true</c> [button state].</param>
        /// <returns></returns>
        /// <Author> Daniel Molina </Author>
        /// <LastModification>  29/11/2017 - 16:20 </LastModification>
        /// <LastModificationBy> Daniel Molina </LastModificationBy>
        public static RoomDeviceResponse UpdateDeviceStatus(int roomId, int selectedDeviceID, bool buttonState)
        {
            try
            {
                //Validate the Device Status
                List <GetDeviceByRoomIdAndDeviceID_Result> lstDeviceByRoomIdAndDeviceId = DeviceController.GetDeviceByRoomIdAndDeviceId(roomId, selectedDeviceID);
                List <DevicesDTOPartial> retVal = new List <DevicesDTOPartial>();
                foreach (GetDeviceByRoomIdAndDeviceID_Result reg in lstDeviceByRoomIdAndDeviceId)
                {
                    retVal.Add(new DevicesDTOPartial(reg));
                }

                //Validate that the device State
                if (retVal[0].State == buttonState)
                {
                    Logger.Logger.Info(profileName, "Method Response: The device has the same status. Username:"******"PasswordRetriesListByUtilityID", "Endpoint not found exception", ex);
                return(new RoomDeviceResponse {
                    Code = (int)ResponseCode.Exception, Message = ResponseCode.Exception.ToString() + ": " + ex.Message
                });
            }
        }