public string GetBespeakData() { string result = ""; StringBuilder sb = new StringBuilder(); string cardNo = Request["txtNum"].ToString().Trim(); string roomNum = Request.Params["selectRooms"] == null ? "" : Request.Params["selectRooms"]; //ddlReadingRoom.SelectedItem.Value; BookingStatus status = Request.Params["selectBespeakState"] == null? BookingStatus.None : (BookingStatus)int.Parse(Request.Params["selectBespeakState"].ToString()); DateTime startDate = DateTime.Parse(Request.Params["beginDate"].ToString()); DateTime endDate = DateTime.Parse(Request.Params["endDate"].ToString()); List <BookingStatus> statusList = new List <BookingStatus>(); if (status == BookingStatus.None) { statusList.Add(BookingStatus.Cencaled); statusList.Add(BookingStatus.Confinmed); statusList.Add(BookingStatus.Waiting); } else { statusList.Add(status); } DataTable dt = new DataTable(); //if (chkSearchMH.Checked == false) if (Request.Params["chkSearchMH"] == null) { dt = LogQueryHelper.BespeakLogQuery(cardNo, roomNum, statusList, startDate, endDate.AddHours(23).AddMinutes(59)); } else { dt = LogQueryHelper.BespeakLogQuery_ByFuzzySearch(cardNo, roomNum, statusList, 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("{\"BespeakID\": '" + r["BespeakID"] + "',\"CardNo\": '" + r["CardNo"] + "',\"ReaderName\": \"" + r["ReaderName"] + "\",\"ReadingRoomName\": \"" + r["ReadingRoomName"] + "\",\"SeatNum\": \"" + r["SeatNum"] + "\",\"BsepeakState\": \"" + r["BsepeakState"] + "\",\"SubmitTime\": \"" + r["SubmitTime"] + "\",\"BespeakTime\": \"" + r["BespeakTime"] + "\",\"CancelTime\": \"" + r["CancelTime"] + "\",\"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); }
public string GetGridString(string beginDateString, string endDateString, string statusString) { string cardNo = this.LoginId; if (string.IsNullOrEmpty(cardNo)) { cardNo = this.LoginId; } BookingStatus status = BookingStatus.None; if (statusString != null) { status = (BookingStatus)int.Parse(statusString); } DateTime startDate = string.IsNullOrEmpty(beginDateString) ? DateTime.Now.Date : DateTime.Parse(beginDateString); DateTime endDate = string.IsNullOrEmpty(endDateString) ? DateTime.Now.AddDays(7).Date : DateTime.Parse(endDateString);//dpEndDate.SelectedDate.Value; List <BookingStatus> statusList = new List <BookingStatus>(); if (status == BookingStatus.None) { statusList.Add(BookingStatus.Cencaled); statusList.Add(BookingStatus.Confinmed); statusList.Add(BookingStatus.Waiting); } else { statusList.Add(status); } DataTable dt = LogQueryHelper.BespeakLogQuery(cardNo, null, statusList, startDate, endDate.AddHours(23).AddMinutes(59)); StringBuilder sb = new StringBuilder(); 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("{\"BespeakID\": '" + r["BespeakID"] + "',\"ReadingRoomName\": '" + r["ReadingRoomName"] + "',\"SeatNum\": \"" + r["SeatNum"] + "\",\"BsepeakState\": \"" + r["BsepeakState"] + "\",\"SubmitTime\": \"" + r["SubmitTime"] + "\",\"BespeakTime\": \"" + r["BespeakTime"] + "\",\"CancelTime\": \"" + r["CancelTime"] + "\",\"Remark\": \"" + r["Remark"] + "\"}"); sb.Append(","); } if (dt.Rows.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); sb.Append("}"); return(sb.ToString()); }
private void GridBindDate() { string cardNo = txtCardNo.Text; string roomNum = ddlReadingRoom.SelectedItem.Value; BookingStatus status = (BookingStatus)int.Parse(ddlBespeakState.SelectedItem.Value); DateTime startDate = dpStartDate.SelectedDate.Value; DateTime endDate = dpEndDate.SelectedDate.Value; List <BookingStatus> statusList = new List <BookingStatus>(); if (status == BookingStatus.None) { statusList.Add(BookingStatus.Cencaled); statusList.Add(BookingStatus.Confinmed); statusList.Add(BookingStatus.Waiting); } else { statusList.Add(status); } DataTable dt = new DataTable(); if (chkSearchMH.Checked == false) { dt = LogQueryHelper.BespeakLogQuery(cardNo, roomNum, statusList, startDate, endDate.AddHours(23).AddMinutes(59)); } else { dt = LogQueryHelper.BespeakLogQuery_ByFuzzySearch(cardNo, roomNum, statusList, startDate, endDate.AddHours(23).AddMinutes(59)); } string sortField = gridBespeakLog.Columns[gridBespeakLog.SortColumnIndex].SortField; string sortDirection = gridBespeakLog.SortDirection; DataView TableView = dt.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); gridBespeakLog.DataSource = TableView; gridBespeakLog.DataBind(); }
private void GridBindDate() { string cardNo = this.LoginId; if (string.IsNullOrEmpty(cardNo)) { cardNo = this.LoginId; } BookingStatus status = BookingStatus.None; if (ddlBespeakState.SelectedItem != null) { status = (BookingStatus)int.Parse(ddlBespeakState.SelectedItem.Value); } DateTime startDate = dpStartDate.SelectedDate.Value; DateTime endDate = dpEndDate.SelectedDate.Value; List <BookingStatus> statusList = new List <BookingStatus>(); if (status == BookingStatus.None) { statusList.Add(BookingStatus.Cencaled); statusList.Add(BookingStatus.Confinmed); statusList.Add(BookingStatus.Waiting); } else { statusList.Add(status); } DataTable dt = LogQueryHelper.BespeakLogQuery(cardNo, null, statusList, startDate, endDate.AddHours(23).AddMinutes(59)); string sortField = gridBespeakLog.Columns[gridBespeakLog.SortColumnIndex].SortField; string sortDirection = gridBespeakLog.SortDirection; DataView TableView = dt.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); gridBespeakLog.DataSource = TableView; gridBespeakLog.DataBind(); }