<%@ Page Title="" Language="C#" MasterPageFile="~/Car/car.Master" AutoEventWireup="true" CodeBehind="CarOil.aspx.cs" Inherits="Car.Car.CarOil" %>
<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="caroil.aspx">加油记录</a></li>
  <li role="presentation"><a href="CarOil_Reporting.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="100">
                填表日期
            </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="addoildate" CssClass="form-control _dt"  ValidationGroup="add" ></asp:TextBox>
                   <asp:RequiredFieldValidator ControlToValidate="addoildate" runat="server"  ValidationGroup="add"  ID="RequiredFieldValidator2" Display="Dynamic" ErrorMessage="必须填写加油日期"></asp:RequiredFieldValidator>
            </td>

             <th >
                加油量（升）
            </th>
            <td  >
               <asp:TextBox runat="server" ID="liter" ValidationGroup="add"  CssClass="form-control"></asp:TextBox>
                <asp:RequiredFieldValidator ControlToValidate="liter"  ValidationGroup="add" runat="server" ID="rf_liter" Display="Dynamic" ErrorMessage="必须填写加油量"></asp:RequiredFieldValidator>
            </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>

            </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="addoildate" DataFormatString="{0:yy-MM-dd}" HeaderStyle-Width="100px" />
             <asp:BoundField HeaderText="加油量（升）"  DataField="liter"  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_oil   where (@uid=-1 or uid=@uid) order by id desc"
         DeleteCommand="delete from car_oil where id=@id " OnSelecting="sds_Selecting"
        >

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


</asp:Content>
