<%@ Page language="c#" Codebehind="TimeEntry.aspx.cs" AutoEventWireup="false" Inherits="ASPNET.StarterKit.TimeTracker.Web.TimeEntry" uiCulture="en-US"%>
<%@ Register TagPrefix="TimeTrack" TagName="Banner" Src="Banner.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>TimeEntry</title>
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK href="styles.css" type="text/css" rel="stylesheet">
		<script language="javascript" src="script.js" type="text/javascript"></script>
	</HEAD>
	<body>
		<form id="TimeEntry" method="post" runat="server">
			<table cellSpacing="0" cellPadding="0" width="100%" border="0">
				<tr>
					<td vAlign="top" background="images/bars.gif" height="46"><timetrack:banner id="Banner1" runat="server"></timetrack:banner></td>
				</tr>
				<tr>
					<td class="tab-active" vAlign="top" height="15"><IMG height="15" src="images/spacer.gif" width="15"></td>
				</tr>
			</table>
			<table cellSpacing="0" cellPadding="0" width="100%" border="0">
				<tr>
					<td width="8"><IMG height="8" src="images/spacer.gif" width="8"></td>
					<td style="WIDTH: 197px" vAlign="top" width="197">
						<!-- Left Panel -->
						<table cellSpacing="0" cellPadding="0" width="206" border="0">
							<tr>
								<td style="WIDTH: 225px" vAlign="top">
									<table class="tan-border" style="WIDTH: 215px; HEIGHT: 47px" cellSpacing="12" cellPadding="0"
										width="215" border="0">
										<tr>
											<td><span class="header-gray">本周结束于:</span></td>
											<td><asp:textbox id="WeekEnding" runat="server" Columns="12" AutoPostBack="True" BorderWidth="0px"
													BorderStyle="None" ReadOnly="True" Width="68px" CssClass="standard-text"></asp:textbox></td>
											<td><A href="javascript:OpenCalendar('WeekEnding', true)"><IMG src="images/icon-calendar.gif" align="absBottom" border="0"></A>
											</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td style="WIDTH: 225px" vAlign="top" height="11"><IMG height="1" src="images/spacer.gif" width="1"></td>
							</tr>
							<tr>
								<td style="WIDTH: 225px" vAlign="top">
									<table class="tan-border" style="WIDTH: 215px; HEIGHT: 332px" cellSpacing="12" cellPadding="0"
										width="215" border="0">
										<tr vAlign="top">
											<td class="header-gray">在时间记录中添加条目</td>
										</tr>
										<tr vAlign="top">
											<td>项目&nbsp;
												<asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" ControlToValidate="ProjectList" ErrorMessage="必须选择一个项目"
													Display="Dynamic"></asp:requiredfieldvalidator><br>
												<asp:dropdownlist id="ProjectList" runat="server" AutoPostBack="True" Width="175px" CssClass="standard-text"></asp:dropdownlist></td>
										</tr>
										<tr vAlign="top">
											<td>
												<table cellSpacing="0" cellPadding="0" border="0">
													<tr>
														<td style="HEIGHT: 12px">目录</td>
														<td style="HEIGHT: 12px" width="10"><IMG height="1" src="images/spacer.gif" width="15"></td>
														<td style="HEIGHT: 12px">天数</td>
														<td style="HEIGHT: 12px" width="10"><IMG height="1" src="images/spacer.gif" width="15"></td>
														<td style="HEIGHT: 12px">小时</td>
													</tr>
													<tr>
														<td style="HEIGHT: 21px"><asp:dropdownlist id="CategoryList" runat="server" Width="60px" CssClass="standard-text"></asp:dropdownlist></td>
														<td style="HEIGHT: 21px">&nbsp;</td>
														<td style="HEIGHT: 21px"><asp:dropdownlist id="Days" runat="server" Width="48px" CssClass="standard-text"></asp:dropdownlist></td>
														<td style="HEIGHT: 21px">&nbsp;</td>
														<td style="HEIGHT: 21px"><asp:textbox id="Hours" runat="server" Columns="5" Width="37px" CssClass="standard-text"></asp:textbox></td>
													</tr>
													<tr>
														<td colSpan="5"><asp:requiredfieldvalidator id="Requiredfieldvalidator1" runat="server" ControlToValidate="Hours" ErrorMessage="必须填写小时数"
																display="Dynamic"></asp:requiredfieldvalidator><asp:comparevalidator id="CompareValidator1" runat="server" ControlToValidate="Hours" ErrorMessage="小时数必须为数字"
																Display="Dynamic" Type="Currency" Operator="DataTypeCheck"></asp:comparevalidator><asp:rangevalidator id="RangeValidator1" runat="server" ControlToValidate="Hours" ErrorMessage="小时数超出范围"
																Type="Double" MinimumValue="0" MaximumValue="24"></asp:rangevalidator></td>
													</tr>
												</table>
											</td>
										</tr>
										<tr vAlign="top">
											<td>描述<br>
												<asp:textbox id="Description" runat="server" Columns="30" Width="175px" CssClass="standard-text"
													MaxLength="255" Rows="9" TextMode="MultiLine"></asp:textbox></td>
										</tr>
										<tr vAlign="top">
											<td align="left"><asp:button id="AddEntry" runat="server" CssClass="standard-text" CausesValidation="False" Text="添加条目"></asp:button><IMG height="8" src="images/spacer.gif" width="8">
												<asp:button id="Cancel" runat="server" Width="64px" CssClass="standard-text" CausesValidation="False"
													Text="取消"></asp:button></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td style="WIDTH: 225px" vAlign="top" height="11"><IMG height="1" src="images/spacer.gif" width="1"></td>
							</tr>
							<tr>
								<td style="WIDTH: 225px" vAlign="top">
									<table class="tan-border" style="WIDTH: 215px; HEIGHT: 81px" cellSpacing="0" cellPadding="0"
										width="214" border="0">
										<tr vAlign="top">
											<td height="12"><IMG height="1" src="images/spacer.gif" width="1"></td>
										</tr>
										<tr vAlign="top">
											<td class="header-gray">
												<P><IMG height="1" src="images/spacer.gif" width="11">&nbsp;小时数总结</P>
												<P>&nbsp;
													<asp:image id="TimeGraph" Runat="server" Visible="False"></asp:image></P>
											</td>
										</tr>
										<tr vAlign="top">
											<td height="12"><IMG height="1" src="images/spacer.gif" width="1"></td>
										</tr>
										<tr vAlign="top">
											<td></td>
										</tr>
										<TR vAlign="top">
											<TD height="12"><IMG height="1" src="images/spacer.gif" width="1"></TD>
										</TR>
									</table>
								</td>
							</tr>
						</table> <!-- End Left Panel --></td>
					<TD width="11"><IMG height="11" src="images/spacer.gif" width="11"></TD>
					<TD vAlign="top">
						<!-- Right Panel -->
						<table class="tan-border" height="570" cellSpacing="11" cellPadding="0" width="100%" border="0">
							<tr vAlign="top">
								<td height="15"><span class="header-gray">时间记录</span>&nbsp;
									<asp:dropdownlist id="UserList" runat="server" AutoPostBack="True" Width="150px" CssClass="standard-text"
										DataTextField="Name" DataValueField="UserID"></asp:dropdownlist></td>
							</tr>
							<tr>
								<td vAlign="top"><asp:datagrid id="TimeEntryGrid" runat="server" BorderStyle="None" Width="100%" BorderColor="White"
										DataKeyField="EntryLogID" AllowSorting="True" FontSize="11px" Font-Name="Verdana" AutoGenerateColumns="False"
										CellPadding="2">
										<HeaderStyle Font-Bold="True" CssClass="grid-header"></HeaderStyle>
										<Columns>
											<asp:TemplateColumn SortExpression="EntryDate" HeaderText="日期">
												<HeaderStyle HorizontalAlign="Left" Width="80px" CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
												<ItemStyle HorizontalAlign="Center" CssClass="grid-first-item"></ItemStyle>
												<ItemTemplate>
													<asp:label ID="EntryDay" Text='&nbsp;<%# DataBinder.Eval(Container, "DataItem.EntryDate", "{0:ddd}") %>' Runat="server" Width='40px' />
												</ItemTemplate>
												<EditItemTemplate>
													<asp:dropdownlist Width="48px" ID="EntryDays" CssClass="Standard-text" DataSource='<%# _dayListTable %>' DataTextField = "Day" DataValueField = "Date" Runat="server">
													</asp:dropdownlist>
												</EditItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn SortExpression="ProjectName" HeaderText="项目">
												<HeaderStyle HorizontalAlign="Left" Width="40px" CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
												<ItemStyle Width="108px" CssClass="grid-item"></ItemStyle>
												<ItemTemplate>
													<asp:label ID="EntryProject" Text='&nbsp;<%# DataBinder.Eval(Container, "DataItem.ProjectName") %>' Runat="server" />
													<asp:label ID="EntryProjectID" Text='<%# DataBinder.Eval(Container, "DataItem.ProjectID") %>' Runat="server" Visible="False" />
												</ItemTemplate>
												<EditItemTemplate>
													<asp:dropdownlist Width="100px" ID="EntryProjects" AutoPostBack="True" CssClass="Standard-text" DataSource='<%# ListUserProjects() %>' DataTextField="Name" DataValueField="ProjectID" Runat="server" OnSelectedIndexChanged="UserProjects_OnChange" />
												</EditItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn SortExpression="CategoryName" HeaderText="目录">
												<HeaderStyle HorizontalAlign="Left" Width="40px" CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
												<ItemStyle Width="88px" CssClass="grid-item"></ItemStyle>
												<ItemTemplate>
													<asp:label id=EntryCategory Text='&nbsp;<%# DataBinder.Eval(Container, "DataItem.CategoryName") %>' Runat="server">
													</asp:label>
												</ItemTemplate>
												<EditItemTemplate>
													<asp:dropdownlist id=EntryCategories CssClass="Standard-text" Width="80px" Runat="server" DataValueField="CategoryID" DataTextField="Abbreviation" DataSource="<%# ListGridCategories(_userInput.ProjectID) %>">
													</asp:dropdownlist>
												</EditItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn SortExpression="Duration" HeaderText="小时">
												<HeaderStyle HorizontalAlign="Left" Width="40px" CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
												<ItemStyle HorizontalAlign="Right" Width="50px" CssClass="grid-item"></ItemStyle>
												<ItemTemplate>
													<asp:label ID="EntryDuration" Text='&nbsp;<%# DataBinder.Eval(Container.DataItem, "Duration", "{0:f}") %>' Runat="server" />
												</ItemTemplate>
												<EditItemTemplate>
													<asp:textbox Width="40px" AutoPostBack=false CssClass="Standard-text" Runat="server" ID="EntryHours" Text='<%# _userInput.Duration %>' />
													<asp:requiredfieldvalidator id="RequiredFieldValidatorGridHours" runat="server" ErrorMessage="必须填写小时数" ControlToValidate="EntryHours"
														Display="Dynamic"></asp:requiredfieldvalidator>
													<asp:comparevalidator id="CompareValidatorGridHours" runat="server" ErrorMessage="小时数必须为数字" ControlToValidate="EntryHours"
														Display="Dynamic" Type="Currency" Operator="DataTypeCheck"></asp:comparevalidator>
												</EditItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn SortExpression="Description" HeaderText="描述">
												<HeaderStyle HorizontalAlign="Left" CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
												<ItemStyle CssClass="grid-item"></ItemStyle>
												<ItemTemplate>
													<asp:label ID="GridDescription" Text='&nbsp;<%# DataBinder.Eval(Container, "DataItem.Description") %>' Runat="server" />
												</ItemTemplate>
												<EditItemTemplate>
													<asp:textbox runat="server" CssClass="Standard-text" ID="EntryDescription" Text='<%# _userInput.Description %>' Width="250" MaxLength="255">
													</asp:textbox>
												</EditItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn HeaderText="修改">
												<HeaderStyle HorizontalAlign="Left" Width="40px" CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
												<ItemStyle CssClass="grid-edit-column"></ItemStyle>
												<ItemTemplate>
													<asp:imagebutton id="Imagebutton1" runat="server" CausesValidation="false" NAME="Imagebutton1" CommandName="Edit"
														AlternateText="Edit" ImageUrl="images/icon-pencil.gif"></asp:imagebutton><IMG src="images/spacer.gif" width="3">
													<asp:imagebutton id="Imagebutton2" CausesValidation="False" Runat="server" NAME="Imagebutton2" CommandName="Delete"
														AlternateText="Delete" ImageUrl="images/icon-delete.gif"></asp:imagebutton>
												</ItemTemplate>
												<EditItemTemplate>
													<asp:imagebutton id="Imagebutton3" runat="server" CausesValidation="False" NAME="Imagebutton3" CommandName="Update"
														AlternateText="Update" ImageUrl="images/icon-floppy.gif"></asp:imagebutton><IMG src="images/spacer.gif" width="3">
													<asp:imagebutton id="Imagebutton4" runat="server" CausesValidation="False" NAME="Imagebutton4" CommandName="Cancel"
														AlternateText="Cancel" ImageUrl="images/icon-pencil-x.gif"></asp:imagebutton>
												</EditItemTemplate>
											</asp:TemplateColumn>
										</Columns>
									</asp:datagrid></td>
							</tr>
						</table>
						<!-- End Right Panel --></TD>
					<td width="11"><IMG height="11" src="images/spacer.gif" width="11"></td>
				</tr>
				<tr>
					<td vAlign="top" colSpan="5" height="15"><IMG height="15" src="images/spacer.gif" width="15"></td>
				</tr>
			</table>
		</form>
	</body>
</HTML>
