Example #1
0
        public void ResolveUserInfo(UserInfo u)
        {
            EndpointAddress addr = new EndpointAddress(ViewModel.PeopleAsmxUrl);
            BasicHttpBinding bnd = new BasicHttpBinding();
            bnd.MaxBufferSize = InitParams.Current.MaxBufferSize;
            bnd.MaxReceivedMessageSize = bnd.MaxBufferSize;

            BCheckPeople.PeopleSoapClient peopleResolveClient =
                new BCheck.Data.BCheckPeople.PeopleSoapClient(bnd, addr);
            peopleResolveClient.ResolvePrincipalsCompleted +=
                new EventHandler<BCheck.Data.BCheckPeople.ResolvePrincipalsCompletedEventArgs>(peopleResolveClient_ResolvePrincipalsCompleted);

            BCheck.Data.BCheckPeople.ArrayOfString logins = new BCheck.Data.BCheckPeople.ArrayOfString();
            logins.Add(u.AccountName);
            peopleResolveClient.ResolvePrincipalsAsync(logins,
                    BCheck.Data.BCheckPeople.SPPrincipalType.User, false);

        }
Example #2
0
        /// <summary>
        /// Iterates through a collection of Tasks and computes the summary counts.
        /// Consolidated the code into a single function as per business requirements of Mar 11 release.
        /// </summary>
        /// <param name="queryalltasks"></param>
        /// <param name="summaryView"></param>
        //private void HelperProcessSummaryResultsAssignedTasks(IEnumerable<TaskItem> queryalltasks, SummaryView summaryView)
        ////{

        ////    //DateTime localmidnight = DateTime.Now.Date; //July 06
        ////    DateTime localmidnight = RegionalSetting.CurrentLocalTime.Date;

        ////    var queryDueLaterToday = from t in queryalltasks
        ////                            where
        ////                                (
        ////                                (
        ////                                t.CreatedLocal >= localmidnight
        ////                                )
        ////                                &&
        ////                                (
        ////                                BCheck.Data.TaskItem.GetCompletionStatus(t) == TaskCompletionStatus.NotDueImmediately
        ////                                )
        ////                                )
        ////                                select t;
        ////    summaryView.TasksDueLaterToday = queryDueLaterToday.Count();

        ////    var queryDueWithinTheNextHour = from t in queryalltasks
        ////                            where
        ////                                (
        ////                                (
        ////                                t.CreatedLocal >= localmidnight
        ////                                )
        ////                                &&
        ////                                (
        ////                                BCheck.Data.TaskItem.GetCompletionStatus(t) == TaskCompletionStatus.ShortlyDue
        ////                                )
        ////                                )
        ////                            select t;
        ////    summaryView.TasksDueWithinNextHour = queryDueWithinTheNextHour.Count();

        ////    var queryOverDueToday = from t in queryalltasks
        ////                           where
        ////                               (
        ////                               (
        ////                               t.CreatedLocal >= localmidnight
        ////                               )
        ////                               &&
        ////                               (
        ////                            t.Status.Equals(CamlHelper.IN_PROGRESS_STATUS)
        ////                               )
        ////                               &&
        ////                               (
        ////                               BCheck.Data.TaskItem.GetCompletionStatus(t) == TaskCompletionStatus.Overdue 
        ////                               )
        ////                               )
        ////                           select t;
        ////    summaryView.TasksOverdueToday  = queryOverDueToday.Count();

        ////    var queryOverDueBeforeToday = from t in queryalltasks
        ////                           where
        ////                               (
        ////                               (
        ////                               t.CreatedLocal < localmidnight
        ////                               )
        ////                               &&
        ////                               (
        ////                            t.Status.Equals(CamlHelper.IN_PROGRESS_STATUS)
        ////                               )
        ////                               )
        ////                           select t;
        ////    summaryView.TasksOverdueBeforeToday  = queryOverDueBeforeToday.Count();

        ////    summaryView.TasksTotalOutstanding = summaryView.TasksOverdueBeforeToday + summaryView.TasksOverdueToday + summaryView.TasksDueLaterToday + summaryView.TasksDueWithinNextHour;

        ////    //Completed and approved
        ////    var queryCompletedApproved = from t in queryalltasks
        ////                                         where
        ////                                             (

        ////                                             (
        ////                                             t.CreatedLocal >= localmidnight
        ////                                             )
        ////                                             &&
        ////                                             (
        ////                                            (t.Status.Equals(CamlHelper.COMPLETED_STATUS))
        ////                                                &&
        ////                                            (t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF))
        ////                                             )
        ////                                             )
        ////                                         select t;
        ////    summaryView.TasksCompletedApproved  = queryCompletedApproved.Count();

        ////    //Completed and awaiting approval
        ////    var queryCompletedAwaitingApproval = from t in queryalltasks
        ////                             where
        ////                                 (

        ////                                 (
        ////                                 t.CreatedLocal >= localmidnight
        ////                                 )
        ////                                 &&
        ////                                 (
        ////                                (t.Status.Equals(CamlHelper.COMPLETED_STATUS )) 
        ////                                    &&
        ////                                (t.ManagementSignOff.Equals(CamlHelper.PENDING_SIGNOFF) )
        ////                                 )
        ////                                 )
        ////                             select t;
        ////    summaryView.TasksCompletedAwaitingApproval  = queryCompletedAwaitingApproval.Count();


        ////    //Not applicable
        ////    var queryNotApplicable = from t in queryalltasks
        ////                             where
        ////                                 (

        ////                                 (
        ////                                 t.CreatedLocal >= localmidnight
        ////                                 )
        ////                                 &&
        ////                                 (
        ////                                t.Status.Equals(CamlHelper.NOTAPPLICABLE_STATUS)
        ////                                 )
        ////                                 )
        ////                             select t;
        ////    summaryView.TasksNotApplicable = queryNotApplicable.Count();

        ////    summaryView.TasksTotal = summaryView.TasksNotApplicable + summaryView.TasksCompletedAwaitingApproval + summaryView.TasksCompletedApproved + summaryView.TasksTotalOutstanding;

        ////    //var querytotaloverdue = from t in queryalltasks
        ////    //                   where
        ////    //                       (
        ////    //                    (!t.Status.Equals(CamlHelper.COMPLETED_STATUS)) ||
        ////    //                    (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF))
        ////    //                       ) 
        ////    //                   select t;
        ////    //summaryView.TasksTotal = querytotaloverdue.Count();


        ////    //commented out on Feb 27, for Mar 2011 release
        ////    ////var queryduetoday = from t in queryalltasks where t.CreatedLocal > localmidnight select t;
        ////    ////summaryView.TasksDueToday = queryduetoday.Count();

        ////    ////var queryoverdue = from t in queryalltasks where 
        ////    ////                                    (
        ////    ////                                        (
        ////    ////                                        t.CreatedLocal < localmidnight
        ////    ////                                        )                                                     
        ////    ////                                        && 
        ////    ////                                        (
        ////    ////                                            (!t.Status.Equals(CamlHelper.COMPLETED_STATUS)) || 
        ////    ////                                            (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF))
        ////    ////                                        )
        ////    ////                                    )
        ////    ////                        select t;
        ////    ////summaryView.TasksOverdue = queryoverdue.Count();

        ////    ////summaryView.TasksTotal = summaryView.TasksOverdue + summaryView.TasksDueToday; 

        ////    ////var outstanding = from t in queryalltasks where t.Status.Equals(CamlHelper.IN_PROGRESS_STATUS) select t;
        ////    ////summaryView.TasksOutstanding = outstanding.Count();


        ////    ////var queryapproved = from t in queryalltasks
        ////    ////                    where
        ////    ////                        (
        ////    ////                        t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF) &&
        ////    ////                        (t.CreatedLocal > localmidnight)
        ////    ////                        )
        ////    ////                    select t;

        ////    ////summaryView.TasksApproved = queryapproved.Count();

        ////    ////var querypending = from t in queryalltasks where t.ManagementSignOff.Equals(CamlHelper.PENDING_SIGNOFF) select t;
        ////    ////summaryView.TasksPending = querypending.Count();

        ////    ////var queryrejected = from t in queryalltasks where t.ManagementSignOff.Equals(CamlHelper.REJECTED_SIGNOFF) select t;
        ////    ////summaryView.TasksRejected = queryrejected.Count();


        ////    ////var reassign = from t in queryalltasks where t.Status.Equals("Reassign") select t;
        ////    ////summaryView.TasksReassign = reassign.Count();

        ////    ////var notapplicable = from t in queryalltasks where t.Status.Equals("Not Applicable") select t;
        ////    ////summaryView.TasksNotApplicable = notapplicable.Count();

        ////    ////var partcompeleted = from t in queryalltasks where t.Status.Equals("Part Completed") select t;
        ////    ////summaryView.TasksPartCompleted = partcompeleted.Count();

        ////    ////var querycomplete = from t in queryalltasks
        ////    ////                    where
        ////    ////                        (
        ////    ////                        (
        ////    ////                        (t.CreatedLocal > localmidnight) &&
        ////    ////                        (t.Status.Equals(CamlHelper.COMPLETED_STATUS))
        ////    ////                        ) ||

        ////    ////                        (
        ////    ////                        (t.CreatedLocal < localmidnight) &&
        ////    ////                        (
        ////    ////                        (t.Status.Equals(CamlHelper.COMPLETED_STATUS)) &&
        ////    ////                        (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF))
        ////    ////                        )
        ////    ////                        )
        ////    ////                        )
        ////    ////                    select t;

        ////    ////summaryView.TasksComplete = querycomplete.Count(); 
        ////}

        //private void HelperProcessSummaryResultsManagedTasks(IEnumerable<TaskItem> queryalltasks, SummaryView summaryView)
        //{
        //    //var querytotaloverdue = from t in queryalltasks
        //    //                   where
        //    //                        (
        //    //                           //(!t.Status.Equals(CamlHelper.COMPLETED_STATUS))
        //    //                           //||
        //    //                           (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF)) 
        //    //                       )
        //    //                   select t;
        //    //summaryView.TasksTotal = querytotaloverdue.Count();

        //    //summaryView.TasksTotal = queryalltasks.Count();

        //    //DateTime localmidnight = DateTime.Now.Date; //July 06
        //    DateTime localmidnight = RegionalSetting.CurrentLocalTime.Date;

        //    //var queryduetoday = from t in queryalltasks where t.CreatedLocal > localmidnight select t;
        //    var queryduetoday = from t in queryalltasks where 
        //                            (
        //                                (t.CreatedLocal > localmidnight)
        //                                //&&
        //                                //(
        //                                //        (!t.Status.Equals(CamlHelper.COMPLETED_STATUS))
        //                                //                ||
        //                                //        (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF)) 
        //                                //)
        //                            )                                
        //                        select t;
        //    summaryView.TasksDueToday = queryduetoday.Count();

        //    var queryoverdue = from t in queryalltasks where 
        //                                (
        //                                    (
        //                                        (!t.Status.Equals(CamlHelper.COMPLETED_STATUS)) 
        //                                                ||
        //                                        (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF)) 
        //                                    )
        //                                    && 
        //                                    (t.CreatedLocal < localmidnight)
        //                                )select t;
        //    summaryView.TasksOverdue = queryoverdue.Count();
        //    summaryView.TasksTotal = summaryView.TasksOverdue + summaryView.TasksDueToday; 

        //    var outstanding = from t in queryalltasks where t.Status.Equals(CamlHelper.IN_PROGRESS_STATUS) select t;
        //    summaryView.TasksOutstanding = outstanding.Count();


        //    var queryapproved = from t in queryalltasks
        //                        where
        //                            (
        //                            t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF) &&
        //                            (t.CreatedLocal > localmidnight)
        //                            )
        //                        select t;


        //    summaryView.TasksApproved = queryapproved.Count();

        //    var querypending = from t in queryalltasks where t.ManagementSignOff.Equals(CamlHelper.PENDING_SIGNOFF) select t;
        //    summaryView.TasksPending = querypending.Count();

        //    var queryrejected = from t in queryalltasks where t.ManagementSignOff.Equals(CamlHelper.REJECTED_SIGNOFF) select t;
        //    summaryView.TasksRejected = queryrejected.Count();


        //    var reassign = from t in queryalltasks where t.Status.Equals("Reassign") select t;
        //    summaryView.TasksReassign = reassign.Count();

        //    var notapplicable = from t in queryalltasks where t.Status.Equals("Not Applicable") select t;
        //    summaryView.TasksNotApplicable = notapplicable.Count();

        //    var partcompeleted = from t in queryalltasks where t.Status.Equals("Part Completed") select t;
        //    summaryView.TasksPartCompleted = partcompeleted.Count();

        //    var querycomplete = from t in queryalltasks
        //                        where
        //                            (
        //                            (
        //                            (t.CreatedLocal > localmidnight) &&
        //                            (t.Status.Equals(CamlHelper.COMPLETED_STATUS))
        //                            ) ||

        //                            (
        //                            (t.CreatedLocal < localmidnight) &&
        //                            (
        //                            (t.Status.Equals(CamlHelper.COMPLETED_STATUS)) &&
        //                            (!t.ManagementSignOff.Equals(CamlHelper.APPROVED_SIGNOFF))
        //                            )
        //                            )
        //                            )
        //                        select t;

        //    summaryView.TasksComplete = querycomplete.Count(); 

        //}

        #endregion

        #region ISharePointDataProvider Members



        public void FetchUserInfo(string pattern)
        {
            EndpointAddress addr = new EndpointAddress(ViewModel.PeopleAsmxUrl);
            BasicHttpBinding bnd = new BasicHttpBinding();
            bnd.MaxBufferSize = InitParams.Current.MaxBufferSize;
            bnd.MaxReceivedMessageSize = bnd.MaxBufferSize;

            BCheckPeople.PeopleSoapClient peopleSearchClient =
                new BCheck.Data.BCheckPeople.PeopleSoapClient(bnd, addr);
            peopleSearchClient.SearchPrincipalsCompleted +=
                new EventHandler<BCheck.Data.BCheckPeople.SearchPrincipalsCompletedEventArgs>(peopleSearchClient_SearchPrincipalsCompleted);

            peopleSearchClient.SearchPrincipalsAsync(pattern,
                    InitParams.Current.MaxUserRecords,
                    BCheck.Data.BCheckPeople.SPPrincipalType.User);
        }