public List <OffPrice> getOffPrices(string userid, string month) { try { Db.Mysql.Open(); MySqlCommand cmd = Db.Mysql.CreateCommand(); cmd.CommandText = "SELECT * FROM lignefraishorsforfait WHERE idutilisateur ='" + userid + "' AND mois='" + month + "'"; MySqlDataReader reader = cmd.ExecuteReader(); OffPrices = new List <OffPrice>(); while (reader.Read()) { OffPrice op = new OffPrice(Int32.Parse(reader["id"].ToString()), reader["idutilisateur"].ToString(), reader["mois"].ToString(), reader["libelle"].ToString(), reader["date"].ToString(), float.Parse(reader["montant"].ToString()), reader["justificatif"].ToString()); OffPrices.Add(op); } Db.Mysql.Close(); return(OffPrices); } catch (Exception e) { Console.WriteLine("ERROR: " + e); return(OffPrices); } }
public override string ToString() { string s = string.Format("{0}, 今日價格:{1} {2} {3}", this.Name, this.Price , OffPrice > 0 ? "超級特價 " + OffPrice.ToString() : "" , !Hot.IsEmpty ? "熱賣" : ""); return(s); }