Beispiel #1
0
        /// <summary>
        /// Получает данные для набора точек за определенный промежуток времени
        /// </summary>
        /// <param name="MPD">Набор идентификаторов точек с промежутками дат</param>
        /// <returns>данные для набора точек за определенный промежуток времени</returns>
        public static List <SGSPointData> GetPointData(ManyPointsData MPD)
        {
            var res = new UniversalModel <SGSPointData>();

            res.QParameters.Add(new SqlParameter("@Points", MPD.ToXMLString()));
            return(res.GetFromDBList("GetPointData"));
        }
        public void GetDataSetTest_GetPointData_manyPoint_pid_1_4_DT_2020_04_01_07_39_0_0()
        {
            var res  = new QueryExecutor("GetPointData");
            var pids = new List <long>()
            {
                1, 4
            };
            var mpd = new ManyPointsData {
                PointsId = pids, DateFrom = new DateTime(2020, 4, 1, 7, 39, 0, 0), DateTo = new DateTime(2020, 4, 1, 7, 39, 0, 0)
            };

            res.Parameters.Add(new SqlParameter("@Points", mpd.ToXMLString()));
            var ds = res.GetDataSet;

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                foreach (DataColumn cn in row.Table.Columns)
                {
                    Console.Write($"{cn.ColumnName}:{row[cn]}| ");
                }
                Console.WriteLine();
                Console.WriteLine("________________________________________________________________________________________________________");
            }
            Assert.AreEqual(1, ds.Tables[0].Rows.Count);
        }
Beispiel #3
0
        public void MPDToXMLStringTest()
        {
            var exam = @"
<ManyPointsData xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <DateFrom>2020-06-04T20:35:00</DateFrom>
  <DateTo>2020-06-04T21:00:00</DateTo>
  <PointsId>1</PointsId>
  <PointsId>4</PointsId>
  <PointsId>5</PointsId>
</ManyPointsData>";
            var pids = new List <long>();

            pids.Add(1);
            pids.Add(4);
            pids.Add(5);
            var res = new ManyPointsData {
                PointsId = pids,
                DateFrom = new DateTime(2020, 06, 4, 20, 35, 0),
                DateTo   = new DateTime(2020, 06, 4, 21, 00, 0)
            };

            Console.WriteLine(res.ToXMLString());
            Assert.AreEqual(exam, res.ToXMLString());

            exam = @"
<ManyPointsData xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <DateFrom>2020-06-04T20:35:00</DateFrom>
  <PointsId>1</PointsId>
  <PointsId>4</PointsId>
  <PointsId>5</PointsId>
</ManyPointsData>";
            res  = new ManyPointsData
            {
                PointsId = pids,
                DateFrom = new DateTime(2020, 06, 4, 20, 35, 0)
            };
            Console.WriteLine(res.ToXMLString());
            Assert.AreEqual(exam, res.ToXMLString());

            exam = @"
<ManyPointsData xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <PointsId>1</PointsId>
  <PointsId>4</PointsId>
  <PointsId>5</PointsId>
</ManyPointsData>";
            res  = new ManyPointsData
            {
                PointsId = pids
            };
            Console.WriteLine(res.ToXMLString());
            Assert.AreEqual(exam, res.ToXMLString());
        }
        public void SGSPDGetPointDataTest_pid_1_4_Z()
        {
            var contDT = new List <long> {
                1, 4
            };
            var mpd = new ManyPointsData {
                PointsId = contDT
            };
            var res = SGSPointData.GetPointData(contDT);

            Assert.IsTrue(res.Count > 0);
            foreach (var m in res)
            {
                Console.WriteLine(m);
            }
        }
Beispiel #5
0
 public IEnumerable <SGSPointData> Post([FromBody] ManyPointsData manyPointsData)
 {
     return(SGSPointData.GetPointData(manyPointsData.PointsId, manyPointsData.DateFrom, manyPointsData.DateTo));
 }