Пример #1
0
        private void GetChangeShiftTaskList(ChangeShiftManagementDAL changeShiftManagementDAL)
        {
            var query = $@"<Where>
                                <And>
                                    <Or>
                                        <Eq>
                                            <FieldRef Name='{StringConstant.CommonSPListField.ApprovalStatusField}' />
                                            <Value Type='Text'>Approved</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='{StringConstant.CommonSPListField.ApprovalStatusField}' />
                                            <Value Type='Text'>Rejected</Value>
                                        </Eq>
                                    </Or>
                                    <And>
	                                    <Eq>
                                            <FieldRef Name='{StringConstant.ChangeShiftList.DHField}' LookupId='TRUE' />
                                            <Value Type='User'>{_currentUserADId}</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='{StringConstant.DefaultSPListField.ModifiedField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                    </And>
                                </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += changeShiftManagementDAL.CountByQuery(query);
            }
            else
            {
                var changeShiftManagementList = changeShiftManagementDAL.GetByQuery(query);
                if (changeShiftManagementList != null)
                {
                    foreach (var changeShiftManagement in changeShiftManagementList)
                    {
                        var filterTask = new FilterTask(changeShiftManagement);
                        filterTask.ApprovalStatusId = changeShiftManagement.ApprovalStatus == "Approved" ? ApprovedStatusId : RejectedStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
        private void GetChangeShiftTaskList(ChangeShiftManagementDAL changeShiftManagementDAL)
        {
            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == ChangeShiftList.ListUrl).Select(d => d.ListItemID).ToList();
            var        delegationQuery  = _filterTaskManager.BuildApprovedByDelegationQuery(_currentUserADId, ChangeShiftList.DHField, "User", delegatedItemIDs);
            var        query            = $@"<Where>
                                <And>
                                    <And>
	                                    {delegationQuery}
                                        <Or>
                                            <Eq>
                                               <FieldRef Name='{StringConstant.ChangeShiftList.FromDateField}' />
                                               <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                            </Eq>
                                            <Eq>
                                               <FieldRef Name='{StringConstant.ChangeShiftList.FromDateField}' />
                                               <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(1).ToString(StringConstant.DateFormatForCAML)}</Value>
                                            </Eq>
                                        </Or>
                                    </And>
	                                <IsNull>
		                                <FieldRef Name='{StringConstant.ChangeShiftList.AprovalStatusField}' />
	                                </IsNull>
                                </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += changeShiftManagementDAL.CountByQuery(query);
            }
            else
            {
                var changeShiftManagementList = changeShiftManagementDAL.GetByQuery(query);
                if (changeShiftManagementList != null)
                {
                    foreach (var changeShiftManagement in changeShiftManagementList)
                    {
                        var filterTask = new FilterTask(changeShiftManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }