/// <summary> /// 获取等待记录 /// </summary> /// <param name="cardNo">读者学号</param> /// <param name="SaetNo">座位号</param> /// <param name="enterOutLogNo">进出记录编号</param> /// <param name="logStatus">记录状态</param> /// <returns></returns> public List <WaitSeatLogInfo> GetWaitLogList(string cardNo, string enterOutLogNo, string begindate, string enddate, List <EnterOutLogType> logType) { StringBuilder strWhere = new StringBuilder(); if (!string.IsNullOrEmpty(cardNo)) { if (String.IsNullOrEmpty(strWhere.ToString())) { strWhere.Append(string.Format(" cardNo='{0}'", cardNo)); } else { strWhere.Append(string.Format(" and cardNo='{0}'", cardNo)); } } if (!string.IsNullOrEmpty(enterOutLogNo)) { if (String.IsNullOrEmpty(strWhere.ToString())) { strWhere.Append(string.Format(" EnterOutLogID='{0}'", enterOutLogNo)); } else { strWhere.Append(string.Format(" and EnterOutLogID='{0}'", enterOutLogNo)); } } if (!string.IsNullOrEmpty(begindate)) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.AppendFormat(" StateChangeTime >= {0}", begindate); } else { strWhere.AppendFormat(" and StateChangeTime >= {0}", begindate); } } if (!string.IsNullOrEmpty(enddate)) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.AppendFormat(" StateChangeTime <= {0}", enddate); } else { strWhere.AppendFormat(" and StateChangeTime <= {0}", enddate); } } if (logType != null && logType.Count > 0) { for (int i = 0; i < logType.Count; i++) { if (i == 0) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.AppendFormat(" WaitingState in ({0}", (int)logType[i]); } else { strWhere.AppendFormat(" and WaitingState in ({0}", (int)logType[i]); } } else if (i != logType.Count - 1) { strWhere.Append(string.Format(",{0}", (int)logType[i])); } if (i == logType.Count - 1) { strWhere.Append(string.Format(" ,{0})", (int)logType[i])); } } } List <WaitSeatLogInfo> list = new List <WaitSeatLogInfo>(); try { DataSet ds = t_sm_seatwaiting_dal.GetList(strWhere.ToString(), null); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { WaitSeatLogInfo waitSeatLog = DataRowToWaitSeatLogInfo(ds.Tables[0].Rows[0]); list.Add(waitSeatLog); } return(list); } catch { throw; } }