Exemplo n.º 1
0
        public void Обновить()
        {
            if (timer != null)
            {
                timer.Stop();
            }
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var query = new RosService.Data.Query(50);
                        query.ДобавитьТипы("Процесс%");
                        query.ДобавитьВыводимыеКолонки("Описание", "СтатусПроцесса", "ТекущееСостояниеПроцесса", "ВремяРаботыПроцесса");
                        query.ДобавитьСортировку("ДатаСозданияОбъекта", RosService.Data.Query.НаправлениеСортировки.Desc);
                        query.ДобавитьУсловиеПоиска("@СкрытьРаздел", false);
                        var items = new ObservableCollection <DataRow>(client.Архив.Поиск(query).AsEnumerable());

                        this.Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, (Action) delegate
                        {
                            ItemsProc = items;
                            if (timer != null)
                            {
                                timer.Start();
                            }
                        });
                    }
                }
                catch (Exception)
                {
                }
            });
        }
 private void PART_Window_Initialized(object sender, EventArgs e)
 {
     using (RosService.Client client = new RosService.Client())
     {
         var query = new RosService.Data.Query();
         query.ДобавитьТипы("ГруппаПользователей");
         query.ДобавитьВыводимыеКолонки("НазваниеОбъекта");
         query.ДобавитьСортировку("НазваниеОбъекта");
         Группы.ItemsSource = client.Архив.Поиск(query).AsEnumerable();
     }
 }
Exemplo n.º 3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (IsLoaded)
            {
                //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    try
                    {
                        using (RosService.Client client = new RosService.Client())
                        {
                            var items = null as EnumerableRowCollection <DataRow>;
                            try
                            {
                                var query = new RosService.Data.Query();
                                query.Sql = @"
                                select Name = '*Данных', count(*) 'Count' from tblValue
                                union
                                select Name = '*Разделов', count(*) 'Count' from tblNode
                                union
                                select [type] 'Name', count(*) 'Count' from tblNode group by [type]
                                ";
                                items     = client.Архив.Поиск(query).AsEnumerable().OrderByDescending(p => p.Field <int>("Count"));

                                this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                                {
                                    PART_ItemsControl.ItemsSource = items;
                                    PART_ItemsControl.Visibility  = System.Windows.Visibility.Visible;
                                });
                            }
                            catch (Exception ex)
                            {
                                this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                                {
                                    PART_TextBlock1.Text         = ex.ToString();
                                    PART_ItemsControl.Visibility = System.Windows.Visibility.Collapsed;
                                });
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
                    }
                });
            }
        }
        private void Удалить(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Выполнить удаление?", "Подтверждение", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                КнопкаУдалить.IsEnabled = false;
                var q        = new RosService.Data.Query(PART_ЗапросУдалить.Text);
                var _Корзина = Корзина.IsChecked.Value;
                var _Связи   = Связи.IsChecked.Value;
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    try
                    {
                        using (RosService.Client client = new RosService.Client())
                        {
                            client.Архив.УдалитьРазделПоискАсинхронно(_Корзина, _Связи, q,
                                                                      RosService.Data.Хранилище.Оперативное,
                                                                      client.Пользователь, client.Домен);

                            //this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate
                            //{
                            //    MessageBox.Show("Удаление завершено.");
                            //});
                        }
                    }
                    catch (Exception ex)
                    {
                        using (RosService.Client client = new RosService.Client())
                        {
                            client.Конфигуратор.ЖурналСобытийДобавитьОшибку("УдалениеПоиском", ex.ToString());
                        }
                    }
                    finally
                    {
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                        {
                            КнопкаУдалить.IsEnabled = true;
                        });
                    }
                });
            }
        }
Exemplo n.º 5
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var PART_Form = GetTemplateChild("PART_Form") as RosControl.UI.Window;

            if (PART_Form != null)
            {
                PART_Form.PreviewKeyDown += new KeyEventHandler(PART_Form_PreviewKeyDown);
            }

            Table1 = GetTemplateChild("Table1") as RosControl.UI.DataGrid;
            if (Table1 != null)
            {
                Table1._isFirstLoaded = true;
                Table1.Searched      += new EventHandler <DataGridArgs>(Table1_Searched);
            }

            var PART_Filter = GetTemplateChild("PART_Filter") as TextBox;

            if (PART_Filter != null)
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                {
                    PART_Filter.Focus();
                });
            }

            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var query = new RosService.Data.Query("[Типы=Пользователь;Колонки=(НазваниеОбъекта,SipНомер);Сортировки=(НазваниеОбъекта,Asc);Условия=(РазрешитьВход,True,Равно)(SipНомер, ,НеРавно)]");
                        var items = new List <RecordsUser>();
                        items.Add(new RecordsUser()
                        {
                            sip = "все"
                        });
                        foreach (var item in client.Архив.Поиск(query).AsEnumerable())
                        {
                            items.Add(new RecordsUser()
                            {
                                id   = item.Convert <decimal>("id_node"),
                                name = item.Convert <string>("НазваниеОбъекта"),
                                sip  = item.Convert <string>("SipНомер"),
                            });
                        }

                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                        {
                            Users            = items;
                            var selectedUser = items.FirstOrDefault(p => p.id == RosService.Client.User.id_node);
                            if (selectedUser != null && (Phone == null || Phone.Count() == 0))
                            {
                                SelectedUser = selectedUser;
                            }
                            else
                            {
                                SelectedUser = items.First();
                            }

                            //Table1.Поиск();
                        });
                    }
                }
                catch (Exception ex)
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
                }
            });
        }
Exemplo n.º 6
0
 public void УдалитьРаздел(RosService.Data.Query query, Хранилище хранилище)
 {
     УдалитьРазделПоиск(false, true, query, хранилище, Client.UserName, Client.Domain);
 }