Example #1
0
        public Cluster(Point centerPoint, List<Order> ordersInCluster, Days daysPlannedFor)
        {
            this.CenterPoint = centerPoint;
            this.AvailableOrdersInCluster = ordersInCluster;

            foreach (Order order in ordersInCluster)
                order.PutInCluster(this);
        }
Example #2
0
 public Player(string nick, string real, Jobs job, int level, Days day)
 {
     NickName = nick;
     RealName = real;
     Job = job;
     Level = level;
     AvailableDays = day;
 }
 /// <summary>
 /// Deserialise FileZilla binary data into object
 /// </summary>
 /// <param name="reader">Binary reader to read data from</param>
 /// <param name="protocolVersion">Current FileZilla protocol version</param>
 /// <param name="index">The 0 based index of this item in relation to any parent list</param>
 public void Deserialize(BinaryReader reader, int protocolVersion, int index)
 {
     SpeedLimit = reader.ReadBigEndianInt32();
     Date = reader.ReadDate();
     FromTime = reader.ReadTime();
     ToTime = reader.ReadTime();
     Days = (Days)reader.ReadByte();
 }
        private static Forecast Get(ForecastResponce fr, Days day)
        {

            return new Forecast
            {
                Humidity = fr.list[(int)(day)].Main.humidity,
                Temperature = Math.Round(fr.list[(int)(day)].Main.temp - 273)
            };
        }
Example #5
0
        public Route(Days Day)
        {
            this.Orders = new List<Order>();
            this.TravelTime = 1800.0d;
            this.Weight = 0;
            this.Day = Day;

            this.Orders.Add(Data.GetOrder0());
        }
        public bool CheckDay(Days shedule, Days dayToCheck)
        {
            if ((shedule & dayToCheck) == dayToCheck)
            {
                return true;
            }

           
            return false;
        }
        public bool ArrangeDay(ref Days shedule, Days dayToAdd)
        {
            if ((shedule & dayToAdd)==dayToAdd)
            {
                return false;
            }

            shedule |= dayToAdd;
            return true;
        }
Example #8
0
 public void AddNewItemToPlanning(Days day, int truckID, List<Route> routes)
 {
     TruckPlanning.Add(new Tuple<Days, int, List<Route>>(day, truckID, routes));
     foreach (Route route in routes)
     {
         foreach (Order order in route.Orders)
             this.AddPlannedOccurrence(order.OrderNumber, route);
         AvailableRoutes.Remove(route);
         TravelTimeScore += route.TravelTime;
     }
 }
Example #9
0
        public bool CanAddOrder(Days day)
        {
            if (OrderDayOccurrences.HasFlag(day))
                return false; // Already occurred on specified day

            foreach (Days restrictions in OrderDayRestrictions)
                if (restrictions.HasFlag(day))
                    return true; // Order has yet to occur on specified day and can be added accorrding to the restrictions

            return false; // restrictions is either empty or does not have the specified day in its restriction
        }
Example #10
0
 void AdvanceDay()
 {
     if (curDay == Days.Heswir) {
         curDay = Days.Vydir;
         AdvanceWeek();
     } else {
         curDay++;
     }
     morningTick = false;
     dinnerTick = false;
     FamilyResources.instance.DayTick ();
 }
        public override Solution executeStrategy(Solution toStartFrom)
        {
            if (toStartFrom.AvailableRoutes.Count == 0)
                return toStartFrom;

            int routeIndex = random.Next(toStartFrom.AvailableRoutes.Count);
            Route routeToDestroy = toStartFrom.AvailableRoutes[routeIndex];
            toStartFrom.RemoveRoute(routeToDestroy);
            ordersDestroyed = routeToDestroy.Orders;
            dayDestroyed = routeToDestroy.Day;
            routeToDestroy.Destroy();

            strategyHasExecuted = true;
            return toStartFrom;
        }
        public override Solution executeStrategy(Solution toStartFrom)
        {
            Planning = toStartFrom.GetRandomPlanning();
            if (Planning.Item3.Count == 0)
                return toStartFrom;

            Route routeToDestroy = Planning.Item3[random.Next(Planning.Item3.Count)];
            ordersDestroyed = routeToDestroy.Orders;
            dayDestroyed = routeToDestroy.Day;

            toStartFrom.RemoveRouteFromPlanning(Planning.Item1, Planning.Item2, routeToDestroy);
            toStartFrom.RemoveRoute(routeToDestroy);
            routeToDestroy.Destroy();

            strategyHasExecuted = true;
            return toStartFrom;
        }
Example #13
0
    public string Translate(Days d)
    {
      switch (d)
      {
        case Days.Sun: // 0
        case Days.Tue: // 2
        case Days.Thu: // 4
        case Days.Fri: // 5
          return "Even";

        case Days.Mon: // 1
        case Days.Sat: // 6
          return "Odd";

        default:
          Contract.Assert(false);     // we forgot one case!
          return null;
      }
    }
Example #14
0
 public static string PrepareRequestByLatLong(MethodType methodType, string key, string latitude, string longitude, Days ofDays)
 {
     return string.Concat(methodType.GetParameters(), "?key=", key, "&", ReqestFor.LatLong(latitude,longitude) , "&", ofDays.PrepareDays());
 }
Example #15
0
 public static string PrepareRequestByAutoIP(MethodType methodType, string key, Days ofDays )
 {
     return string.Concat(methodType.GetParameters(), "?key=", key, "&", ReqestFor.AutoIP(), "&", ofDays.PrepareDays());
 }
Example #16
0
 public static string PrepareRequest( MethodType methodType,string key, GetBy getBy, string value, Days ofDays)
 {
     return string.Concat(methodType.GetParameters(),"?key=",key,"&", getBy.PrepareQueryParameter(value),"&", ofDays.PrepareDays());
 }
Example #17
0
        /// <summary>Days�I�u�W�F�N�g��ݒ肷��</summary>
        /// <param name="days">Days�I�u�W�F�N�g</param>
        public void SetDays(Days days)
        {
            //���ݕҏW����Days�I�u�W�F�N�g������ꍇ�̓C�x���g�ʒm����
            if (this.days != null)
            {
                this.days.NameChangeEvent -= new Days.NameChangeEventHandler(days_NameChangeEvent);
                this.days.DayChangeEvent -= new Days.DayChangeEventHandler(days_DayChangeEvent);
            }

            this.days = days;

            //�C�x���g�o�^
            days.NameChangeEvent += new Days.NameChangeEventHandler(days_NameChangeEvent);
            days.DayChangeEvent += new Days.DayChangeEventHandler(days_DayChangeEvent);

            //�R���g���[���j�����ɃC�x���g�ʒm����
            this.Disposed += delegate(object sender, EventArgs e)
            {
                days.NameChangeEvent -= new Days.NameChangeEventHandler(days_NameChangeEvent);
                days.DayChangeEvent -= new Days.DayChangeEventHandler(days_DayChangeEvent);
            };

            //������������s��
            bool initFlag = initializing;
            initializing = true;

            //���̂�ݒ�
            tbxDaysName.Text = days.Name;

            //TextBox�ɗj���O���[�v��ݒ�
            tbxSunday.Text = days.GetTermName(DayOfWeek.Sunday);
            tbxMonday.Text = days.GetTermName(DayOfWeek.Monday);
            tbxTuesday.Text = days.GetTermName(DayOfWeek.Tuesday);
            tbxWednesday.Text = days.GetTermName(DayOfWeek.Wednesday);
            tbxThursday.Text = days.GetTermName(DayOfWeek.Thursday);
            tbxFriday.Text = days.GetTermName(DayOfWeek.Friday);
            tbxSaturday.Text = days.GetTermName(DayOfWeek.Saturday);

            initializing = initFlag;
        }
 public void ResetDay(ref Days shedule, Days dayToRemove)
 {
     shedule &= ~dayToRemove;
 }
Example #19
0
 private int DayInt(Days day)
 {
     switch (day)
     {
         case Days.Monday:
             return 1;
         case Days.Tuesday:
             return 2;
         case Days.Wednesday:
             return 3;
         case Days.Thursday:
             return 4;
         case Days.Friday:
             return 5;
         default:
             return -1;
     }
 }
 /// <summary>
 /// Default constructor (sets defaults as in FileZilla server interface)
 /// </summary>
 public SpeedLimitRule()
 {
     SpeedLimit = 8;
     Days = Days.All;
 }
        private IEnumerable<TimeTable> Parse(List<List<string>> rows, City city)
        {
            string busNumber;
            string stopName;
            string finalStop;
            Days days = new Days();
            IEnumerable<Shedule> stops;

            List<TimeTable> Result = new List<TimeTable>();

            foreach (List<string> row in rows)
            {
                if (!String.IsNullOrEmpty(row[0] as string) && !String.IsNullOrEmpty(row[1] as string) && !String.IsNullOrEmpty(row[2] as string) && !String.IsNullOrEmpty(row[3] as string))
                {
                    busNumber = row[busNumberOffset].Remove(0, 1);
                    stopName = row[stopNameOffset].Trim(' ');
                    finalStop = row[finalStopOffset].Trim(' ');
                    var daysList = row[daysOffset].Split(',');
                    days = new Days();
                    foreach (var item in daysList)
                    {
                        switch (item.Trim(' '))
                        {
                            case "ПН": { days |= Days.Monday; break; }
                            case "ВТ": { days |= Days.Tuesday; break; }
                            case "СР": { days |= Days.Wednesday; break; }
                            case "ЧТ": { days |= Days.Thursday; break; }
                            case "ПТ": { days |= Days.Friday; break; }
                            case "СБ": { days |= Days.Saturday; break; }
                            case "ВС": { days |= Days.Sunday; break; }
                            case "Р": { days |= Days.Working; break; }
                            case "В": { days |= Days.Weekend; break; }
                        }

                    }
                    stops = Convert(row.Skip(sheduleStartOffset).Take(row.Count() - endOffset), days);

                    if (!Result.Where(x => x.Stop.Name == stopName && x.Bus.Number == busNumber && x.FinalStop.Name == finalStop).Any())
                    {
                        Result.Add(new TimeTable
                        {
                            Bus = new Bus { Number = busNumber, CityId = city.Id },
                            Stop = new Stop { Name = stopName, CityId = city.Id },
                            FinalStop = new Stop { Name = finalStop, CityId = city.Id },
                            Shedules = stops.ToList()
                        });
                    }
                    else
                    {
                        var shedules = Result.Where(x => x.Stop.Name == stopName && x.Bus.Number == busNumber && x.FinalStop.Name == finalStop).First().Shedules;
                        foreach (var temp in stops)
                        {
                            shedules.Add(temp);
                        }
                    }
                }
            }
            return Result;
        }
Example #22
0
        public TestClass()
        {
            // initialize demo vars.

            fieldDay = Days.Tue;

            fieldClassInstance = new Child(5);
            fieldClassInstance.fctChild1(new int[3] { 1, 2, 3 });   // accept only  arrays
            fieldClassInstance.fctChild3(1, 2, 3);                // parameters are converted to array
            fieldClassInstance.fctChild3(new int[3] { 1, 2, 3 });   // also accept array

            fieldHash = new Hashtable();
            fieldHash.Add("Tuesday", fieldDay);

            fieldArrayList = new ArrayList();
            fieldArrayList.Add(fieldDay);

            // init bound array
            int[] myLengthsArray = new int[3] { 1, 2, 5 };     // 1 by 2 by 5
            int[] myBoundsArray = new int[3] { 2, 3, 8 };     // 2..4 , 3..4 , 8..12
            fieldArray = Array.CreateInstance(typeof(Object), myLengthsArray, myBoundsArray);

            // sub array
            int[] myIndArray = new int[3];
            myIndArray[0] = 2;
            myIndArray[1] = 4;
            myIndArray[2] = 6;

            fieldArray.SetValue(238, new int[3] { 2, 3, 8 });
            fieldArray.SetValue("239", new int[3] { 2, 3, 9 });
            fieldArray.SetValue(DateTime.Now, new int[3] { 2, 4, 8 });
            fieldArray.SetValue(fieldClassInstance, new int[3] { 2, 4, 9 });
            fieldArray.SetValue(myIndArray, new int[3] { 2, 4, 10 });
        }
 //======================================================//
 private IEnumerable<Shedule> Convert(IEnumerable<string> values, Days days)
 {
     return values.Where(x => !String.IsNullOrEmpty(x)).Select(x => new Shedule { Days = days, Time = Helper(x) });
 }
Example #24
0
		public Account(Days days)
		{
			_days = days;
		}
 public ActionResult AddShedule(AddSheduleViewModel model)
 {
     int cityId = (int)Session["City"];
     if (ModelState.IsValid)
     {
         try
         {
             var busId = int.Parse(model.Bus);
             var stop = stopsRepository.Get(x => x.CityId == cityId && x.Name == model.Stop).First();
             var endStop = stopsRepository.Get(x => x.CityId == cityId && x.Name == model.EndStop).First();
             var timeTable = timeTablesRepository.Get(x => x.BusId == busId && x.Stop.Id == stop.Id && x.FinalStop.Id == endStop.Id).First();
             Days days = new Days();
             foreach (var day in model.SelectedDays)
             {
                 days |= ((Days[])Enum.GetValues(typeof(Days))).Where(x => x.ToDescription() == day).First();
             }
             List<Shedule> sheduleRange = new List<Shedule>();
             foreach (var time in model.Shedule)
             {
                 sheduleRange.Add(new Shedule { Days = days, TimeTableId = timeTable.Id, Time = time });
             }
             shedulesRepository.InsertRange(sheduleRange);
             model.Shedule = null;
             model.Bus = null;
             model.SelectedDays = null;
             TempData["Success"] = "Запись добавлена";
         }
         catch (Exception ex)
         {
             NLog.LogManager.GetCurrentClassLogger().Error(ex);
             ModelState.AddModelError("", "Ошибка при добавлении записи. Повторите попытку позже");
         }
     }
     model.Buses = timeTablesRepository.Get(x => x.Bus.CityId == cityId && x.Shedules.Count == 0)
                                     .Select(x => x.Bus)
                                     .Distinct()
                                     .Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Number });
     model.Days = ((Days[])Enum.GetValues(typeof(Days))).Select(x => x.ToDescription());
     return View(model);
 }
Example #26
0
 public WeatherModel GetWeatherData( string key, GetBy getBy, string value, Days ForecastOfDays)
 {
     return GetData(APIURL +RequestBuilder.PrepareRequest(MethodType.Forecast, key, getBy, value, ForecastOfDays));
 }
Example #27
0
 public Day() : base()
 {
     this.iValue = default(Days);
     this.iNameOfDay = this.Value.ToString();
 }
Example #28
0
 public WeatherModel GetWeatherDataByAutoIP( string key, Days ForecastOfDays)
 {
     return GetData(APIURL + RequestBuilder.PrepareRequestByAutoIP(MethodType.Forecast, key, ForecastOfDays));
 }
Example #29
0
 public WeatherModel GetWeatherDataByLatLong( string key, string latitude, string longitude, Days ForecastOfDays)
 {
     return GetData(APIURL + RequestBuilder.PrepareRequestByLatLong(MethodType.Forecast, key,latitude,longitude, ForecastOfDays));
 }
Example #30
0
        public TestClass()
        {
            // initialize demo vars.

             fieldDay = Days.Tue;

             fieldClassInstance = new Child(5);
             fieldClassInstance.fctChild1(new int[3] { 1, 2, 3 });   // accept only  arrays
             fieldClassInstance.fctChild3(1, 2, 3);                // parameters are converted to array
             fieldClassInstance.fctChild3(new int[3] { 1, 2, 3 });   // also accept array

             // init array
             int[] myLengthsArray = new int[3] { 1, 2, 5 };     // 1 by 2 by 5

             // sub array
             int[] myIndArray = new int[3];
             myIndArray[0] = 2;
             myIndArray[1] = 4;
             myIndArray[2] = 6;

             fieldArray = Array.CreateInstance(typeof(Object), myLengthsArray);  // Silerlight 2 support only 0 based array index
             fieldArray.SetValue(238, new int[3] { 0, 1, 3 });
             fieldArray.SetValue("239", new int[3] { 0, 1, 2 });
             fieldArray.SetValue(DateTime.Now, new int[3] { 0, 0, 3 });
             fieldArray.SetValue(fieldClassInstance, new int[3] { 0, 0, 4 });
             fieldArray.SetValue(myIndArray, new int[3] { 0, 1, 4 });
        }