예제 #1
0
        public List <Point> Search(string searchString)
        {
            List <Point> children;
            List <Point> result = new List <Point>();
            Point        current;
            string       sql = string.Format(@"
select id_point from points where pointname like '%{0}%'
and dbo.treerootid(id_point) in ({1})",
                                             searchString, string.Join(",", roots.Select(r => r.ID.ToString())));
            DataTable found = m.GetData(sql, 60);

            foreach (DataRow row in found.Rows)
            {
                current = this.GetPoint((int)row[0]);
                if (current == null)
                {
                    int[] path = GetPathReversed((int)row[0]);
                    foreach (int id in path)
                    {
                        current = this.GetPoint(id);
                        if (current == null)
                        {
                            break;
                        }
                        if (!current.Loaded)
                        {
                            children = current.Children;
                            PointsUpdate?.Invoke(new PointEventArgs()
                            {
                                Points = children, ParentPoint = current
                            });
                        }
                    }
                }
                if (current?.ID == (int)row[0])
                {
                    result.Add(current);
                }
            }
            return(result);
        }
예제 #2
0
        public DataTable MeterLogs(List <Parameter> pps, DateTime dtStart, DateTime dtEnd)
        {
            string sql = string.Format(@"
select dbo.zzz_getps(pp.id_point) Подстанция,
(select pointname from points where id_point=pp.ID_Point) Счетчик,
d.dt Дата, d.description Описание,d.comment Дополнительно
from pointparams pp
inner join schemacontents sc_high on pp.ID_PP=sc_high.ID_PP and
sc_high.RefIsPoint=2
inner join schemacontents sc_low on sc_high.ID_Ref=sc_low.ID_PP and
sc_low.refispoint=1
inner join channels_main c1 on c1.ID_Channel=sc_low.ID_Ref and
sc_low.RefIsPoint=1
inner join channels_main c2 on c2.ID_USPD=c1.ID_USPD and c2.TypeChan='J'
inner join vwDiscretsWithDesc d on d.id_channel=c2.ID_Channel
where d.dt between '{0}' and '{1}'
and sc_high.id_pp in ({2})
order by 1,2,3 desc",
                                       dtStart.ToString("yyyyMMdd"), dtEnd.ToString("yyyyMMdd"),
                                       string.Join(",", pps.Select(p => p.Id)));

            return(m.GetData(sql, 120));
        }