/// <summary>
 /// Constructor helper method.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="min">Minimum length of time between updates.</param>
 /// <param name="max">Maximum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 private void CreateUpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod min, UpdatePeriod max, CacheStyle cacheStyle)
 {
     this.DefaultPeriod = defaultPeriod;
     this.Minimum = min;
     this.Maximum = max;
     this.CacheStyle = cacheStyle;
 }
Exemple #2
0
 /// <summary>
 /// Constructor helper method.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="min">Minimum length of time between updates.</param>
 /// <param name="max">Maximum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 private void CreateUpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod min, UpdatePeriod max, CacheStyle cacheStyle)
 {
     this.DefaultPeriod = defaultPeriod;
     this.Minimum       = min;
     this.Maximum       = max;
     this.CacheStyle    = cacheStyle;
 }
Exemple #3
0
 /// <summary>
 /// Constructor helper method.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="minimum">Minimum length of time between updates.</param>
 /// <param name="maximum">Maximum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 private void CreateUpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod minimum, UpdatePeriod maximum, CacheStyle cacheStyle)
 {
     DefaultPeriod = defaultPeriod;
     Minimum       = minimum;
     Maximum       = maximum;
     CacheStyle    = cacheStyle;
 }
Exemple #4
0
 public Website(int id, string title, string url, PageStyle pageStyle, DateTime lastChecked, UpdatePeriod updatePeriod, int expectedDay = 1, DayOfWeek expectedDayOfWeek = DayOfWeek.Monday)
 {
     ID                = id;
     Title             = title;
     Url               = url;
     PageStyle         = pageStyle;
     LastChecked       = lastChecked;
     UpdatePeriod      = updatePeriod;
     ExpectedDay       = expectedDay;
     ExpectedDayOfWeek = expectedDayOfWeek;
 }
Exemple #5
0
        public DB_Form(Synch.SynchPoolManager synchPoolManager, bool AdminShowSettings = false)
        {
            InitializeComponent();

            _synchPoolManager = synchPoolManager;

            _uTables = _synchPoolManager.UTables.ToArray();

            {
                var User = T.User.CreateSubTable(false);

                User.QUERRY().SHOW.DO();

                this.Users = new uint[User.Rows.Count];

                for (int i = 0; i < Users.Length; i++)
                {
                    Users[i] = User.Rows.GetID(i);
                    ForceUser_combo.Items.Add(User.Rows.Get <string>(i, C.User.Login));
                }
            }

            UpdatePeriod_Box.Text = UpdatePeriod.ToString();

            SelectCurrentSPool();

            ShowSettings = AdminShowSettings;

            Pass_Box_KeyDown(null, new KeyEventArgs(Keys.A));

            UTable_Grid.VirtualMode = true;

            UTable_Grid.Columns.Clear();
            UTable_Grid.Columns.Add("Number", "Номер");
            UTable_Grid.Columns.Add("Name", "Наименование");
            UTable_Grid.Columns.Add("Increment", "Инкремент");

            var column = new DataGridViewColumn();

            column.Name         = "Use";
            column.HeaderText   = "Задействовать";
            column.CellTemplate = new DataGridViewCheckBoxCell();

            UTable_Grid.Columns.Add(column);

            UTable_Grid.RowCount = _uTables.Length;

            PodrCode_label.Text += GetImportName(data.UserID);
        }
        public void Apply(DateTime startDate, DateTime endDate, UpdatePeriod updatePeriod)
        {
            // Initiliase allocation before simulation starts
             DateTime? actualStartDate = this.InitialiseAllocation(startDate);
             if (actualStartDate == null)
             {
            MessageBox.Show("Impossible to start simulation at this date: " + startDate, "Invalid input data",
                MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
             }

             var calendar = CultureInfo.CurrentCulture.Calendar;
             DateTime currentDate = actualStartDate.Value.AddDays(1);
             DateTime previousDate = currentDate;

             StockSerie serie = Series.First();

             while (currentDate < endDate)
             {
            switch (updatePeriod)
            {
               case UpdatePeriod.Daily:
                  //StockLog.Write("Updating " + updatePeriod.ToString() + " :" + currentDate.ToShortDateString());
                  this.ApplyAtDate(currentDate);
                  break;
               case UpdatePeriod.Weekly:
                  if (calendar.GetWeekOfYear(currentDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday) !=
                      calendar.GetWeekOfYear(previousDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday))
                  {
                     //StockLog.Write("Updating " + updatePeriod.ToString() + " :" + currentDate.ToShortDateString());
                     this.ApplyAtDate(currentDate);
                  }
                  break;
               case UpdatePeriod.Monthly:
                  if (currentDate.Month > previousDate.Month)
                  {
                     //StockLog.Write("Updating " + updatePeriod.ToString() + " :" + currentDate.ToShortDateString());
                     this.ApplyAtDate(currentDate);
                  }
                  break;
            }
            previousDate = currentDate;
            do
            {
               currentDate = currentDate.AddDays(1);
            } while (currentDate <= endDate && ( currentDate.DayOfWeek == DayOfWeek.Saturday || currentDate.DayOfWeek == DayOfWeek.Sunday || serie.IndexOf(currentDate) == -1));
             }
        }
        public IUpdatePeriod Create(UpdatePeriod updatePeriodType)
        {
            switch (updatePeriodType)
            {
            case UpdatePeriod.Fixed:
                return(new UpdatePeriodFixed(_frameworkMessenger, _debugAnalytics));

            case UpdatePeriod.Fixed_Adaptive:
                return(new UpdatePeriodFixedAdaptive(_frameworkMessenger, _debugAnalytics));

            case UpdatePeriod.Variable:
                return(new UpdatePeriodVariable(_frameworkMessenger, _debugAnalytics));
            }

            throw new Yak2DException("Invalid update period Enum -> shouldn't be possible :)");
        }
Exemple #8
0
        public static TimeSpan ToDuration(this UpdatePeriod period)
        {
            switch (period)
            {
            case UpdatePeriod.Never:
                return(TimeSpan.MaxValue);

            case UpdatePeriod.Minutes5:
                return(TimeSpan.FromMinutes(5));

            case UpdatePeriod.Minutes15:
                return(TimeSpan.FromMinutes(15));

            case UpdatePeriod.Minutes30:
                return(TimeSpan.FromMinutes(30));

            case UpdatePeriod.Hours1:
                return(TimeSpan.FromHours(1));

            case UpdatePeriod.Hours2:
                return(TimeSpan.FromHours(2));

            case UpdatePeriod.Hours3:
                return(TimeSpan.FromHours(3));

            case UpdatePeriod.Hours6:
                return(TimeSpan.FromHours(6));

            case UpdatePeriod.Hours12:
                return(TimeSpan.FromHours(12));

            case UpdatePeriod.Day:
                return(TimeSpan.FromDays(1));

            case UpdatePeriod.Week:
                return(TimeSpan.FromDays(7));

            default:
                throw new NotImplementedException();
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="min">Minimum length of time between updates.</param>
 /// <param name="max">Maximum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod min, UpdatePeriod max, CacheStyle cacheStyle)
 {
     CreateUpdateAttribute(defaultPeriod, min, max, cacheStyle);
 }
Exemple #10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="minimum">Minimum length of time between updates.</param>
 /// <param name="maximum">Maximum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod minimum, UpdatePeriod maximum, CacheStyle cacheStyle)
 {
     CreateUpdateAttribute(defaultPeriod, minimum, maximum, cacheStyle);
 }
Exemple #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="minimum">Minimum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod minimum, CacheStyle cacheStyle)
 {
     CreateUpdateAttribute(defaultPeriod, minimum, UpdatePeriod.Week, cacheStyle);
 }
Exemple #12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="min">Minimum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod min, CacheStyle cacheStyle)
 {
     CreateUpdateAttribute(defaultPeriod, min, UpdatePeriod.Week, cacheStyle);
 }
Exemple #13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod"></param>
 /// <param name="min"></param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod min)
 {
     this.DefaultPeriod = defaultPeriod;
     this.Maximum       = UpdatePeriod.Week;
     this.Minimum       = min;
 }
Exemple #14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod"></param>
 /// <param name="min"></param>
 /// <param name="max"></param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod min, UpdatePeriod max)
 {
     this.DefaultPeriod = defaultPeriod;
     this.Minimum       = min;
     this.Maximum       = max;
 }
Exemple #15
0
 /// <summary>
 /// Constructor helper method.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="minimum">Minimum length of time between updates.</param>
 /// <param name="maximum">Maximum length of time between updates.</param>
 /// <param name="cacheStyle">Cache style.</param>
 private void CreateUpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod minimum, UpdatePeriod maximum, CacheStyle cacheStyle)
 {
     DefaultPeriod = defaultPeriod;
     Minimum = minimum;
     Maximum = maximum;
     CacheStyle = cacheStyle;
 }
Exemple #16
0
 public MonthlyWebsite(int id, string title, string url, PageStyle pageStyle, DateTime lastChecked, UpdatePeriod updatePeriod = UpdatePeriod.Weekly, int expectedDay = 1, DayOfWeek expectedDayOfWeek = DayOfWeek.Monday) :
     base(id, title, url, pageStyle, lastChecked, updatePeriod, expectedDay, expectedDayOfWeek)
 {
 }
Exemple #17
0
 /// <summary>
 /// Constructor helper method.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="minimum">Minimum length of time between updates.</param>
 /// <param name="maximum">Maximum length of time between updates.</param>
 private void CreateUpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod minimum, UpdatePeriod maximum)
 {
     DefaultPeriod = defaultPeriod;
     Minimum       = minimum;
     Maximum       = maximum;
 }
Exemple #18
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="defaultPeriod">Default length of time between updates.</param>
 /// <param name="minimum">Minimum length of time between updates.</param>
 /// <param name="maximum">Maximum length of time between updates.</param>
 public UpdateAttribute(UpdatePeriod defaultPeriod, UpdatePeriod minimum, UpdatePeriod maximum)
 {
     CreateUpdateAttribute(defaultPeriod, minimum, maximum);
 }
Exemple #19
0
 public void Parse(XmlReader xmlReader)
 {
     while (xmlReader.Read())
     {
         if (xmlReader.NodeType == XmlNodeType.Element)
         {
             switch (xmlReader.LocalName)
             {
                 case "updatePeriod":
                     xmlReader.MoveToContent();
                     updatePeriod = (UpdatePeriod)Enum.Parse(typeof(UpdatePeriod), xmlReader.ReadString(), true);
                     break;
                 case "updateFrequency":
                     xmlReader.MoveToContent();
                     updateFrequency = Int32.Parse(xmlReader.ReadString());
                     break;
                 case "updateBase":
                     xmlReader.MoveToContent();
                     updateBase = DTHelper.ParseDateTime(xmlReader.ReadString());
                     break;
             }
         }
     }
 }