Esempio n. 1
0
        public static DateTime?GetNextDate(ScheduleEnum scheduleType, int time, int timezone, DayOfWeek dayOfWeek,
                                           int dayOfMonth)
        {
            var currentDate = DateTime.UtcNow.Date.AddHours(time).AddMinutes(timezone);

            return(GetNextDate(currentDate, scheduleType, dayOfWeek, dayOfMonth));
        }
Esempio n. 2
0
        public static DateTime?GetNextDate(DateTime start, ScheduleEnum scheduleType, DayOfWeek?dayOfWeek, int?dayOfMonth)
        {
            DateTime?nextdate = null;

            switch (scheduleType)
            {
            case ScheduleEnum.Daily:
                nextdate = GetNextDay(start);
                break;

            case ScheduleEnum.Weekly:
                nextdate = GetNextWeekday(start, (DayOfWeek)dayOfWeek);
                break;

            case ScheduleEnum.Monthly:
                nextdate = GetNextMonthday(start, (int)dayOfMonth);
                break;

            case ScheduleEnum.None:
            default:
                nextdate = null;
                break;
            }
            return(nextdate);
        }
Esempio n. 3
0
        public void Configure(EntityTypeBuilder <Card> builder)
        {
            CheckScheduleMaxLength();

            builder
            .Property(p => p.Schedule)
            .HasConversion(
                p => p.Value,
                p => ScheduleEnum.FromValue(p)
                )
            .HasMaxLength(SCHEDULE_MAX_LENGTH);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayoutScheduleResponse" /> class.
 /// </summary>
 /// <param name="nextScheduledPayout">The date of the next scheduled payout. (required).</param>
 /// <param name="schedule">The payout schedule of the account. &gt;Permitted values: &#x60;DEFAULT&#x60;, &#x60;HOLD&#x60;, &#x60;DAILY&#x60;, &#x60;WEEKLY&#x60;, &#x60;MONTHLY&#x60;. (required).</param>
 public PayoutScheduleResponse(DateTime?nextScheduledPayout = default(DateTime?), ScheduleEnum schedule = default(ScheduleEnum))
 {
     // to ensure "schedule" is required (not null)
     if (schedule == null)
     {
         throw new InvalidDataException("schedule is a required property for PayoutScheduleResponse and cannot be null");
     }
     else
     {
         this.Schedule = schedule;
     }
     this.NextScheduledPayout = nextScheduledPayout;
 }
Esempio n. 5
0
 public ResourceSchedule(SortUser sortUserTool, ICalcInterfere cInterfere, TDCalcCommonParam m_CommonParam,
     List<TDHSDPABearer> bearerList)
 {
     this.m_SortUser = sortUserTool;
     this.m_CalcInterfere = cInterfere;
     this.m_BearerList = bearerList;
     this.m_Linkloss = m_CommonParam.CalcLinkLoss;
     this.m_trafficpriority = m_CommonParam.TdUIParam.TrafficPriorityFactor;
     this.m_userpriority = m_CommonParam.TdUIParam.UEPriorityFactor;
     this.m_chpriority = m_CommonParam.TdUIParam.CHPriorityFactor;
     this.m_IsCDMAon = m_CommonParam.TdUIParam.IsCDMAon;
     this.m_ScheduleType = m_CommonParam.TdUIParam.HSPA_SheduleType;
     m_GetTDLinkLoss = new TDLinkLossCalc(m_Linkloss);
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdatePayoutScheduleRequest" /> class.
 /// </summary>
 /// <param name="action">Direction on how to handle any payouts that have already been scheduled. Permitted values: * &#x60;CLOSE&#x60; will close the existing batch of payouts. * &#x60;UPDATE&#x60; will reschedule the existing batch to the new schedule. * &#x60;NOTHING&#x60; (**default**) will allow the payout to proceed..</param>
 /// <param name="reason">The reason for the payout schedule update. &gt; This field is required when the &#x60;schedule&#x60; parameter is set to &#x60;HOLD&#x60;..</param>
 /// <param name="schedule">The payout schedule to which the account is to be updated. Permitted values: &#x60;DEFAULT&#x60;, &#x60;HOLD&#x60;, &#x60;DAILY&#x60;, &#x60;WEEKLY&#x60;, &#x60;MONTHLY&#x60;. &#x60;HOLD&#x60; will prevent scheduled payouts from happening but will still allow manual payouts to occur. (required).</param>
 public UpdatePayoutScheduleRequest(ActionEnum?action = default(ActionEnum?), string reason = default(string), ScheduleEnum schedule = default(ScheduleEnum))
 {
     // to ensure "schedule" is required (not null)
     if (schedule == null)
     {
         throw new InvalidDataException("schedule is a required property for UpdatePayoutScheduleRequest and cannot be null");
     }
     else
     {
         this.Schedule = schedule;
     }
     this.Action = action;
     this.Reason = reason;
 }
Esempio n. 7
0
        public void Update()
        {
            //GET Control page
            System.Net.HttpWebRequest  request;
            System.Net.HttpWebResponse response;
            StreamReader streamReader;
            String       responseString;

            request                 = (HttpWebRequest)System.Net.HttpWebRequest.Create(Account.DeviceControlURL + ID);
            request.KeepAlive       = true;
            request.CookieContainer = Account.Login();
            request.Method          = "GET";
            request.ContentType     = "application/x-www-form-urlencoded";
            request.UserAgent       = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36";

            response       = (HttpWebResponse)request.GetResponse();
            streamReader   = new StreamReader(response.GetResponseStream());
            responseString = streamReader.ReadToEnd();
            response.Close();

            Tools.Log(responseString);

            // pull out data
            CoolSetPoint = (int)double.Parse(Tools.Parse(responseString, "coolSetpoint, ", ");"));
            //Tools.Log( "coolSetPoint=" + CoolSetPoint );
            HeatSetPoint = (int)double.Parse(Tools.Parse(responseString, "heatSetpoint, ", ");"));
            //Tools.Log( "heatSetPoint=" + HeatSetPoint );
            Temperature = Tools.Parse(responseString, "dispTemperature, ", ");");
            //Tools.Log( "temperature=" + Temperature );

            SystemSwitch = (SystemSwitchEnum)int.Parse(Tools.Parse(responseString, "systemSwitchPosition, ", ");"));
            //Tools.Log( "SystemSwitch=" + SystemSwitch.ToString() );

            Schedule = (ScheduleEnum)int.Parse(Tools.Parse(responseString, "statusHeat, ", ");"));
            //Tools.Log( "Schedule=" + Schedule.ToString() );

            if (SystemSwitch == SystemSwitchEnum.Heat)
            {
                NextPeriod = int.Parse(Tools.Parse(responseString, "heatNextPeriod, ", ");"));
                //Tools.Log( "NextPeriod=" + NextPeriod );
            }
            if (SystemSwitch == SystemSwitchEnum.Cool)
            {
                NextPeriod = int.Parse(Tools.Parse(responseString, "coolNextPeriod, ", ");"));
                //Tools.Log( "NextPeriod=" + NextPeriod );
            }
        }
Esempio n. 8
0
/*
 * -- off -> set cool permanent hold heat at 50
 * CoolNextPeriod: null
 * CoolSetpoint: null
 * DeviceID: 416280
 * FanMode: null
 * HeatNextPeriod: null
 * HeatSetpoint: 51
 * StatusCool: 2
 * StatusHeat: 2
 * SystemSwitch: 1
 *
 * --> off
 * CoolNextPeriod: null
 * CoolSetpoint: null
 * DeviceID: 416280
 * FanMode: null
 * HeatNextPeriod: null
 * HeatSetpoint: null
 * StatusCool: null
 * StatusHeat: null
 * SystemSwitch: 2
 *
 * --> heat hold until 8:15 pm
 * CoolNextPeriod: 81
 * CoolSetpoint: null
 * DeviceID: 416280
 * FanMode: null
 * HeatNextPeriod: 81
 * HeatSetpoint: 52
 * StatusCool: 1
 * StatusHeat: 1
 * SystemSwitch: 1
 *
 * --> follow schedule
 * CoolNextPeriod: null
 * CoolSetpoint: 99
 * DeviceID: 416280
 * FanMode: null
 * HeatNextPeriod: null
 * HeatSetpoint: 50
 * StatusCool: 0
 * StatusHeat: 0
 * SystemSwitch: null
 */

        /// <summary>
        /// Control the thermostat
        /// </summary>
        /// <param name="systemSwitch">Off, Heat, Cool</param>
        /// <param name="schedule">FollowSchedule, HoldUntil, PermanentHold</param>
        /// <param name="setPoint">Set poitn for heating or cooling</param>
        /// <param name="holdHour">Hours to hold for. E.g. 2 holds for 2 hours.</param>
        /// <param name="holdMinute">Minutes to hold for in multiples of 15 minutes. E.g. 2 = 30 minutes</param>
        public void Set(SystemSwitchEnum systemSwitch, ScheduleEnum schedule, int setPoint, int nextPeriod)
        {
            System.Net.HttpWebRequest  request;
            System.Net.HttpWebResponse response;
            StreamReader streamReader;
            String       responseString;

            request                 = (HttpWebRequest)System.Net.HttpWebRequest.Create("https://mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges");
            request.KeepAlive       = false;
            request.ProtocolVersion = HttpVersion.Version10;
            request.CookieContainer = Account.Login();
            request.Method          = "POST";
            request.Accept          = "application/json, text/javascript, */*";
            request.ContentType     = "application/json; charset=UTF-8";
            request.UserAgent       = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36";
            string postData = "{ \"DeviceID\":" + ID;

            postData += ", \"CoolNextPeriod\":" + ((schedule == ScheduleEnum.HoldUntil) ? nextPeriod.ToString() : "null");
            postData += ", \"CoolSetPoint\":" + ((systemSwitch == SystemSwitchEnum.Cool) ? setPoint.ToString() : "null");
            postData += ", \"FanMode\":null";
            postData += ", \"HeatNextPeriod\":" + ((schedule == ScheduleEnum.HoldUntil) ? nextPeriod.ToString() : "null");
            postData += ", \"HeatSetPoint\":" + ((systemSwitch == SystemSwitchEnum.Heat) ? setPoint.ToString() : "null");
            postData += ", \"StatusCool\":" + (int)schedule;
            postData += ", \"StatusHeat\":" + (int)schedule;
            postData += ", \"SystemSwitch\":" + (int)systemSwitch;
            postData += "}";
            byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
            request.ContentLength = byteArray.Length;
            System.IO.Stream dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();

            response       = (HttpWebResponse)request.GetResponse();
            streamReader   = new StreamReader(response.GetResponseStream());
            responseString = streamReader.ReadToEnd();
            response.Close();
        }
Esempio n. 9
0
        public ActionResult Schedule(ScheduleEnum scheduleType = ScheduleEnum.None, int time = 0, int timezone = 0, DayOfWeek dayOfWeek = DayOfWeek.Monday, int dayOfMonth = 1)
        {
            CurrentUser.BackupPeriod = (int)scheduleType;
            switch (scheduleType)
            {
            case ScheduleEnum.Daily:
                CurrentUser.Time       = time;
                CurrentUser.DayOfWeek  = null;
                CurrentUser.DayOfMonth = null;
                break;

            case ScheduleEnum.Weekly:
                CurrentUser.Time       = time;
                CurrentUser.DayOfWeek  = (int)dayOfWeek;
                CurrentUser.DayOfMonth = null;
                break;

            case ScheduleEnum.Monthly:
                CurrentUser.Time       = time;
                CurrentUser.DayOfWeek  = null;
                CurrentUser.DayOfMonth = dayOfMonth;
                break;

            case ScheduleEnum.None:
            default:
                CurrentUser.Time       = null;
                CurrentUser.DayOfWeek  = null;
                CurrentUser.DayOfMonth = null;
                break;
            }
            CurrentUser.NextBackupDate = ScheduleHelper.GetNextDate(scheduleType, time, timezone, dayOfWeek, dayOfMonth);
            UnitOfWork.Commit();
            return
                (Json(
                     new ScheduleModel(CurrentUser.LastBackupDate, CurrentUser.NextBackupDate, CurrentUser.BackupPeriod, CurrentUser.Time, (DayOfWeek?)CurrentUser.DayOfWeek, CurrentUser.DayOfMonth)));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayoutScheduleResponse" /> class.
 /// </summary>
 /// <param name="nextScheduledPayout">The date of the next scheduled payout. (required).</param>
 /// <param name="schedule">The payout schedule of the account. &gt;Permitted values: &#x60;DEFAULT&#x60;, &#x60;HOLD&#x60;, &#x60;DAILY&#x60;, &#x60;WEEKLY&#x60;, &#x60;MONTHLY&#x60;. (required).</param>
 public PayoutScheduleResponse(DateTime?nextScheduledPayout = default(DateTime?), ScheduleEnum schedule = default(ScheduleEnum))
 {
     this.Schedule            = schedule;
     this.NextScheduledPayout = nextScheduledPayout;
 }
Esempio n. 11
0
        public Card(ScheduleEnum schedule)
        {
            Schedule = schedule;

            Events.Add(new CardCreatedEvent(this));
        }
Esempio n. 12
0
 //public HSUPA_CommonParam()
 //{
 //    InitUIParam();
 //}
 #endregion
 //Todo...
 private void InitUIParam()
 {
     SimTTINumber = m_UMTSUIParam.MaxTTINum;
     W_User = m_UMTSUIParam.W1;
     W_Service = m_UMTSUIParam.W2;
     W_SPI = m_UMTSUIParam.W3;
     ScheduleRule = m_UMTSUIParam.ScheduleType;
     ThermalNoise = m_UMTSUIParam.ThermalNoise;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdatePayoutScheduleRequest" /> class.
 /// </summary>
 /// <param name="action">Direction on how to handle any payouts that have already been scheduled. Permitted values: * &#x60;CLOSE&#x60; will close the existing batch of payouts. * &#x60;UPDATE&#x60; will reschedule the existing batch to the new schedule. * &#x60;NOTHING&#x60; (**default**) will allow the payout to proceed..</param>
 /// <param name="reason">The reason for the payout schedule update. &gt; This field is required when the &#x60;schedule&#x60; parameter is set to &#x60;HOLD&#x60;..</param>
 /// <param name="schedule">The payout schedule to which the account is to be updated. Permitted values: &#x60;DEFAULT&#x60;, &#x60;HOLD&#x60;, &#x60;DAILY&#x60;, &#x60;WEEKLY&#x60;, &#x60;MONTHLY&#x60;. &#x60;HOLD&#x60; will prevent scheduled payouts from happening but will still allow manual payouts to occur. (required).</param>
 public UpdatePayoutScheduleRequest(ActionEnum?action = default(ActionEnum?), string reason = default(string), ScheduleEnum schedule = default(ScheduleEnum))
 {
     this.Schedule = schedule;
     this.Action   = action;
     this.Reason   = reason;
 }