private bool TryGetConditions(int pageIndex, int pageSize, out Hashtable conditions) { var errors = new List <string>(); Int32 pageStart = pageSize * (pageIndex - 1) + 1; Int32 pageEnd = pageSize * pageIndex; EndDate = EndDate.AddDays(1).AddSeconds(-1); conditions = new Hashtable() { { "StartDate", StartDate }, { "EndDate", EndDate }, { "PageStart", pageStart }, { "PageEnd", pageEnd }, }; if (!string.IsNullOrWhiteSpace(Keyword)) { conditions.Add("Keyword", Keyword); } if (!string.IsNullOrWhiteSpace(OperatorId)) { if (OperatorId.ToInt32() == ConvertorExtension.ConvertionFailureValue) { errors.Add("操作人员ID的输入值必须是数字"); } conditions.Add("UserID", OperatorId); } if (errors.Any()) { var message = string.Join("\n", errors); DispatcherHelper.CheckBeginInvokeOnUI(() => { Messenger.Default.Send(new NotificationMessage(message), Tokens.SysOperationLogPage_ShowNotification); }); return(false); } return(true); }
private bool TryGetConditions(int pageIndex, int pageSize, out Hashtable conditions) { var errors = new List <string>(); Int32 pageStart = pageSize * (pageIndex - 1) + 1; Int32 pageEnd = pageSize * pageIndex; EndDate = EndDate.AddDays(1).AddSeconds(-1); conditions = new Hashtable() { { "StartDate", StartDate }, { "EndDate", EndDate }, { "PageStart", pageStart }, { "PageEnd", pageEnd }, }; if (!string.IsNullOrWhiteSpace(DeviceCode)) { if (DeviceCode.ToInt32() == ConvertorExtension.ConvertionFailureValue) { errors.Add("设备编号的输入值必须是数字"); } if (ApplicationManager.GetInstance().AuthorizationDevices.All(x => x.Code != DeviceCode)) { errors.Add("输入的设备编号不存在系统中"); } conditions.Add("DeviceCode", DeviceCode); } if (!string.IsNullOrWhiteSpace(UserCode)) { if (UserCode.ToInt32() == ConvertorExtension.ConvertionFailureValue) { errors.Add("人员工号的输入值必须是数字"); } conditions.Add("DeviceUserId", UserCode); } if (!string.IsNullOrWhiteSpace(OperatorId)) { if (OperatorId.ToInt32() == ConvertorExtension.ConvertionFailureValue) { errors.Add("操作人员工号的输入值必须是数字"); } conditions.Add("OperatorId", OperatorId); } if (errors.Any()) { var message = string.Join("\n", errors); DispatcherHelper.CheckBeginInvokeOnUI(() => { Messenger.Default.Send(new NotificationMessage(message), Tokens.DeviceOperationLogPage_ShowNotification); }); return(false); } return(true); }