예제 #1
0
 private bool TryGetTime()
 {
     if (!IsConnected && !Connect())
     {
         return(false);
     }
     try
     {
         Logger.AddEvent("Определение диапазона источника");
         var cmd = new OleDbCommand("Exec RT_ARCHDATE", Connection);
         using (OleDbDataReader rec = cmd.ExecuteReader())
         {
             if (rec == null)
             {
                 return(false);
             }
             rec.Read();
             BeginTime = (DateTime)rec[0];
             EndTime   = (DateTime)rec[1];
             TimeIntervals.Clear();
             TimeIntervals.Add(new TimeInterval(BeginTime, EndTime));
             Logger.AddEvent("Диапазон источника определен", BeginTime + " - " + EndTime);
             return(BeginTime.ToString() != "0:00:00");
         }
     }
     catch (Exception ex)
     {
         Logger.AddError("Ошибка определения диапазона архива ПТК Космотроника", ex);
         IsConnected = false;
         return(false);
     }
 }
예제 #2
0
파일: Input.cs 프로젝트: Adi7693/PostRig
        private void TimeCalculate()
        {
            if (TimeNeedsToRecalculate)
            {
                if (TimeIntervals == null)
                {
                    TimeIntervals = new List <double>();
                }

                TimeIntervals.Clear();

                //DateTime time = DateTime.Now;

                for (double i = StartTime; i <= EndTime + TimeStep / 2.0; i += TimeStep)
                {
                    double interval = Math.Round(i, 6);
                    TimeIntervals.Add(interval);
                }

                //_tTime = (DateTime.Now - time).TotalMilliseconds;

                TimeNeedsToRecalculate = false;

                FrequencyNeedsToRecalculate = true;
            }
        }
예제 #3
0
        //Получение времени источника
        public TimeInterval GetTime()
        {
            TimeIntervals.Clear();
            TimeInterval t = null;

            try
            {
                if (IsOriginal)
                {
                    t = new TimeInterval(Different.MinDate.AddYears(1), DateTime.Now);
                }
                else
                {
                    using (var sys = new SysTabl(DatabaseFile, false))
                        t = new TimeInterval(DateTime.Parse(sys.Value("BeginInterval")), DateTime.Parse(sys.Value("EndInterval")));
                }
                TimeIntervals.Add(t);
            }
            catch (Exception ex)
            {
                AddError("Ошибка определения диапазона источника", ex);
                IsConnected = false;
            }
            return(t);
        }
예제 #4
0
        //Получение времени источника
        public TimeInterval GetTime()
        {
            TimeIntervals.Clear();
            var t = new TimeInterval(Different.MinDate.AddYears(1), DateTime.Now);

            TimeIntervals.Add(t);
            return(t);
        }
예제 #5
0
        //Получение диапазона архива по блокам истории
        public TimeInterval GetTime()
        {
            TimeIntervals.Clear();
            var ti = new TimeInterval(Different.MinDate, Different.MaxDate);

            TimeIntervals.Add(ti);
            return(ti);
        }
예제 #6
0
 //Получение диапазона клона
 public TimeInterval GetTime()
 {
     if (CloneFile.IsEmpty())
     {
         return(new TimeInterval(Different.MinDate, Different.MaxDate));
     }
     using (var sys = new SysTabl(CloneFile))
     {
         TimeIntervals.Clear();
         var t = new TimeInterval(sys.Value("BeginInterval").ToDateTime(), IsHandInput ? DateTime.Now : sys.Value("EndInterval").ToDateTime());
         TimeIntervals.Add(t);
         return(t);
     }
 }
예제 #7
0
 //Получение диапазона клона
 public TimeInterval GetTime()
 {
     try
     {
         using (var rec = new DataSetSql(SqlProps, "SysTabl"))
         {
             rec.FindFirst("ParamName", "BeginInterval");
             TimeIntervals.Clear();
             var t = new TimeInterval(rec.GetString("ParamValue").ToDateTime(), DateTime.Now);
             TimeIntervals.Add(t);
             return(t);
         }
     }
     catch { return(new TimeInterval(Different.MinDate, Different.MaxDate)); }
 }
예제 #8
0
        //Получение диапазона архива по блокам истории
        public TimeInterval GetTime()
        {
            TimeIntervals.Clear();
            DateTime mind = Different.MaxDate, maxd = Different.MinDate;
            DateTime mint = Different.MaxDate, maxt = Different.MinDate;

            try
            {
                using (var rec = new ReaderAdo(SqlProps, "SELECT FromDate, ToDate FROM v_HistoryBlock ORDER BY FromDate, ToDate DESC"))
                    while (rec.Read())
                    {
                        var fromd = rec.GetTime("FromDate");
                        var tod   = rec.GetTime("ToDate");
                        if (fromd < mind)
                        {
                            mind = fromd;
                        }
                        if (fromd.Subtract(maxt).TotalMinutes > 1)
                        {
                            if (maxt != Different.MinDate)
                            {
                                TimeIntervals.Add(new TimeInterval(mint, maxt));
                            }
                            mint = fromd;
                        }
                        if (maxd < tod)
                        {
                            maxd = tod;
                        }
                        if (maxt < tod)
                        {
                            maxt = tod;
                        }
                    }
            }
            catch (Exception ex)
            {
                Logger.AddError("Ошибка при получении диапазона источника", ex);
            }
            if (mind == Different.MaxDate && maxd == Different.MinDate)
            {
                return(new TimeInterval(Different.MinDate, Different.MaxDate));
            }
            Logger.AddEvent("Диапазон источника определен", mind + " - " + maxd);
            return(new TimeInterval(mind, maxd));
        }
예제 #9
0
파일: InputData.cs 프로젝트: Adi7693/2DoF
        private void TimeCalculate()
        {
            if (TimeNeedsToRecalculate)
            {
                if (TimeIntervals == null)
                {
                    TimeIntervals = new List <double>();
                }

                TimeIntervals.Clear();

                for (double i = StartTime; i <= EndTime + TimeStep / 2.0; i += TimeStep)
                {
                    double interval = Math.Round(i, 6);
                    TimeIntervals.Add(interval);
                }

                TimeNeedsToRecalculate = false;
            }
        }
예제 #10
0
        //Получение диапазона архива
        public TimeInterval GetTime()
        {
            var pdic = Archive.ReadProjects(ReportType.Calc);
            var t    = new TimeInterval(Different.MaxDate, Different.MinDate);

            foreach (var pr in pdic.Values)
            {
                var dic = Archive.ReadRanges(pr.Code, ReportType.Calc);
                AddIntervalTime(dic, IntervalType.Day, t);
                AddIntervalTime(dic, IntervalType.Hour, t);
                AddIntervalTime(dic, IntervalType.Base, t);
                AddIntervalTime(dic, IntervalType.Moments, t);
                AddIntervalTime(dic, IntervalType.AbsoluteDay, t);
            }
            TimeIntervals.Clear();
            TimeIntervals.Add(t);
            BeginTime = t.Begin;
            EndTime   = t.End;
            return(t);
        }