/// <summary> /// 获取操作涉及的全文总页数。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public Int64 CountPageCount(LogQueryCondition cond) { Int64 result=0; if (null != cond.opType && cond.opType.Equals("INSERT")) { IDictionary<string, string> para = GetParaCondition(cond); try { result = sqlMapper.QueryForObject<Int64>("SqlCountPages", para); } catch {} return result; } try { result = sqlMapper.QueryForObject<Int64>("CountFullTextPage", cond); } catch (Exception) { } return result; }
/// <summary> /// 获取操作涉及的全文总页数。 /// 如果针对一条记录有多次操作,仅记录一次全文页数。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public int CountPageCount(LogQueryCondition cond) { IList<OperationLogItem> allPageCount = sqlMapper.QueryForList<OperationLogItem>("CountFulltextPage", cond); int result = 0; foreach (OperationLogItem pageCount in allPageCount) { result += pageCount.opPageCount; } return result; }
/// <summary> /// 获取操作次数。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public int CountOperation(LogQueryCondition cond) { if (null != cond.opType && cond.opType.Equals("INSERT")) { IDictionary<string, string> para = GetParaCondition(cond); return sqlMapper.QueryForObject<int>("SqlCountRecords", para); } else return sqlMapper.QueryForObject<int>("CountOperation", cond); }
/// <summary> /// 获取操作涉及的全文总页数。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public Int64 CountPageCount(LogQueryCondition cond) { Int64 result=0; try { result = sqlMapper.QueryForObject<Int64>("CountFullTextPage", cond); } catch (Exception) { } return result; }
/// <summary> /// 获取操作的本数。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public int CountBook(LogQueryCondition cond) { if (null != cond.opType && cond.opType.Equals("INSERT")) { IDictionary<string, string> para = GetParaCondition(cond); string tableName = para["tableName"]; if (tableName.Equals("ZWQK_PM") || tableName.Equals("WWQK_PM")) return sqlMapper.QueryForObject<int>("QKCountBooks", para); return sqlMapper.QueryForObject<int>("SqlCountBooks", para); } else return sqlMapper.QueryForObject<int>("CountBook", cond); }
/// <summary> /// 查询指定条件,日志的记录数 /// </summary> /// <param name="cond">条件</param> /// <returns></returns> public int CountOperationLogItem(LogQueryCondition cond) { return sqlMapper.QueryForObject<int>("CountOperationLogItem", cond); }
/// <summary> /// 根据cond构造查询参数 /// </summary> /// <param name="cond"></param> /// <returns></returns> IDictionary<string, string> GetParaCondition(LogQueryCondition cond) { IDictionary<string, string> para = new Dictionary<string, string>(); string tableName = GetTableByName(cond.wk); para.Add("tableName", tableName); para.Add("dlr", cond.userName); para.Add("startDate", cond.startDate.ToString("yyyy-MM-dd")); para.Add("endDate", cond.endDate.ToString("yyyy-MM-dd")); if (tableName.Equals("ZGCG_PM") || tableName.Equals("KJCG_PM")) para.Add("colName", "flbm"); else if (tableName.Equals("ZWHY_PM") || tableName.Equals("WWHY_PM")) para.Add("colName", "sybm"); else para.Add("colName", "wjm"); if (tableName.Equals("ZWQK_PM") || tableName.Equals("WWQK_PM") || tableName.Equals("ZWQKJG_PM")) { para.Add("sybm", "sybm"); para.Add("nf", "nf"); para.Add("qh", "qh"); } return para; }
/// <summary> /// 根据条件进行日志查询,返回数据库中的日志记录。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public IList<OperationLogItem> queryLogItem(LogQueryCondition cond) { return sqlMapper.QueryForList<OperationLogItem>("QueryOperationLogItem", cond); }
/// <summary> /// 获取操作的本数。 /// </summary> /// <param name="cond"></param> /// <returns></returns> public int CountBook(LogQueryCondition cond) { return sqlMapper.QueryForObject<int>("CountBook", cond); }
/// <summary> /// 获取查询条件 /// </summary> /// <returns></returns> private LogQueryCondition GetLogQueryCondition() { LogQueryCondition condition = new LogQueryCondition(); condition.startDate = DateTime.Parse(this.startTextBox.Text); condition.endDate = DateTime.Parse(this.endTextBox.Text); condition.wk = this.wkDropDownList.SelectedItem.Text; condition.userName = this.staffDropDownList.SelectedValue; if (condition.userName.Equals("全部")) condition.userName = ""; condition.opType = this.GetOPType(); return condition; }
/// <summary> /// 获取查询条件 /// </summary> /// <returns></returns> private LogQueryCondition GetLogQueryCondition() { LogQueryCondition condition = new LogQueryCondition(); condition.startDate = DateTime.Parse(this.startHiddenField.Value); condition.endDate = DateTime.Parse(this.endHiddenField.Value); condition.wk = this.wkHiddenField.Value; condition.userName = this.staffHiddenField.Value; condition.opType = this.GetOPType(); //获取符合查询条件的总的记录数 int pageCount = this.logDAO.CountOperationLogItem(condition); //总的记录数 this.totalRecordsHiddenField.Value = pageCount.ToString(); //每页显示的记录数 int pageSize = 20; //总的页数 int totalPage = (pageCount -1) / pageSize+1; this.pageCountHiddenField.Value = totalPage.ToString(); //页码 int pageNumber = 1; try { pageNumber = Int32.Parse(this.pageNumberHiddenField.Value); } catch (Exception) { } if (pageNumber < 1) { pageNumber = 1; } if (pageNumber > totalPage) { pageNumber = totalPage; } this.pageNumberHiddenField.Value = pageNumber.ToString(); condition.start = (pageNumber-1)*pageSize+1; condition.end = pageNumber*pageSize; return condition; }