Hi,
I did all the developments so far, served to fetch and insert information from Microsoft CRM and so far no problems with permissions. Right now I have a problem that is inserting data into a table in a local server, a database of SQL Server 2008 R2 with LINQ
After creating a new module for this purpose, this contains a small form that will be inserting data into the table in sql server, but that only happens if you are Administrator and the EDIT mode is active. DNN version (DotNetNuke Community Edition version - 06:02:06)
CODE:
----------------------------------------------------------------
ViewTetos.ascx.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Entities.Modules;
namespace HD.Modules.Tetos
{
partial class ViewTetos : PortalModuleBase
{
#region Optional Interfaces
public ModuleActionCollection ModuleActions
{
get
{
ModuleActionCollection Actions = new ModuleActionCollection();
Actions.Add(this.GetNextActionID(), Localization.GetString(ModuleActionType.AddContent, this.LocalResourceFile), ModuleActionType.AddContent, "", "", this.EditUrl(), true, SecurityAccessLevel.Edit, true, false);
return Actions;
}
}
#endregion
#region Private Members
private string strTemplate;
#endregion
#region Event Handlers
protected void Page_Load(System.Object sender, System.EventArgs e)
{
}
#endregion
protected void btnAdd_Click(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
Coco tc = new Coco();
tc.tipo = txtTipo.Text;
tc.tamanho = txtTamanho.Text;
db.Cocos.InsertOnSubmit(tc);
db.SubmitChanges();
}
}
}
--------------------------------------------------------
ViewTetos.ascx
<%@ Control language="C#" Inherits="HD.Modules.Tetos.ViewTetos" CodeFile="ViewTetos.ascx.cs" AutoEventWireup="true"%>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 81px;
}
</style>
<table class="style1">
<tr>
<td class="style2">
Tipo</td>
<td>
<asp:TextBox ID="txtTipo" runat="server" Height="22px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
Tamanho</td>
<td>
<asp:TextBox ID="txtTamanho" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td>
<asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click"
Text="ADD" />
</td>
</tr>
</table>
------------------------------------------------------------
As you can see is a simple code.
Please Help,
Thanks.