Exemple #1
0
        public void Register_Button_Click(object sender, RoutedEventArgs e)
        {
            if (Login.Text.Length == 0 || RegisterPassword.Text.Length == 0 || ConfirmPassword.Text.Length == 0)
            {
                MessageBox.Show("Заповніть всі поля");
                return;
            }
            else if (RegisterPassword.Text != ConfirmPassword.Text)
            {
                MessageBox.Show("Паролі не співпадають");
                return;
            }
            else
            {
                DB_ServerConnection cnn = DB_ServerConnection.getInstance();

                string[] res = cnn.Connect("select Student_Password from Student where Student_Login = '******'").Split('/');
                if (res[0].Length != 0)
                {
                    MessageBox.Show("Користувач з таким логіном вже існує");
                }
                else
                {
                    cnn.Connect("insert into Student (Student_Login, Student_Password) values('" + Login.Text + "', '" + RegisterPassword.Text + "')");
                    ProfileSearchWindow p = new ProfileSearchWindow(Login.Text);
                    p.Show();
                    this.Close();
                }
            }
        }
Exemple #2
0
        public Search()
        {
            InitializeComponent();
            DB_ServerConnection cnn = DB_ServerConnection.getInstance();
            string str = cnn.Connect("select Student_First_Name, Student_Last_Name, Age, Student_Group, Institute, Specialty,  Student_Card_ID from Student where Student_First_Name is not null");

            Student_Grid.ItemsSource = DB_ServerConnection.MakeListFromString(str);
        }
Exemple #3
0
        private void Save_Button_Click(object sender, RoutedEventArgs e)
        {
            DB_ServerConnection cnn = DB_ServerConnection.getInstance();

            cnn.Connect("update Student set Student_First_Name = '" + inpName.Text +
                        "', Student_Last_Name = '" + inpSurname.Text +
                        "', Age = '" + inpAge.Text +
                        "', Student_Group = '" + inpGroup.Text +
                        "', Institute = '" + inpInst.Text +
                        "', Specialty = '" + InpSpec.Text +
                        "', Student_Card_ID= '" + inpStudID.Text +
                        "' where Student_Login = '******'");
            MessageBox.Show("Зміни збережено");
        }
Exemple #4
0
        private void Search_Button_Click(object sender, RoutedEventArgs e)
        {
            DB_ServerConnection cnn = DB_ServerConnection.getInstance();
            string s   = SearchInput.Text;
            string str = cnn.Connect("select Student_First_Name, Student_Last_Name, Age, Student_Group, Institute, Specialty,  Student_Card_ID from Student where " +
                                     "Student_First_Name like'%" + s +
                                     "%' OR Student_Last_Name like '%" + s +
                                     "%' OR Age like '%" + s +
                                     "%' OR Student_Group like '%" + s +
                                     "%' OR  Institute like '%" + s +
                                     "%' OR  Specialty like '%" + s +
                                     "%' OR Student_Card_ID like '%" + s + "%'");

            Student_Grid.ItemsSource = DB_ServerConnection.MakeListFromString(str);
        }
Exemple #5
0
        public Profile()
        {
            InitializeComponent();
            DB_ServerConnection cnn = DB_ServerConnection.getInstance();
            string str = cnn.Connect("select Student_First_Name, Student_Last_Name, Age, Student_Group, Institute, Specialty,  Student_Card_ID from Student where Student_Login = '******'");
            List <Student> User = DB_ServerConnection.MakeListFromString(str);

            inpName.Text    = User[0].FirstName;
            inpSurname.Text = User[0].LastName;
            inpStudID.Text  = User[0].Student_Card_ID;
            inpAge.Text     = User[0].Age;
            inpInst.Text    = User[0].Institute;
            InpSpec.Text    = User[0].Specialty;
            inpGroup.Text   = User[0].Group;
        }
Exemple #6
0
        private void Login_Button_Click(object sender, RoutedEventArgs e)
        {
            DB_ServerConnection cnn = DB_ServerConnection.getInstance();

            string[] res = cnn.Connect("select Student_Password from Student where Student_Login = '******'").Split('/');
            if (res[0].Length == 0)
            {
                MessageBox.Show("Користувача з таким логіном не існує");
            }
            else if (res[0] != Password.Password)
            {
                MessageBox.Show("Невірний пароль");
            }
            else if (res[0] == Password.Password)
            {
                ProfileSearchWindow p = new ProfileSearchWindow(Login.Text);
                this.Close();
                p.Show();
            }
        }