From: <ro...@us...> - 2006-07-27 18:44:36
|
Revision: 228 Author: rouquin Date: 2006-07-27 11:44:20 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=228&view=rev Log Message: ----------- Roles and Rights and Users all display correctly now (except for roles for rights - waiting on procedure). You can view everything and even insert new roles and rights, but you cannot add user, rights, products, etc to those roles and rights - I need update procedures for those. Anyhow, we may be ready to start defining rights and enforcing them. Modified Paths: -------------- Website/App_Code/tcdbDataSet.xsd Website/App_Code/tcdbDataSet.xss Website/Includes/AdministrationTree.ascx.cs Website/Includes/Rights.ascx Website/Includes/Rights.ascx.cs Website/Includes/Roles.ascx Website/Includes/Roles.ascx.cs Website/Includes/UserSettings.ascx Website/Includes/UserSettings.ascx.cs Modified: Website/App_Code/tcdbDataSet.xsd =================================================================== --- Website/App_Code/tcdbDataSet.xsd 2006-07-27 17:18:49 UTC (rev 227) +++ Website/App_Code/tcdbDataSet.xsd 2006-07-27 18:44:20 UTC (rev 228) @@ -753,7 +753,7 @@ </TableAdapter> <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="db_roleUserProductTableAdapter" GeneratorDataComponentClassName="db_roleUserProductTableAdapter" Name="db_roleUserProduct" UserDataComponentName="db_roleUserProductTableAdapter"> <MainSource> - <DbSource ConnectionRef="tcdbConnectionString (Web.config)" DbObjectName="tcdb.dbo.sel_roleUserProduct" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill"> + <DbSource ConnectionRef="tcdbConnectionString (Web.config)" DbObjectName="tcdb.dbo.sel_roleUserProduct" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill"> <SelectCommand> <DbCommand CommandType="StoredProcedure" ModifiedByUser="False"> <CommandText>dbo.sel_roleUserProduct</CommandText> @@ -779,6 +779,33 @@ <Sources> </Sources> </TableAdapter> + <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="db_roleRightTableAdapter" GeneratorDataComponentClassName="db_roleRightTableAdapter" Name="db_roleRight" UserDataComponentName="db_roleRightTableAdapter"> + <MainSource> + <DbSource ConnectionRef="tcdbConnectionString (Web.config)" DbObjectName="tcdb.dbo.sel_roleRight" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill"> + <SelectCommand> + <DbCommand CommandType="StoredProcedure" ModifiedByUser="False"> + <CommandText>dbo.sel_roleRight</CommandText> + <Parameters> + <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="False" SourceVersion="Current"> + </Parameter> + <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@roleID" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="False" SourceVersion="Current"> + </Parameter> + <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="Boolean" Direction="Input" ParameterName="@active" Precision="1" ProviderType="Bit" Scale="0" Size="1" SourceColumnNullMapping="False" SourceVersion="Current"> + </Parameter> + </Parameters> + </DbCommand> + </SelectCommand> + </DbSource> + </MainSource> + <Mappings> + <Mapping SourceColumn="roleID" DataSetColumn="roleID" /> + <Mapping SourceColumn="rightsID" DataSetColumn="rightsID" /> + <Mapping SourceColumn="rightName" DataSetColumn="rightName" /> + <Mapping SourceColumn="active" DataSetColumn="active" /> + </Mappings> + <Sources> + </Sources> + </TableAdapter> </Tables> <Sources> </Sources> @@ -1199,6 +1226,22 @@ </xs:sequence> </xs:complexType> </xs:element> + <xs:element name="db_roleRight" msprop:Generator_UserTableName="db_roleRight" msprop:Generator_RowDeletedName="db_roleRightRowDeleted" msprop:Generator_TableClassName="db_roleRightDataTable" msprop:Generator_RowChangedName="db_roleRightRowChanged" msprop:Generator_RowClassName="db_roleRightRow" msprop:Generator_RowChangingName="db_roleRightRowChanging" msprop:Generator_RowEvArgName="db_roleRightRowChangeEvent" msprop:Generator_RowEvHandlerName="db_roleRightRowChangeEventHandler" msprop:Generator_TablePropName="db_roleRight" msprop:Generator_TableVarName="tabledb_roleRight" msprop:Generator_RowDeletingName="db_roleRightRowDeleting"> + <xs:complexType> + <xs:sequence> + <xs:element name="roleID" msprop:Generator_UserColumnName="roleID" msprop:Generator_ColumnPropNameInRow="roleID" msprop:Generator_ColumnVarNameInTable="columnroleID" msprop:Generator_ColumnPropNameInTable="roleIDColumn" type="xs:int" /> + <xs:element name="rightsID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_UserColumnName="rightsID" msprop:Generator_ColumnPropNameInRow="rightsID" msprop:Generator_ColumnVarNameInTable="columnrightsID" msprop:Generator_ColumnPropNameInTable="rightsIDColumn" type="xs:int" /> + <xs:element name="rightName" msprop:Generator_UserColumnName="rightName" msprop:Generator_ColumnPropNameInRow="rightName" msprop:Generator_ColumnVarNameInTable="columnrightName" msprop:Generator_ColumnPropNameInTable="rightNameColumn" minOccurs="0"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="255" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="active" msprop:Generator_UserColumnName="active" msprop:Generator_ColumnPropNameInRow="active" msprop:Generator_ColumnVarNameInTable="columnactive" msprop:Generator_ColumnPropNameInTable="activeColumn" type="xs:boolean" /> + </xs:sequence> + </xs:complexType> + </xs:element> </xs:choice> </xs:complexType> <xs:unique name="Constraint1" msdata:PrimaryKey="true"> Modified: Website/App_Code/tcdbDataSet.xss =================================================================== --- Website/App_Code/tcdbDataSet.xss 2006-07-27 17:18:49 UTC (rev 227) +++ Website/App_Code/tcdbDataSet.xss 2006-07-27 18:44:20 UTC (rev 228) @@ -4,22 +4,23 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. </autogenerated>--> -<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="144" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout"> +<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="106" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout"> <Shapes> - <Shape ID="DesignTable:db_users" ZOrder="14" X="87" Y="57" Height="241" Width="201" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="194" /> - <Shape ID="DesignTable:db_products" ZOrder="13" X="25" Y="506" Height="241" Width="213" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="194" /> - <Shape ID="DesignTable:db_actionItems" ZOrder="12" X="619" Y="59" Height="292" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="228" /> - <Shape ID="DesignTable:db_status" ZOrder="11" X="272" Y="369" Height="122" Width="296" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" /> - <Shape ID="DesignTable:db_notes" ZOrder="10" X="309" Y="56" Height="139" Width="208" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> - <Shape ID="DesignTable:db_assignments" ZOrder="9" X="636" Y="368" Height="275" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="228" /> - <Shape ID="DesignTable:db_testPass" ZOrder="8" X="25" Y="317" Height="122" Width="211" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" /> - <Shape ID="DesignTable:db_config" ZOrder="7" X="382" Y="203" Height="156" Width="198" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="109" /> - <Shape ID="DesignTable:db_version" ZOrder="6" X="268" Y="539" Height="173" Width="216" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="126" /> - <Shape ID="DesignTable:db_rights" ZOrder="5" X="599" Y="657" Height="139" Width="260" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> - <Shape ID="DesignTable:db_role" ZOrder="4" X="319" Y="763" Height="139" Width="242" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> - <Shape ID="DesignTable:db_roleProductUser" ZOrder="3" X="903" Y="671" Height="156" Width="255" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="109" /> - <Shape ID="DesignTable:db_roleProduct" ZOrder="2" X="904" Y="843" Height="105" Width="231" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" /> - <Shape ID="DesignTable:db_roleUserProduct" ZOrder="1" X="592" Y="814" Height="122" Width="257" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" /> + <Shape ID="DesignTable:db_users" ZOrder="15" X="87" Y="57" Height="241" Width="201" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="194" /> + <Shape ID="DesignTable:db_products" ZOrder="14" X="25" Y="506" Height="241" Width="213" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="194" /> + <Shape ID="DesignTable:db_actionItems" ZOrder="13" X="619" Y="59" Height="86" Width="300" AdapterExpanded="true" DataTableExpanded="false" OldAdapterHeight="0" OldDataTableHeight="228" SplitterPosition="22" /> + <Shape ID="DesignTable:db_status" ZOrder="12" X="272" Y="369" Height="122" Width="296" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" /> + <Shape ID="DesignTable:db_notes" ZOrder="11" X="309" Y="56" Height="139" Width="208" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> + <Shape ID="DesignTable:db_assignments" ZOrder="10" X="636" Y="368" Height="275" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="228" /> + <Shape ID="DesignTable:db_testPass" ZOrder="9" X="25" Y="317" Height="122" Width="211" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" /> + <Shape ID="DesignTable:db_config" ZOrder="8" X="382" Y="203" Height="156" Width="198" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="109" /> + <Shape ID="DesignTable:db_version" ZOrder="7" X="268" Y="539" Height="173" Width="216" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="126" /> + <Shape ID="DesignTable:db_rights" ZOrder="6" X="599" Y="657" Height="139" Width="260" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> + <Shape ID="DesignTable:db_role" ZOrder="5" X="319" Y="763" Height="139" Width="242" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> + <Shape ID="DesignTable:db_roleProductUser" ZOrder="4" X="903" Y="671" Height="156" Width="255" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="109" /> + <Shape ID="DesignTable:db_roleProduct" ZOrder="3" X="904" Y="843" Height="105" Width="231" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" /> + <Shape ID="DesignTable:db_roleUserProduct" ZOrder="2" X="592" Y="814" Height="122" Width="255" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" /> + <Shape ID="DesignTable:db_roleRight" ZOrder="1" X="61" Y="768" Height="139" Width="217" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" /> </Shapes> <Connectors /> </DiagramLayout> \ No newline at end of file Modified: Website/Includes/AdministrationTree.ascx.cs =================================================================== --- Website/Includes/AdministrationTree.ascx.cs 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/AdministrationTree.ascx.cs 2006-07-27 18:44:20 UTC (rev 228) @@ -446,35 +446,29 @@ protected void BuildRightsList(TreeNode parent) { ArrayList nodes = (ArrayList)Session["AdminNodes"]; - /* - * // Populate Rights - query = "SELECT rights.* FROM rights INNER JOIN roleRights ON roleRights.rightsID=rights.rightsID WHERE roleRights.roleID=" + e.Node.Value; - DBAdapter = new SqlDataAdapter(query, DBConnection); - DBAdapter.Fill(ResultsDataSet); + tcdbDataSetTableAdapters.db_roleRightTableAdapter rightAdapter = new tcdbDataSetTableAdapters.db_roleRightTableAdapter(); + tcdbDataSet.db_roleRightDataTable rightTable = rightAdapter.GetData(Convert.ToInt32(parent.Value), true); + + // Populate Rights + foreach (tcdbDataSet.db_roleRightRow row in rightTable) + { + // Create the new node. + TreeNode newNode = new TreeNode(); + newNode.Text = "<font color=green>Right: </font><font color=blue>" + row.rightName + "</font>"; + newNode.Value = row.rightsID.ToString(); - if (ResultsDataSet.Tables.Count > 0) - { - foreach (DataRow row in ResultsDataSet.Tables[0].Rows) - { - // Create the new node. - newNode = new TreeNode(); - newNode.Text = "<font color=green>Right: </font><font color=blue>" + row["name"] + "</font>"; - newNode.Value = row["rightsID"].ToString(); + // Set the PopulateOnDemand property to true so that the child nodes can be + // dynamically populated. + newNode.PopulateOnDemand = true; - // Set the PopulateOnDemand property to true so that the child nodes can be - // dynamically populated. - newNode.PopulateOnDemand = true; + // Set additional properties for the node. + newNode.SelectAction = TreeNodeSelectAction.Expand; + newNode.NavigateUrl = "~/Right.aspx?"+Constants.CODE_RIGHT+"=" + newNode.Value; - // Set additional properties for the node. - newNode.SelectAction = TreeNodeSelectAction.Expand; - newNode.NavigateUrl = "~/RightsEdit.aspx?id=" + newNode.Value; - - // Add the new node to the ChildNodes collection of the parent node. - e.Node.ChildNodes.Add(newNode); - newNode.Expand(); - } - } - */ + // Add the new node to the ChildNodes collection of the parent node. + parent.ChildNodes.Add(newNode); + newNode.Expand(); + } } protected void BuildBuildList(TreeNode parent) { @@ -682,9 +676,9 @@ BuildVersionCategories(e.Node); else if (e.Node.Parent.Value == "status") BuildStatusList(e.Node); - else if (e.Node.NavigateUrl.Contains("labEdit")) + else if (e.Node.NavigateUrl.Contains("Lab")) BuildComputerList(e.Node); - else if (e.Node.NavigateUrl.Contains("roleEdit")) + else if (e.Node.NavigateUrl.Contains("Role")) BuildRightsList(e.Node); break; case 4: @@ -696,7 +690,7 @@ BuildPlatformList(e.Node); break; case 5: - if (e.Node.NavigateUrl.Contains("platformEdit")) + if (e.Node.NavigateUrl.Contains("Platform")) { BuildOSList(e.Node); BuildArchitectureList(e.Node); Modified: Website/Includes/Rights.ascx =================================================================== --- Website/Includes/Rights.ascx 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/Rights.ascx 2006-07-27 18:44:20 UTC (rev 228) @@ -34,7 +34,7 @@ <tr> <td align="left" colspan="2" valign="top" width="33%"> <strong>Roles:<br /> - </strong> <asp:ListBox ID="roleList" runat="server" OnDataBound="roleList_DataBound"></asp:ListBox> + </strong> <asp:ListBox ID="roleList" runat="server" OnDataBound="roleList_DataBound" DataSourceID="RolesDataSource" DataTextField="roleName" DataValueField="roleID"></asp:ListBox> </td> <td align="left" colspan="2" valign="top" width="33%"> </td> @@ -91,7 +91,7 @@ <tr> <td align="left" colspan="2" valign="top" width="33%"> <strong>Roles:<br /> - </strong> <asp:ListBox ID="roleList" runat="server" OnDataBound="roleList_DataBound"></asp:ListBox> + </strong> <asp:ListBox ID="roleList" runat="server" OnDataBound="roleList_DataBound" DataSourceID="RolesDataSource" DataTextField="roleName" DataValueField="roleID"></asp:ListBox> </td> <td align="left" colspan="2" valign="top" width="33%"> </td> @@ -144,13 +144,7 @@ <tr> <td align="left" colspan="2" valign="top" width="33%"> <strong>Roles:<br /> - </strong> <asp:ListBox ID="rightsList" runat="server"></asp:ListBox><asp:SqlDataSource ID="RoleRightsDataSource" - runat="server" ConnectionString="<%$ ConnectionStrings:tcdbConnectionString %>" - SelectCommand="del_config" SelectCommandType="StoredProcedure"> - <SelectParameters> - <asp:Parameter Name="configID" Type="Int32" /> - </SelectParameters> - </asp:SqlDataSource> + </strong> <asp:ListBox ID="rightsList" runat="server"></asp:ListBox> </td> <td align="left" colspan="2" valign="top" width="33%"> </td> @@ -183,11 +177,11 @@ </HeaderTemplate> </asp:FormView> <asp:ObjectDataSource ID="RightsDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" - TypeName="tcdbDataSetTableAdapters.sel_rightsTableAdapter" DeleteMethod="Update" InsertMethod="Insert" UpdateMethod="Update"> + TypeName="tcdbDataSetTableAdapters.db_rightsTableAdapter" DeleteMethod="Update" InsertMethod="Insert" UpdateMethod="Update"> <SelectParameters> <asp:SessionParameter Name="rightsID" SessionField="id" Type="Int32" /> <asp:Parameter Name="rightsName" Type="String" /> - <asp:Parameter Name="active" Type="Boolean" /> + <asp:Parameter Name="active" Type="Boolean" DefaultValue="true" /> </SelectParameters> <DeleteParameters> <asp:Parameter Name="rightsID" Type="Int32" /> @@ -211,7 +205,7 @@ <asp:ObjectDataSource ID="RolesDataSource" runat="server" OldValuesParameterFormatString="original_{0}" - SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.sel_roleTableAdapter" InsertMethod="Insert" UpdateMethod="Update"> + SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleTableAdapter" InsertMethod="Insert" UpdateMethod="Update"> <UpdateParameters> <asp:Parameter Name="roleID" Type="Int32" /> <asp:Parameter Name="name" Type="String" /> @@ -221,7 +215,7 @@ <SelectParameters> <asp:Parameter Name="roleID" Type="Int32" /> <asp:Parameter Name="roleName" Type="String" /> - <asp:Parameter Name="active" Type="Boolean" /> + <asp:Parameter Name="active" Type="Boolean" DefaultValue="true" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="name" Type="String" /> Modified: Website/Includes/Rights.ascx.cs =================================================================== --- Website/Includes/Rights.ascx.cs 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/Rights.ascx.cs 2006-07-27 18:44:20 UTC (rev 228) @@ -44,17 +44,13 @@ } protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) { - /* - SqlDataAdapter DBAdapter = new SqlDataAdapter("SELECT MAX(rightsID) AS newID FROM rights", Master.DBConnection); - DataSet result = new DataSet(); - DBAdapter.Fill(result); - if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) - id = result.Tables[0].Rows[0]["newID"].ToString(); + tcdbDataSetTableAdapters.db_rightsTableAdapter rightsAdapter = new tcdbDataSetTableAdapters.db_rightsTableAdapter(); + tcdbDataSet.db_rightsDataTable rightsTable = rightsAdapter.GetData(null, e.Values["rightsName"].ToString(), true); + rightsID = rightsTable[rightsTable.Count - 1].rightsID; + updateRoles(); - Master.updateTree(); - Response.Redirect("~/RightsEdit.aspx?id=" + id); - */ + Response.Redirect("~/Right.aspx?"+Constants.CODE_RIGHT+"=" + rightsID); } protected void FormView1_ItemDeleted(object sender, FormViewDeletedEventArgs e) { Modified: Website/Includes/Roles.ascx =================================================================== --- Website/Includes/Roles.ascx 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/Roles.ascx 2006-07-27 18:44:20 UTC (rev 228) @@ -3,7 +3,7 @@ <asp:FormView ID="FormView1" runat="server" DataKeyNames="roleID" DataSourceID="RoleDataSource" OnItemDeleted="FormView1_ItemDeleted" OnItemInserted="FormView1_ItemInserted" - OnItemUpdated="FormView1_ItemUpdated" OnModeChanged="FormView1_ModeChanged" OnItemCommand="FormView1_ItemCommand"> + OnItemUpdated="FormView1_ItemUpdated" OnItemCommand="FormView1_ItemCommand"> <HeaderTemplate> <div align="left"> <h2> @@ -39,36 +39,34 @@ <strong>Products: <asp:DropDownList ID="productList" runat="server" AutoPostBack="True" DataSourceID="RoleProductDataSource" DataTextField="productName" DataValueField="productID" OnSelectedIndexChanged="productList_SelectedIndexChanged"> - </asp:DropDownList></strong> <asp:SqlDataSource ID="RoleProductDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:tcdbConnectionString %>" - SelectCommand="sel_roleProduct" SelectCommandType="StoredProcedure"> - <SelectParameters> - <asp:SessionParameter Name="roleID" SessionField="roleID" /> - <asp:Parameter Name="active" Type="Boolean" DefaultValue="true" /> - </SelectParameters> - </asp:SqlDataSource> + </asp:DropDownList><asp:ObjectDataSource ID="RoleProductDataSource" runat="server" + OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleProductTableAdapter"> + <SelectParameters> + <asp:SessionParameter Name="roleID" SessionField="roleID" Type="Int32" /> + <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> + </SelectParameters> + </asp:ObjectDataSource> + </strong> </td> <td colspan="2" align="left" valign="top" width="33%"> - <strong>Users:</strong><br /> <asp:ListBox ID="userList" runat="server" DataSourceID="RoleUserDataSource" DataTextField="fullName" DataValueField="userID"></asp:ListBox><asp:SqlDataSource - ID="RoleUserDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:tcdbConnectionString %>" - SelectCommand="sel_roleProductUser" SelectCommandType="StoredProcedure"> + <strong>Users:</strong><br /> <asp:ListBox ID="userList" runat="server" DataSourceID="RoleProductUserDataSource" DataTextField="fullName" DataValueField="userID"></asp:ListBox><asp:ObjectDataSource ID="RoleProductUserDataSource" runat="server" + OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleProductUserTableAdapter"> <SelectParameters> - <asp:SessionParameter Name="roleID" SessionField="roleID" /> - <asp:ControlParameter ControlID="productList" Name="productID" PropertyName="SelectedValue" /> - <asp:Parameter Name="active" Type="Boolean" DefaultValue="true" /> + <asp:SessionParameter Name="roleID" SessionField="roleID" Type="Int32" /> + <asp:ControlParameter ControlID="productList" Name="productID" PropertyName="SelectedValue" + Type="Int32" /> + <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> </SelectParameters> - </asp:SqlDataSource> + </asp:ObjectDataSource> </td> <td colspan="2" align="left" valign="top" width="34%"> - <strong>Rights:</strong><br /> <asp:ListBox ID="rightsList" runat="server"></asp:ListBox><asp:SqlDataSource ID="RoleRightsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:tcdbConnectionString %>" - SelectCommand="sel_userRights" SelectCommandType="StoredProcedure"> + <strong>Rights:</strong><br /> <asp:ListBox ID="rightsList" runat="server" DataSourceID="RoleRightsDataSource" DataTextField="rightName" DataValueField="rightsID"></asp:ListBox><asp:ObjectDataSource ID="RoleRightsDataSource" runat="server" OldValuesParameterFormatString="original_{0}" + SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleRightTableAdapter"> <SelectParameters> - <asp:Parameter Name="userID" Type="Int32" /> - <asp:Parameter Name="productID" Type="Int32" /> - <asp:Parameter Name="rightsID" Type="Int32" /> - <asp:Parameter Name="rightsName" Type="String" /> - <asp:Parameter Name="active" Type="Boolean" /> + <asp:SessionParameter Name="roleID" SessionField="roleID" Type="Int32" /> + <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> </SelectParameters> - </asp:SqlDataSource> + </asp:ObjectDataSource> </td> </tr> <tr> @@ -194,7 +192,14 @@ <td colspan="2" align="left" valign="top" width="34%"> <strong>Rights: <asp:LinkButton ID="newRight" runat="server" CommandName="newRight" OnCommand="newRight">New Right</asp:LinkButton><br /> - </strong> <asp:ListBox ID="rightsList" runat="server" DataSourceID="RightsDataSource" DataTextField="rightsName" DataValueField="rightsID" SelectionMode="Multiple"></asp:ListBox> + </strong> <asp:ListBox ID="rightsList" runat="server" DataSourceID="RoleRightsDataSource" DataTextField="rightName" DataValueField="rightsID" SelectionMode="Multiple"></asp:ListBox><asp:ObjectDataSource ID="RoleRightsDataSource" runat="server" OldValuesParameterFormatString="original_{0}" + SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleRightTableAdapter"> + <SelectParameters> + <asp:SessionParameter Name="roleID" SessionField="roleID" Type="Int32" /> + <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> + </SelectParameters> + </asp:ObjectDataSource> + </td> </tr> <tr> Modified: Website/Includes/Roles.ascx.cs =================================================================== --- Website/Includes/Roles.ascx.cs 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/Roles.ascx.cs 2006-07-27 18:44:20 UTC (rev 228) @@ -1,13 +1,15 @@ using System; using System.Data; using System.Configuration; +using System.Collections; +using System.Collections.Generic; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; -using System.Collections.Generic; +using System.Data.SqlClient; using TCDB.Assignments; using TCDB.Common; using TCDB.Products; @@ -19,6 +21,7 @@ private static ILog m_logg = LogManager.GetLogger("Page:Roles"); int roleID = Convert.ToInt32(HttpContext.Current.Request.QueryString[Constants.CODE_ROLE]); String mode = HttpContext.Current.Request.QueryString["mode"]; + String product = HttpContext.Current.Request.QueryString[Constants.CODE_PRODUCT]; protected void Page_Load(object sender, EventArgs e) { @@ -88,54 +91,31 @@ } protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) { - /* - SqlDataAdapter DBAdapter = new SqlDataAdapter("SELECT MAX(roleID) AS newID FROM role", Master.DBConnection); - DataSet result = new DataSet(); - DBAdapter.Fill(result); - if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) - id = result.Tables[0].Rows[0]["newID"].ToString(); + tcdbDataSetTableAdapters.db_roleTableAdapter roleAdapter = new tcdbDataSetTableAdapters.db_roleTableAdapter(); + tcdbDataSet.db_roleDataTable roleTable = roleAdapter.GetData(null, e.Values["roleName"].ToString(), true); + roleID = roleTable[roleTable.Count - 1].roleID; updateUserRoleProducts(); updateRoleRights(); - Response.Redirect("~/RoleEdit.aspx?id=" + id); - */ + Response.Redirect("~/Role.aspx?"+Constants.CODE_ROLE+"=" + roleID); } protected void FormView1_ItemDeleted(object sender, FormViewDeletedEventArgs e) { - /* - Master.updateTree(); - Response.Redirect("~/Admin.aspx"); - */ + Response.Redirect("~/Administration.aspx"); } protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { - /* updateUserRoleProducts(); updateRoleRights(); - Master.updateTree(); - */ + Response.Redirect("~/Role.aspx?" + Constants.CODE_ROLE + "=" + roleID); } - protected void FormView1_ModeChanged(object sender, EventArgs e) - { - /* - Panel notes = (Panel)Master.FindControl("noteViewPanel"); - - if (FormView1.CurrentMode == FormViewMode.Insert) - notes.Visible = false; - else - notes.Visible = true; - */ - } protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e) { - /* if (FormView1.CurrentMode == FormViewMode.Insert && e.CommandName == "Cancel") - Response.Redirect("Admin.aspx"); - */ + Response.Redirect("~/Administration.aspx"); } protected void userList_DataBound(object sender, EventArgs e) { - /* Dictionary<String, ArrayList> ProductUsers = (Dictionary<String, ArrayList>)Session["ProductUsers"]; if (ProductUsers != null) @@ -151,46 +131,32 @@ userList.Items.FindByValue(userID).Selected = true; } } - */ } protected void rightsList_DataBound(object sender, EventArgs e) { - /* ListBox rightsList = (ListBox)sender; - SqlDataAdapter DBAdapter = new SqlDataAdapter("SELECT rightsID FROM roleRights WHERE roleID=" + id, Master.DBConnection); - DataSet result = new DataSet(); - DBAdapter.Fill(result); + tcdbDataSetTableAdapters.db_roleRightTableAdapter roleRightAdapter = new tcdbDataSetTableAdapters.db_roleRightTableAdapter(); + tcdbDataSet.db_roleRightDataTable roleRightTable = roleRightAdapter.GetData(roleID, true); - if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) - { - foreach (DataRow row in result.Tables[0].Rows) - rightsList.Items.FindByValue(row["rightsID"].ToString()).Selected = true; - } - */ + foreach (tcdbDataSet.db_roleRightRow row in roleRightTable) + rightsList.Items.FindByValue(row.rightsID.ToString()).Selected = true; } protected void addUsers(object sender, CommandEventArgs e) { - /* updateUserRoleProducts(); - */ } protected void newRight(object sender, CommandEventArgs e) { - /* - Response.Redirect("RightsEdit.aspx?mode=new&role=" + id); - */ + Response.Redirect("Right.aspx?mode=new&"+Constants.CODE_ROLE+"=" + roleID); } protected void productList_SelectedIndexChanged(object sender, EventArgs e) { - /* ListBox userList = (ListBox)FormView1.FindControl("userList"); userList.DataBind(); - */ } protected void userList_SelectedIndexChanged(object sender, EventArgs e) { - /* ListBox userList = (ListBox)sender; DropDownList productList = (DropDownList)FormView1.FindControl("productList"); Dictionary<String, ArrayList> ProductUsers = (Dictionary<String, ArrayList>)Session["ProductUsers"]; @@ -201,15 +167,11 @@ foreach (int index in indices) users.Add(userList.Items[index].Value); ProductUsers[productID] = users; - */ } protected void productListEdit_DataBound(object sender, EventArgs e) { - /* DropDownList productList = (DropDownList)sender; ListBox userList = (ListBox)FormView1.FindControl("userList"); - SqlDataAdapter DBAdapter = new SqlDataAdapter("", Master.DBConnection); - DataSet result = new DataSet(); // Init ProductUsers if (Session["ProductUsers"] == null) @@ -221,16 +183,12 @@ { ArrayList users = new ArrayList(); String productID = productItem.Value; - result.Clear(); - DBAdapter.SelectCommand.CommandText = "SELECT userID FROM UserRoleProduct WHERE roleID=" + id + " AND productID=" + productID; - DBAdapter.Fill(result); + tcdbDataSetTableAdapters.db_roleProductUserTableAdapter roleProductUserAdapter = new tcdbDataSetTableAdapters.db_roleProductUserTableAdapter(); + tcdbDataSet.db_roleProductUserDataTable roleProductUserTable = roleProductUserAdapter.GetData(roleID, Convert.ToInt32(productID), true); - if (result.Tables.Count > 0) - { - foreach (DataRow row in result.Tables[0].Rows) - users.Add(row["userID"].ToString()); - } + foreach (tcdbDataSet.db_roleProductUserRow row in roleProductUserTable) + users.Add(row.userID.ToString()); if (ProductUsers.ContainsKey(productID)) ProductUsers[productID] = users; @@ -240,11 +198,9 @@ if (product != null) productList.SelectedValue = product; userList.DataBind(); - */ } protected void productListInsert_DataBound(object sender, EventArgs e) { - /* DropDownList productList = (DropDownList)sender; // Initialize Product Users @@ -267,6 +223,5 @@ // Init productList if (product != null) productList.SelectedValue = product; - */ } } \ No newline at end of file Modified: Website/Includes/UserSettings.ascx =================================================================== --- Website/Includes/UserSettings.ascx 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/UserSettings.ascx 2006-07-27 18:44:20 UTC (rev 228) @@ -69,14 +69,15 @@ <div class="item"> <label> Roles:</label><br /> - <asp:ListBox ID="roleList" runat="server" Width="150px" Height="150px" DataSourceID="UserRolesDataSource" DataTextField="roleName" DataValueField="roleID" OnDataBound="roleList_DataBound"></asp:ListBox><asp:SqlDataSource ID="UserRolesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:tcdbConnectionString %>" - SelectCommand="sel_roleUserProduct" SelectCommandType="StoredProcedure"> + <asp:ListBox ID="roleList" runat="server" Width="150px" Height="150px" DataSourceID="UserRolesDataSource" DataTextField="roleName" DataValueField="roleID"></asp:ListBox><asp:ObjectDataSource ID="UserRolesDataSource" runat="server" OldValuesParameterFormatString="original_{0}" + SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleUserProductTableAdapter"> <SelectParameters> <asp:SessionParameter Name="userID" SessionField="userID" Type="Int32" /> <asp:Parameter Name="productID" Type="Int32" /> <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> </SelectParameters> - </asp:SqlDataSource> + </asp:ObjectDataSource> + </div> <div class="item"> <label> @@ -170,7 +171,7 @@ <div class="item"> <label> Roles:</label><br /> - <asp:ListBox ID="roleList" runat="server" Width="150px" Height="150px" DataSourceID="RolesDateSource" DataTextField="roleName" DataValueField="roleID"></asp:ListBox> + <asp:ListBox ID="roleList" runat="server" Width="150px" Height="150px" DataSourceID="RolesDataSource" DataTextField="roleName" DataValueField="roleID"></asp:ListBox> </div> <div class="item"> <label> @@ -279,6 +280,7 @@ </div> </InsertItemTemplate> </asp:FormView> + </div> <asp:ObjectDataSource ID="UserDataSource" runat="server" SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_usersTableAdapter" UpdateMethod="Update" InsertMethod="Insert"> @@ -308,11 +310,24 @@ <asp:Parameter Name="automation" Type="Boolean" /> </InsertParameters> </asp:ObjectDataSource> -<asp:SqlDataSource ID="RolesDateSource" runat="server" ConnectionString="<%$ ConnectionStrings:tcdbConnectionString %>" - SelectCommand="sel_role" SelectCommandType="StoredProcedure"> + +<asp:ObjectDataSource ID="RolesDataSource" runat="server" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" + SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleTableAdapter" + UpdateMethod="Update"> + <UpdateParameters> + <asp:Parameter Name="roleID" Type="Int32" /> + <asp:Parameter Name="name" Type="String" /> + <asp:Parameter Name="description" Type="String" /> + <asp:Parameter Name="active" Type="Boolean" /> + </UpdateParameters> <SelectParameters> <asp:Parameter Name="roleID" Type="Int32" /> <asp:Parameter Name="roleName" Type="String" /> <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> </SelectParameters> -</asp:SqlDataSource> + <InsertParameters> + <asp:Parameter Name="name" Type="String" /> + <asp:Parameter Name="description" Type="String" /> + <asp:Parameter Name="active" Type="Boolean" /> + </InsertParameters> +</asp:ObjectDataSource> Modified: Website/Includes/UserSettings.ascx.cs =================================================================== --- Website/Includes/UserSettings.ascx.cs 2006-07-27 17:18:49 UTC (rev 227) +++ Website/Includes/UserSettings.ascx.cs 2006-07-27 18:44:20 UTC (rev 228) @@ -155,8 +155,4 @@ } } } - protected void roleList_DataBound(object sender, EventArgs e) - { - - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |