Beispiel #1
0
        public static IntervalEnum ToIntervalBaseEnum(this string anIntervalName)
        {
            IntervalEnum result = IntervalEnum.P1;

            switch (anIntervalName)
            {
            case "P1":
                result = IntervalEnum.P1;
                break;

            case "m2":
                result = IntervalEnum.m2;
                break;

            case "M2":
                result = IntervalEnum.M2;
                break;

            case "m3":
                result = IntervalEnum.m3;
                break;

            case "M3":
                result = IntervalEnum.M3;
                break;

            case "P4":
                result = IntervalEnum.P4;
                break;

            case "TT":
                result = IntervalEnum.TT;
                break;

            case "P5":
                result = IntervalEnum.P5;
                break;

            case "m6":
                result = IntervalEnum.m6;
                break;

            case "M6":
                result = IntervalEnum.M6;
                break;

            case "m7":
                result = IntervalEnum.m7;
                break;

            case "M7":
                result = IntervalEnum.M7;
                break;

            case "P8":
                result = IntervalEnum.P8;
                break;
            }
            return(result);
        }
        /// <summary>
        /// Converts local datetime to interval value basing on interval (db value)
        /// </summary>
        public static int ToIntervalValue(this DateTime localDateTime, IntervalEnum interval)
        {
            var epochStart = new LocalDateTime(2010, 01, 01, 0, 0, 0, 0); // Jan 1, 2010, a Friday
            var epochEnd   = LocalDateTime.FromDateTime(localDateTime);

            switch (interval)
            {
            case IntervalEnum.Day:
            case IntervalEnum.Custom:
                return((int)Period.Between(epochStart, epochEnd, PeriodUnits.Days).Days);

            case IntervalEnum.Week:
                return(((int)Period.Between(epochStart, epochEnd, PeriodUnits.Days).Days + 5) / 7);

            case IntervalEnum.Month:
                return((int)Period.Between(epochStart, epochEnd, PeriodUnits.Months).Months);

            case IntervalEnum.Year:
                return((int)Period.Between(epochStart, epochEnd, PeriodUnits.Years).Years);

            case IntervalEnum.AllTime:
                return(0);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #3
0
        public IHttpActionResult QueryQAHistroyDatasAPI(dynamic data)
        {
            var jsonData = data.ToString();
            QAReportSearchVM conditionModel = JsonConvert.DeserializeObject <QAReportSearchVM>(jsonData);
            IntervalEnum     time           = EventReportManagerService.GetIntervalInfo("OP1");

            if (string.IsNullOrEmpty(conditionModel.Time_interval) && string.IsNullOrEmpty(conditionModel.Tab_Select_Text))
            {
                conditionModel.Time_interval = time.Time_Interval;
                conditionModel.ProductDate   = DateTime.Parse(time.NowDate);
            }

            var result = QualityService.QueryQAHistroyDatas(conditionModel, DateTime.Parse(time.NowDate));

            return(Ok(result));
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InlineResponse20022CurrentPotentialLoss" /> class.
 /// </summary>
 /// <param name="amount">amount (required).</param>
 /// <param name="interval">interval (required).</param>
 public InlineResponse20022CurrentPotentialLoss(string amount = default(string), IntervalEnum interval = default(IntervalEnum))
 {
     // to ensure "amount" is required (not null)
     if (amount == null)
     {
         throw new InvalidDataException("amount is a required property for InlineResponse20022CurrentPotentialLoss and cannot be null");
     }
     else
     {
         this.Amount = amount;
     }
     // to ensure "interval" is required (not null)
     if (interval == null)
     {
         throw new InvalidDataException("interval is a required property for InlineResponse20022CurrentPotentialLoss and cannot be null");
     }
     else
     {
         this.Interval = interval;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="V3usersDepositLimits" /> class.
 /// </summary>
 /// <param name="interval">interval (required).</param>
 /// <param name="totalAllowance">totalAllowance (required).</param>
 public V3usersDepositLimits(IntervalEnum interval = default(IntervalEnum), string totalAllowance = default(string))
 {
     // to ensure "interval" is required (not null)
     if (interval == null)
     {
         throw new InvalidDataException("interval is a required property for V3usersDepositLimits and cannot be null");
     }
     else
     {
         this.Interval = interval;
     }
     // to ensure "totalAllowance" is required (not null)
     if (totalAllowance == null)
     {
         throw new InvalidDataException("totalAllowance is a required property for V3usersDepositLimits and cannot be null");
     }
     else
     {
         this.TotalAllowance = totalAllowance;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InlineResponse20022Queued" /> class.
 /// </summary>
 /// <param name="amount">amount (required).</param>
 /// <param name="authorised">authorised (required).</param>
 /// <param name="interval">interval (required).</param>
 /// <param name="startDate">startDate (required).</param>
 public InlineResponse20022Queued(string amount = default(string), bool?authorised = default(bool?), IntervalEnum interval = default(IntervalEnum), DateTime?startDate = default(DateTime?))
 {
     // to ensure "amount" is required (not null)
     if (amount == null)
     {
         throw new InvalidDataException("amount is a required property for InlineResponse20022Queued and cannot be null");
     }
     else
     {
         this.Amount = amount;
     }
     // to ensure "authorised" is required (not null)
     if (authorised == null)
     {
         throw new InvalidDataException("authorised is a required property for InlineResponse20022Queued and cannot be null");
     }
     else
     {
         this.Authorised = authorised;
     }
     // to ensure "interval" is required (not null)
     if (interval == null)
     {
         throw new InvalidDataException("interval is a required property for InlineResponse20022Queued and cannot be null");
     }
     else
     {
         this.Interval = interval;
     }
     // to ensure "startDate" is required (not null)
     if (startDate == null)
     {
         throw new InvalidDataException("startDate is a required property for InlineResponse20022Queued and cannot be null");
     }
     else
     {
         this.StartDate = startDate;
     }
 }
        public void Interval(double interval, Action task, IntervalEnum intervalEnum, Guid scheduleId, DayOfWeek dayEnum, bool rpeatedly, TimeSpan?startAt = null)
        {
            switch (intervalEnum)
            {
            case IntervalEnum.Day:
                interval *= 24;
                break;

            case IntervalEnum.Hour:
                break;

            case IntervalEnum.Minute:
                interval /= 60;
                break;

            case IntervalEnum.Second:
                interval /= 3600;
                break;
            }

            SchedulerService.Instance.ScheduleTask(interval, task, scheduleId, dayEnum, rpeatedly, startAt);
        }
Beispiel #8
0
        ///<summary>
        /// Calls GetExperimentStatsInfosWithinInterval on the server and waits for a response (synchronous).
        /// This should not be called on a UI thread
        ///</summary>
        public IEnumerable <ExperimnetStatsInfo> GetExperimentStatsInfosWithinInterval(IntervalEnum interval)
        {
            IAsyncResult result = BeginGetExperimentStatsInfosWithinInterval(interval, null, null);

            result.AsyncWaitHandle.WaitOne();

            return(EndGetExperimentStatsInfosWithinInterval(result));
        }
Beispiel #9
0
        ///<summary>
        /// Returns the result of calling GetExperimentStatsInfosWithinInterval on the server as an async Task.
        ///</summary>
        public Task <IEnumerable <ExperimnetStatsInfo> > GetExperimentStatsInfosWithinIntervalAsync(IntervalEnum interval)
        {
            var taskSource = new TaskCompletionSource <IEnumerable <ExperimnetStatsInfo> >();

            BeginGetExperimentStatsInfosWithinInterval(interval, asyncResult =>
            {
                try
                {
                    var result = EndGetExperimentStatsInfosWithinInterval(asyncResult);
                    taskSource.SetResult(result);
                }
                catch (Exception exception)
                {
                    taskSource.SetException(exception);
                }
            }, null);
            return(taskSource.Task);
        }
Beispiel #10
0
 ///<summary>
 /// Calls GetExperimentStatsInfos on the server and may or may not wait for a response see client.
 /// If this is synchronous it should not be called on the UI thread.
 ///</summary>
 public IAsyncResult BeginGetExperimentStatsInfosWithinInterval(IntervalEnum interval, System.AsyncCallback callback, object asyncState)
 {
     return(base.Channel.BeginGetExperimentStatsInfosWithinInterval(interval, callback, asyncState));
 }
Beispiel #11
0
        ///<summary>
        /// Calls GetiCInstrumentStatsInfosWithinInterval on the server and waits for a response (synchronous).
        /// This should not be called on a UI thread
        ///</summary>
        public IEnumerable <InstrumentStatsInfo> GetiCInstrumentStatsInfosWithinInterval(IntervalEnum interval, string iCProductName)
        {
            IAsyncResult result = BeginGetiCInstrumentStatsInfosWithinInterval(interval, iCProductName, null, null);

            result.AsyncWaitHandle.WaitOne();

            return(EndGetiCInstrumentStatsInfosWithinInterval(result));
        }
Beispiel #12
0
 ///<summary>
 /// Calls GetInstrumentInfos on the server and may or may not wait for a response see client.
 /// If this is synchronous it should not be called on the UI thread.
 ///</summary>
 public IAsyncResult BeginGetiCInstrumentStatsInfosWithinInterval(IntervalEnum interval, string iCProductName, System.AsyncCallback callback, object asyncState)
 {
     return(base.Channel.BeginGetiCInstrumentStatsInfosWithinInterval(interval, iCProductName, callback, asyncState));
 }