1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
<form id="form1" runat="server">
<!-- Définition des DataSources -->
<asp:SqlDataSource ID="UsersDS" runat="server" ConnectionString="<%$ ConnectionStrings:SMU_DEVConnectionString %>" SelectCommand="SELECT firstname + ' ' + lastname as name, ipn FROM XRUserInfo WHERE ipn IN (SELECT DISTINCT ipn FROM GnRights) ORDER BY lastname, firstname"></asp:SqlDataSource>
<asp:SqlDataSource ID="AccesDS" runat="server" ConnectionString="<%$ ConnectionStrings:SMU_DEVConnectionString %>"
SelectCommand="SELECT DISTINCT [applabel] FROM [GNLevels] WHERE ([appid] = @appid)">
<SelectParameters>
<asp:ControlParameter ControlID="UserAppsGridView" Name="appid"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="UserAppsDS" runat="server"
ConnectionString="<%$ ConnectionStrings:SMU_DEVConnectionString %>"
SelectCommand="SELECT id as 'appid',name, GNLevels.applabel
FROM GNAppz
INNER JOIN GNLevels ON GNLevels.appid = GNappz.id
INNER JOIN GNRights ON (GNRights.appid = GNAppz.id AND GNRights.applevel = GNLevels.applevel AND GNRights.ipn=@ipn)
ORDER BY id
"
UpdateCommand="UPDATE [GNRights] SET [applevel] = @applevel WHERE [ipn] = @ipn AND [appid] = @appid">
<SelectParameters>
<asp:ControlParameter ControlID="UsersDropDown" Name="ipn" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="applevel" Type="Int32" />
<asp:Parameter Name="ipn" Type="String" />
<asp:Parameter Name="appid" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<!-- Définition de l'interface -->
<asp:DropDownList ID="UsersDropDown" runat="server" DataSourceID="UsersDS" DataTextField="name" DataValueField="ipn" AutoPostBack="True"></asp:DropDownList>
<br /><br />
<asp:GridView ID="UserAppsGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="appid" DataSourceID="UserAppsDS">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="appid" HeaderText="appid" ReadOnly="True" SortExpression="appid" InsertVisible="False" />
<asp:BoundField DataField="name" HeaderText="name" ReadOnly="True" SortExpression="name" />
<asp:TemplateField HeaderText="applabel" SortExpression="applabel">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AppDS" DataTextField="applabel" DataValueField="applevel"></asp:DropDownList>
<asp:SqlDataSource ID="AppDS" runat="server"
ConnectionString="<%$ ConnectionStrings:SMU_DEVConnectionString %>"
SelectCommand="SELECT applabel,applevel FROM GNLevels WHERE appid = 1">
<SelectParameters>
<asp:ControlParameter ControlID="UserAppsGridView" Name="appid" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("applabel") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</form> |
Partager