Beispiel #1
0
 private void ContactsViewModel_OnSaveComplete(string result)
 {
     if (result == null)
     {
         Contacts.Reset();
         Contacts.Refresh();
     }
     ErrorMessage.SetValue(result);
 }
Beispiel #2
0
        public Action DeleteCommand()
        {
            if (_deleteCommand == null)
            {
                _deleteCommand = delegate()
                {
                    // Delete all selected jobs in grid
                    SelectedRange[] ranges = JobsViewModel.GetSelectedRows();
                    List <int>      rows   = DataViewBase.RangesToRows(ranges);

                    bool confirmed = Script.Confirm(String.Format("Are you sure you want to delete these {0} job(s)?", rows.Count));
                    if (!confirmed)
                    {
                        return;
                    }



                    IsBusy.SetValue(true);
                    DelegateItterator.CallbackItterate(delegate(int index, Action nextCallback, ErrorCallBack errorCallBack)
                    {
                        dev1_ScheduledJob job = (dev1_ScheduledJob)this.JobsViewModel.GetItem(rows[index]);
                        // First delete the scheduled jobs associated
                        DeleteBulkDeleteJobs(job.dev1_ScheduledJobId, delegate(){
                            OrganizationServiceProxy.BeginDelete(dev1_ScheduledJob.EntityLogicalName, job.dev1_ScheduledJobId, delegate(object result)
                            {
                                try
                                {
                                    OrganizationServiceProxy.EndDelete(result);
                                    IsBusyProgress.SetValue((index / rows.Count) * 100);
                                    nextCallback();
                                }
                                catch (Exception ex)
                                {
                                    errorCallBack(ex);
                                }
                            });
                        });
                    },
                                                       rows.Count,
                                                       delegate()
                    {
                        // Completed
                        IsBusy.SetValue(false);
                        JobsViewModel.Reset();
                        JobsViewModel.Refresh();
                    },
                                                       delegate(Exception ex)
                    {
                        // Error
                        ReportError(ex);
                    });
                };
            }
            return(_deleteCommand);
        }
 private void ConnectionsViewModel_OnSaveComplete(string result)
 {
     if (result == null)
     {
         // Saved OK
         Connections.Reset();
         Connections.Refresh();
     }
     ErrorMessage.SetValue(result);
 }
 void ContactViewModel_OnSaveComplete(string result)
 {
     if (result == null)
     {
         ErrorMessage.SetValue(null);
         Contacts.Reset();
         Contacts.Refresh();
     }
     else
     {
         ErrorMessage.SetValue(result);
     }
 }
Beispiel #5
0
        void jobsViewModel_OnSelectedRowsChanged()
        {
            // Get the selected bulk delete
            SelectedRange[] selectedRows = JobsViewModel.GetSelectedRows();
            if (selectedRows.Length > 0)
            {
                ScheduledJob job = SelectedJob.GetValue();

                dev1_ScheduledJob item = (dev1_ScheduledJob)JobsViewModel.GetItem(selectedRows[0].FromRow.Value);

                job.RecurrancePattern.SetValue(item.dev1_RecurrancePattern);
                RecurrancePatternMapper.DeSerialise(job, item.dev1_RecurrancePattern);
                job.ScheduledJobId.SetValue(item.dev1_ScheduledJobId);
                job.Name.SetValue(item.dev1_Name);
                job.StartDate.SetValue(item.dev1_StartDate);
                job.RecurrancePattern.SetValue(item.dev1_RecurrancePattern);

                EntityReference entityName = new EntityReference(null, null, item.dev1_WorkflowName);

                job.WorkflowId.SetValue(entityName);

                // Update the dependant data grid
                string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' returntotalrecordcount='true' no-lock='true' distinct='false' count='{0}' paging-cookie='{1}' page='{2}'>
                            <entity name='bulkdeleteoperation'>
                            <attribute name='name' />
                            <attribute name='createdon' />
                            <attribute name='asyncoperationid' />
                            <filter type='and'>
                            <condition attribute='name' operator='like' value='%" + item.dev1_ScheduledJobId.Value + @"%' />
                            </filter>
                            <link-entity name='asyncoperation' to='asyncoperationid' from='asyncoperationid' link-type='inner' alias='a0'>
                            <attribute name='postponeuntil' alias='asyncoperation_postponeuntil' />
                            <attribute name='statecode' alias='asyncoperation_statecode' />
                            <attribute name='statuscode'  alias='asyncoperation_statuscode' />
                            <attribute name='recurrencepattern'  alias='asyncoperation_recurrencepattern' />
                            </link-entity>{3}
                            </entity>
                            </fetch>";

                bulkDeleteJobsViewModel.FetchXml = fetchXml;
                bulkDeleteJobsViewModel.Reset();
                bulkDeleteJobsViewModel.Refresh();
            }
        }
        public Action ResetCommand()
        {
            if (_resetCommand == null)
            {
                _resetCommand = delegate()
                {
                    bool confirmed = Script.Confirm(String.Format("Are you sure you want to reset the grid? This will loose any values you have edited."));
                    if (!confirmed)
                    {
                        return;
                    }

                    Contacts.Reset();
                    Contacts.Refresh();
                };
            }

            return(_resetCommand);
        }