Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CustomerDocuments.aspx.cs" Inherits="CustomerDocuments" StylesheetTheme="Theme" %>
- <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
- <table>
- <tr>
- <td style="width:20%"></td>
- <td style="width:80%"><asp:Label ID="lblErr" runat="server" ForeColor="Red"></asp:Label></td>
- </tr>
- <tr>
- <td colspan="2" style="background-color:rgb(255, 233, 126)" >
- <asp:Label ID="Label2" runat="server" Text="New Document Types"
- style="font-weight: 700"></asp:Label>
- </td>
- </tr>
- <tr>
- <td><asp:Label ID="Label3" runat="server" Text="Document Type"></asp:Label></td>
- <td>
- <asp:TextBox ID="txtDocType" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td><asp:Button ID="btnSave0" runat="server" onclick="btnSave0_Click"
- Text="Save Document Type" />
- </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td colspan="2" style="background-color:rgb(255, 233, 126)" >
- <asp:Label ID="Label1" runat="server" Text="Customer Associated Document Types"
- style="font-weight: 700"></asp:Label>
- </td>
- </tr>
- <tr>
- <td><asp:Label ID="Label4" runat="server" Text="Customers"></asp:Label></td>
- <td><asp:DropDownList ID="ddlCustomers" runat="server" BackColor='AliceBlue' Width=218px
- DataSourceID="Customers" DataTextField="CustomerName"
- DataValueField="CustomerId" AutoPostBack="True">
- </asp:DropDownList></td>
- </tr>
- <tr>
- <td><asp:Label ID="Label5" runat="server" Text="Customer Type"></asp:Label></td>
- <td>
- <asp:DropDownList ID="ddlDocumentTypes" runat="server"
- DataSourceID="DocumentTypes" DataTextField="DocumentType"
- DataValueField="DocumentTypeId" Width="209px">
- </asp:DropDownList>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td><asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save" />
- </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td colspan="2">
- <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
- AllowSorting="True" AutoGenerateColumns="False" DataSourceID="CustomerDocumentTypes"
- EnableModelValidation="True" SkinID="GridListView"
- EmptyDataText="Customer has no document types associated">
- <Columns>
- <asp:BoundField DataField="DocumentType"
- HeaderText="Customer Document Types"
- SortExpression="DocumentType" />
- </Columns>
- </asp:GridView>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <asp:SqlDataSource ID="Customers" runat="server"
- ConnectionString="<%$ ConnectionStrings:SecurityDB_20101025ConnectionString %>"
- SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerId] = ISNULL(@CustomerId, '') OR @IsSuperAdmin = 1 )
- order by customername
- "
- >
- <SelectParameters>
- <asp:SessionParameter Name="CustomerId" SessionField="CustomerID"
- />
- <asp:SessionParameter Name="IsSuperAdmin" SessionField="IsSuperAdmin" Type="Boolean"
- />
- </SelectParameters>
- </asp:SqlDataSource>
- <asp:SqlDataSource ID="DocumentTypes" runat="server"
- ConnectionString="<%$ ConnectionStrings:SecurityDB_20101025ConnectionString %>"
- SelectCommand="SELECT * FROM [DocumentTypes]
- WHERE DocumentTypeId NOT IN ( Select DocumentTypeId from CustomerDocumentTypes WHERE CustomerId = @CustomerId)" InsertCommand="INSERT INTO [DocumentTypes]
- (DocumentType)
- VALUES
- (@DocumentType)">
- <InsertParameters>
- <asp:ControlParameter ControlID="txtDocType" Name="DocumentType" PropertyName="Text" />
- </InsertParameters>
- <SelectParameters>
- <asp:ControlParameter ControlID="ddlCustomers" Name="CustomerId"
- PropertyName="SelectedValue" />
- </SelectParameters>
- </asp:SqlDataSource>
- <asp:SqlDataSource ID="CustomerDocumentTypes" runat="server"
- ConnectionString="<%$ ConnectionStrings:SecurityDB_20101025ConnectionString %>"
- SelectCommand="SELECT D.DocumentType FROM [CustomerDocumentTypes] C
- INNER JOIN DocumentTypes D
- ON C.DocumentTypeID = D.DocumentTypeID
- WHERE ([CustomerId] = @CustomerId)" InsertCommand="INSERT INTO CustomerDocumentTypes
- (CustomerID, DocumentTypeId)
- VALUES
- (@CustomerId, @DocumentTypeId)">
- <SelectParameters>
- <asp:ControlParameter ControlID="ddlCustomers" Name="CustomerId"
- PropertyName="SelectedValue" Type="Int32" />
- </SelectParameters>
- <InsertParameters>
- <asp:ControlParameter ControlID="ddlCustomers" Name="CustomerId"
- PropertyName="SelectedValue" Type="Int32" />
- <asp:ControlParameter ControlID="ddlDocumentTypes" Name="DocumentTypeId"
- PropertyName="SelectedValue" Type="Int32" />
- </InsertParameters>
- </asp:SqlDataSource>
- <br />
- </td>
- </tr>
- </table>
- </asp:Content>
Advertisement
Add Comment
Please, Sign In to add comment