public GetValues()
        {
            InitializeComponent();
            DataContext = this;

            GlobalIdentifiers = new ObservableCollection <GlobalIdentifierViewModel>();

            try
            {
                tgda = new TestGda();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "GetValues", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            foreach (DMSType dmsType in Enum.GetValues(typeof(DMSType)))
            {
                if (dmsType == DMSType.MASK_TYPE)
                {
                    continue;
                }

                ModelCode dmsTypesModelCode = modelResourcesDesc.GetModelCodeFromType(dmsType);
                tgda.GetExtentValues(dmsTypesModelCode, new List <ModelCode> {
                    ModelCode.IDOBJ_GID
                }, null).ForEach(g => GlobalIdentifiers.Add(new GlobalIdentifierViewModel()
                {
                    GID  = g,
                    Type = dmsTypesModelCode.ToString(),
                }));
            }

            SelectedGID = null;
        }
Ejemplo n.º 2
0
        private void refTypeGetRelatedValuescomboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (refTypeGetRelatedValuescomboBox.SelectedItem == null)
            {
                return;
            }
            TestGda tgda = new TestGda();
            List <List <string> > path = tgda.GetRelatedValuesAndPath(Convert.ToInt64(gidGetRelatedValuescomboBox.SelectedItem.ToString()), new Association(refGetRelatedValuescomboBox.SelectedItem.ToString(), refTypeGetRelatedValuescomboBox.SelectedItem.ToString()));
            string xmlString           = System.IO.File.ReadAllText(path[0][0]);

            richTextBox3.Document.Blocks.Clear();
            richTextBox3.Document.Blocks.Add(new Paragraph(new Run(xmlString)));
            listBox3.SelectedItem = null;
            listBox3.Items.Clear();
            listBox3Pairs.Clear();
            foreach (var item in path[1])
            {
                string[] propPair = item.Split('~');
                if (listBox3Pairs.Keys.Contains(propPair[0]))
                {
                    listBox3Pairs[propPair[0]] += "\n" + propPair[1];
                }
                else
                {
                    listBox3.Items.Add(propPair[0]);
                    listBox3Pairs.Add(propPair[0], propPair[1]);
                }
            }
        }
        public GetExtentValues()
        {
            InitializeComponent();
            DataContext = this;

            ClassTypes = new ObservableCollection <ClassTypeViewModel>();

            try
            {
                tgda = new TestGda();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "GetExtentValues", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            foreach (DMSType dmsType in Enum.GetValues(typeof(DMSType)))
            {
                if (dmsType == DMSType.MASK_TYPE)
                {
                    continue;
                }

                ModelCode dmsTypesModelCode = modelResourcesDesc.GetModelCodeFromType(dmsType);
                ClassTypes.Add(new ClassTypeViewModel()
                {
                    ClassType = dmsTypesModelCode
                });
            }

            SelectedType = null;
        }
Ejemplo n.º 4
0
        private void GetExtentValuescomboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TestGda tgda = new TestGda();
            List <List <string> > path = tgda.GetExtentValuesAndPath(InputModelCode(typeExtentcomboBox.SelectedItem.ToString()));
            string xmlString           = System.IO.File.ReadAllText(path[0][0]);

            richTextBox2.Document.Blocks.Clear();
            richTextBox2.Document.Blocks.Add(new Paragraph(new Run(xmlString)));
            listBox2.SelectedItem = null;
            listBox2.Items.Clear();
            listBox2Pairs.Clear();
            foreach (var item in path[1])
            {
                string[] propPair = item.Split('~');
                if (listBox2Pairs.Keys.Contains(propPair[0]))
                {
                    listBox2Pairs[propPair[0]] += "\n" + propPair[1];
                }
                else
                {
                    listBox2.Items.Add(propPair[0]);
                    listBox2Pairs.Add(propPair[0], propPair[1]);
                }
            }
        }
Ejemplo n.º 5
0
        private void typeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TestGda tgda = new TestGda();

            gidComboBox.ItemsSource  = tgda.GetExtentValues(InputModelCode(typeComboBox.SelectedItem.ToString()));
            gidComboBox.SelectedItem = null;
            listBox1.SelectedItem    = null;
            listBox1.Items.Clear();
            listBox1Pairs.Clear();
            richTextBox.Document.Blocks.Clear();
        }
Ejemplo n.º 6
0
        private void gidGetRelatedValuescomboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (gidGetRelatedValuescomboBox.SelectedItem == null)
            {
                return;
            }
            TestGda tgda = new TestGda();

            refGetRelatedValuescomboBox.ItemsSource      = tgda.GetReferences(Convert.ToInt64(gidGetRelatedValuescomboBox.SelectedItem.ToString()));
            refGetRelatedValuescomboBox.SelectedItem     = null;
            refTypeGetRelatedValuescomboBox.SelectedItem = null;
            refTypeGetRelatedValuescomboBox.ItemsSource  = null;
            refTypeGetRelatedValuescomboBox.Items.Clear();
            listBox3.SelectedItem = null;
            listBox3.Items.Clear();
            listBox3Pairs.Clear();
            richTextBox3.Document.Blocks.Clear();
        }
        public GetRelatedValues()
        {
            InitializeComponent();
            DataContext = this;

            GlobalIdentifiersRelated = new ObservableCollection <GlobalIdentifierViewModel>();
            RelationalProperties     = new ObservableCollection <PropertyViewModel>();
            RelatedEntityDmsTypes    = new ObservableCollection <DmsTypeViewModel>();

            try
            {
                tgda = new TestGda();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "GetRelatedValues", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Task.Run(Initialize);
        }
Ejemplo n.º 8
0
        private void gidComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (gidComboBox.SelectedItem == null)
            {
                return;
            }
            TestGda tgda = new TestGda();
            List <List <string> > path = tgda.GetValuesAndPath(Convert.ToInt64(gidComboBox.SelectedItem.ToString()));
            string xmlString           = System.IO.File.ReadAllText(path[0][0]);

            richTextBox.Document.Blocks.Clear();
            richTextBox.Document.Blocks.Add(new Paragraph(new Run(xmlString)));
            listBox1.SelectedItem = null;
            listBox1.Items.Clear();
            listBox1Pairs.Clear();
            foreach (var item in path[1])
            {
                string[] propPair = item.Split('~');
                listBox1.Items.Add(propPair[0]);
                listBox1Pairs.Add(propPair[0], propPair[1]);
            }
        }
        public GetValues()
        {
            InitializeComponent();
            DataContext = this;

            modelResourcesDesc = new ModelResourcesDesc();
            propertiesDesc     = new Dictionary <ModelCode, string>();

            SelectedGID       = null;
            GlobalIdentifiers = new ObservableCollection <GlobalIdentifierViewModel>();

            try
            {
                tgda = new TestGda();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "GetValues", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Task.Run(Initialize);
        }
Ejemplo n.º 10
0
        public static void Main(string[] args)
        {
            ModelResourcesDesc resDesc = new ModelResourcesDesc();

            try
            {
                // Set NMSTestInterfaceClient console layout
                Console.SetWindowPosition(0, 0);
                Console.SetBufferSize(250, 1000);
                Console.SetWindowSize((int)(Console.LargestWindowWidth * 0.7), (int)(Console.LargestWindowHeight * 0.8));
                Console.Title = "Network Model Service Test Client";
            }
            catch (Exception ex)
            {
                string errPositionMessage = string.Format("Error: Could not set Network Model Service Test Client's window size and position. {0}", ex.Message);
                Console.WriteLine(errPositionMessage);
                CommonTrace.WriteTrace(CommonTrace.TraceError, errPositionMessage);
            }

            string message = string.Format("Network Model Service Test Client is up and running...");

            Console.WriteLine(message);
            CommonTrace.WriteTrace(CommonTrace.TraceInfo, message);

            message = string.Format("Result directory: {0}", Config.Instance.ResultDirecotry);
            Console.WriteLine(message);
            CommonTrace.WriteTrace(CommonTrace.TraceInfo, message);


            try
            {
                TestGda tgda = new TestGda();


                string str = string.Empty;
                do
                {
                    PrintMenu();
                    str = Console.ReadLine();

                    if (str == "1")
                    {
                        try
                        {
                            tgda.GetValues(InputGlobalId());
                        }
                        catch (Exception ex)
                        {
                            message = string.Format("GetValues failed. {0}", ex.Message);
                            Console.WriteLine(message);
                            CommonTrace.WriteTrace(CommonTrace.TraceError, message);
                        }
                    }
                    else if (str == "2")
                    {
                        try
                        {
                            tgda.GetExtentValues(InputModelCode());
                        }
                        catch (Exception ex)
                        {
                            message = string.Format("GetExtentValues failed. {0}", ex.Message);
                            Console.WriteLine(message);
                            CommonTrace.WriteTrace(CommonTrace.TraceError, message);
                        }
                    }
                    else if (str == "3")
                    {
                        try
                        {
                            tgda.GetRelatedValues(InputGlobalId(), InputAssociation());
                        }
                        catch (Exception ex)
                        {
                            message = string.Format("GetRelatedValues failed. {0}", ex.Message);
                            Console.WriteLine(message);
                            CommonTrace.WriteTrace(CommonTrace.TraceError, message);
                        }
                    }
                    else if (str == "4")
                    {
                        try
                        {
                            tgda.TestApplyDeltaInsert();
                        }
                        catch (Exception ex)
                        {
                            message = string.Format("Test ApplyUpdate: Insert - Update - Delte failed. {0}", ex.Message);
                            Console.WriteLine(message);
                            CommonTrace.WriteTrace(CommonTrace.TraceError, message);
                        }
                    }
                    else if (str != "q")
                    {
                        PrintUnknownOption();
                    }

                    Console.WriteLine();
                }while (str != "q");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                CommonTrace.WriteTrace(CommonTrace.TraceError, ex.Message);
            }

            message = "Network Model Service Test Client stopped.";
            Console.WriteLine(message);
            CommonTrace.WriteTrace(CommonTrace.TraceError, message);
        }
Ejemplo n.º 11
0
        private void bGetRelValues_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tbGid.Text))
            {
                MessageBox.Show("Enter valid GID first", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (Combo.SelectedItem == null)
            {
                MessageBox.Show("Please choose reference for all fields", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            if (ComboType.SelectedItem == null)
            {
                MessageBox.Show("Reference type must be selected first. If there is nothing to select from, try loading references fist", "Warning", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
                return;
            }

            //gid
            var gid = InputGlobalId(tbGid.Text);

            if (gid == -1)
            {
                return;
            }

            //za popunjavanje propertija
            var props = new List <ModelCode>();

            foreach (var item in _item3)
            {
                if (!item.IsChecked)
                {
                    continue;
                }
                var myStatus = (ModelCode)Enum.Parse(typeof(ModelCode), item.Name, true);
                props.Add(myStatus);
            }

            var asc = new Association();

            try
            {
                //asocijacija

                Enum.TryParse(Combo.SelectedItem.ToString(), true, out ModelCode mc);
                asc.PropertyId = mc;
                Enum.TryParse(ComboType.SelectedItem.ToString(), true, out mc);
                asc.Type = mc;
            }
            catch (Exception)
            {
                MessageBox.Show("Incorrect field selection for reference or reference type", "Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }


            var gda = new TestGda();

            if (gda.GetRelatedValues(gid, props, asc) != null)
            {
                var path = Directory.GetCurrentDirectory();
                path            = Path.GetFullPath(Path.Combine(path, @"..\..\..\Results\GetRelatedValues_Results.xml"));
                TextBoxRel.Text = string.Empty;
                TextBoxRel.Text = File.Exists(path) ? File.ReadAllText(path) : "File does not exists";
            }
            else
            {
                MessageBox.Show("Unkown error in GetRelatedValues");
            }
        }