Example #1
0
        private void getInformationFromBase()
        {
            if (connect.connectionToDataBase())
            {
                OleDbCommand    showRecord = new OleDbCommand("SELECT * FROM Komputery", connect.con);
                OleDbDataReader data       = showRecord.ExecuteReader();
                while (data.Read())
                {
                    object office = data["Wersja Office"];
                    lista.Add(new BaseData()
                    {
                        Serial  = data["Numer seryjny"].ToString(),
                        Name    = data["Nazwa"].ToString(),
                        Model   = data["Model"].ToString(),
                        Login   = data["Login"].ToString(),
                        Windows = data["System operacyjny"].ToString(),
                        Office  = changeOfficeVersion(office).ToString(),
                        RAM     = data["RAM"].ToString()
                    });

                    DataBaseList.ItemsSource = lista;
                }
                data.Close();
            }
            connect.con.Close();
        }
        private bool testData(string s)
        {
            bool existInBase = false;

            if (connectToBase.connectionToDataBase())
            {
                OleDbCommand    showRecord = new OleDbCommand("SELECT * FROM Komputery", connectToBase.con);
                OleDbDataReader data       = showRecord.ExecuteReader();
                while (data.Read())
                {
                    if (data["Numer seryjny"].ToString() == s)
                    {
                        LogField.Foreground = new SolidColorBrush(Colors.YellowGreen);
                        LogField.Content   += "Laptop jest już w bazie! \n";
                        existInBase         = true;
                    }
                    else
                    {
                        existInBase = false;
                    }
                }
                data.Close();
            }
            connectToBase.con.Close();
            return(existInBase);
        }
Example #3
0
        public void OnClickLoginButton(object sender, RoutedEventArgs e)
        {
            messageLabel.Content = "";
            BaseConnect connect = new BaseConnect();

            //string pass = passText.Text;
            //BaseConnect.pass = passText.Password;
            if (connect.connectionToDataBase() == true)
            {
                BaseView wyswietl_baze = new BaseView();
                Content = wyswietl_baze;
                messageLabel.Content = "Połączono";
            }
            else
            {
                messageLabel.Foreground = new SolidColorBrush(Colors.Red);
                messageLabel.Content    = "Brak połączenia z bazą lub podane hasło jest nieprawidłowe";
            }
        }