Пример #1
0
        /* Select group by count(*) from SGAlarmInfo of CategoryId */
        public Dictionary <LSIDEBAR, int> SelectAlarmInfoCategoryCount(int groupId)
        {
            Dictionary <LSIDEBAR, int> AlarmDic;

            AlarmDic = DBCtx.Alarms
                       .Where(Alarm => Alarm.GroupId == groupId)
                       .GroupBy(Alarm => Alarm.CategoryId)
                       .Select(Alarm => new
            {
                CategoryId    = Alarm.Key,
                CategoryCount = Alarm.Count()
            }
                               )
                       .OrderBy(Alarm => Alarm.CategoryId)
                       .ToDictionary(Alarm => Alarm.CategoryId, Alarm => Alarm.CategoryCount);
            return(AlarmDic);
        }
Пример #2
0
    static void Main(string[] args)
    {
        Baterai baterai = new Baterai {
            Kapsitas = 75
        };
        Alarm alarm = new Alarm(baterai, false);

        Alarm.Count();
        Alarm alarm2 = new Alarm();

        Alarm.Count();
        Alarm.machineCode = "MOVFFF0X";
        Alarm alarm3 = new Alarm();

        Alarm.Count();
        Alarm alarm4 = new Alarm();

        Alarm.Count();

        Console.ReadKey();
    }