示例#1
0
 public static string QueryMyTasksDueToday(UserTasks taskids)
 {
     //This query suffices for ASSIGNEDTASKS_DUETODAY, ASSIGNEDTASKS_ALERTS and MANAGEDTASKS_ALERTS
     //Post Release : Addition of filter to also search completed tasks group when tasks dont move between views
     string query = "<View><Query><Where><And><And><In><FieldRef Name='ID'/><Values>";
     foreach (var taskid in taskids.AssignedTasksDueToday)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.AssignedTasksOverdue)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksDueToday)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksIncomplete)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.AssignedTasksCompletedApproved)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.AssignedTasksNotApplicable)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksCompleted)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksNotApplicable)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     query += "</Values></In>";
     query += TasksCreatedTodayCAML() + "</And><Or>";
     query += StatusEqualToCAML(REASSIGN_STATUS);
     query += StatusEqualToCAML(IN_PROGRESS_STATUS) + "</Or></And>";
     query += "</Where></Query></View>";
     return query;
 }
示例#2
0
        public static string QueryManagedTasksIncomplete(UserTasks taskids)
        {
            string query = "<View><Query><Where><And><In><FieldRef Name='ID'/><Values>";
            foreach (var taskid in taskids.ManagedTasksDueToday)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksIncomplete)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksCompleted)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksNotApplicable)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            query += "</Values></In><Or>";
            query += SignOffEqualToCAML(PENDING_SIGNOFF);
            query += SignOffEqualToCAML(REJECTED_SIGNOFF);
            query += "</Or></And></Where></Query></View>";
            return query;

            //Removing the NOT Equal to operator as it slows down CAML queries.
            //query += StatusNotEqualToCAML(COMPLETED_STATUS);
            //query += SignOffNotEqualToCAML(APPROVED_SIGNOFF);
        }
示例#3
0
 public static string QueryAssignedTasksNotApplicable(UserTasks taskids)
 {
     string query = "<View><Query><Where><And><In><FieldRef Name='ID'/><Values>";
     foreach (var taskid in taskids.AssignedTasksDueToday)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.AssignedTasksOverdue)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.AssignedTasksCompletedApproved)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.AssignedTasksNotApplicable)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     query += "</Values></In>";
     query += StatusEqualToCAML(NOTAPPLICABLE_STATUS);
     query += "</And></Where></Query></View>";
     return query;
 }
示例#4
0
 public static string QueryManagedTasksCompleted(UserTasks taskids)
 {
     string query = "<View><Query><Where><And><And><In><FieldRef Name='ID'/><Values>";
     foreach (var taskid in taskids.ManagedTasksDueToday)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksIncomplete)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksCompleted)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     foreach (var taskid in taskids.ManagedTasksNotApplicable)
     {
         query += "<Value Type='Number'>" + taskid + "</Value>";
     }
     query += "</Values></In>";
     query += TasksCreatedTodayCAML() + "</And><And>";
     query += StatusEqualToCAML(COMPLETED_STATUS);
     query += SignOffEqualToCAML(APPROVED_SIGNOFF);
     query += "</And></And></Where></Query></View>";
     return query;
 }
示例#5
0
        public static string QueryManagedTasksDueToday(UserTasks taskids)
        {
            //This query suffices for MANAGEDTASKS_DUETODAY, ASSIGNEDTASKS_ALERTS and MANAGEDTASKS_ALERTS
            string query = "<View><Query><Where><And><And><In><FieldRef Name='ID'/><Values>";
            foreach (var taskid in taskids.AssignedTasksDueToday)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.AssignedTasksOverdue)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksDueToday)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksIncomplete)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksCompleted)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.ManagedTasksNotApplicable)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            query += "</Values></In>";
            query += TasksCreatedTodayCAML() + "</And><Or>";
            query += SignOffEqualToCAML(PENDING_SIGNOFF);
            query += SignOffEqualToCAML(REJECTED_SIGNOFF);
            query += "</Or></And>";
            query += "</Where></Query></View>";
            return query;

            //Removing the NOT Equal to operator as it slows down CAML queries.
            //query += StatusNotEqualToCAML(COMPLETED_STATUS);
            //query += SignOffNotEqualToCAML(APPROVED_SIGNOFF);
        }
示例#6
0
        public static string QueryMyTasksApprovedComplete(UserTasks taskids)
        {
            string query = "<View><Query><Where><And><And><In><FieldRef Name='ID'/><Values>";
            foreach (var taskid in taskids.AssignedTasksCompletedApproved)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.AssignedTasksDueToday)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.AssignedTasksOverdue)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            foreach (var taskid in taskids.AssignedTasksNotApplicable)
            {
                query += "<Value Type='Number'>" + taskid + "</Value>";
            }
            query += "</Values></In><Or>";
            query += TasksCreatedTodayCAML();
            query += SignOffEqualToCAML(PENDING_SIGNOFF);
            query += "</Or></And>";
            query += StatusEqualToCAML(COMPLETED_STATUS);
            query += "</And></Where></Query></View>";

            return query;
        }
示例#7
0
 public void PopulateTaskIDs(Action<bool> reply)
 {
     taskids = new UserTasks();
     var masterlist = _tasksclient.Web.Lists.GetByTitle(InitParams.Current.LookupMasterListName);
     CamlQuery camlq = new CamlQuery();
     camlq.ViewXml = "<View><Query><Where><Eq><FieldRef Name='UserID'/><Value Type='Number'><UserID Type='Number'/></Value></Eq></Where></Query></View>";   // <Value Type='Number'>690</Value></Eq></Where></Query></View>";
     //camlq.ViewXml = "<View><Query><Where><Eq><FieldRef Name='UserID' /><Value Type='Number'>8011</Value></Eq></Where></Query></View>";
     ListItemCollection collListItem = masterlist.GetItems(camlq);
     _tasksclient.Load(collListItem, items => items.Include(item => item["AssignedTasks"],
                                                            item => item["AssignedTasksOverdue"],
                                                            item => item["AssignedTasksNotApplicable"],
                                                            item => item["AssignedTasksCompletedApproved"],
                                                            item => item["AssignedTasksDueTodayCount"],
                                                            item => item["AssignedTasksOverdueCount"],
                                                            item => item["AssignedTasksNotApplicableCount"],
                                                            item => item["AssignedTasksCompletedApprovedCo"],
                                                            item => item["ManagedTasks"],
                                                            item => item["ManagedTasksCompletedApproved"],
                                                            item => item["ManagedTasksOverdue"],
                                                            item => item["ManagedTasksNotApplicable"],
                                                            item => item["ManagedTasksDueTodayCount"],
                                                            item => item["ManagedTasksCompletedApprovedCou"],
                                                            item => item["ManagedTasksOverdueCount"],
                                                            item => item["ManagedTasksNotApplicableCount"]));
     ClientRequestSucceededEventHandler SuccessHandler = null;
     ClientRequestFailedEventHandler FailureHandler = null;
     SuccessHandler = (s, e1) =>
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             if (collListItem.Count > 0)
             {
                 if (int.Parse(collListItem[0]["AssignedTasksDueTodayCount"].ToString()) > 0)
                 {
                     string delimitedassignedtasks = collListItem[0]["AssignedTasks"].ToString();
                     taskids.AssignedTasksDueToday = delimitedassignedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["AssignedTasksOverdueCount"].ToString()) > 0)
                 {
                     string delimitedassignedtasks = collListItem[0]["AssignedTasksOverdue"].ToString();
                     taskids.AssignedTasksOverdue = delimitedassignedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["AssignedTasksNotApplicableCount"].ToString()) > 0)
                 {
                     string delimitedassignedtasks = collListItem[0]["AssignedTasksNotApplicable"].ToString();
                     taskids.AssignedTasksNotApplicable = delimitedassignedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["AssignedTasksCompletedApprovedCo"].ToString()) > 0)
                 {
                     string delimitedassignedtasks = collListItem[0]["AssignedTasksCompletedApproved"].ToString();
                     taskids.AssignedTasksCompletedApproved = delimitedassignedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["ManagedTasksDueTodayCount"].ToString()) > 0)
                 {
                     string delimitedmanagedtasks = collListItem[0]["ManagedTasks"].ToString();
                     taskids.ManagedTasksDueToday = delimitedmanagedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["ManagedTasksCompletedApprovedCou"].ToString()) > 0)
                 {
                     string delimitedmanagedtasks = collListItem[0]["ManagedTasksCompletedApproved"].ToString();
                     taskids.ManagedTasksCompleted = delimitedmanagedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["ManagedTasksOverdueCount"].ToString()) > 0)
                 {
                     string delimitedmanagedtasks = collListItem[0]["ManagedTasksOverdue"].ToString();
                     taskids.ManagedTasksIncomplete = delimitedmanagedtasks.Split(new char[] { ',' }).ToList();
                 }
                 if (int.Parse(collListItem[0]["ManagedTasksNotApplicableCount"].ToString()) > 0)
                 {
                     string delimitedmanagedtasks = collListItem[0]["ManagedTasksNotApplicable"].ToString();
                     taskids.ManagedTasksNotApplicable = delimitedmanagedtasks.Split(new char[] { ',' }).ToList();
                 }
             }
         });
         reply(true);
     };
     FailureHandler = (s, e1) =>
     {
         reply(false);
     };
     _tasksclient.ExecuteQueryAsync(SuccessHandler, FailureHandler);
 }
示例#8
0
        public string CreateCAMLQuery(View vw, SearchParams paramSearch, UserTasks taskids)
        {
            string queryXml = "";
            string viewFieldsXml = "";

            switch (vw)
            {
                case View.vwOpsChecklistLoad:
                    if (taskids.AssignedTasksDueToday.Count + taskids.AssignedTasksOverdue.Count + taskids.AssignedTasksCompletedApproved.Count + taskids.AssignedTasksNotApplicable.Count + taskids.ManagedTasksDueToday.Count + taskids.ManagedTasksIncomplete.Count + taskids.ManagedTasksCompleted.Count + taskids.ManagedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryMyTasksOnLoad(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwDueToday | View.vwAssignedTasks:
                    if (taskids.AssignedTasksDueToday.Count + taskids.AssignedTasksOverdue.Count + taskids.AssignedTasksCompletedApproved.Count + taskids.AssignedTasksNotApplicable.Count + taskids.ManagedTasksDueToday.Count + taskids.ManagedTasksIncomplete.Count + taskids.ManagedTasksCompleted.Count + taskids.ManagedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryMyTasksOnLoad(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwOverDue | View.vwAssignedTasks:
                    if (taskids.AssignedTasksDueToday.Count + taskids.AssignedTasksOverdue.Count + taskids.AssignedTasksCompletedApproved.Count + taskids.AssignedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryMyTasksOverdue(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwCompletedApproved | View.vwAssignedTasks:
                    if (taskids.AssignedTasksCompletedApproved.Count + taskids.AssignedTasksDueToday.Count + taskids.AssignedTasksOverdue.Count + taskids.AssignedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryMyTasksApprovedComplete(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;


                case View.vwDueToday | View.vwManagedTasks:
                    if (taskids.AssignedTasksDueToday.Count + taskids.AssignedTasksOverdue.Count + taskids.ManagedTasksDueToday.Count + taskids.ManagedTasksIncomplete.Count + taskids.ManagedTasksCompleted.Count + taskids.ManagedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryManagedTasksDueToday(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwOverDue | View.vwManagedTasks:
                    if (taskids.ManagedTasksDueToday.Count + taskids.ManagedTasksIncomplete.Count + taskids.ManagedTasksCompleted.Count + taskids.ManagedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryManagedTasksIncomplete(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwCompletedApproved | View.vwManagedTasks:
                    if (taskids.ManagedTasksCompleted.Count + taskids.ManagedTasksDueToday.Count + taskids.ManagedTasksIncomplete.Count + taskids.ManagedTasksNotApplicable.Count < 400)
                    {
                        queryXml = CamlHelper.QueryManagedTasksCompleted(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwCustomSearch:
                    queryXml = CamlHelper.QueryCustomSearch(paramSearch);
                    viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    break;

                case View.vwArchiveView:
                    // If its the custom search do nothing, we just use the different service to query
                    break;

                case View.vwAssignedTasks | View.vwNotApplicable:
                    if (taskids.AssignedTasksNotApplicable.Count + taskids.AssignedTasksDueToday.Count + taskids.AssignedTasksOverdue.Count + taskids.AssignedTasksCompletedApproved.Count < 400)
                    {
                        queryXml = CamlHelper.QueryAssignedTasksNotApplicable(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                case View.vwManagedTasks | View.vwNotApplicable:
                    if (taskids.ManagedTasksNotApplicable.Count + taskids.ManagedTasksDueToday.Count + taskids.ManagedTasksIncomplete.Count + taskids.ManagedTasksCompleted.Count < 400)
                    {
                        queryXml = CamlHelper.QueryManagedTasksNotApplicable(taskids);
                        viewFieldsXml = CamlHelper.VIEWFIELDS_MYTASKSVERBOSE;
                    }
                    else
                    {
                        queryXml = "Overload"; //Too many tasks, revert to old solution
                    }
                    break;

                default:
                    queryXml = "";
                    throw new NotImplementedException("this view has not been implemented:" + vw.ToString());
                //break;
            }
            queryXml = queryXml.Replace("&", "&amp;");
            return queryXml;
        }