示例#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;
 }