private void GetVehicleTaskList(VehicleManagementDAL vehicleManagementDAL)
        {
            var        taskListQuery    = _filterTaskManager.BuildTaskListQuery(StepModuleList.VehicleManagement.ToString(), TaskStatusList.InProgress.ToString(), _currentUserADId);
            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == VehicleManagementList.ListUrl).Select(d => d.ListItemID).ToList();
            var        delegationQuery  = _filterTaskManager.BuildApprovedByDelegationQuery(_currentUserADId, string.Empty, string.Empty, delegatedItemIDs);

            var query = $@"<Where>
                                <And>
                                    <Or>
                                        {taskListQuery}
                                        {delegationQuery}
                                    </Or>
                                    <Or>
                                        <Eq>
                                            <FieldRef Name='{VehicleManagementList.CommonFrom}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='{VehicleManagementList.CommonFrom}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(1).ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                    </Or>
                                </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += vehicleManagementDAL.CountByQuery(query);
            }
            else
            {
                var vehicleManagementList = vehicleManagementDAL.GetByQuery(query);

                if (vehicleManagementList != null)
                {
                    foreach (var vehicleManagement in vehicleManagementList)
                    {
                        var filterTask = new FilterTask(vehicleManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
Esempio n. 2
0
        private void GetVehicleTaskList(VehicleManagementDAL vehicleManagementDAL)
        {
            var query = _filterTaskManager.BuildApprovalTaskListQuery(StepModuleList.VehicleManagement.ToString(), _currentUserADId, DateTime.Now);

            if (this.CountOnly)
            {
                TotalCount += vehicleManagementDAL.CountByQuery(query);
            }
            else
            {
                var vehicleManagementList = vehicleManagementDAL.GetByQuery(query);
                if (vehicleManagementList != null && vehicleManagementList.Count > 0)
                {
                    foreach (var vehicleManagement in vehicleManagementList)
                    {
                        var filterTask = new FilterTask(vehicleManagement);
                        filterTask.ApprovalStatusId = vehicleManagement.ApprovalStatus == Status.Approved ? ApprovedStatusId
                            : vehicleManagement.ApprovalStatus == Status.Rejected ? RejectedStatusId
                            : InProgressStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }