예제 #1
0
        private void GetRequestTaskList(RequestsDAL requestDAL)
        {
            var query = _filterTaskManager.BuildApprovalWorkflowHistoryQuery(RequestsList.ListName, this.ApproverFullName, DateTime.Now);

            if (this.CountOnly)
            {
                TotalCount += requestDAL.CountByQuery(query);
            }
            else
            {
                var requestManagementList = requestDAL.GetByQuery(query);
                if (requestManagementList != null && requestManagementList.Count > 0)
                {
                    foreach (var requestManagement in requestManagementList)
                    {
                        var filterTask = new FilterTask(requestManagement);
                        filterTask.ApprovalStatusId = requestManagement.WFStatus == ApprovalStatus.Approved ? ApprovedStatusId
                            : requestManagement.WFStatus == ApprovalStatus.InProcess ? InProcessStatusId
                            : requestManagement.WFStatus == ApprovalStatus.Completed ? CompletedId
                            : requestManagement.WFStatus == ApprovalStatus.Rejected ? RejectedStatusId
                            : InProgressStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
예제 #2
0
        private void GetRequestTaskList(RequestsDAL requestDAL)
        {
            var        requestByValue   = "Mua hàng/Buy new materials or equipments";
            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == RequestsList.Url).Select(d => d.ListItemID).ToList();
            var        delegationQuery  = _filterTaskManager.BuildApprovedByDelegationQuery(_currentUserInfoId, RequestsList.PendingAtField, "Lookup", delegatedItemIDs);

            var query = $@"<Where>
                            <And>
                                <And>
                                    {delegationQuery}
                                    <Eq>
                                        <FieldRef Name='{ApprovalFields.WFStatus}' />
                                        <Value Type='Text'>{StringConstant.ApprovalStatus.InProgress}</Value>
                                    </Eq>
                                </And>
                                <Or>
                                    <And>
                                        <Neq>
                                            <FieldRef Name='{RequestsList.RequestTypeRefField}'/>
                                            <Value Type='Lookup'>{requestByValue}</Value>
                                        </Neq>
                                        <Gt>
                                            <FieldRef Name='{RequestsList.FinishDateField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(1).ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Gt>
                                    </And>
                                    <And>
                                        <Eq>
                                            <FieldRef Name='{RequestsList.RequestTypeRefField}'/>
                                            <Value Type='Lookup'>{requestByValue}</Value>
                                        </Eq>
                                        <Leq>
                                            <FieldRef Name='{StringConstant.DefaultSPListField.CreatedField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Leq>
                                    </And>
                                </Or>
                            </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += requestDAL.CountByQuery(query);
            }
            else
            {
                var requestManagementList = requestDAL.GetByQuery(query);
                if (requestManagementList != null && requestManagementList.Count > 0)
                {
                    foreach (var requestManagement in requestManagementList)
                    {
                        var filterTask = new FilterTask(requestManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }