Exemplo n.º 1
0
        public List <Detail> GetAllExternalApplicationByAlarmRuleCatalogId(int alarmNotificationId)
        {
            DBHelper._AlarmNotification dbhelp = new DBHelper._AlarmNotification();

            return(dbhelp.GetAllByAlarmRuleCatalogId(alarmNotificationId).Select(s => new Detail()
            {
                ExternalApplicationId = s.ExternalApplicationId,
                ExternalApplicationName = (s.ExternalApplication == null) ? "" : s.ExternalApplication.Name
            }).ToList <Detail>());
        }
Exemplo n.º 2
0
        public void AttachExternalApplication(int alarmNotificationId, Edit AlarmNotification)
        {
            DBHelper._AlarmNotification dbhelp = new DBHelper._AlarmNotification();
            List <AlarmNotification>    newExternalApplicationList   = new List <AlarmNotification>();
            List <AlarmNotification>    existExternalApplicationList = dbhelp.GetAllByAlarmRuleCatalogId(alarmNotificationId);

            dbhelp.Delete(existExternalApplicationList);
            if (AlarmNotification != null)
            {
                foreach (int ExternalApplicationId in AlarmNotification.ExternalApplicationIdList)
                {
                    if (ExternalApplicationId > 0)
                    {
                        newExternalApplicationList.Add(new AlarmNotification()
                        {
                            AlarmRuleCatalogId    = alarmNotificationId,
                            ExternalApplicationId = ExternalApplicationId
                        });
                    }
                }
            }

            dbhelp.Add(newExternalApplicationList);
        }