コード例 #1
0
        public LookupItem GetCurrentEmployeeProcessing(SPListItem listItem)
        {
            LookupItem ret = null;

            VehicleManagement vehicleManagement = this.ParseToEntity(listItem);
            string            approvalStatus    = vehicleManagement.ApprovalStatus.ToLower();

            if (approvalStatus != ApprovalStatus.Approved.ToLower() && approvalStatus != ApprovalStatus.Rejected.ToLower() && approvalStatus != ApprovalStatus.Cancelled.ToLower())
            {
                TaskManagementDAL _taskManagementDAL = new TaskManagementDAL(this.SiteUrl);
                string            taskQueryStr       = string.Format(@"<Where>
                                  <And>
                                     <Eq>
                                        <FieldRef Name='CurrentStepStatus' />
                                        <Value Type='Choice'>{0}</Value>
                                     </Eq>
                                     <And>
                                        <Eq>
                                            <FieldRef Name='StepModule' />
                                            <Value Type='Choice'>{1}</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='ItemId' />
                                            <Value Type='Number'>{2}</Value>
                                        </Eq>
                                     </And>
                                  </And>
                               </Where><OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy>", vehicleManagement.ApprovalStatus.ToString(), StepModuleList.VehicleManagement.ToString(), vehicleManagement.ID);
                SPQuery           spQuery            = new SPQuery()
                {
                    Query    = taskQueryStr,
                    RowLimit = 1
                };

                List <TaskManagement> taskManagementCollection = _taskManagementDAL.GetByQuery(taskQueryStr);
                if (taskManagementCollection != null && taskManagementCollection.Count > 0)
                {
                    var currentStepApprover = employeeInfoDAL.GetByADAccount(taskManagementCollection[0].AssignedTo.ID);
                    if (currentStepApprover != null)
                    {
                        ret = new LookupItem()
                        {
                            LookupId = currentStepApprover.ID, LookupValue = currentStepApprover.FullName
                        }
                    }
                    ;
                }
            }

            return(ret);
        }
コード例 #2
0
        private string BuildQueryGetListOfTasks(EmployeeInfo employeeInfo)
        {
            string filterStr = "<Eq><FieldRef Name='ID' /><Value Type='Counter'>0</Value></Eq>";

            TaskManagementDAL     _taskManagementDAL       = new TaskManagementDAL(this.SiteUrl);
            string                taskQueryStr             = string.Format(@"<Where>
                                  <And>
                                     <Eq>
                                        <FieldRef Name='Status' />
                                        <Value Type='Choice'>{0}</Value>
                                     </Eq>
                                     <And>
                                        <Eq>
                                            <FieldRef Name='StepModule' />
                                            <Value Type='Choice'>{1}</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='AssignedTo' LookupId='TRUE' />
                                            <Value Type='User'>{2}</Value>
                                        </Eq>
                                     </And>
                                  </And>
                               </Where>", TaskStatusList.InProgress.ToString(), StepModuleList.FreightManagement.ToString(), employeeInfo.ADAccount.ID);
            List <TaskManagement> taskManagementCollection = _taskManagementDAL.GetByQuery(taskQueryStr);

            if (taskManagementCollection != null && taskManagementCollection.Count > 0)
            {
                List <int> itemIds = taskManagementCollection.Where(t => t.ItemId > 0).Select(t => t.ItemId).ToList();

                if (itemIds != null && itemIds.Count > 0)
                {
                    filterStr = "";
                    foreach (var itemId in itemIds)
                    {
                        filterStr += string.Format("<Value Type = 'Number'>{0}</Value>", itemId);
                    }
                    if (!string.IsNullOrEmpty(filterStr))
                    {
                        filterStr = string.Format("<In><FieldRef Name = 'ID'/><Values>{0}</Values></In>", filterStr);
                    }
                }
            }

            filterStr = string.Format("<Where>{0}</Where>", filterStr);

            return(filterStr);
        }