예제 #1
0
        public void pumpa1klik(object sender, RoutedEventArgs e)
        {
            login lgn = new login();

            if (lgn.ShowDialog() == true)
            {
                if (lgn.DialogResult == true)
                {

                    p1lok = false;

                    try
                    {
                       // if (komanda1==1)
                        p1Stanje = true;

                        if (VozacLista.SelectedIndex != -1 && VozilaLista.SelectedIndex != -1)
                        {
                            DataContainer.VozacS1 = ((ListBoxItem)VozacLista.SelectedValue).Content.ToString();
                            DataContainer.VoziloS1 = ((ListBoxItem)VozilaLista.SelectedValue).Content.ToString();

                            //Potvrda potvrda = new Potvrda();
                            //potvrda.ShowDialog();

                            //if (DataContainer.sigurnost)

                        }
                        VozacLista.SelectedIndex = -1;
                        VozilaLista.SelectedIndex = -1;
                        UnosBtn.IsEnabled = true;
                        UnosBtn_Copy.IsEnabled = true;
            keypad1:
                        Keypad key = new Keypad(this);
                              if (key.ShowDialog() == true)

                                  if (key.Result == null || key.Result=="")
                                  {
                                      MessageBox.Show("Niste uneli količinu goriva ? Pokusajte ponovo.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Question);
                                      goto keypad1;
                                  }

                                  DataContainer.GorivoS1Provera = float.Parse(key.Result);

                             Potvrda potvrda = new Potvrda(1);
                              potvrda.ShowDialog();

                              if (DataContainer.sigurnost)
                              {
                                  Thread.Sleep(2000);
                                  sqlwriteProvera(MainWindow.DataContainer.VozacS1, DataContainer.VoziloS1, DataContainer.GorivoS1Provera);
                                  if (DataContainer.GorivoS1 < 2000 && DataContainer.GorivoS1 != 0)
                                  {
                                  sqlwrite(MainWindow.DataContainer.VozacS1, DataContainer.VoziloS1, DataContainer.GorivoS1);
                                  }
                                  else
                                  {
                                  sqlwrite(MainWindow.DataContainer.VozacS1, DataContainer.VoziloS1, DataContainer.GorivoS1Provera);
                                  }
                              }
                              else
                              {
                                  goto keypad1;
                              }

                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show(ee.ToString());
                    }
                }
                else
                {
                    p1lok = true;
                    p1Stanje = false;
                }
                }
        }
예제 #2
0
        private void pumpa2klik(object sender, RoutedEventArgs e)
        {
            login lgn = new login();

            if (lgn.ShowDialog() == true)
            {
                if (lgn.DialogResult == true)
                {

                    try
                    {

                        p2Stanje = true;
                        p2lok = false;
                        Encoding enc = new UTF8Encoding(true, true);

                        if (VozacLista.SelectedIndex != -1 && VozilaLista.SelectedIndex != -1)
                        {
                            DataContainer.VozacS2 = ((ListBoxItem)VozacLista.SelectedValue).Content.ToString();
                            DataContainer.VoziloS2 = ((ListBoxItem)VozilaLista.SelectedValue).Content.ToString();

                        }
                        VozacLista.SelectedIndex = -1;
                        VozilaLista.SelectedIndex = -1;
                        UnosBtn.IsEnabled = true;
                        UnosBtn_Copy.IsEnabled = true;
               keypad2:
                        Keypad key = new Keypad(this);
                        if (key.ShowDialog() == true)

                            if (key.Result == null || key.Result == "")
                            {
                                MessageBox.Show("Niste uneli količinu goriva ? Pokusajte ponovo.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Question);
                                goto keypad2;
                            }

                            DataContainer.GorivoS2Provera = float.Parse(key.Result);

                        Potvrda potvrda = new Potvrda(2);
                        potvrda.ShowDialog();

                        if (DataContainer.sigurnost)
                        {
                            Thread.Sleep(2000);
                            sqlwriteProvera(MainWindow.DataContainer.VozacS2, DataContainer.VoziloS2, DataContainer.GorivoS2Provera);
                            if (DataContainer.GorivoS2 < 2000 && DataContainer.GorivoS2 != 0)
                            {
                                sqlwrite(MainWindow.DataContainer.VozacS2, DataContainer.VoziloS2, DataContainer.GorivoS2);
                            }
                            else
                            {
                                sqlwrite(MainWindow.DataContainer.VozacS2, DataContainer.VoziloS2, DataContainer.GorivoS2Provera);
                            }
                        }
                        else
                        {

                                  goto keypad2;
                        }
                    }
                    catch
                    {

                    }
                }
                else
                {
                    p2lok = true;
                    p2Stanje = false;
                }
            }
        }