Exemplo n.º 1
0
        public void UpdateTasksNotApplicable(IEnumerable<TaskItem> tasks)
        {
            OpsChecklistDataAgentService dataservice = new OpsChecklistDataAgentService();

            List<bCheckV2.Helpers.Definitions.TaskItem> taskitems = new List<bCheckV2.Helpers.Definitions.TaskItem>();

            tasks.ToList().ForEach(t => taskitems.Add(FetchedTasks.Where(ft => ft.UniqueID.ToString() == t.ID1).First()));

            taskitems.ForEach(titem => titem.StatusID = ViewModel.Current.StaticData["AssigneeStatus"].Where(status => status.Value == AssigneeStatus.NA).First().Key);

            dataservice.UpdateTasks(taskitems, reply =>
            {
                if (reply != null)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        ViewModel.Current.IsUpdating = false;
                        ViewModel.Current.Refresh(false);
                    }));
                }
                else
                {
                    Deployment.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        ViewModel.Current.IsUpdating = false;
                        ViewModel.Current.Refresh(false);
                    }));
                }


            });


            //string url = ConstructUrlParams(IIsAction.UPDATEBULK, null, tasks.Count());
            //var addr = new EndpointAddress(url);//URL params injected, Mar 29
            //var bnd = new BasicHttpBinding { MaxBufferSize = InitParams.Current.MaxBufferSize };
            //bnd.MaxReceivedMessageSize = bnd.MaxBufferSize;

            //var changeTaskUsersClient = new BCheckLists.ListsSoapClient(bnd, addr);
            //changeTaskUsersClient.UpdateListItemsCompleted +=
            //    assignedTasksUpdateClient_UpdateListItemsCompleted;

            //string xmlUdpates = CamlHelper.QueryUpdateTaskNotApplicable(tasks);
            //XElement updateQuery = XElement.Parse(xmlUdpates);
            //changeTaskUsersClient.UpdateListItemsAsync(InitParams.Current.ListName, updateQuery);
        }
Exemplo n.º 2
0
        public void UpdateManagedTasksSignOff(IEnumerable<TaskItem> tasks)
        {
            OpsChecklistDataAgentService dataservice = new OpsChecklistDataAgentService();

            List<bCheckV2.Helpers.Definitions.TaskItem> taskitems = new List<bCheckV2.Helpers.Definitions.TaskItem>();

            tasks.ToList().ForEach(t => taskitems.Add(FetchedTasks.Where(ft => ft.UniqueID.ToString() == t.ID1).First()));

            //FetchedTasks[0].StatusID = 6;
            //taskitems.Add(FetchedTasks[0]);
            //tasks.ToList().ForEach(task => {
            // FetchedTasks.Where(ft => ft.TaskName == task.TaskName).ToList().ForEach(t =>{
            // })});


            //});
            taskitems.ForEach(titem => titem.StatusID = ViewModel.Current.StaticData["ManagementStatus"].Where(mgmtstatus => mgmtstatus.Value == ManagementStatus.APPROVED).First().Key);

            dataservice.UpdateTasks(taskitems, reply =>
            {
                if (reply != null)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        ViewModel.Current.IsUpdating = false;
                        ViewModel.Current.Refresh(false);
                    }));
                }
                else
                {
                    Deployment.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        ViewModel.Current.IsUpdating = false;
                        ViewModel.Current.Refresh(false);
                    }));
                }


            });
            //string url = this.ConstructUrlParams(IIsAction.UPDATEBULK, null, tasks.Count());
            //EndpointAddress addr = new EndpointAddress(url);//URL params injected, Mar 29
            //BasicHttpBinding bnd = new BasicHttpBinding();
            //bnd.MaxBufferSize = InitParams.Current.MaxBufferSize;
            //bnd.MaxReceivedMessageSize = bnd.MaxBufferSize;

            //BCheckLists.ListsSoapClient assignedTasksUpdateClient = new BCheck.Data.BCheckLists.ListsSoapClient(bnd, addr);
            //assignedTasksUpdateClient.UpdateListItemsCompleted +=
            //    new EventHandler<BCheck.Data.BCheckLists.UpdateListItemsCompletedEventArgs>(assignedTasksUpdateClient_UpdateListItemsCompleted);

            //string xmlUdpates = CamlHelper.QueryUpdateManagedTasks(tasks);
            //XElement updateQuery = XElement.Parse(xmlUdpates);

            //assignedTasksUpdateClient.UpdateListItemsAsync(InitParams.Current.ListName, updateQuery);
        }