Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShowHardware sh = new ShowHardware();

            sh.Show();
            this.Close();
        }
Пример #2
0
        private void Submit_Nodes(object sender, RoutedEventArgs e)
        {
            ManufacturingDataModel MDM = new ManufacturingDataModel();
            Test     t = new Test(MDM);
            Hardware h = new Hardware();

            try
            {
                nodes     = AddNodes.Text;
                repeaters = AddRepeaters.Text;
                hubs      = AddHubs.Text;

                h.Nodes     = Convert.ToInt32(nodes);
                h.Repeaters = Convert.ToInt32(repeaters);
                h.Hubs      = Convert.ToInt32(hubs);

                t.AddHardware(h);

                ShowHardware sh = new ShowHardware();
                sh.Show();
                this.Close();
            }
            catch
            {
                MessageBox.Show("Add a numerical value");
            }
        }
Пример #3
0
        private void Update_Hardware(object sender, RoutedEventArgs e)
        {
            ManufacturingDataModel MDM = new ManufacturingDataModel();
            Test t = new Test(MDM);



            try
            {
                //Get data
                List <Hardware> hardware = t.GetHardware();

                //Get user input
                string _IDItem = IDlist.Text;
                int    IDItem  = Convert.ToInt32(_IDItem);

                //Prepare node/repeater/hub parameters
                string _node = Node.Text;
                int    node  = Convert.ToInt32(_node);

                string _repeater = Repeater.Text;
                int    repeater  = Convert.ToInt32(_repeater);

                string _hub = Hub.Text;
                int    hub  = Convert.ToInt32(_hub);

                //looping in list
                foreach (Hardware i in hardware)
                {
                    if (i.ID == IDItem)
                    {
                        i.Nodes     = node;
                        i.Repeaters = repeater;
                        i.Hubs      = hub;
                        t.UpdateHardware(i);
                    }
                }


                ShowHardware sh = new ShowHardware();
                sh.Show();
                this.Close();
            }
            catch
            {
                //Try or catch in care user enter invalid id number or string
                MessageBox.Show("Your update has failed. Please check for:" + "\n" + "- Character" + "\n" + "- String" + "\n" + "- Empty box");
            }
        }
Пример #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //The code below is to navigate between Windows.
            //If you wish to do it with page then use frame as below

            /* XAML
             * <Frame Source="Page1.xaml">
             * cs.file
             * page1.content = new addhardware*/

            ShowHardware sh = new ShowHardware();

            sh.Show();
            this.Close();
        }
Пример #5
0
        //in order to reset the auto_increase of sql ID you need to truncate the table

        private void Remove_Hardware(object sender, RoutedEventArgs e)
        {
            ManufacturingDataModel MDM = new ManufacturingDataModel();
            Test t = new Test(MDM);

            try
            {
                //Get data
                List <Hardware> hardware = t.GetHardware();


                //Get user input
                string _RemoveItem = Remove.Text;
                int    RemoveItem  = Convert.ToInt32(_RemoveItem);


                //loop into data to find hardware of interest


                foreach (Hardware i in hardware)
                {
                    if (i.ID == RemoveItem)
                    {
                        t.RemoveHardware(i);
                        MessageBox.Show("Hardware succesfully removed");
                        break;
                    }
                }


                ShowHardware sh = new ShowHardware();
                sh.Show();
                this.Close();
            }
            catch
            {
                //Try or catch in care user enter invalid id number or string
                MessageBox.Show("Your update has failed. Please check for:" + "\n" + "- Character" + "\n" + "- String" + "\n" + "- Empty box");
            }
        }