예제 #1
0
파일: Rollout.cs 프로젝트: jhogan/qed
 public static Rollouts GetAllUnrolled(string ORDER_BY)
 {
     Rollouts rollouts = new Rollouts();
     Rollout rollout;
     using (MySqlConnection conn = Connections.Inst.item("QED_DB").MySqlConnection){
         conn.Open();
         using(MySqlCommand cmd = conn.CreateCommand()){
             cmd.CommandText = "SELECT * FROM " + _table + " WHERE rolled = 0" + ((ORDER_BY.Trim().Length == 0) ? "" : " ORDER BY " + ORDER_BY);
             using(MySqlDataReader dr = cmd.ExecuteReader()){
                 while(dr.Read()){
                     rollout = new Rollout(dr);
                     rollouts.Add(rollout);
                 }
             }
         }
     }
     return rollouts;
 }
예제 #2
0
파일: Rollout.cs 프로젝트: jhogan/qed
 public static Rollouts Get(DateTime from, DateTime to, bool rolled, string orderBy)
 {
     Rollouts rollouts = new Rollouts();
     Rollout rollout;
     using (MySqlConnection conn = Connections.Inst.item("QED_DB").MySqlConnection){
         conn.Open();
         using(MySqlCommand cmd = conn.CreateCommand()){
             cmd.CommandText = "SELECT * FROM " + _table + " WHERE scheduledDate BETWEEN @FROM AND @TO AND rolled = @ROLLED ORDER BY " + orderBy;
             cmd.Parameters.Add("@FROM", from);
             cmd.Parameters.Add("@TO", to);
             cmd.Parameters.Add("@ROLLED", rolled);
             using(MySqlDataReader dr = cmd.ExecuteReader()){
                 while(dr.Read()){
                     rollout = new Rollout(dr);
                     rollouts.Add(rollout);
                 }
             }
         }
     }
     return rollouts;
 }