/// <summary>
        /// Searches for tasks that match the search criteria.
        /// </summary>
        public IRIS.Law.WebServiceInterfaces.Diary.Task[] SearchTask(int startRow, int pageSize, string sortBy, string taskStatus, string user, string fromDate, string toDate, bool forceRefresh)
        {
            DiaryServiceClient diaryService = null;
            IRIS.Law.WebServiceInterfaces.Diary.Task[] tasks = null;
            try
            {
                if (HttpContext.Current.Session[SessionName.LogonSettings] != null)
                {
                    Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId;
                    CollectionRequest collectionRequest = new CollectionRequest();
                    collectionRequest.ForceRefresh = forceRefresh;
                    collectionRequest.StartRow = startRow;
                    collectionRequest.RowCount = pageSize;

                    TaskSearchCriteria criteria = new TaskSearchCriteria();
                    criteria.MemberID = user;
                    criteria.OrderBy = sortBy;
                    if (Session[SessionName.ProjectId] != null)
                    {
                        criteria.ProjectID = new Guid(Session[SessionName.ProjectId].ToString());
                    }

                    if (!string.IsNullOrEmpty(fromDate))
                    {
                        criteria.StartDate = Convert.ToDateTime(fromDate);
                    }
                    else
                    {
                        criteria.StartDate = DataConstants.BlankDate;
                    }

                    if (!string.IsNullOrEmpty(toDate))
                    {
                        criteria.ToDate = Convert.ToDateTime(toDate);
                    }
                    else
                    {
                        criteria.ToDate = DataConstants.BlankDate;
                    }

                    if (!string.IsNullOrEmpty(taskStatus))
                    {
                        criteria.Status = taskStatus;
                    }

                    diaryService = new DiaryServiceClient();
                    TaskSearchReturnValue returnValue = diaryService.MatterTaskSearch(_logonId,
                                                collectionRequest, criteria);

                    if (returnValue.Success)
                    {
                        _taskRowCount = returnValue.Tasks.TotalRowCount;
                        tasks = returnValue.Tasks.Rows;
                    }
                    else
                    {
                        throw new Exception(returnValue.Message);
                    }
                }
                return tasks;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (diaryService != null)
                {
                    if (diaryService.State != System.ServiceModel.CommunicationState.Faulted)
                        diaryService.Close();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Searches for tasks that match the search criteria.
        /// </summary>
        public IRIS.Law.WebServiceInterfaces.Diary.Task[] SearchTask(int startRow, int pageSize, string sortBy, string taskStatus, string user, string fromDate, string toDate, bool forceRefresh)
        {
            DiaryServiceClient diaryService = null;

            IRIS.Law.WebServiceInterfaces.Diary.Task[] tasks = null;
            try
            {
                if (HttpContext.Current.Session[SessionName.LogonSettings] != null)
                {
                    Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId;
                    CollectionRequest collectionRequest = new CollectionRequest();
                    collectionRequest.ForceRefresh = forceRefresh;
                    collectionRequest.StartRow     = startRow;
                    collectionRequest.RowCount     = pageSize;

                    TaskSearchCriteria criteria = new TaskSearchCriteria();
                    criteria.MemberID = user;
                    criteria.OrderBy  = sortBy;
                    if (Session[SessionName.ProjectId] != null)
                    {
                        criteria.ProjectID = new Guid(Session[SessionName.ProjectId].ToString());
                    }

                    if (!string.IsNullOrEmpty(fromDate))
                    {
                        criteria.StartDate = Convert.ToDateTime(fromDate);
                    }
                    else
                    {
                        criteria.StartDate = DataConstants.BlankDate;
                    }

                    if (!string.IsNullOrEmpty(toDate))
                    {
                        criteria.ToDate = Convert.ToDateTime(toDate);
                    }
                    else
                    {
                        criteria.ToDate = DataConstants.BlankDate;
                    }

                    if (!string.IsNullOrEmpty(taskStatus))
                    {
                        criteria.Status = taskStatus;
                    }

                    diaryService = new DiaryServiceClient();
                    TaskSearchReturnValue returnValue = diaryService.MatterTaskSearch(_logonId,
                                                                                      collectionRequest, criteria);

                    if (returnValue.Success)
                    {
                        _taskRowCount = returnValue.Tasks.TotalRowCount;
                        tasks         = returnValue.Tasks.Rows;
                    }
                    else
                    {
                        throw new Exception(returnValue.Message);
                    }
                }
                return(tasks);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (diaryService != null)
                {
                    if (diaryService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        diaryService.Close();
                    }
                }
            }
        }