コード例 #1
0
ファイル: ReadAllSelect.cs プロジェクト: presslxqii/CondorWPF
        //Конструктор
        public ReadAllSelect(string beginDate, string endDate)
        {
            var tagsList = new Tags();

            Messur = new List <RoadName>();;
            var hdas = Connect.ServerHdaConnect();
            //var listTag = tagsList.GetMassurm().Select(tags => Convert.ToString(tags.Value)).ToList();
            var listTag = new List <string>();

            foreach (var tag in tagsList.GetMassurm())
            {
                switch (tag.Name)
                {
                case "NameRoad":
                    listTag.Add(tag.Value);
                    break;
                }
            }

            Signal name = null;


            var di = new SignalDict(hdas, listTag, null, beginDate, endDate);

            foreach (var tag in tagsList.GetMassurm())
            {
                switch (tag.Name)
                {
                case "NameRoad":
                    name = di.Dictionary[tag.Value];
                    break;
                }
            }

            for (var sec = 0; sec <= (name.DtEnd - name.DtBegin).TotalSeconds - 1; sec += 25)
            {
                var nm  = name.DtBegin.AddSeconds(sec);
                var nam = Seconds.GetValue(name, nm).OpcRec;

                var alarms = new RoadName {
                    Time = nam.Timestamp, Name = Convert.ToString(nam.Value)
                };
                if (nam.Value.ToString() == string.Empty)
                {
                    continue;
                }
                var flag = true;


                Messur.Add(alarms);
            }
        }
コード例 #2
0
        public void Validate()
        {
            string roadName = RoadName?.Trim();

            if (string.IsNullOrEmpty(roadName))
            {
                throw new InvalidTrafficJamException("Road must be set!");
            }
            ValidateLocation(FromLocation, "FromLocation");
            ValidateLocation(ToLocation, "ToLocation");

            if (Reason == null)
            {
                Reason = String.Empty;
            }
            if (Description == null)
            {
                Description = String.Empty;
            }
        }