private void GetBusinessTripTaskList(BusinessTripManagementDAL businessTripManagementDAL)
        {
            var        taskListQuery    = _filterTaskManager.BuildTaskListQuery(StepModuleList.BusinessTripManagement.ToString(), TaskStatusList.InProgress.ToString(), _currentUserADId);
            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == BusinessTripManagementList.Url).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='{CommonSPListField.CommonReqDueDateField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='{CommonSPListField.CommonReqDueDateField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(1).ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                    </Or>
                                </And>
                            </Where>";

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

                if (businessTripManagementList != null)
                {
                    foreach (var businessTripManagement in businessTripManagementList)
                    {
                        var filterTask = new FilterTask(businessTripManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
예제 #2
0
        private void GetBusinessTripTaskList(BusinessTripManagementDAL businessTripManagementDAL)
        {
            var query = _filterTaskManager.BuildApprovalTaskListQuery(StepModuleList.BusinessTripManagement.ToString(), _currentUserADId, DateTime.Now);

            if (this.CountOnly)
            {
                TotalCount += businessTripManagementDAL.CountByQuery(query);
            }
            else
            {
                var businessTripManagementList = businessTripManagementDAL.GetByQuery(query);
                if (businessTripManagementList != null && businessTripManagementList.Count > 0)
                {
                    foreach (var businessTripManagement in businessTripManagementList)
                    {
                        var filterTask = new FilterTask(businessTripManagement);
                        filterTask.ApprovalStatusId = businessTripManagement.ApprovalStatus == Status.Approved ? ApprovedStatusId
                            : businessTripManagement.ApprovalStatus == Status.Rejected ? RejectedStatusId
                            : InProgressStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
예제 #3
0
        public DelegationModel GetDelegatedTaskInfo(string Id)
        {
            DelegationModel delegationModel = new DelegationModel();

            int listItemId = 0;

            if (int.TryParse(Id, out listItemId))
            {
                string[] viewFields = new string[] { StringConstant.BusinessTripManagementList.Fields.DH, StringConstant.BusinessTripManagementList.Fields.DirectBOD,
                                                     StringConstant.BusinessTripManagementList.Fields.BOD, StringConstant.BusinessTripManagementList.Fields.AdminDept,
                                                     StringConstant.CommonSPListField.ApprovalStatusField, StringConstant.CommonSPListField.CommonDepartmentField, CommonSPListField.CommonLocationField };
                string queryStr = $@"<Where>
                                      <Eq>
                                         <FieldRef Name='ID' />
                                         <Value Type='Counter'>{listItemId}</Value>
                                      </Eq>
                                   </Where>";
                string siteUrl  = SPContext.Current.Site.Url;
                List <Biz.Models.BusinessTripManagement> businessTripManagementCollection = _businessTripManagementDAL.GetByQuery(queryStr, viewFields);
                if (businessTripManagementCollection != null && businessTripManagementCollection.Count > 0)
                {
                    EmployeeInfo currentApprover = null;
                    Biz.Models.BusinessTripManagement businessTripManagement = businessTripManagementCollection[0];
                    StepManagementDAL _stepManagementDAL = new StepManagementDAL(siteUrl);
                    var currentStep = _stepManagementDAL.GetStepManagement(businessTripManagement.ApprovalStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId);
                    if (currentStep != null)
                    {
                        currentApprover = _businessTripManagementDAL.GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, currentStep.StepNumber);
                    }

                    if (currentApprover != null)
                    {
                        Delegation delegation = DelegationPermissionManager.IsDelegation(currentApprover.ID, StringConstant.BusinessTripManagementList.Url, businessTripManagement.ID);
                        delegationModel = new DelegationModel(delegation);
                    }
                }
            }

            return(delegationModel);
        }