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("没有查询到信息"); } }
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); }