public List <EPGInfo> GetEPGForChannel(string idChannel)
        {
            IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
            List <EPGInfo>  infos      = new List <EPGInfo>();
            SqlBuilder      sb         = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof(Program));

            sb.AddConstraint(Operator.Equals, "idChannel", Int32.Parse(idChannel));
            DateTime thisMorning = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            sb.AddConstraint(String.Format("startTime>='{0}'", thisMorning.ToString(GetDateTimeString(), mmddFormat)));
            sb.AddOrderByField(true, "startTime");
            SqlStatement stmt     = sb.GetStatement(true);
            IList        programs = ObjectFactory.GetCollection(typeof(Program), stmt.Execute());

            if (programs != null && programs.Count > 0)
            {
                foreach (Program prog in programs)
                {
                    EPGInfo epg = new EPGInfo();
                    epg.startTime   = prog.StartTime;
                    epg.endTime     = prog.EndTime;
                    epg.title       = prog.Title;
                    epg.description = prog.Description;
                    infos.Add(epg);
                }
            }
            return(infos);
        }
Ejemplo n.º 2
0
 public List<EPGInfo> GetEPGForChannel(string idChannel)
 {
   IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
   List<EPGInfo> infos = new List<EPGInfo>();
   SqlBuilder sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof (Program));
   sb.AddConstraint(Operator.Equals, "idChannel", Int32.Parse(idChannel));
   DateTime thisMorning = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
   sb.AddConstraint(String.Format("startTime>='{0}'", thisMorning.ToString(GetDateTimeString(), mmddFormat)));
   sb.AddOrderByField(true, "startTime");
   SqlStatement stmt = sb.GetStatement(true);
   IList programs = ObjectFactory.GetCollection(typeof (Program), stmt.Execute());
   if (programs != null && programs.Count > 0)
   {
     foreach (Program prog in programs)
     {
       EPGInfo epg = new EPGInfo();
       epg.startTime = prog.StartTime;
       epg.endTime = prog.EndTime;
       epg.title = prog.Title;
       epg.description = prog.Description;
       infos.Add(epg);
     }
   }
   return infos;
 }