Пример #1
0
        /// <summary>МЕТОД Создание фильтров</summary>
        private void MET_CreateFiltr()
        {
            PART_Grid.RowDefinitions[0].Height = new GridLength(80, GridUnitType.Auto);
            PART_Expander.Visibility           = Visibility.Visible;
            Border _Border = new Border();

            _Border.Style            = (Style)FindResource("Border_2");
            PART_Expander.Content    = _Border;
            PART_Expander.IsExpanded = true;
            StackPanel _SPanel = new StackPanel();

            _Border.Child = _SPanel;
            // ---- Настраиваем фильтр
            StackPanel _SPanel_1 = new StackPanel();

            _SPanel_1.Orientation = Orientation.Horizontal;
            _SPanel_1.Margin      = new Thickness(0, 2, 0, 2);
            _SPanel.Children.Add(_SPanel_1);
            // Server
            PRI_Server = new UserPole_ComboBox();
            PRI_Server.PART_ComboBox.ItemsSource   = new[] { "Pol", "Fil" };
            PRI_Server.PART_ComboBox.SelectedValue = "Pol";
            PRI_Server.PROP_WidthText   = 60;
            PRI_Server.PROP_Description = "Server";
            _SPanel_1.Children.Add(PRI_Server);
            // UserCod
            PRI_FiltrUserCod = new UserPole_Text();
            PRI_FiltrUserCod.PROP_MinWidthDescription = 90;
            PRI_FiltrUserCod.PROP_WidthText           = 100;
            PRI_FiltrUserCod.PROP_Description         = "UserCod";
            _SPanel_1.Children.Add(PRI_FiltrUserCod);
            // UserName
            PRI_FiltrUserName = new UserPole_Text();
            PRI_FiltrUserName.PROP_MinWidthDescription = 90;
            PRI_FiltrUserName.PROP_WidthText           = 100;
            PRI_FiltrUserName.PROP_Description         = "UserName";
            _SPanel_1.Children.Add(PRI_FiltrUserName);
            // CompName
            PRI_FiltrCompName = new UserPole_Text();
            PRI_FiltrCompName.PROP_WidthText   = 100;
            PRI_FiltrCompName.PROP_Description = "CompName";
            _SPanel_1.Children.Add(PRI_FiltrCompName);
            // Process
            PRI_FiltrProcess = new UserPole_Text();
            PRI_FiltrProcess.PROP_WidthText   = 100;
            PRI_FiltrProcess.PROP_Description = "Process";
            _SPanel_1.Children.Add(PRI_FiltrProcess);
            // DateN
            PRI_FiltrDateN = new UserPole_Data();
            PRI_FiltrDateN.PROP_WidthText   = 100;
            PRI_FiltrDateN.PROP_Date        = DateTime.Today;
            PRI_FiltrDateN.PROP_Description = "DateN";
            _SPanel_1.Children.Add(PRI_FiltrDateN);
            // DateK
            PRI_FiltrDateK = new UserPole_Data();
            PRI_FiltrDateK.PROP_WidthText   = 100;
            PRI_FiltrDateK.PROP_Date        = DateTime.Today;
            PRI_FiltrDateK.PROP_Description = "DateK";
            _SPanel_1.Children.Add(PRI_FiltrDateK);
            // Level
            PRI_FiltrLevel = new UserPole_ComboBox();
            PRI_FiltrLevel.PART_ComboBox.ItemsSource   = new[] { "All", "Error+Fatal", "Trace", "Debug", "Info", "Warn", "Error", "Fatal" };
            PRI_FiltrLevel.PART_ComboBox.SelectedValue = "Error+Fatal";
            PRI_FiltrLevel.PROP_WidthText   = 100;
            PRI_FiltrLevel.PROP_Description = "Level";
            _SPanel_1.Children.Add(PRI_FiltrLevel);
            // ---- Кнопка обновления фильтров
            PRI_ButtonReplace         = new Button();
            PRI_ButtonReplace.Content = "Обновить";
            PRI_ButtonReplace.Margin  = new Thickness(20, 0, 0, 0);
            PRI_ButtonReplace.Click  += delegate { MET_SqlFilter(); };
            _SPanel_1.Children.Add(PRI_ButtonReplace);
            // ---- Кнопка удаления отфильтрованных записей
            PRI_ButtonDelete         = new Button();
            PRI_ButtonDelete.Content = "Удалить";
            PRI_ButtonDelete.Margin  = new Thickness(20, 0, 0, 0);
            PRI_ButtonDelete.Click  += delegate
            {
                // Спросим на всякий случай
                if (MessageBox.Show("Вы точно хотите Удалить все эти записи?", "Внимание!", MessageBoxButton.YesNo) == MessageBoxResult.No)
                {
                    return;
                }
                // Удаляем
                MySql.MET_QueryNo(MyQuery.log_wpfBazis_Delete_1(PRO_SqlWhere, PRI_Server.PART_ComboBox.SelectedValue.ToString()));
                MET_SqlFilter();
            };
            _SPanel_1.Children.Add(PRI_ButtonDelete);
            // ---- Кнопка перехода в историю с ошибкой
            PRI_GotoHistory         = new Button();
            PRI_GotoHistory.Content = "Переход";
            PRI_GotoHistory.Margin  = new Thickness(20, 0, 0, 0);
            PRI_GotoHistory.Click  += delegate
            {
                try
                {
                    DataRowView _DataRowView = (DataRowView)PART_DataGrid.SelectedItem;
                    if (_DataRowView == null)
                    {
                        return;
                    }
                    decimal _KL  = Convert.ToDecimal(_DataRowView.Row["KL"]);
                    decimal _IND = Convert.ToDecimal(_DataRowView.Row["CodApstac"]);
                    MySql.MET_DsAdapterFill(MyQuery.log_wpfBazis_Select_2(_KL, _IND), "TableRezult");
                    DataTable _Table = MyGlo.DataSet.Tables["TableRezult"];
                    if (_Table.Rows.Count == 0)
                    {
                        MessageBox.Show("Данной записи на текущем сервере нет, возможно эта запись сегодня создана на другом сервере", "Внимание!");
                        return;
                    }
                    DataRow _Row = _Table.Rows[0];
                    string  _Tip = (string)_Row["Tip"];

                    MyTipProtokol _MyTipProtokol;
                    switch (_Tip)
                    {
                    case "стац":
                        _MyTipProtokol = new MyTipProtokol(eTipDocum.Stac);         // модуль стационара
                        break;

                    case "пол":
                        _MyTipProtokol = new MyTipProtokol(eTipDocum.Pol);          // модуль поликлиники
                        break;

                    case "пар":
                        _MyTipProtokol = new MyTipProtokol(eTipDocum.Paracl);       // модуль параклиники
                        break;

                    default:
                        _MyTipProtokol = new MyTipProtokol(eTipDocum.Null);         // модуль истории болезни
                        break;
                    }
                    // У не админов доступ только в историю болезни
                    if (!MyGlo.PROP_Admin)
                    {
                        _MyTipProtokol = new MyTipProtokol(eTipDocum.Null);
                    }
                    // Пытаемся открыть новую копию программы, для редактирования протоколов
                    MyMet.MET_EditWindows(_MyTipProtokol.PROP_TipDocum, _IND, _KL);
                    PROP_Return = true;
                }
                catch
                {
                }
            };
            _SPanel_1.Children.Add(PRI_GotoHistory);
        }
Пример #2
0
        /// <summary>МЕТОД Создаем объект Pole</summary>
        /// <param name="pTypePole">Номер типа поля eTypePole</param>
        protected VirtualPole MET_CreateUserPole(int pTypePole)
        {
            VirtualPole _Pole;

            switch (pTypePole)
            {
            case 1:
                _Pole = new UserPole_Number();
                break;

            case 2:
                _Pole = new UserPole_Text();
                break;

            case 3:
                _Pole = new UserPole_Data();
                break;

            case 4:
                _Pole = new UserPole_Text();
                break;

            case 5:
                _Pole = new UserPole_ComboBox();     // список
                break;

            case 6:
                _Pole = new UserPole_Text();
                break;

            case 7:
                _Pole = new UserPole_MultyList();     // пока только операции
                break;

            case 8:
                _Pole = new UserPole_Text();
                break;

            case 9:
                _Pole = new UserPole_Razdel();
                break;

            case 10:
                _Pole = new UserPole_Text();
                break;

            case 11:
                _Pole = new UserPole_Text();
                break;

            case 12:
                _Pole = new UserPole_RadioButton();
                break;

            case 13:
                _Pole = new UserPole_Image();
                break;

            case 14:
                _Pole = new UserPole_Grid();
                break;

            case 15:
                _Pole = new UserPole_Label();
                break;

            case 16:
                _Pole = new UserPole_Sprav();           // справочники
                break;

            case 17:
                _Pole = new UserPole_Calendar();
                break;

            default:
                _Pole = new UserPole_Text();
                break;
            }
            // Проставляем тип поля
            _Pole.PROP_Type  = (eVopros)pTypePole;
            _Pole.PROP_Docum = PROP_Docum;
            return(_Pole);
        }