public List <PrintLogEntity> ListPrintLogs(PrintLogEntity PrintLog, DateTime DateFrom, DateTime DateTo) { IMapper map = DatabaseInstance.Instance(); string sql = @"SELECT START_SEQ,QTY,PRINT_USER,PRINT_DATE,TYP FROM PRINT_LOGS where (@Name is null or PRINT_USER = @Name) and (@DateFrom is null or PRINT_DATE >= @DateFrom) and (@DateTo is null or PRINT_DATE <= @DateTo)"; return(map.Query <PrintLogEntity>(sql, new { Name = PrintLog.PRINT_USER, DateFrom = DateFrom, DateTo = DateTo })); }
private void BindDetail(string name, DateTime dateBegin, DateTime dateEnd) { try { if (dateBeginDate.DateTime > dateEndDate.DateTime) { MsgBox.Warn("开始时间不能大于结束时间。"); return; } PrintLogEntity logs = new PrintLogEntity(); labName = logs.PRINT_USER = string.IsNullOrEmpty(name) ? null : name; labDateBegin = dateBegin; labDateEnd = dateEnd; List <PrintLogEntity> printlogs = printlog.ListPrintLogs(logs, dateBegin, dateEnd.AddDays(1)); gridOperateHistoryEntities.DataSource = printlogs; labelTextDisplay(); } catch (Exception ex) { MsgBox.Err(ex.Message); } }