/// <summary>Regista uma nova notcia</summary> public void AddNews( Entry entry ) { #if !DEBUG Mailer.SendToNewsML( entry.Title, entry.Content ); #endif Register(entry); }
/// <summary>Regista uma nova notícia</summary> protected override void Register( Entry entry ) { Hashtable parameters = new Hashtable(); parameters.Add( "@title", entry.Title ); parameters.Add( "@content", entry.Content ); SqlServerUtility.executeNonQuery("OrionsBelt_InsertNews",parameters); }
/// <summary>Regista uma nova notícia</summary> protected override void Register( Entry entry ) { PostGre.PostGreParam [] param = new PostGreParam[3]; param[0] = new PostGreParam( entry.Title,NpgsqlDbType.Varchar ); param[1] = new PostGreParam( entry.Content,NpgsqlDbType.Varchar ); param[2] = new PostGreParam( entry.Language,NpgsqlDbType.Varchar ); PostGreServerUtility.executeNonQuery2("OrionsBelt_InsertNews",param); }
/// <summary>Regista uma nova notícia</summary> protected override void Register( Entry entry ) { /*CREATE TABLE News ( Id int NOT NULL auto_increment, Title varchar(100) NOT NULL, Content mediumtext NOT NULL, Date datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (Id) ) TYPE=MyISAM; */ string query = string.Format("INSERT INTO News(Title, Content, Date) VALUES('{0}', '{1}', NOW())", entry.Title, entry.Content ); MySqlUtility.executeNonQuery(query); }
/// <summary>Cria uma NewsList com base num DataSet</summary> /// <remarks> /// Este mtodo espera um dataset com as seguintes colunas, na /// ordem seguinte: /// id | Title | Content | Date /// /// O mtodo no liga aos nomes, vai aos ndices buscar o contedo /// </remarks> public NewsList NewsFromDataSet( DataSet ds ) { NewsList list = new NewsList(); foreach( DataRow row in ds.Tables[0].Rows ) { DateTime date = (DateTime) row[3]; string title = row[1].ToString(); string message = row[2].ToString(); string lang = row[3].ToString(); Entry entry = new Entry(date, message, title,lang); entry.Id = (int) row[0]; list.List.Add(entry); } return list; }
/// <summary>Regista uma nova notcia</summary> protected abstract void Register( Entry entry );