<%@ Page Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeFile="WhAssets.aspx.cs" Inherits="WhAssets" 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: left">
                &nbsp;</td>
            <td style="text-align: right">
                &nbsp;</td>
            <td>
                </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_WhAssetName" runat="server" CssClass="Label1" 
                    Text="نام کالا:" Height="16px"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:TextBox ID="Txt_ProviderName" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft" ValidationGroup="11" MaxLength="100"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="Txt_ProviderName" 
                    ErrorMessage="ورود نام الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_AssetUnit" runat="server" CssClass="Label1" 
                    Text="واحد شمارش:" Height="16px"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:DropDownList ID="Drp_AssetUnitID" runat="server" CssClass="DropDownList" 
                    DataSourceID="LinqDt_Drp_AssetUnit" DataTextField="AssetUnitDescrition" 
                    DataValueField="AssetUnitID">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_Drp_AssetUnit" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="AssetUnitID desc" 
                    TableName="tblAssetUnits">
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="Drp_AssetUnitID" 
                    ErrorMessage="انتخاب واحد شمارش کالا الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_AssetCategory" runat="server" CssClass="Label1" 
                    Text="طبقه بندی:" Height="16px"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:DropDownList ID="Drp_AssetCategory" runat="server" CssClass="DropDownList" 
                    DataSourceID="LinqDt_Drp_AssetCategotyID" 
                    DataTextField="AssetCategoryDescription" DataValueField="AssetCategoryID">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_Drp_AssetCategotyID" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" TableName="tblAssetCategories">
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="Drp_AssetCategory" 
                    ErrorMessage="ورود آدرس ایمیل الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_AssetProvider" runat="server" CssClass="Label1" 
                    Text="تامین کننده:" Height="16px"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:DropDownList ID="Drp_AssetProvider" runat="server" CssClass="DropDownList" 
                    DataSourceID="LinqDt_Drp_AssetProvider" DataTextField="NameSname" 
                    DataValueField="ProviderID">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_Drp_AssetProvider" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="NameSname" 
                    TableName="xtblAssetProviders">
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="Drp_AssetProvider" 
                    ErrorMessage="انتخاب نام تاکین کننده الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_AssetOrderPoint" runat="server" CssClass="Label1" 
                    Text="نقطه سفارش:" Height="16px"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:TextBox ID="Txt_OrderPoint" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft" ValidationGroup="11" MaxLength="250"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="Txt_OrderPoint" 
                    ErrorMessage="ورود شماره نمابر الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator1" runat="server" 
                    ErrorMessage="مقدار عددی وارد شده صحیح نمی باشد  &gt; 1  &lt; = 99999999" 
                    ControlToValidate="Txt_OrderPoint" MaximumValue="99999999" MinimumValue="1" 
                    Type="Double" ValidationGroup="11">*</asp:RangeValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                </td>
            <td>
                <asp:Button ID="Btn_Insert" runat="server" CssClass="ButtonAdd" 
                    onclick="Btn_Insert_Click" Text="ایجاد کالا" ValidationGroup="11" />
            </td>
            <td>
                <asp:Label ID="Lbl_Error" runat="server" CssClass="LabelError"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right" colspan="3">
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" Width="700px" 
                    ValidationGroup="11" />
            </td>
        </tr>
        <tr>
            <td style="text-align: center" colspan="3">
                <asp:GridView ID="Grd_WhAssets" runat="server" CssClass="mGrid" 
                    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                    DataKeyNames="AssetID" DataSourceID="LinqDt_WhAssets" PageSize="20">
                    <Columns>
                        <asp:CommandField ShowEditButton="True" />
                        <asp:BoundField DataField="AssetID" HeaderText="کد کالا" 
                            InsertVisible="False" ReadOnly="True" SortExpression="AssetID">
                        </asp:BoundField>
                        <asp:BoundField DataField="AssetName" HeaderText="نام کالا" 
                            SortExpression="AssetName" />
                        <asp:TemplateField HeaderText="واحد شمارش">
                            <EditItemTemplate>
                                <asp:DropDownList ID="DropDownList1" runat="server" 
                                    DataSourceID="LinqDt_Drp_AssetUnit" DataTextField="AssetUnitDescrition" 
                                    DataValueField="AssetUnitID" SelectedValue='<%# Bind("AssetUnitID") %>'>
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" 
                                    Text='<%# Eval("tblAssetUnit.AssetUnitDescrition") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="طبقه بندی">
                            <EditItemTemplate>
                                <asp:DropDownList ID="DropDownList2" runat="server" 
                                    DataSourceID="LinqDt_Drp_AssetCategotyID" 
                                    DataTextField="AssetCategoryDescription" DataValueField="AssetCategoryID" 
                                    SelectedValue='<%# Bind("AssetCategoryID") %>'>
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" 
                                    Text='<%# Eval("tblAssetCategory.AssetCategoryDescription") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="فروشنده (فراهم کننده)">
                            <EditItemTemplate>
                                <asp:DropDownList ID="DropDownList3" runat="server" 
                                    DataSourceID="LinqDt_Drp_AssetProvider" DataTextField="NameSname" 
                                    DataValueField="ProviderID" SelectedValue='<%# Bind("AssetProviderID") %>'>
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" 
                                    Text='<%# "نام و نام خانوادگی: " + Eval("tblProvider.ProviderName") + Eval("tblProvider.ProviderSName") + " آدرس ایمیل: "  + Eval("tblProvider.ProviderEmail") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="AssetUnitID" HeaderText="AssetUnitID" 
                            SortExpression="AssetUnitID" Visible="False" />
                        <asp:BoundField DataField="AssetCategoryID" HeaderText="AssetCategoryID" 
                            SortExpression="AssetCategoryID" Visible="False" />
                        <asp:BoundField DataField="AssetProviderID" HeaderText="AssetProviderID" 
                            SortExpression="AssetProviderID" Visible="False" />
                        <asp:BoundField DataField="AssetOrderPoint" HeaderText="نقطه سفارش کالا" 
                            SortExpression="AssetOrderPoint" />
                        <asp:CommandField ShowDeleteButton="True" />
                    </Columns>
                    <HeaderStyle ForeColor="#E4E4E4" />
                </asp:GridView>
                <asp:LinqDataSource ID="LinqDt_WhAssets" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="AssetID desc" 
                    TableName="tblWhAssets" EnableDelete="True" EnableUpdate="True">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                &nbsp;</td>
            <td>
                <uc1:UC_AdminOperatoChecker ID="UC_AdminOperatoChecker1" runat="server" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>

</asp:Content>

