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

<%@ Register src="US_MainAdminChecker.ascx" tagname="US_MainAdminChecker" 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 colspan="3">
                <asp:Label ID="Lbl_Title" runat="server" CssClass="LabelHeaader" 
                    Text="ثبت نام کاربر جدید"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_UserName" runat="server" CssClass="Label1" 
                    Text="نام کاربری:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_UserName" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="Txt_UserName" ErrorMessage="ورود نام کاربری الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Pass" runat="server" CssClass="Label1" 
                    Text="کلمه عبور:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Password" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft" TextMode="Password"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="Txt_Password" ErrorMessage="ورود کلمه عبور الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_RePass" runat="server" CssClass="Label1" 
                    Text="تکرار کلمه عبور:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_RePassword" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft" TextMode="Password"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="Txt_RePassword" ErrorMessage="تکرار کلمه عبور الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
                <asp:CompareValidator ID="CompareValidator1" runat="server" 
                    ControlToCompare="Txt_RePassword" ControlToValidate="Txt_Password" 
                    ErrorMessage="کلمه عبور را صحیح وارد کنید" ValidationGroup="11">*</asp:CompareValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_TypeUser" runat="server" CssClass="Label1" 
                    Text="نوع کاربر:"></asp:Label>
                        </td>
            <td>
                <asp:DropDownList ID="Drp_TypeUser" runat="server" CssClass="DropDownList" 
                    DataSourceID="LinqDt_UserType" DataTextField="UserTypeDescription" 
                    DataValueField="UserTypeID">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_UserType" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="UserTypeID desc" 
                    Select="new (UserTypeID, UserTypeDescription)" TableName="tblUserTypes">
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="Drp_TypeUser" ErrorMessage="انتخاب نوع کاربر الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Name" runat="server" CssClass="Label1" 
                    Text="نام:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Name" runat="server" CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="Txt_Name" ErrorMessage="ورود نام الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Family" runat="server" CssClass="Label1" 
                    Text="نام خانوادگی:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Family" runat="server" CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                    ControlToValidate="Txt_Family" ErrorMessage="ورود نام خانوادگی الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_DateSh" runat="server" CssClass="Label1" 
                    Text="تاریخ تولد:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_BirthDate" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                    ControlToValidate="Txt_BirthDate" ErrorMessage="ورود تاریخ تولد الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Email" runat="server" CssClass="Label1" 
                    Text="ایمیل:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Email" runat="server" CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                    ControlToValidate="Txt_Email" ErrorMessage="ورود آدرس ایمیل الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="Txt_Email" ErrorMessage="آدرس ایمیل را بصورت صحیح وارد کنید" 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                    ValidationGroup="11">*</asp:RegularExpressionValidator>
            </td>
            <td>
                <asp:Label ID="Label2" runat="server" 
                    Text="Your Email: YourID@WebSiteName.Domain -&gt;  Sample-Bahar@yahoo.com"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_WebSite" runat="server" CssClass="Label1" 
                    Text="وب سایت:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_WebSite" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                    ControlToValidate="Txt_WebSite" ErrorMessage="ورود آدرس وب سایت الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                    ControlToValidate="Txt_WebSite" 
                    ErrorMessage="آدرس وب سایت را بصورت صحیح وارد کنید" 
                    ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?" 
                    ValidationGroup="11">*</asp:RegularExpressionValidator>
            </td>
            <td>
                <asp:Label ID="Lab" runat="server" 
                    
                    Text="Your WebSite: http://www.WebSiteName.Domain -&gt;  Sample-http://www.yahoo.com"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Tell" runat="server" CssClass="Label1" 
                    Text="تلفن:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Tell" runat="server" CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" 
                    ControlToValidate="Txt_Tell" ErrorMessage="ورود تلفن الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Mobail" runat="server" CssClass="Label1" 
                    Text="تلفن همراه:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Mobail" runat="server" CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" 
                    ControlToValidate="Txt_Mobail" ErrorMessage="ورود تلفن همراه الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Company" runat="server" CssClass="Label1" 
                    Text="نام شرکت:"></asp:Label>
                        </td>
            <td>
                <asp:DropDownList ID="Drp_CompanyName" runat="server" CssClass="DropDownList" 
                    DataSourceID="LinqDt_Company" DataTextField="CompanyUnitName" 
                    DataValueField="CompanyUnitID">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_Company" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="CompanyUnitID desc" 
                    Select="new (CompanyUnitID, CompanyUnitName)" TableName="tblCompanyUnits">
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" 
                    ControlToValidate="Drp_CompanyName" ErrorMessage="انتخاب شرکت الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_Note" runat="server" CssClass="Label1" 
                    Text="ملاحظات:"></asp:Label>
                        </td>
            <td>
                <asp:TextBox ID="Txt_Note" runat="server" CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" 
                    ControlToValidate="Txt_Note" ErrorMessage="ورود ملاحظات الزامی است" 
                    ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Lbl_UserIsActive" runat="server" CssClass="Label1" 
                    Text="وضعیت کاربر:"></asp:Label>
                        </td>
            <td>
                <asp:CheckBox ID="Chb_UserIsActive" runat="server" ValidationGroup="11" />
            </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                            <asp:Button ID="Btn_Save" runat="server" CssClass="ButtonSave" 
                                onclick="Btn_Save_Click" Text="ثبت نام" ValidationGroup="11" />
                        </td>
            <td>
                <asp:Label ID="Lbl_Error" runat="server" CssClass="LabelError"></asp:Label>
                        </td>
            <td>
                <uc1:US_MainAdminChecker ID="US_MainAdminChecker1" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:GridView ID="Grd_User" runat="server" AutoGenerateColumns="False" 
                    CssClass="mGrid" DataKeyNames="UserName" DataSourceID="LinqDataSource1">
                    <Columns>
                        <asp:CommandField HeaderText="حذف" ShowDeleteButton="True" />
                        <asp:BoundField DataField="RowID" HeaderText="ردیف" InsertVisible="False" 
                            SortExpression="RowID" />
                        <asp:BoundField DataField="UserName" HeaderText="نام کاربری" ReadOnly="True" 
                            SortExpression="UserName" />
                        <asp:BoundField DataField="UsersPswa" HeaderText="کلمه عبور" 
                            SortExpression="UsersPswa" />
                        <asp:BoundField DataField="NameOfUser" HeaderText="نام" 
                            SortExpression="NameOfUser" />
                        <asp:BoundField DataField="SnameOfUser" HeaderText="نام خانوادگی" 
                            SortExpression="SnameOfUser" />
                        <asp:BoundField DataField="RegDateSH" HeaderText="تاریخ تولد" 
                            SortExpression="RegDateSH" />
                        <asp:BoundField DataField="EmailOfUser" HeaderText="آدرس ایمیل" 
                            SortExpression="EmailOfUser" />
                        <asp:BoundField DataField="WebSiteOfUser" HeaderText="وب سایت" 
                            SortExpression="WebSiteOfUser" />
                        <asp:BoundField DataField="PhonesOfUser" HeaderText="تلفن" 
                            SortExpression="PhonesOfUser" />
                        <asp:BoundField DataField="MobilesOfUser" HeaderText="تلفن همراه" 
                            SortExpression="MobilesOfUser" />
                        <asp:CheckBoxField DataField="UserIsActive" HeaderText="وضعیت کاربر" 
                            SortExpression="UserIsActive" />
                        <asp:TemplateField HeaderText="نوع کاربر">
                            <ItemTemplate>
                                <asp:DropDownList ID="Grd_Item_UserTypeName" runat="server" 
                                    DataSourceID="LinqDt_Type" DataTextField="UserTypeDescription" 
                                    DataValueField="UserTypeID" Enabled="False" 
                                    SelectedValue='<%# Bind("UserTypeID") %>'>
                                </asp:DropDownList>
                                <asp:LinqDataSource ID="LinqDt_Type" runat="server" 
                                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="UserTypeID desc" 
                                    Select="new (UserTypeID, UserTypeDescription)" TableName="tblUserTypes">
                                </asp:LinqDataSource>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList ID="Grd_Edit_UserType" runat="server" 
                                    DataSourceID="LinqDt_UserType" DataTextField="UserTypeDescription" 
                                    DataValueField="UserTypeID" SelectedValue='<%# Bind("UserTypeID") %>'>
                                </asp:DropDownList>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="نام واحد شرکت">
                            <ItemTemplate>
                                <asp:DropDownList ID="Grd_Item_CompanyUnit" runat="server" 
                                    DataSourceID="LinqDt_Company" DataTextField="CompanyUnitName" 
                                    DataValueField="CompanyUnitID" Enabled="False" 
                                    SelectedValue='<%# Bind("CompanyUnitID") %>'>
                                </asp:DropDownList>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList ID="Grd_Edit_Drp_CompanyUnit" runat="server" 
                                    DataSourceID="LinqDt_Company" DataTextField="CompanyUnitName" 
                                    DataValueField="CompanyUnitID" SelectedValue='<%# Bind("CompanyUnitID") %>'>
                                </asp:DropDownList>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="NotesDesc" HeaderText="ملاحظات" 
                            SortExpression="NotesDesc" />
                        <asp:CommandField HeaderText="ویرایش" ShowEditButton="True" />
                        <asp:BoundField DataField="CompanyUnitID" HeaderText="CompanyUnitID" 
                            SortExpression="CompanyUnitID" Visible="False" />
                        <asp:BoundField DataField="UserTypeID" HeaderText="UserTypeID" 
                            SortExpression="UserTypeID" Visible="False" />
                        <asp:BoundField DataField="RegDateDt" HeaderText="RegDateDt" 
                            SortExpression="RegDateDt" Visible="False" />
                    </Columns>
                </asp:GridView>
                <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" EnableDelete="True" 
                    EnableUpdate="True" TableName="tblUsers">
                </asp:LinqDataSource>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                                ValidationGroup="11" />
                        </td>
        </tr>
        <tr>
            <td colspan="3">
                            &nbsp;</td>
            <td>
                            &nbsp;</td>
        </tr>
    </table>
</asp:Content>

