示例#1
0
 private void КомпилироватьКонфигурацию(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Вы действительно хотите продолжить действие?", "Подтверждение", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         var start = System.Diagnostics.Stopwatch.StartNew();
         System.Threading.Tasks.Task.Factory.StartNew(() =>
         {
             try
             {
                 using (RosService.Client client = new RosService.Client(TimeSpan.FromMinutes(5)))
                 {
                     client.Конфигуратор.КомпилироватьКонфигурацию(RosService.Client.Domain);
                     this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                     {
                         MessageBox.Show(string.Format("Конфигурация обновлена {0}.", start.Elapsed.ToString()), "Сообщение", MessageBoxButton.OK, MessageBoxImage.Information);
                     });
                 }
             }
             catch (Exception ex)
             {
                 this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
             }
         });
     }
 }
示例#2
0
        private void СменитьСтатусЗадачи(DataRowView row)
        {
            if (row == null)
            {
                return;
            }

            var status = row["Статус"].Equals("В работе") ? "Готово" : "В работе";

            row["Статус"]         = status;
            row["ДатаЗавершения"] = status == "Готово" ? (object)DateTime.Now : Convert.DBNull;

            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate(object __e)
            System.Threading.Tasks.Task.Factory.StartNew((__e) =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var v = new Dictionary <string, object>();
                        v.Add("ДатаЗавершения", status == "Готово" ? (object)DateTime.Now : null);
                        v.Add("Статус", status);
                        client.Архив.СохранитьЗначение((decimal)__e, v, RosService.Data.Хранилище.Оперативное, false);
                    }
                }
                catch (Exception)
                {
                }
            }, row["id_node"]);
        }
示例#3
0
        private void ТаблицаСообщения_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var id_node = Convert.ToDecimal(ТаблицаСообщения.SelectedValue);

            if (id_node == 0)
            {
                ТекстСообщения = string.Empty;
                return;
            }

            ТекстСообщения = "Загрузка...";
            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var text = client.Архив.ПолучитьЗначение <string>(id_node, "Содержание");
                        this.Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, (Action) delegate
                        {
                            ТекстСообщения = text;
                        });
                    }
                }
                catch (Exception ex)
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { ТекстСообщения = ex.Message; });
                }
            });
        }
示例#4
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 CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (Items == null)
            {
                return;
            }

            var id_nodes = ((IEnumerable <object>)Items).Cast <ВыбранныйПользователь>().Select(p => (object)p.id_node).ToArray();
            var _text    = PART_Сообщение.Text;

            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        client.Сервисы.СообщенияПользователя_Добавить(client.СведенияПользователя.id_node, id_nodes, _text, client.Пользователь, client.Домен);
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                        {
                            this.Close();
                        });
                    }
                }
                catch (Exception ex)
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
                }
            });
        }
        private void ЗагрузитьИконку_Click(object sender, RoutedEventArgs e)
        {
            if (SelectedItem == null)
            {
                return;
            }

            var openFileDialog1 = new OpenFileDialog();

            if (openFileDialog1.ShowDialog().Value)
            {
                using (RosService.Client client = new RosService.Client())
                {
                    var Name   = SelectedItem.Name; //(Дерево.SelectedValue as RosService.Configuration.Type).Name;
                    var window = new RosControl.Forms.аботаСФайлами();
                    window.Complite += delegate
                    {
                        if (RosControl.UI.FilePreview.cache.ContainsKey(Name))
                        {
                            RosControl.UI.FilePreview.CacheBitmap remove;
                            RosControl.UI.FilePreview.cache.TryRemove(Name, out remove);
                        }
                    };
                    window.СохранитьИконку(openFileDialog1.FileName, Name, "ИконкаПоУмолчанию");
                    window.Show();
                }
            }
        }
        private void DropDownButton_Click(object sender, RoutedEventArgs e)
        {
            var _type  = SelectedItem.Name;
            var _value = (e.OriginalSource as FrameworkElement).Tag;

            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        client.Конфигуратор.СохранитьЗначение(_type, "@РазмерОкна", _value);
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                        {
                            азмерОкна = Convert.ToString(_value);
                            //сбросить кеш
                            RosControl.Helper.ClearCache(_type);
                        });
                    }
                }
                catch
                {
                }
            });
        }
        private void УдалитьТипДанных()
        {
            if (SelectedItem != null && MessageBox.Show(string.Format("Вы действительно хотите удалить тип '{0}'?", SelectedItem.Name),
                                                        "Подтверждение", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                using (RosService.Client client = new RosService.Client())
                {
                    client.Конфигуратор.УдалитьТип(SelectedItem.Name, RosService.Client.Domain);

                    if (this.СписокТипов != null)
                    {
                        this.СписокТипов.Remove(SelectedItem);
                    }
                }
            }
            else if (SelectedItem == null && MessageBox.Show("Вы действительно хотите удалить группу типов данных?",
                                                             "Подтверждение", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                //using (RosService.Client client = new RosService.Client())
                //foreach (var item in (Дерево.SelectedItem as RosControl.UI.TreeViewItem).Items.Cast<RosControl.UI.TreeViewItem>())
                //{
                //    if (item.Tag is RosService.Configuration.Type)
                //    {
                //        client.Конфигуратор.УдалитьТип(((RosService.Configuration.Type)item.Tag).Name, RosService.Client.Domain);
                //    }
                //}
                //(Дерево.SelectedItem as RosControl.UI.TreeViewItem).ItemsSource = null;
            }
        }
        private void  едакторСвойств_ЗагрузитьФайл(object sender, RoutedEventArgs e)
        {
            var attr = Convert.ToString(Диаграмма.SelectedValue);

            if (!string.IsNullOrEmpty(attr))
            {
                var openFileDialog1 = new OpenFileDialog();
                if (openFileDialog1.ShowDialog().Value)
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var _Name  = (Дерево.SelectedValue as RosService.Configuration.Type).Name;
                        var window = new RosControl.Forms.аботаСФайлами();
                        window.Complite += delegate
                        {
                            if (RosControl.UI.FilePreview.cache.ContainsKey(_Name))
                            {
                                RosControl.UI.FilePreview.CacheBitmap remove;
                                RosControl.UI.FilePreview.cache.TryRemove(_Name, out remove);
                            }
                        };
                        window.СохранитьИконку(openFileDialog1.FileName, _Name, attr);
                        window.Show();
                    }
                }
            }
        }
        private void Замена(object sender, RoutedEventArgs e)
        {
            if (Items == null)
            {
                return;
            }

            var values = Items.Where(p => p.IsEdit).ToDictionary(p => p.Name, q => (object)q.Value);

            if (values.Count == 0)
            {
                MessageBox.Show("Укажите хоты бы одно значение для замены");
                return;
            }

            if (MessageBox.Show("Выполнить замену?", "Подтверждение", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                PART_Замена.IsEnabled = false;
                using (RosService.Client client = new RosService.Client())
                {
                    client.Архив.СохранитьЗначениеПоискАсинхронно(
                        new RosService.Data.Query(PART_ЗаменаЗапрос.Text),
                        RosService.Helper.ConvertDataValue(values),
                        true, RosService.Data.Хранилище.Оперативное,
                        client.Пользователь, client.Домен);
                    PART_Замена.IsEnabled = true;
                    //MessageBox.Show("Готово");
                }
            }
        }
示例#11
0
 private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (PART_ListBox.SelectedItem != null)
     {
         if (MessageBox.Show("Вы действительно хотите скрыть выбранные записи?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             using (RosService.Client client = new RosService.Client())
             {
                 Parallel.ForEach(PART_ListBox.SelectedItems.Cast <DataRow>(), i =>
                 {
                     client.Архив.СохранитьЗначение(i.Field <decimal>("id_node"), "@СкрытьРаздел", true);
                 });
             }
             Обновить();
         }
     }
     else
     {
         var row = Convert.ToDecimal(e.Parameter);
         if (row > 0)
         {
             using (RosService.Client client = new RosService.Client())
             {
                 client.Архив.СохранитьЗначение(row, "@СкрытьРаздел", true);
             }
             Обновить();
         }
     }
 }
示例#12
0
 private void Обновить()
 {
     System.Threading.Tasks.Task.Factory.StartNew(() =>
     {
         try
         {
             using (RosService.Client client = new RosService.Client())
             {
                 var items = client.Конфигуратор.МониторПроизводительности();
                 this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                 {
                     Items  = new ObservableCollection <RosService.Configuration.PerformanceItem>(items);
                     var cv = (CollectionView)CollectionViewSource.GetDefaultView(PART_DataGrid.ItemsSource);
                     if (cv != null)
                     {
                         cv.SortDescriptions.Add(new SortDescription(SortMemberPath, ListSortDirection.Descending));
                     }
                 });
             }
         }
         catch (Exception ex)
         {
             this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
         }
     });
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     IsLoading = true;
     //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
     System.Threading.Tasks.Task.Factory.StartNew(() =>
     {
         try
         {
             using (RosService.Client client = new RosService.Client())
             {
                 this.СписокТипов = client.Конфигуратор.СписокТипов().ToList();
                 this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                 {
                     ОбновитьДерево();
                     IsLoading = false;
                 });
             }
         }
         catch (Exception ex)
         {
             this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
             {
                 IsLoading = false;
                 throw ex;
             });
         }
     });
 }
示例#14
0
        private void Выключить(object sender, RoutedEventArgs e)
        {
            var item = ((MenuItem)sender);

            if (item.IsChecked)
            {
                item.Header = "Включить блокирование";
            }
            else
            {
                item.Header = "Выключить блокирование";
            }

            var off = item.IsChecked;

            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        client.Конфигуратор.АвторизацияБлокировки(off);
                    }
                }
                catch
                {
                }
            });
        }
示例#15
0
 private void СоздатьТелефонныеИндексы_Click(object sender, RoutedEventArgs e)
 {
     using (RosService.Client client = new RosService.Client())
     {
         client.Сервисы.Данные_СписокТелефонов_Проиндекировать(0, client.Пользователь, client.Домен);
         //client.Сервисы.Данные_СоздатьТелефонныйИндекс(0, new string[] { "ТелефонныйНомер" }, "ТелефонныйНомерИндекс", client.Пользователь, client.Домен);
         MessageBox.Show("Готово");
     }
 }
        private void Обновить()
        {
            #region Запрос
            var query = new Query();
            query.ДобавитьТипы("СлужебнаяЗадача%");
            query.ДобавитьВыводимыеКолонки("ДатаСозданияОбъекта", "СсылкаНаПользователя", "СсылкаНаОбъект", "НазваниеОбъекта",
                                           "@Новый", "Срок", "Вложения", "Статус", "Срочно", "ДатаЗавершения");
            query.ДобавитьСортировку("Срок", RosService.Data.Query.НаправлениеСортировки.Desc);

            switch (Показать)
            {
            case СписокЗадачПоказать.Входящие:
                query.ДобавитьУсловиеПоиска("СсылкаНаОбъект", RosService.Client.User.id_node);
                break;

            case СписокЗадачПоказать.КИсполнению:
                query.ДобавитьУсловиеПоиска("СсылкаНаОбъект", RosService.Client.User.id_node);
                query.ДобавитьУсловиеПоиска("Статус", "В работе");
                break;

            case СписокЗадачПоказать.Срочно:
                query.ДобавитьУсловиеПоиска("СсылкаНаОбъект", RosService.Client.User.id_node);
                query.ДобавитьУсловиеПоиска("Статус", "В работе");
                query.ДобавитьУсловиеПоиска("Срочно", true);
                break;

            case СписокЗадачПоказать.Отправленые:
                if (Пользователь != null)
                {
                    query.ДобавитьУсловиеПоиска("СсылкаНаОбъект", Пользователь);
                }
                query.ДобавитьУсловиеПоиска("СсылкаНаПользователя", RosService.Client.User.id_node);
                break;
            }
            #endregion

            ItemsSource = null;

            System.Threading.Tasks.Task.Factory.StartNew((e) =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var items = client.Архив.Поиск((Query)e).Значение.AsDataView();
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                        {
                            ItemsSource = items;
                        });
                    }
                }
                catch (Exception)
                {
                }
            }, query);
        }
示例#17
0
 private void Описание_ValueChanged(object sender, RosControl.UI.SearchTextBoxValueChangedEventArgs e)
 {
     using (RosService.Client client = new RosService.Client())
     {
         var type = client.Конфигуратор.ПолучитьТип(Convert.ToString(Описание.Value));
         if (type != null)
         {
             ТипДанныхОписание.Text = type.BaseType;
         }
     }
 }
 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();
     }
 }
示例#19
0
 private void Описание_LostFocus(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(Описание.Text))
     {
         Имя.Text = null;
         return;
     }
     using (RosService.Client client = new RosService.Client())
     {
         Имя.Text = client.Конфигуратор.ОписаниеВИмя(Описание.Text);
     }
 }
示例#20
0
        private void Window_Complite(object sender, EventArgs e)
        {
            using (RosService.Client client = new RosService.Client())
            {
                if (Значения)
                {
                    client.Конфигуратор.УдалитьКешированныеЗначения(client.Пользователь, client.Домен);
                }

                var items = new List <string>();
                if (Запросы)
                {
                    items.Add(client.Домен + ":Z:КешЗапрос*");
                    items.Add(client.Домен + ":Z:КешЗапросХешьТаблица*");
                }

                if (СписокАтрибутов)
                {
                    items.Add(client.Домен + ":Z:КешСписокАтрибутов*");
                }

                if (Счётчики)
                {
                    items.Add(client.Домен + ":Z:КешСчётчик*");
                }

                if (КешТаблицы)
                {
                    items.Add(client.Домен + ":Z:КешХешьТаблица*");
                }

                if (Индентификаторы)
                {
                    items.Add(client.Домен + ":Z:КешИдентификаторРаздела*");
                }

                if (ВсёОстальное)
                {
                    items.Add(client.Домен + ":Z:КешДобавитьРаздел*");
                    items.Add(client.Домен + ":Z:КешПолучитьТип*");
                    items.Add(client.Домен + ":Z:КешФорма*");
                    items.Add(client.Домен + ":Z:КешХешьТаблицаПамять*");
                    items.Add(client.Домен + ":Z:ХешьАтрибут*");
                }

                if (items.Count > 0)
                {
                    client.Конфигуратор.УдалитьКешированныеОбъекты(items.ToArray(), client.Пользователь, client.Домен);
                }

                DialogResult = true;
            }
        }
        private void ЗагрузитьСписокАтрибутов(string Имя)
        {
            IsLoadingClass = true;

            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        var items       = client.Конфигуратор.СписокАтрибутов(Имя);
                        var _РазмерОкна = client.Конфигуратор.ПолучитьЗначение <string>(Имя, "@РазмерОкна");
                        var _UpdateDate = client.Конфигуратор.ПолучитьЗначение <DateTime?>(Имя, "@UpdateDate");
                        if (string.IsNullOrEmpty(_РазмерОкна))
                        {
                            _РазмерОкна = "пусто";
                        }

                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                        {
                            if (IsSystemAtribute.IsChecked.Value)
                            {
                                SetValue(СписокАтрибутовProperty, items.Where(p => !p.IsReadOnly));
                            }
                            else
                            {
                                SetValue(СписокАтрибутовProperty, items);
                            }

                            азмерОкна      = _РазмерОкна;
                            Обновление     = _UpdateDate;
                            IsLoadingClass = false;
                        });

                        this.Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, (Action) delegate
                        {
                            if (едакторСвойств != null)
                            {
                                едакторСвойств.Properties = СписокСвойств(Имя, SelectedItem);
                            }
                        });
                    }
                }
                catch (Exception)
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                    {
                        IsLoadingClass = false;
                    });
                }
            });
        }
示例#22
0
        public static void СохранитьЗначение(decimal id_node, string[] attributes, Хранилище хранилище, System.Web.UI.Control content)
        {
            using (RosService.Client client = new RosService.Client())
            {
                var values = new Dictionary <string, object>();
                foreach (var item in client.Архив.ПолучитьЗначение(id_node, attributes))
                {
                    var control = content.FindControl(Regex.Replace(item.Key.ToString(), "[./]", "_"));
                    if (control == null)
                    {
                        continue;
                    }

                    if (control is ListControl)
                    {
                        if (Convert.ToString(item.Value) != (control as ListControl).SelectedValue)
                        {
                            values.Add(item.Key, (control as ListControl).SelectedValue);
                        }
                    }
                    else if (control is ITextControl)
                    {
                        if (control is TextBox && ((TextBox)control).ReadOnly)
                        {
                            continue;
                        }
                        if (Convert.ToString(item.Value) != (control as ITextControl).Text)
                        {
                            values.Add(item.Key, (control as ITextControl).Text);
                        }
                    }
                    else if (control is System.Web.UI.WebControls.Repeater)
                    {
                        if ((control as System.Web.UI.WebControls.Repeater).DataSource is DataTable ||
                            (control as System.Web.UI.WebControls.Repeater).DataSource is DataView)
                        {
                            (control as System.Web.UI.WebControls.Repeater).DataSource = item.Value;
                        }
                    }
                    else if (control is System.Web.UI.WebControls.BaseDataList)
                    {
                        if ((control as System.Web.UI.WebControls.BaseDataList).DataSource is DataTable ||
                            (control as System.Web.UI.WebControls.BaseDataList).DataSource is DataView)
                        {
                            (control as System.Web.UI.WebControls.BaseDataList).DataSource = item.Value;
                        }
                    }
                }
                client.Архив.СохранитьЗначение(id_node, values, хранилище);
            }
        }
示例#23
0
        private void ОткрытьЧат(object sender)
        {
            var item = ((Selector)sender).SelectedValue;

            if (item == null)
            {
                return;
            }

            if (PART_Content.Content is IDisposable)
            {
                ((IDisposable)PART_Content.Content).Dispose();
            }

            PART_Content.Content = new RosControl.Forms.ЧатПользователей()
            {
                id_node = item
            };
            PART_UserInfo.DataContext = ((Selector)sender).SelectedItem;
            PART_UserInfo.Visibility  = System.Windows.Visibility.Visible;


            var main = RosControl.Helper.FindParentControl <Main>(this);

            if (main != null)
            {
                var user = main.СписокПользователей.FirstOrDefault(p => p.id_node.Equals(item));
                if (user == null || user.Сообщения == 0)
                {
                    return;
                }
                user.Сообщения = 0;
                main.ОбновитьКоличествоНовыхСообщений();

                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    try
                    {
                        using (RosService.Client client = new RosService.Client())
                        {
                            client.Сервисы.СообщенияПользователя_Очистить(client.СведенияПользователя.id_node, Convert.ToDecimal(item), client.Пользователь, client.Домен);
                        }
                    }
                    catch (Exception)
                    {
                        //this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate { MessageBox.Show(ex.Message); });
                    }
                });
            }
        }
示例#24
0
        private void Save_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var sb = new StringBuilder();

            if (Users == null || Users.Count() == 0)
            {
                sb.Append("В поле 'Кому'  необходимо указать по крайней мере одного получателя\n");
            }
            if (PART_Сообщение.Text.Length == 0)
            {
                sb.Append("Заполните текст задачи");
            }
            if (sb.Length > 0)
            {
                throw new Exception(sb.ToString());
            }



            var _id_nodes = Users.Select(p => (object)p.id_node).ToArray();
            var _text     = PART_Сообщение.Text;
            var _high     = Срочно.IsChecked.Value;
            var _end      = Срок.SelectedDate;

            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        client.Сервисы.ЗадачаПользователя_Добавить(
                            client.СведенияПользователя.id_node,
                            _id_nodes, _text, _high, _end,
                            _files.ToDictionary(p => p.Name, q => File.ReadAllBytes(q.FullName)),
                            client.Пользователь, client.Домен);
                    }
                }
                catch (Exception ex)
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
                }
            });
            var window = RosControl.Helper.FindParentControl <Window>(this);

            if (window != Application.Current.MainWindow)
            {
                window.Close();
            }
        }
 private void Window_Initialized(object sender, EventArgs e)
 {
     System.Threading.Tasks.Task.Factory.StartNew(() =>
     {
         using (RosService.Client client = new RosService.Client())
         {
             var items = client.Конфигуратор.ЖурналУдалений(RosService.Client.Domain);
             this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
             {
                 PART_DataGrid.ItemsSource = items;
             });
         }
     });
 }
        private void ДобавитьАтрибут()
        {
            if (SelectedItem == null)
            {
                return;
            }

            var window = new ДобавитьАтрибут();

            window.ДобавитьВ.Text = SelectedItem.Описание;
            if (window.ShowDialog().Value)
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                {
                    using (RosService.Client client = new RosService.Client())
                    {
                        if (window.Описание.SelectedItem == null)
                        {
                            var ТипДанных = client.Конфигуратор.ДобавитьТип(
                                0, window.Имя.Text,
                                window.Описание.Text, "System.Default",
                                Convert.ToString(window.ТипДанных.SelectedValue),
                                false, //window.Массив.IsChecked.Value,
                                true,
                                RosService.Client.UserName,
                                RosService.Client.Domain);

                            client.Конфигуратор.ДобавитьАтрибут(
                                SelectedItem.Name, ТипДанных,
                                true,
                                RosService.Client.UserName,
                                RosService.Client.Domain);

                            client.Конфигуратор.СохранитьЗначение(ТипДанных, "@UpdateDate", DateTime.Now);
                        }
                        else
                        {
                            client.Конфигуратор.ДобавитьАтрибут(
                                SelectedItem.Name,
                                Convert.ToString(window.Описание.Value),
                                true,
                                RosService.Client.UserName,
                                RosService.Client.Domain);
                            client.Конфигуратор.СохранитьЗначение(SelectedItem.Name, "@UpdateDate", DateTime.Now);
                        }
                        ЗагрузитьСписокАтрибутов(this.SelectedItem.Name);
                    }
                });
            }
        }
        private void Домен_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            var domain = Домен.Text as string;

            if (string.IsNullOrEmpty(domain))
            {
                Типы = null;
                return;
            }

            this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    for (int i = 0; i < 3; i++)
                    {
                        try
                        {
                            using (RosService.Client client = new RosService.Client(TimeSpan.FromSeconds(20)))
                            {
                                var types = client.Конфигуратор.СписокТипов(null, domain);
                                this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action) delegate
                                {
                                    Типы = types;

                                    //var cv = (CollectionView)CollectionViewSource.GetDefaultView(types);
                                    //if (cv != null)
                                    //{
                                    //    cv.SortDescriptions.Add(new SortDescription("Namespace", ListSortDirection.Ascending));
                                    //    cv.SortDescriptions.Add(new SortDescription("Описание", ListSortDirection.Ascending));
                                    //    //Тип.ItemsSource = cv;
                                    //    //Тип.IsEnabled = true;
                                    //}
                                });
                            }
                            break;
                        }
                        catch (TimeoutException)
                        {
                            continue;
                        }
                        catch (Exception ex)
                        {
                            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate { MessageBox.Show(ex.Message); });
                            break;
                        }
                    }
                });
            });
        }
        private void Window_Complite(object sender, EventArgs e)
        {
            using (RosService.Client client = new RosService.Client())
            {
                var sb = new StringBuilder();
                sb.AppendLine("---------------");
                sb.AppendFormat("Имя базы: {0}\r\n", Домен.Text);
                sb.AppendFormat("e-mail: {0}\r\n", "**" /*Почта.Text*/);
                sb.AppendFormat("Логин: {0}\r\n", Логин.Text);
                sb.AppendFormat("Пароль: {0}\r\n", Пароль.Password);

                client.Конфигуратор.ОтправитьПисьмоВТехническуюПоддержку(
                    Домен.Text, Логин.Text, "заявка на создание аккаунта",
                    sb.ToString(), null, "");
            }
        }
示例#29
0
 public static DataTable Поиск(Query запрос, Хранилище хранилище)
 {
     using (RosService.Client client = new RosService.Client())
     {
         var table = client.Архив.Поиск(запрос, хранилище).Значение;
         foreach (DataColumn item in table.Columns)
         {
             if (!item.ColumnName.Contains('.'))
             {
                 continue;
             }
             item.ColumnName = item.ColumnName.Replace('.', '_');
         }
         return(table);
     }
 }
        private void ОбновитьКэш(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Вы действительно хотите обновить запрос в кэше?", "Подтверждение", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                using (RosService.Client client = new RosService.Client())
                {
                    var result = client.Архив.UpdateCacheObject(new RosService.Data.Query(PART_Query.Text), client.Домен);
                    if (string.IsNullOrEmpty(result))
                    {
                        result = "OK";
                    }

                    MessageBox.Show(result, "Результат");
                }
            }
        }