<%@ Page Title="" Language="C#" MasterPageFile="~/Car/car.Master" AutoEventWireup="true" CodeBehind="CarMaintain.aspx.cs" Inherits="Car.Car.CarMaintain" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

     <ul class="nav nav-tabs">
  <li role="presentation" class="active"><a href="CarMaintain.aspx">日常维护</a></li>
  <li role="presentation"><a href="CarMaintain_Road.aspx">行驶里程</a></li>
 
</ul>
 

    <table class="table  table-bordered">
        <tr>

             <th width="130">
                所属车辆
            </th>
            <td width="250">
               <asp:DropDownList runat="server" ID="ddl_car" ValidationGroup="add" CssClass="form-control"></asp:DropDownList>
                <asp:RequiredFieldValidator runat="server"  ControlToValidate="ddl_car" Display="Dynamic" ID="rf" ValidationGroup="add" ErrorMessage="必须选择车辆"></asp:RequiredFieldValidator>
            </td>


            <th width="100">
                填表人
            </th>
            <td width="250">
                <asp:TextBox runat="server" ID="opusername" Enabled="false" CssClass="form-control"></asp:TextBox>
            </td>


             <th width="120">
                填表日期
            </th>
            <td width="250">
                <asp:TextBox runat="server" ID="opdate" Enabled="false"  CssClass="form-control"></asp:TextBox>
            </td>
        </tr>




         <tr>

                <th >
                维护日期
            </th>
            <td >
                <asp:TextBox runat="server" ID="maintaindate" CssClass="form-control _dt"  ValidationGroup="add" ></asp:TextBox>
                   <asp:RequiredFieldValidator ControlToValidate="maintaindate" runat="server"  ValidationGroup="add"  ID="RequiredFieldValidator2" Display="Dynamic" ErrorMessage="必须填写加油日期"></asp:RequiredFieldValidator>
            </td>

             <th >
                维护类型
            </th>
            <td  >
             <asp:RadioButtonList runat="server" ID="types" RepeatColumns="3">
                 <asp:ListItem Text="日常保养" Value="日常保养"></asp:ListItem>
                  <asp:ListItem Text="故障维修" Value="故障维修"></asp:ListItem>

             </asp:RadioButtonList>
                
                
                   </td>


            <th >
                维护费用（元）
            </th>
            <td >
                <asp:TextBox runat="server" ID="fee" CssClass="form-control" ValidationGroup="add" ></asp:TextBox>
                         <asp:RequiredFieldValidator ControlToValidate="fee" ValidationGroup="add"  runat="server" ID="RequiredFieldValidator1" Display="Dynamic" ErrorMessage="必须填写费用"></asp:RequiredFieldValidator>
       
            </td>


             
         

        </tr>

        <tr>
            <th>具体内容</th>
            <td colspan="4">
                <asp:textbox runat="server" ID="note" CssClass="form-control" TextMode="MultiLine"></asp:textbox>
                   <asp:RequiredFieldValidator ControlToValidate="note" runat="server"  ValidationGroup="add"  ID="RequiredFieldValidator43" Display="Dynamic" ErrorMessage="必须填写维护内容"></asp:RequiredFieldValidator>
            </td>
            <td  >

                <asp:Button runat="server" ID="btn_add" Text="添加维护记录"  ValidationGroup="add"  CssClass="btn btn-primary" OnClick="btn_add_Click" />
            </td>
        </tr>
    </table>
    <br />


    <asp:GridView runat="server" ID="gv_list" AutoGenerateColumns="false"
         GridLines="None" CssClass="table table-hover " PageSize="20"
         DataSourceID="sds" DataKeyNames="id" AllowPaging="True">
        <Columns>
            <asp:BoundField HeaderText="车辆"  DataField="carname"  HeaderStyle-Width="120px" />
             <asp:BoundField HeaderText="填单人"  DataField="opUserName"  HeaderStyle-Width="90px" />
             <asp:BoundField HeaderText="填单日期"  DataField="opdate"  DataFormatString="{0:yy-MM-dd}" HeaderStyle-Width="100px" />
             <asp:BoundField HeaderText="维护日期"  DataField="maintaindate" DataFormatString="{0:yy-MM-dd}" HeaderStyle-Width="100px" />
             <asp:BoundField HeaderText="维护类型"  DataField="types"  HeaderStyle-Width="100px" />
             <asp:BoundField HeaderText="费用(元)"  DataField="fee"  HeaderStyle-Width="100px" />
             <asp:BoundField HeaderText="备注"  DataField="note"   />


          <asp:CommandField ShowDeleteButton="True"  DeleteText="删除" ButtonType="Button" ControlStyle-CssClass="btn btn-sm btn-danger" HeaderStyle-Width="80px"/>
        </Columns>
<PagerStyle CssClass="pagination-ys" />

    </asp:GridView>


    <asp:SqlDataSource runat="server" ID="sds"
         ConnectionString="<%$ConnectionStrings:ConnectionString %>"
         SelectCommand =" select  * from car_maintain   where (@uid=-1 or uid=@uid) order by id desc"
         DeleteCommand="delete from car_maintain where id=@id " OnSelecting="sds_Selecting"
        >

        <SelectParameters>
            <asp:Parameter DefaultValue="-1" Name="uid" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>

</asp:Content>
