/// <summary> /// 获取日志信息集合 /// </summary> /// <param name="pageSize">每页显示记录数</param> /// <param name="pageIndex">当前页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="searchInfo">查询信息</param> /// <returns></returns> public virtual IList <EyouSoft.Model.TicketStructure.MLBLogInfo> GetLogs(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.TicketStructure.MLogTicketSearchInfo searchInfo) { IList <EyouSoft.Model.TicketStructure.MLBLogInfo> items = new List <EyouSoft.Model.TicketStructure.MLBLogInfo>(); StringBuilder cmdQuery = new StringBuilder(); string tableName = "view_LogTicket"; string primaryKey = "Id"; string orderByString = "LatestDate DESC"; StringBuilder fields = new StringBuilder(); fields.Append("*"); fields.Append(",(SELECT CompanyName,ContactName,ContactMobile,ContactTel,ContactQQ,LoginCount,LastLoginTime,IssueTime FROM tbl_CompanyInfo WHERE Id=view_LogTicket.CompanyId FOR XML RAW,ROOT('root')) AS Others"); //fields.Append(",(SELECT COUNT(*) FROM [tbl_LogUserLogin] WHERE [OperatorId]=view_LogTicket.UserId AND DATEDIFF(dd,[EventTime],GETDATE())<7) AS WeekLoginNumber"); using (IDataReader rdr = DbHelper.ExecuteReader(base.TourStore, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields.ToString(), cmdQuery.ToString(), orderByString)) { while (rdr.Read()) { EyouSoft.Model.TicketStructure.MLBLogInfo item = new EyouSoft.Model.TicketStructure.MLBLogInfo(); /* * item.CDate = rdr.GetDateTime(rdr.GetOrdinal("CDate")); * item.LCity = rdr["LCity"].ToString(); * if (!rdr.IsDBNull(rdr.GetOrdinal("LDate"))) * { * item.LDate = rdr.GetDateTime(rdr.GetOrdinal("LDate")); * } * item.RCity = rdr["RCity"].ToString(); * if (!rdr.IsDBNull(rdr.GetOrdinal("RDate"))) * { * item.RDate = rdr.GetDateTime(rdr.GetOrdinal("RDate")); * }*/ item.CompanyId = rdr["CompanyId"].ToString(); item.UserId = rdr["UserId"].ToString(); item.LatestDate = rdr.GetDateTime(rdr.GetOrdinal("LatestDate")); item.TotalTimes = rdr.GetInt32(rdr.GetOrdinal("TotalTimes")); item.WeekTimes = rdr.GetInt32(rdr.GetOrdinal("WeekTimes")); string xml = rdr["Others"].ToString(); if (!string.IsNullOrEmpty(xml)) { XElement xRoot = XElement.Parse(xml); var xRow = Utility.GetXElement(xRoot, "row"); item.CompanyName = Utility.GetXAttributeValue(xRow, "CompanyName"); item.ContactName = Utility.GetXAttributeValue(xRow, "ContactName"); item.ContactMobile = Utility.GetXAttributeValue(xRow, "ContactMobile"); item.ContactTelephone = Utility.GetXAttributeValue(xRow, "ContactTel"); item.ContactQQ = Utility.GetXAttributeValue(xRow, "ContactQQ"); item.LoginNumber = Utility.GetInt(Utility.GetXAttributeValue(xRow, "LoginCount")); item.LastLoginTime = Utility.GetDateTime(Utility.GetXAttributeValue(xRow, "LastLoginTime")); item.RegTime = Utility.GetDateTime(Utility.GetXAttributeValue(xRow, "IssueTime")); } //item.WeekLoginNumber = rdr.IsDBNull(rdr.GetOrdinal("WeekLoginNumber")) ? 0 : rdr.GetInt32(rdr.GetOrdinal("WeekLoginNumber")); items.Add(item); } } if (items != null && items.Count > 0) { foreach (var item in items) { item.WeekLoginNumber = this.GetUserWeekLoginNumber(item.UserId); } } return(items); }
/// <summary> /// 获取日志信息集合 /// </summary> /// <param name="pageSize">每页显示记录数</param> /// <param name="pageIndex">当前页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="searchInfo">查询信息</param> /// <returns></returns> public IList <EyouSoft.Model.TicketStructure.MLBLogInfo> GetLogs(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.TicketStructure.MLogTicketSearchInfo searchInfo) { return(dal.GetLogs(pageSize, pageIndex, ref recordCount, searchInfo)); }