Files
yavsc/plugins/fortune/MyClass.cs
Paul Schneider 31734da129 * Web.config:
* Web.csproj:
* instdbws.sql:
* packages.config:
* TestByteA.cs:
* App.master:
* MyClass.cs:
* LocalizedText.resx:
* Index.aspx:
* LocalizedText.fr.resx:
* packages.config:
* Details.aspx:
* packages.config:
* packages.config:
* packages.config:
* EventPub.aspx:
* LocalizedText.Designer.cs:
* FileSystemController.cs:
* FrontOfficeController.cs:
* NpgsqlContentProvider.cs:
* ITContentProvider.csproj:
* FileSystemManager.cs:
* Circle.cs:
* YaEvent.cs:
* NpgsqlBlogProvider.csproj:
* NpgsqlMRPProviders.csproj:
* EventPub.cs:
* NpgsqlContentProvider.csproj:
* EventType.cs:
* UserPrefs.cs:
* CalendarController.cs:
* EstablishmentType.cs: 

* ITCPNpgsqlProvider.cs:
* NpgsqlBlogProvider.cs:
* NpgsqlRoleProvider.cs:
* NpgsqlProfileProvider.cs:
* NpgsqlMembershipProvider.cs: Npgsql Command.Parameters.Add is
  obsolete

* Commande.cs: FileSystem ctor needs a format parameter in order to
  use path by membership

* google-services.json: intented to be used to build android
  application able to receive push notification via GCM
2015-06-02 01:42:49 +02:00

67 lines
1.5 KiB
C#

using System;
using Yavsc.Model;
using System.Configuration;
using System.Text;
using System.Collections.Generic;
namespace fortune
{
public class Entry {
public string Message{ get; set; }
public string Author{ get; set; }
public string Body{ get; set; }
}
public class MyClass : IModule
{
public MyClass ()
{
}
#region IModule implementation
string tblname = "fortune";
public void Install (System.Data.IDbConnection cnx)
{
using (var cmd = cnx.CreateCommand())
{
StringBuilder strb = new StringBuilder (string.Format("create table {0} ",tblname));
strb.Append ( "( author character varying (1024) not null, \n");
strb.Append ( "body character varying (65536) not null," +
"CONSTRAINT uniqueid PRIMARY KEY (uniqueid)," +
"uniqueid bigserial NOT NULL ) WITH (\n OIDS=FALSE\n);"
+string.Format("CREATE INDEX fki_cst{0}ref\n ON wrtags\n USING btree\n (tagid);",
tblname));
cmd.CommandText = strb.ToString ();
cmd.ExecuteNonQuery ();
}
}
public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig)
{
using (var cmd = cnx.CreateCommand ()) {
cmd.CommandText = string.Format ("drop table {0};", tblname);
cmd.ExecuteNonQuery ();
}
}
public void Initialize (string name, System.Collections.Specialized.NameValueCollection config)
{
}
/*
public class Discovery {
IServiceProvider[] Provider;
ISettingsProviderService[] SettingsBase;
}
public Discovery GetServices() {
throw new NotImplementedException ();
}
*/
#endregion
}
}