<%@ Page Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeFile="ViewOrderDetails.aspx.cs" Inherits="ViewOrderDetails" Title="Untitled Page" %>

<%@ Register src="UC_AdminOperatoChecker.ascx" tagname="UC_AdminOperatoChecker" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width:100%;">
        <tr>
            <td style="text-align: left" colspan="3">
                <asp:Label ID="Lbl_Title" runat="server" CssClass="LabelHeaader" 
                    Text="مشاهده جزئیات سفارش"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right" colspan="3">
                <table style="width:100%;">
                    <tr>
                        <td class="style1">
                <asp:Label ID="Lbl_AssetUnit" runat="server" CssClass="Label1" 
                    Text="نام کاربری:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="Drp_Users" runat="server" CssClass="DropDownList" 
                                Width="200px" ValidationGroup="11">
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ErrorMessage="انتخاب نام کاربری الزامی می باشد" 
                                ControlToValidate="Drp_Users" ValidationGroup="11">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            &nbsp;</td>
                        <td>
                            <asp:Button ID="Btn_ViewUserOrders" runat="server" CssClass="ButtonOk" 
                                Text="مشاهده" onclick="Btn_ViewUserOrders_Click" ValidationGroup="11" />
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td class="style1">
                            &nbsp;</td>
                        <td>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                                ValidationGroup="11" />
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="text-align: center" colspan="3">
                <asp:GridView ID="Grd_AssetUnits" runat="server" CssClass="mGrid" 
                    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                    PageSize="20" DataKeyNames="OrderID" 
                    onselectedindexchanged="Grd_AssetUnits_SelectedIndexChanged">
                    <Columns>
                        <asp:CommandField HeaderText="مشاهده جزئیات سفارش" 
                            SelectText="نمایش جزئیات سفارش کالا" ShowSelectButton="True">
                            <ItemStyle Width="200px" />
                        </asp:CommandField>
                        <asp:BoundField DataField="OrderID" HeaderText="کد سفارش" 
                            InsertVisible="False" SortExpression="OrderID">
                        </asp:BoundField>
                        <asp:BoundField DataField="UserName" HeaderText="نام کاربری درخواست کننده" 
                            SortExpression="UserName" />
                        <asp:BoundField DataField="OrderDate" HeaderText="تاریخ صدور سفارش کالا" 
                            SortExpression="OrderDate" />
                        <asp:CheckBoxField DataField="OrderClosedBit" HeaderText="OrderClosedBit" 
                            SortExpression="OrderClosedBit" Visible="False" />
                        <asp:BoundField DataField="OrderState" HeaderText="وضعیت سفارش" 
                            SortExpression="OrderState" />
                    </Columns>
                    <HeaderStyle ForeColor="#E4E4E4" />
                </asp:GridView>
                <uc1:UC_AdminOperatoChecker ID="UC_AdminOperatoChecker1" runat="server" />
                <asp:LinqDataSource ID="LinqDtsOrdersShow" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="OrderID desc" 
                    TableName="xtblOrders">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td style="text-align: center" colspan="3">
                <asp:LinqDataSource ID="LinqDt_Users" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" TableName="xtblOrders" 
                    Where="UserName == @UserName">
                    <WhereParameters>
                        <asp:ControlParameter ControlID="Drp_Users" Name="UserName" 
                            PropertyName="SelectedValue" Type="String" />
                    </WhereParameters>
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td style="text-align: left" colspan="3">
                <fieldset id="Fld_OrderDetails" align="middle" class="FieldSetSt" ><legend>مشاهده جزئیات سفارش</legend>
                <center>
                    <asp:GridView ID="Grd_OrderDetails" runat="server" CellPadding="4" ForeColor="#333333" 
                    GridLines="None" AutoGenerateColumns="False" CssClass="mGrid" 
                        DataKeyNames="OrderID,AssetID" 
                        EmptyDataText="جزدیات سفارش انتخاب نشده اند">
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <Columns>
                        <asp:CommandField HeaderText="ویرایش" ShowEditButton="True" />
                        <asp:BoundField DataField="OrderDetailID" HeaderText="کد جزئیات سفارش" 
                            InsertVisible="False" SortExpression="OrderDetailID" />
                        <asp:BoundField DataField="OrderID" HeaderText="کد سفارش" ReadOnly="True" 
                            SortExpression="OrderID" />
                        <asp:BoundField DataField="AssetID" HeaderText="کالا" ReadOnly="True" 
                            SortExpression="AssetID" Visible="False" />
                        <asp:TemplateField HeaderText="عنوان کالا">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" 
                                    Text='<%# Eval("tblWhAsset.AssetName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="AssetQuantity" HeaderText="مقدار سفارش" 
                            SortExpression="AssetQuantity" />
                        <asp:BoundField DataField="OrderDetailNotes" HeaderText="جزئیات سفارش" 
                            SortExpression="OrderDetailNotes" />
                        <asp:CommandField HeaderText="حذف" ShowDeleteButton="True" />
                    </Columns>
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                </asp:GridView>
                    <asp:LinqDataSource ID="LinqDt_OrderDetails" runat="server" 
                        ContextTypeName="LSC_WareHouseDataContext" EnableDelete="True" 
                        EnableUpdate="True" TableName="tblOrderDetails" Where="OrderID == @OrderID">
                        <WhereParameters>
                            <asp:Parameter DefaultValue="1" Name="OrderID" Type="Decimal" />
                        </WhereParameters>
                    </asp:LinqDataSource>
                    </center></fieldset>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>

