Page_Load:
protected void Page_Load(System.Object sender, System.EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
if (((string)Settings["template"] != null) && ((string)Settings["template"] != ""))
strTemplate = (string)Settings["template"];
else
strTemplate = Localization.GetString("Template.Text", LocalResourceFile);
EtiquetaMagicaController objEtiquetaMagicas = new EtiquetaMagicaController();
List<EtiquetaMagicaInfo> colEtiquetaMagicas;
//get the content from the EtiquetaMagica table
colEtiquetaMagicas = objEtiquetaMagicas.GetEtiquetaMagicas(ModuleId);
if (colEtiquetaMagicas.Count == 0)
{
//add the content to the EtiquetaMagica table
EtiquetaMagicaInfo objEtiquetaMagica = new EtiquetaMagicaInfo();
objEtiquetaMagica.ModuleId = ModuleId;
objEtiquetaMagica.Content = Localization.GetString("DefaultContent", LocalResourceFile);
objEtiquetaMagica.CreatedByUser = this.UserId;
objEtiquetaMagicas.AddEtiquetaMagica(objEtiquetaMagica);
//get the content from the EtiquetaMagica table
colEtiquetaMagicas = objEtiquetaMagicas.GetEtiquetaMagicas(ModuleId);
}
//bind the content to the repeater
lstContent.DataSource = colEtiquetaMagicas;
lstContent.DataBind();
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
AddEtiquetaMagica at EtiquetaMagicaController.cs
public void AddEtiquetaMagica(EtiquetaMagicaInfo objEtiquetaMagica)
{
if (objEtiquetaMagica.Content.Trim() != "")
{
DataProvider.Instance().AddEtiquetaMagica(objEtiquetaMagica.ModuleId, objEtiquetaMagica.Content, objEtiquetaMagica.CreatedByUser);
}
}
AddEtiquetaMagica at SQLDataProvider.cs
public override void AddEtiquetaMagica(int ModuleId, string Content, int UserID)
{
SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddEtiquetaMagica"), ModuleId, Content, UserID);
}
Stored Procedure at 01.00.00.SqlDataProvider:
create procedure {databaseOwner}{objectQualifier}Tracasa_AddEtiquetaMagica
@ModuleId int,
@Content ntext,
@UserID int
as
insert into {objectQualifier}Tracasa_EtiquetaMagica (
ModuleId,
Content,
CreatedByUser,
CreatedDate
)
values (
@ModuleId,
@Content,
@UserID,
getdate()
)
GO
Best regards.