Example #1
0
        private void CW_Register_ComboBoxFiller()
        {
            DB_Resolver comboboxinitializer = new DB_Resolver();

            comboboxinitializer.DB_ConnectionComboBoxUniver(CW_Register_University_ComboBox);
            comboboxinitializer.DB_ConnectionComboBoxUniverAvail(CW_Register_University_Available_ComboBox);
        }
Example #2
0
        private void MW_F_Register(object sender, RoutedEventArgs e)
        {
            DB_Resolver dbinterface = new DB_Resolver();

            dbinterface.DB_ConnectionOpener();
            if (dbinterface.DB_ConnectionChecker())
            {
                var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Rejestracja"));

                if (existingWindow == null)
                {
                    Window ChildWindow_Register = new ChildWindow_Register();
                    ChildWindow_Register.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    ChildWindow_Register.Owner = this;
                    ChildWindow_Register.Show();
                }
                else
                {
                    existingWindow.WindowState = WindowState.Normal;
                    existingWindow.Activate();
                }
            }
            else
            {
                var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Rejestracja"));
                if (existingWindow != null)
                {
                    existingWindow.Close();
                }
                MessageBox.Show("Błąd połączenia z bazą danych systemu. Napewno posiadasz połączenie z internetem?", "SRUW - Błąd Połączenia", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        private void CW_Status_F_Delete_User(object sender, RoutedEventArgs e)
        {
            MessageBoxResult Result = MessageBox.Show("Czy napewno chcesz usunąć wszystkie dane z systemu?", "SRUW - Usuwanie Użytkownika", MessageBoxButton.YesNo, MessageBoxImage.Information);

            if (Result == MessageBoxResult.Yes)
            {
                DB_Resolver connection = new DB_Resolver();
                connection.DB_ConnectionOpener();
                if (connection.DB_ConnectionChecker())
                {
                    connection.DB_Resolver_Status_User_Deletion(usedid);
                    Close();
                    var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("System Rekrutacji Uczelni Wyższych"));
                    existingWindow.WindowState = WindowState.Normal;
                    existingWindow.Activate();
                }
                else
                {
                    MessageBox.Show("Błąd połączenia z bazą danych systemu. Napewno posiadasz połączenie z internetem?", "SRUW - Błąd Połączenia", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else if (Result == MessageBoxResult.No)
            {
                var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Status"));
                existingWindow.WindowState = WindowState.Normal;
                existingWindow.Activate();
            }
        }
        public ChildWindow_Status(int usedid)
        {
            InitializeComponent();
            this.usedid = usedid;
            DB_Resolver informationpreload = new DB_Resolver();

            informationpreload.DB_Resolver_Status_Queue(CW_Status_Pesel_Field, CW_Status_Name_Field, CW_Status_Email_Field, CW_Status_Address1_Field, CW_Status_Address2_Field, CW_Status_Polish_Field, CW_Status_Maths_Field, CW_Status_English_Field, CW_Status_Pol1Add_Field, CW_Status_Mat2Add_Field, CW_Status_Eng3Add_Field, CW_Status_Route_Field, CW_Status_Status_Field, CW_Status_Points_Field, usedid);
        }
Example #5
0
        public void DB_Resolver_Status_Queue(TextBox pesel, TextBox Name, TextBox Email, TextBox Address1, TextBox Address2, TextBox pol, TextBox mat, TextBox eng, TextBox pol1add, TextBox mat2add, TextBox eng3add, TextBox route, TextBox status, TextBox points, int usedid)
        {
            MySqlConnection dbconnectionobj        = new MySqlConnection(db_connectionstring);
            String          peselholder            = "";
            String          nameholder             = "";
            String          emailholder            = "";
            String          address1holder         = "";
            String          address2holder         = "";
            String          polholder              = "";
            String          matholder              = "";
            String          engholder              = "";
            String          pol1addholder          = "";
            String          mat2addholder          = "";
            String          eng3addholder          = "";
            String          universitynameholder   = "";
            String          routeholder            = "";
            String          statusholder           = "";
            String          pointsholder           = "";
            int             calculatedpointsholder = 0;
            int             iduniverholder         = 0;
            int             idgradesholder         = 0;
            int             iduniveravailholder    = 0;

            String       db_selectionquery1 = "SELECT name,pesel,email,address1,address2,iduniver,idgrades,iduniveravail from sruw_accounts WHERE id = @userid";
            MySqlCommand execcommand1       = new MySqlCommand(db_selectionquery1, dbconnectionobj);

            execcommand1.Parameters.AddWithValue("@userid", usedid);
            execcommand1.CommandTimeout = 30;

            String       db_selectionquery2 = "SELECT polish,english,maths,add1,add2,add3 from sruw_grades WHERE id = @gradesid";
            MySqlCommand execcommand2       = new MySqlCommand(db_selectionquery2, dbconnectionobj);

            execcommand2.CommandTimeout = 30;

            String       db_selectionquery3 = "SELECT name from sruw_univer WHERE id = @univerid";
            MySqlCommand execcommand3       = new MySqlCommand(db_selectionquery3, dbconnectionobj);

            execcommand3.CommandTimeout = 30;

            String       db_selectionquery4 = "SELECT name,pointtresh from sruw_univer_avail WHERE iduniver = @univerid AND id=@iduniveravail";
            MySqlCommand execcommand4       = new MySqlCommand(db_selectionquery4, dbconnectionobj);

            execcommand4.CommandTimeout = 30;

            MySqlDataReader datareader;

            try
            {
                dbconnectionobj.Open();
                datareader = execcommand1.ExecuteReader();
                if (datareader.HasRows)
                {
                    while (datareader.Read())
                    {
                        nameholder          = datareader.GetString(0);
                        peselholder         = datareader.GetString(1);
                        emailholder         = datareader.GetString(2);
                        address1holder      = datareader.GetString(3);
                        address2holder      = datareader.GetString(4);
                        iduniverholder      = datareader.GetInt32(5);
                        idgradesholder      = datareader.GetInt32(6);
                        iduniveravailholder = datareader.GetInt32(7);
                    }
                }
                datareader.Close();
                execcommand2.Parameters.AddWithValue("@gradesid", idgradesholder);

                datareader = execcommand2.ExecuteReader();
                if (datareader.HasRows)
                {
                    while (datareader.Read())
                    {
                        polholder     = datareader.GetString(0);
                        engholder     = datareader.GetString(1);
                        matholder     = datareader.GetString(2);
                        pol1addholder = datareader.GetString(3);
                        mat2addholder = datareader.GetString(4);
                        eng3addholder = datareader.GetString(5);
                    }
                }
                datareader.Close();
                execcommand3.Parameters.AddWithValue("@univerid", iduniverholder);
                datareader = execcommand3.ExecuteReader();
                if (datareader.HasRows)
                {
                    while (datareader.Read())
                    {
                        universitynameholder = datareader.GetString(0);
                    }
                }
                datareader.Close();
                execcommand4.Parameters.AddWithValue("@univerid", iduniverholder);
                execcommand4.Parameters.AddWithValue("@iduniveravail", iduniveravailholder);
                datareader = execcommand4.ExecuteReader();
                if (datareader.HasRows)
                {
                    while (datareader.Read())
                    {
                        routeholder  = datareader.GetString(0);
                        pointsholder = datareader.GetString(1);
                    }
                }
                datareader.Close();
                DB_ConnectionCloser(dbconnectionobj);
                pesel.Text    = peselholder;
                Name.Text     = nameholder;
                Email.Text    = emailholder;
                Address1.Text = address1holder;
                Address2.Text = address2holder;
                pol.Text      = polholder;
                mat.Text      = matholder;
                eng.Text      = engholder;
                pol1add.Text  = pol1addholder;
                mat2add.Text  = mat2addholder;
                eng3add.Text  = eng3addholder;
                route.Text    = universitynameholder + " - " + routeholder;
                DB_Resolver calculation = new DB_Resolver();
                calculation.DB_Resolver_StatusPointsCalculator(polholder, matholder, engholder, pol1addholder, mat2addholder, eng3addholder, out calculatedpointsholder);
                if (pointsholder == "NIEUSTAWIONE")
                {
                    statusholder = "OCZEKUJĄCY";
                }
                else if (Convert.ToInt32(pointsholder) < calculatedpointsholder)
                {
                    statusholder = "PRZYJĘTY";
                }
                else if (Convert.ToInt32(pointsholder) > calculatedpointsholder)
                {
                    statusholder = "ODRZUCONY";
                }
                else if (Convert.ToInt32(pointsholder) == calculatedpointsholder)
                {
                    statusholder = "PRZYJETY";
                }
                status.Text = statusholder;
                points.Text = Convert.ToString(calculatedpointsholder);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Błąd Bazodanowy. Operacja nie powiodła się.", "SRUW - Błąd Bazodanowy", MessageBoxButton.OK, MessageBoxImage.Error);
            };
        }
        private void CW_Status_F_Modify_User_Locker(object sender, RoutedEventArgs e)
        {
            int peselcorrector    = 0;
            int namecorrector     = 0;
            int emailcorrector    = 0;
            int address1corrector = 0;
            int address2corrector = 0;
            int polishcorrector   = 0;
            int mathscorrector    = 0;
            int englishcorrector  = 0;
            int pol1addcorrector  = 0;
            int mat2addcorrector  = 0;
            int eng3addcorrector  = 0;

            if (CW_Status_Pesel_Field.Text == "")
            {
                CW_Status_Pesel_Field.Text = "";
                peselcorrector             = 0;
            }
            else
            {
                try
                {
                    String peselinput = CW_Status_Pesel_Field.Text;
                    int    length     = peselinput.Length;
                    if (length == 11)
                    {
                        double isanumber = Convert.ToDouble(peselinput);
                        peselcorrector = 1;
                    }
                    else
                    {
                        CW_Status_Pesel_Field.Text = "";
                        peselcorrector             = 0;
                    }
                }
                catch (Exception exception)
                {
                    CW_Status_Pesel_Field.Text = "";
                    peselcorrector             = 0;
                };
            }
            //napraw

            if (CW_Status_Name_Field.Text == "")
            {
                CW_Status_Name_Field.Text = "";
                namecorrector             = 0;
            }
            else
            {
                String nameinput = CW_Status_Name_Field.Text;
                int    foundq    = nameinput.IndexOf(" ");
                if (foundq == -1)
                {
                    CW_Status_Name_Field.Text = "";
                    namecorrector             = 0;
                }
                else
                {
                    namecorrector = 1;
                }
            }

            if (CW_Status_Email_Field.Text == "")
            {
                CW_Status_Email_Field.Text = "";
                emailcorrector             = 0;
            }
            else
            {
                String emailinput = CW_Status_Email_Field.Text;
                int    foundq     = emailinput.IndexOf("@");
                if (foundq == -1)
                {
                    CW_Status_Email_Field.Text = "";
                    emailcorrector             = 0;
                }
                else
                {
                    emailcorrector = 1;
                }
            }

            if (CW_Status_Address1_Field.Text == "")
            {
                CW_Status_Address1_Field.Text = "";
                address1corrector             = 0;
            }
            else
            {
                address1corrector = 1;
            }

            if (CW_Status_Address2_Field.Text == "")
            {
                CW_Status_Address2_Field.Text = "";
                address2corrector             = 0;
            }
            else
            {
                address2corrector = 1;
            }



            String input = CW_Status_Polish_Field.Text;

            try
            {
                int inputvalue = Convert.ToInt32(input);
                if (inputvalue > 100)
                {
                    CW_Status_Polish_Field.Text = "";
                    polishcorrector             = 0;
                }
                else if (inputvalue < 0)
                {
                    CW_Status_Polish_Field.Text = "";
                    polishcorrector             = 0;
                }
                else if (inputvalue == 000 || inputvalue == 00)
                {
                    CW_Status_Polish_Field.Text = "0";
                    polishcorrector             = 1;
                }
                else
                {
                    polishcorrector = 1;
                }
            }
            catch (Exception exception)
            {
                CW_Status_Polish_Field.Text = "";
                polishcorrector             = 0;
            };

            input = CW_Status_Maths_Field.Text;
            try
            {
                int inputvalue = Convert.ToInt32(input);
                if (inputvalue > 100)
                {
                    CW_Status_Maths_Field.Text = "";
                    mathscorrector             = 0;
                }
                else if (inputvalue < 0)
                {
                    CW_Status_Maths_Field.Text = "";
                    mathscorrector             = 0;
                }
                else if (inputvalue == 000 || inputvalue == 00)
                {
                    CW_Status_Maths_Field.Text = "0";
                    mathscorrector             = 1;
                }
                else
                {
                    mathscorrector = 1;
                }
            }
            catch (Exception exception)
            {
                CW_Status_Maths_Field.Text = "";
                mathscorrector             = 0;
            };

            input = CW_Status_English_Field.Text;
            try
            {
                int inputvalue = Convert.ToInt32(input);
                if (inputvalue > 100)
                {
                    CW_Status_English_Field.Text = "";
                    englishcorrector             = 0;
                }
                else if (inputvalue < 0)
                {
                    CW_Status_English_Field.Text = "";
                    englishcorrector             = 0;
                }
                else if (inputvalue == 000 || inputvalue == 00)
                {
                    CW_Status_English_Field.Text = "0";
                    englishcorrector             = 1;
                }
                else
                {
                    englishcorrector = 1;
                }
            }
            catch (Exception exception)
            {
                CW_Status_English_Field.Text = "";
                englishcorrector             = 0;
            };

            input = CW_Status_Pol1Add_Field.Text;
            try
            {
                int inputvalue = Convert.ToInt32(input);
                if (inputvalue > 100)
                {
                    CW_Status_Pol1Add_Field.Text = "";
                    pol1addcorrector             = 0;
                }
                else if (inputvalue < 0)
                {
                    CW_Status_Pol1Add_Field.Text = "";
                    pol1addcorrector             = 0;
                }
                else if (inputvalue == 000 || inputvalue == 00)
                {
                    CW_Status_Pol1Add_Field.Text = "0";
                    pol1addcorrector             = 1;
                }
                else
                {
                    pol1addcorrector = 1;
                }
            }
            catch (Exception exception)
            {
                CW_Status_Pol1Add_Field.Text = "";
                pol1addcorrector             = 0;
            };

            input = CW_Status_Mat2Add_Field.Text;
            try
            {
                int inputvalue = Convert.ToInt32(input);
                if (inputvalue > 100)
                {
                    CW_Status_Mat2Add_Field.Text = "";
                    mat2addcorrector             = 0;
                }
                else if (inputvalue < 0)
                {
                    CW_Status_Mat2Add_Field.Text = "";
                    mat2addcorrector             = 0;
                }
                else if (inputvalue == 000 || inputvalue == 00)
                {
                    CW_Status_Mat2Add_Field.Text = "0";
                    mat2addcorrector             = 1;
                }
                else
                {
                    mat2addcorrector = 1;
                }
            }
            catch (Exception exception)
            {
                CW_Status_Mat2Add_Field.Text = "";
                mat2addcorrector             = 0;
            };

            input = CW_Status_Eng3Add_Field.Text;
            try
            {
                int inputvalue = Convert.ToInt32(input);
                if (inputvalue > 100)
                {
                    CW_Status_Eng3Add_Field.Text = "";
                    eng3addcorrector             = 0;
                }
                else if (inputvalue < 0)
                {
                    CW_Status_Eng3Add_Field.Text = "";
                    eng3addcorrector             = 0;
                }
                else if (inputvalue == 000 || inputvalue == 00)
                {
                    CW_Status_Eng3Add_Field.Text = "0";
                    eng3addcorrector             = 1;
                }
                else
                {
                    eng3addcorrector = 1;
                }
            }
            catch (Exception exception)
            {
                CW_Status_Eng3Add_Field.Text = "";
                eng3addcorrector             = 0;
            };


            if (peselcorrector == 0 || namecorrector == 0 || emailcorrector == 0 || address1corrector == 0 || address2corrector == 0 || polishcorrector == 0 || mathscorrector == 0 || englishcorrector == 0 || address1corrector == 0 || pol1addcorrector == 0 || mat2addcorrector == 0 || eng3addcorrector == 0)
            {
                var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Status"));
                existingWindow.Activate();
                MessageBox.Show("Niektóre pola nie przeszły testów walidacyjnych i zostały wyczyszczone przez system bądź zostały pozostawione puste. Wypełnij je poprawnie.", "SRUW - Modyfikacja Profilu", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                DB_Resolver updaterconnection = new DB_Resolver();
                updaterconnection.DB_ConnectionOpener();
                if (updaterconnection.DB_ConnectionChecker())
                {
                    CW_Status_Pesel_Field.IsReadOnly     = true;
                    CW_Status_Pesel_Field.BorderBrush    = Brushes.Gray;
                    CW_Status_Name_Field.IsReadOnly      = true;
                    CW_Status_Name_Field.BorderBrush     = Brushes.Gray;
                    CW_Status_Email_Field.IsReadOnly     = true;
                    CW_Status_Email_Field.BorderBrush    = Brushes.Gray;
                    CW_Status_Address1_Field.IsReadOnly  = true;
                    CW_Status_Address1_Field.BorderBrush = Brushes.Gray;
                    CW_Status_Address2_Field.IsReadOnly  = true;
                    CW_Status_Address2_Field.BorderBrush = Brushes.Gray;
                    CW_Status_Polish_Field.IsReadOnly    = true;
                    CW_Status_Polish_Field.BorderBrush   = Brushes.Gray;
                    CW_Status_Maths_Field.IsReadOnly     = true;
                    CW_Status_Maths_Field.BorderBrush    = Brushes.Gray;
                    CW_Status_English_Field.IsReadOnly   = true;
                    CW_Status_English_Field.BorderBrush  = Brushes.Gray;
                    CW_Status_Pol1Add_Field.IsReadOnly   = true;
                    CW_Status_Pol1Add_Field.BorderBrush  = Brushes.Gray;
                    CW_Status_Mat2Add_Field.IsReadOnly   = true;
                    CW_Status_Mat2Add_Field.BorderBrush  = Brushes.Gray;
                    CW_Status_Eng3Add_Field.IsReadOnly   = true;
                    CW_Status_Eng3Add_Field.BorderBrush  = Brushes.Gray;
                    CW_Status_Modify_Lock.Visibility     = Visibility.Hidden;
                    CW_Status_Modify_UnLock.Visibility   = Visibility.Visible;
                    updaterconnection.DB_Resolver_Status_Modify_Updater(CW_Status_Pesel_Field, CW_Status_Name_Field, CW_Status_Email_Field, CW_Status_Address1_Field, CW_Status_Address2_Field, CW_Status_Polish_Field, CW_Status_Maths_Field, CW_Status_English_Field, CW_Status_Pol1Add_Field, CW_Status_Mat2Add_Field, CW_Status_Eng3Add_Field, usedid);
                    updaterconnection.DB_Resolver_Status_Queue(CW_Status_Pesel_Field, CW_Status_Name_Field, CW_Status_Email_Field, CW_Status_Address1_Field, CW_Status_Address2_Field, CW_Status_Polish_Field, CW_Status_Maths_Field, CW_Status_English_Field, CW_Status_Pol1Add_Field, CW_Status_Mat2Add_Field, CW_Status_Eng3Add_Field, CW_Status_Route_Field, CW_Status_Status_Field, CW_Status_Points_Field, usedid);
                }
                else
                {
                    var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Status"));
                    if (existingWindow != null)
                    {
                        existingWindow.WindowState = WindowState.Normal;
                        existingWindow.Activate();
                    }
                    MessageBox.Show("Błąd połączenia z bazą danych systemu. Napewno posiadasz połączenie z internetem?", "SRUW - Błąd Połączenia", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
        }
Example #7
0
        private void CW_Login_F_Login_Attempt(object sender, RoutedEventArgs e)
        {
            String      usedlogin    = CW_Login_Pesel_Field.Text;
            String      usedauthcode = CW_Login_AuthCode_Field.Password;
            String      loginstatus  = "";
            String      logintype    = "";
            int         loginid      = 0;
            DB_Resolver connection   = new DB_Resolver();

            connection.DB_ConnectionOpener();
            if (connection.DB_ConnectionChecker())
            {
                connection.DB_Resolver_Login_Queue(usedlogin, usedauthcode, out loginstatus, out logintype, out loginid);
                if (loginstatus == "OUT")
                {
                    var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Logowanie"));
                    existingWindow.WindowState = WindowState.Normal;
                    existingWindow.Activate();
                }
                else
                {
                    if (logintype == "STANDARD")
                    {
                        Hide();
                        var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Status"));

                        if (existingWindow == null)
                        {
                            Window ChildWindow_Status = new ChildWindow_Status(loginid);
                            ChildWindow_Status.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            ChildWindow_Status.Owner = this;
                            ChildWindow_Status.Show();
                        }
                        else
                        {
                            existingWindow.WindowState = WindowState.Normal;
                            existingWindow.Activate();
                        }
                    }
                    else
                    {
                        Hide();
                        var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Panel Administratora"));

                        if (existingWindow == null)
                        {
                            Window ChildWindow_AdmCtr = new ChildWindow_AdmCtr(loginid);
                            ChildWindow_AdmCtr.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            ChildWindow_AdmCtr.Owner = this;
                            ChildWindow_AdmCtr.Show();
                        }
                        else
                        {
                            existingWindow.WindowState = WindowState.Normal;
                            existingWindow.Activate();
                        }
                    }
                }
            }
            else
            {
                var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Logowanie"));
                if (existingWindow != null)
                {
                    existingWindow.WindowState = WindowState.Normal;
                    existingWindow.Activate();
                }
                MessageBox.Show("Błąd połączenia z bazą danych systemu. Napewno posiadasz połączenie z internetem?", "SRUW - Błąd Połączenia", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Example #8
0
        private void CW_Register_University_Available_Route_Switcher(object sender, RoutedEventArgs e)
        {
            DB_Resolver comboboxinitializer = new DB_Resolver();

            comboboxinitializer.DB_ConnectionComboBoxUniverAvailSwitch(CW_Register_University_Available_ComboBox, CW_Register_University_ComboBox);
        }
Example #9
0
        private void CW_Register_F_RegisterInitializer(object sender, RoutedEventArgs e)
        {
            bool registerformstatus = CW_Register_FieldsChecker();

            if (registerformstatus == true)
            {
                DB_Resolver connection = new DB_Resolver();
                connection.DB_ConnectionOpener();
                if (connection.DB_ConnectionChecker() == true)
                {
                    MessageBoxResult Result = MessageBox.Show("Wszystko wygląda poprawnie. Kontynuować?", "SRUW - Akceptacja", MessageBoxButton.YesNo, MessageBoxImage.Information);
                    if (Result == MessageBoxResult.Yes)
                    {
                        connection.DB_ConnectionInsert(CW_Register_polish_Field, CW_Register_maths_Field, CW_Register_english_Field, CW_Register_add1pol_Field, CW_Register_add2mat_Field, CW_Register_add3eng_Field, CW_Register_Name_Field, CW_Register_Pesel_Field, CW_Register_Email_Field, CW_Register_Address1_Field, CW_Register_Address2_Field, CW_Register_University_ComboBox, CW_Register_University_Available_ComboBox);
                        MessageBoxResult Result2 = MessageBox.Show("Użytkownik został dodany do systemu." + System.Environment.NewLine +
                                                                   "Twoje dane do logowania to : " + System.Environment.NewLine +
                                                                   "Login : "******"Hasło : " + connection.generatedpassword + System.Environment.NewLine +
                                                                   "Skopiować dane do schowka systemowego?", "SRUW - Pomyślnie zarejestrowano", MessageBoxButton.YesNo, MessageBoxImage.Information);
                        if (Result2 == MessageBoxResult.Yes)
                        {
                            String SRUWCLIPB1 = "==============================================" + System.Environment.NewLine;
                            String SRUWCLIPB2 = "SRUW - WYGENEROWANE POŚWIADCZENIA" + System.Environment.NewLine;
                            String SRUWCLIPB3 = "==============================================" + System.Environment.NewLine;
                            String SRUWCLIPB4 = "LOGIN : "******"HASŁO : " + connection.generatedpassword + System.Environment.NewLine;
                            String SRUWCLIPB6 = "==============================================" + System.Environment.NewLine;
                            Clipboard.SetText(SRUWCLIPB1 + SRUWCLIPB2 + SRUWCLIPB3 + SRUWCLIPB4 + SRUWCLIPB5 + SRUWCLIPB6);
                            MessageBox.Show("Pomyślnie skopiowano poświadczenia do schowka systemowego. Rejestracja Pomyślna.", "SRUW - Operacja pomyślna.", MessageBoxButton.OK, MessageBoxImage.Information);
                            Close();
                            var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("System Rekrutacji Uczelni Wyższych"));
                            existingWindow.Activate();
                        }
                        else if (Result2 == MessageBoxResult.No)
                        {
                            MessageBox.Show("Rejestracja Pomyślna. Powracanie do okna głównego.", "SRUW - Operacja pomyślna.", MessageBoxButton.OK, MessageBoxImage.Information);
                            Close();
                            var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("System Rekrutacji Uczelni Wyższych"));
                            existingWindow.Activate();
                        }
                        else
                        {
                            MessageBox.Show("Rejestracja Pomyślna. Powracanie do okna głównego.", "SRUW - Operacja pomyślna.", MessageBoxButton.OK, MessageBoxImage.Information);
                            Close();
                            var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("System Rekrutacji Uczelni Wyższych"));
                            existingWindow.Activate();
                        }
                    }
                    else if (Result == MessageBoxResult.No)
                    {
                        var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Rejestracja"));
                        existingWindow.Activate();
                    }
                }
                else
                {
                    MessageBox.Show("Błąd połączenia z bazą danych systemu. Napewno posiadasz połączenie z internetem?", "SRUW - Błąd Połączenia", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                var existingWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.Title.Equals("SRUW - Rejestracja"));
                existingWindow.Activate();
                MessageBox.Show("Nie wszystkie pola są zapełnione lub poprawnie wypełnione.", "SRUW - Błąd Rejestracji", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }