public List <FrayteSystemAlert> GetSystemAlerts(TrackSystemAlert trackSystemAlert)
 {
     try
     {
         List <FrayteSystemAlert> list = new List <FrayteSystemAlert>();
         list = new SystemAlertRepository().GetSystemAlerts(trackSystemAlert);
         return(list);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
        public List <FrayteSystemAlert> GetSystemAlerts(TrackSystemAlert trackSystemAlert)
        {
            int SkipRows = 0;

            SkipRows = (trackSystemAlert.CurrentPage - 1) * trackSystemAlert.TakeRows;
            var result = dbContext.spGet_GetSystemAlerts(trackSystemAlert.OperationZoneId, trackSystemAlert.FromDate, trackSystemAlert.ToDate,
                                                         SkipRows, trackSystemAlert.TakeRows).ToList();
            List <FrayteSystemAlert> list = new List <FrayteSystemAlert>();

            if (result != null && result.Count > 0)
            {
                FrayteSystemAlert SystemAlertResult;
                foreach (var data in result)
                {
                    SystemAlertResult = new FrayteSystemAlert();
                    SystemAlertResult.SystemAlertId       = data.SystemAlertId;
                    SystemAlertResult.OperationZoneId     = data.OperationZoneId;
                    SystemAlertResult.Heading             = data.Heading;
                    SystemAlertResult.Description         = data.Description;
                    SystemAlertResult.FromDate            = data.FromDate;
                    SystemAlertResult.FromTime            = UtilityRepository.GetTimeZoneTime(data.FromTime);
                    SystemAlertResult.ToDate              = data.ToDate;
                    SystemAlertResult.ToTime              = UtilityRepository.GetTimeZoneTime(data.ToTime);
                    SystemAlertResult.IsActive            = data.IsActive;
                    SystemAlertResult.TotalRows           = data.TotalRows.Value;
                    SystemAlertResult.TimeZoneDetail      = new TimeZoneModal();
                    SystemAlertResult.TimeZoneDetail.Name = data.TimeZoneName;
                    if (data.TimezoneId.HasValue)
                    {
                        SystemAlertResult.TimeZoneDetail.TimezoneId = data.TimezoneId.Value;
                    }
                    SystemAlertResult.TimeZoneDetail.Offset      = data.TimeZoneOffset;
                    SystemAlertResult.TimeZoneDetail.OffsetShort = data.TimeZoneOffsetShort;
                    var TimeZoneInformation = TimeZoneInfo.FindSystemTimeZoneById(data.TimeZoneName);
                    SystemAlertResult.FromTime = UtilityRepository.UtcDateToOtherTimezone(data.FromDate, data.FromTime, TimeZoneInformation).Item2;
                    SystemAlertResult.FromDate = UtilityRepository.UtcDateToOtherTimezone(data.FromDate, data.FromTime, TimeZoneInformation).Item1;
                    SystemAlertResult.ToTime   = UtilityRepository.UtcDateToOtherTimezone(data.ToDate, data.ToTime, TimeZoneInformation).Item2;
                    SystemAlertResult.ToDate   = UtilityRepository.UtcDateToOtherTimezone(data.ToDate, data.ToTime, TimeZoneInformation).Item1;
                    list.Add(SystemAlertResult);
                }
            }
            return(list);
        }