private void EnterOutLogListBinding() { string roomNum = ddlReadingRoom.SelectedItem.Value; DateTime startDate = dpStartDate.SelectedDate.Value; if (startDate.Date < SeatManage.Bll.ServiceDateTime.Now.AddDays(-30).Date) { FineUI.Alert.Show("最多可以查询30天前的数据"); return; }// DateTime.Parse(string.Format("{0} {1}", dpStartDate.Text, " 0:00:00")); DateTime endDate = dpEndDate.SelectedDate.Value; //DateTime.Parse(string.Format("{0} {1}", dpEndDate.Text, " 23:59:59")); EnumEnterOutLogQueryMethod method = EnumEnterOutLogQueryMethod.CardNo; DataTable dt = null; dt = LogQueryHelper.GetEnterOutLogDataSet(this.LoginId, roomNum, method, startDate, endDate.AddHours(23).AddMinutes(59)); if (dt != null) { string sortField = EnterOutGrid.Columns[EnterOutGrid.SortColumnIndex].SortField; string sortDirection = EnterOutGrid.SortDirection; DataView TableView = dt.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); EnterOutGrid.DataSource = TableView; EnterOutGrid.DataBind(); } else { FineUI.Alert.Show("没有查询到信息"); } }
private void EnterOutLogListBinding() { string num = txtNum.Text; string roomNum = ddlReadingRoom.SelectedItem.Value; DateTime startDate = dpStartDate.SelectedDate.Value; if (startDate.Date < SeatManage.Bll.ServiceDateTime.Now.AddDays(-30).Date) { FineUI.Alert.Show("最多可以查询30天前的数据"); return; }// DateTime.Parse(string.Format("{0} {1}", dpStartDate.Text, " 0:00:00")); DateTime endDate = dpEndDate.SelectedDate.Value; //DateTime.Parse(string.Format("{0} {1}", dpEndDate.Text, " 23:59:59")); EnumEnterOutLogQueryMethod method = EnumEnterOutLogQueryMethod.None; DataTable dt = null; if (ddlQueryMethod.SelectedValue == "cardNo") { method = EnumEnterOutLogQueryMethod.CardNo; } else if (ddlQueryMethod.SelectedValue == "seatNum") { method = EnumEnterOutLogQueryMethod.SeatNum; } if (chkSearchMH.Checked == false) { dt = LogQueryHelper.GetEnterOutLogDataSet(num, roomNum, method, startDate, endDate.AddHours(23).AddMinutes(59)); } else { dt = LogQueryHelper.GetEnterOutLogDataSet_ByFuzzySearch(num, roomNum, method, startDate, endDate.AddHours(23).AddMinutes(59)); } if (dt != null) { string sortField = enterOutLogList.Columns[enterOutLogList.SortColumnIndex].SortField; string sortDirection = enterOutLogList.SortDirection; DataView TableView = dt.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); enterOutLogList.DataSource = TableView; enterOutLogList.DataBind(); } else { FineUI.Alert.Show("没有查询到信息"); } }
/// <summary> /// 进出记录查询 /// </summary> /// <param name="beginDateString"></param> /// <param name="endDateString"></param> /// <param name="roomNo"></param> /// <returns></returns> public string GetEnterOutGridString(string beginDateString, string endDateString, string roomNo) { DateTime serviceDate = SeatManage.Bll.ServiceDateTime.Now; string cardNo = this.LoginId; DateTime startDate = string.IsNullOrEmpty(beginDateString) ? DateTime.Now.AddDays(-7).Date : DateTime.Parse(beginDateString); StringBuilder sb = new StringBuilder(); if (startDate.Date < SeatManage.Bll.ServiceDateTime.Now.AddDays(-30).Date) { return("-1"); } else { DateTime endDate = string.IsNullOrEmpty(endDateString) ? DateTime.Now.Date : DateTime.Parse(endDateString); //DateTime.Parse(string.Format("{0} {1}", dpEndDate.Text, " 23:59:59")); EnumEnterOutLogQueryMethod method = EnumEnterOutLogQueryMethod.CardNo; DataTable dt = null; dt = LogQueryHelper.GetEnterOutLogDataSet(this.LoginId, roomNo, method, startDate, endDate.AddHours(23).AddMinutes(59)); sb.Append("{"); sb.Append("\"form.paginate.pageNo\": 1,"); sb.Append("\"form.paginate.totalRows\": 100,"); sb.Append(" \"rows\": ["); foreach (DataRow r in dt.Rows) { sb.Append("{\"ReadingRoomName\": '" + r["ReadingRoomName"] + "',\"SeatShortNum\": '" + r["SeatShortNum"] + "',\"Status\": \"" + r["Status"] + "\",\"EnterOutTime\": \"" + r["EnterOutTime"] + "\",\"Remark\": \"" + r["Remark"] + "\"}"); sb.Append(","); } if (dt.Rows.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); sb.Append("}"); } return(sb.ToString()); }
public string GetEnterOutData() { string result = ""; string chkSearchMH = Request.Params["chkSearchMH"] == null ? string.Empty : Request.Params["chkSearchMH"]; string num = Request.Params["txtNum"].Trim(); string roomNum = Request.Params["selectRooms"].Trim(); DateTime startDate = DateTime.Parse(Request.Params["beginDate"].Trim()); StringBuilder sb = new StringBuilder(); if (startDate.Date < SeatManage.Bll.ServiceDateTime.Now.AddDays(-30).Date) { result = "最多可以查询30天前的数据"; } else { DateTime endDate = DateTime.Parse(Request.Params["endDate"].Trim()); EnumEnterOutLogQueryMethod method = EnumEnterOutLogQueryMethod.None; DataTable dt = null; if (Request.Params["selectCardNoOrSeatNo"] == "cardNo") { method = EnumEnterOutLogQueryMethod.CardNo; } else if (Request.Params["selectCardNoOrSeatNo"] == "seatNum") { method = EnumEnterOutLogQueryMethod.SeatNum; } if (chkSearchMH == string.Empty) { dt = LogQueryHelper.GetEnterOutLogDataSet(num, roomNum, method, startDate, endDate.AddHours(23).AddMinutes(59)); } else { dt = LogQueryHelper.GetEnterOutLogDataSet_ByFuzzySearch(num, roomNum, method, startDate, endDate.AddHours(23).AddMinutes(59)); } if (dt != null) { sb.Append("{"); sb.Append("\"form.paginate.pageNo\": 1,"); sb.Append("\"form.paginate.totalRows\": 100,"); sb.Append(" \"rows\": ["); foreach (DataRow r in dt.Rows) { sb.Append("{\"CardNo\": '" + r["CardNo"] + "',\"ReaderName\": '" + r["ReaderName"] + "',\"ReadingRoomName\": \"" + r["ReadingRoomName"] + "\",\"SeatShortNum\": \"" + r["SeatShortNum"] + "\",\"Status\": \"" + r["Status"] + "\",\"EnterOutTime\": \"" + r["EnterOutTime"] + "\",\"Remark\": \"" + r["Remark"] + "\"}"); sb.Append(","); } if (dt.Rows.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); sb.Append("}"); result = sb.ToString(); } else { result = "没有查询到信息"; } } return(result); }