public IEnumerable<Core.Business.Sendsms> SelectAll() { IList<Core.Business.Sendsms> sendsmslist = new List<Core.Business.Sendsms>(); MySqlUtility sql = new MySqlUtility(); MySqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSendsms); if (reader != null) { while (reader.Read()) { Core.Business.Sendsms sendsms = new Core.Business.Sendsms(); if (!reader.IsDBNull(0)) sendsms.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) sendsms.StatusTime = reader.GetDateTime(1); if (!reader.IsDBNull(2)) sendsms.Content = reader.GetString(2); if (!reader.IsDBNull(3)) sendsms.Phone = reader.GetString(3); if (!reader.IsDBNull(4)) sendsms.ReturnFlag = reader.GetString(4); sendsms.MarkOld(); sendsmslist.Add(sendsms); } reader.Close(); } return sendsmslist; }
public Core.Business.Sendsms Select(Int64 id) { MySqlUtility sql = new MySqlUtility(); sql.AddParameter("@Id", MySqlDbType.Int64, id); MySqlDataReader reader = sql.ExecuteSqlReader(SqlSelectSendsms); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Sendsms sendsms = new Core.Business.Sendsms(); if (!reader.IsDBNull(0)) sendsms.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) sendsms.StatusTime = reader.GetDateTime(1); if (!reader.IsDBNull(2)) sendsms.Content = reader.GetString(2); if (!reader.IsDBNull(3)) sendsms.Phone = reader.GetString(3); if (!reader.IsDBNull(4)) sendsms.ReturnFlag = reader.GetString(4); reader.Close(); return sendsms; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public void Delete(Core.Business.Sendsms sendsms) { MySqlUtility sql = new MySqlUtility(); sql.AddParameter("@Id", MySqlDbType.Int64, sendsms.Id); sql.ExecuteSql(SqlDeleteSendsms); }
public void Insert(Core.Business.Sendsms sendsms) { MySqlUtility sql = new MySqlUtility(); string strSQL = "INSERT INTO Sendsms(Content,Phone) values('" + sendsms.Content + "', '"+sendsms.Phone+"');"; sql.ExecuteSql(strSQL); }
public void Update(Core.Business.Sendsms sendsms) { MySqlUtility sql = new MySqlUtility(); sql.AddParameter("@StatusTime", MySqlDbType.DateTime, sendsms.StatusTime); sql.AddParameter("@Content", MySqlDbType.VarChar, sendsms.Content); sql.AddParameter("@Phone", MySqlDbType.VarChar, sendsms.Phone); sql.AddParameter("@ReturnFlag", MySqlDbType.VarChar, sendsms.ReturnFlag); sql.AddParameter("@Id", MySqlDbType.Int64, sendsms.Id); sql.ExecuteSql(SqlUpdateSendsms); }