示例#1
0
 public void InfoForFilms()
 {
     using (course_work cw = new course_work())
     {
         var forBD = cw.Database.SqlQuery <Film>($"select * from film where Film.filmID = '{FilmID}'");
         foreach (var check in forBD)
         {
             NameF        = check.filmName;
             Year         = (int)check.year;
             Plot         = check.plotDescription;
             Genres       = check.genres;
             Rating       = (float)check.rating;
             Countries    = check.countries;
             Director     = check.director;
             Actors       = check.actors;
             Duration     = (int)check.duration;
             PremiereDate = check.premiereDate;
             Poster       = check.poster;
         }
     }
     FilmName.Text         = NameF;
     FilmYear.Text         = $"{Year}";
     FilmPlot.Text         = Plot;
     FilmGenres.Text       = Genres;
     FilmRating.Text       = $"{Rating}";
     FilmCountries.Text    = Countries;
     FilmDirector.Text     = Director;
     FilmActros.Text       = Actors;
     FilmDuration.Text     = $"{Duration} минут";
     FilmPremiereDate.Text = PremiereDate;
 }
 public void InfoForListBox()
 {
     using (course_work cw = new course_work())
     {
         var info = cw.Ticket.ToList();
         infoforTickets = new ObservableCollection <AppViewTickets>();
         var forBD = cw.Database.SqlQuery <UsersBD>($"select * from UsersBD where UsersBD.login = '******'");
         foreach (var check in forBD)
         {
             foreach (var i in info)
             {
                 if (check.userID == i.userID)
                 {
                     var forFilm = cw.Database.SqlQuery <Film>($"select * from Film where Film.filmName = '{i.filmName}'");
                     foreach (var n in forFilm)
                     {
                         if (n.filmName == i.filmName)
                         {
                             AppViewTickets allTicket = new AppViewTickets();
                             allTicket.InfoForTickets(i.ticketID, i.sessionID, i.userID, i.filmName, i.price, i.date, i.time, i.row, i.place, n.poster);
                             infoforTickets.Add(allTicket);
                         }
                     }
                 }
             }
         }
         ListBoxTicket.ItemsSource = infoforTickets;
     }
 }
        public void Info()
        {
            using (course_work cw = new course_work())
            {
                var forBD = cw.Database.SqlQuery <UsersBD>($"select * from UsersBD");
                foreach (var check in forBD)
                {
                    if (LOGIN.Trim() == check.login.Trim())
                    {
                        USERID = check.userID;
                    }
                }

                var forBDs = cw.Database.SqlQuery <Session>($"select * from Session where Session.sessionID = '{SESSID}'");
                foreach (var check in forBDs)
                {
                    if (SESSID == check.sessionID)
                    {
                        var forFilm = cw.Database.SqlQuery <Film>($"select * from Film where Film.filmID = '{check.filmID}'");
                        foreach (var i in forFilm)
                        {
                            FILMNAME          = i.filmName.Trim();
                            PRICE             = check.price_for_place;
                            DATE              = check.date;
                            TIME              = check.time;
                            NumberOfFreeSeats = check.number_of_free_seats;
                        }
                    }
                }
            }
        }
 private void Button_Click_Save(object sender, RoutedEventArgs e)
 {
     try
     {
         using (course_work cw = new course_work())
         {
             if (rev == true)
             {
                 Feedback feedback = new Feedback()
                 {
                     feedbackID   = FeedbackID.Trim(),
                     userID       = USERid.Trim(),
                     feedback1    = Feedback_TextBox.Text.Trim(),
                     login        = LOGIN.Trim(),
                     dateFeedback = GetNetworkDateTime(),
                 };
                 cw.Feedback.Add(feedback);
                 cw.SaveChanges();
             }
         }
         MessageBox.Show("Спасибо за отзыв.");
         InfoForFeedback();
     }
     catch (Exception)
     {
         MessageBox.Show("Нет подключения к интернету");
     }
 }
 private void Button_Buy_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (course_work cw = new course_work())
         {
             var forBD = cw.Database.SqlQuery <Ticket>($"select * from Ticket where Ticket.sessionID = '{SESSID}'");
             foreach (var check in forBD)
             {
                 if (check.row == Convert.ToInt32(ComboBoxRow.Text) && check.place == Convert.ToInt32(ComboBoxPlace.Text))
                 {
                     valid = false;
                 }
             }
             if (valid == true)
             {
                 NumberOfFreeSeats--;
                 Ticket ticket = new Ticket()
                 {
                     ticketID  = TICKETID.Trim(),
                     sessionID = SESSID.Trim(),
                     userID    = USERID.Trim(),
                     filmName  = FILMNAME.Trim(),
                     price     = PRICE,
                     date      = DATE,
                     time      = TIME,
                     row       = Convert.ToInt32(ComboBoxRow.Text),
                     place     = Convert.ToInt32(ComboBoxPlace.Text)
                 };
                 cw.Ticket.Add(ticket);
                 cw.SaveChanges();
                 TicketsSingleton();
                 MessageBox.Show("Запись прошла успешно.");
                 course_work context  = new course_work();
                 var         customer = context.Session
                                        .Where(c => c.sessionID == SESSID)
                                        .FirstOrDefault();
                 customer.number_of_free_seats = NumberOfFreeSeats;
                 context.SaveChanges();
             }
             else
             {
                 MessageBox.Show("Место занято.");
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Ошибка");
     }
 }
 public void     userid()
 {
     using (course_work cw = new course_work())
     {
         var forenter = cw.Database.SqlQuery <UsersBD>($"select * from UsersBD");
         foreach (var check in forenter)
         {
             if (check.login == LOGIN)
             {
                 USERid = check.userID;
             }
         }
     }
 }
        private void Button_Click_Sing_In(object sender, RoutedEventArgs e)
        {
            //Hide();

            if (loginbool == false)
            {
                LoginLabel.Content = "Неверный логин.";
            }
            if (passbool == false)
            {
                PassLabel.Content = "Неверный пароль.";
            }
            if (loginbool == true && passbool == true)
            {
                using (course_work cw = new course_work())
                {
                    var forBD = cw.Database.SqlQuery <UsersBD>($"select * from UsersBD where UsersBD.login = '******'");
                    foreach (var check in forBD)
                    {
                        if (check.login.Trim() == TextBoxLogin.Text.Trim())
                        {
                            if (check.password.Trim() == GetHashPassword(PasswordBox.Password.Trim()))
                            {
                                try
                                {
                                    loginbool_for_sing_In = true;
                                    MainWindow mainWindow = new MainWindow(check.admin, check.login);
                                    mainWindow.Show();
                                }
                                catch (Exception)
                                {
                                    MessageBox.Show("Нет подключения к интернету");
                                }
                            }
                            else
                            {
                                PassLabel.Content  = "Неверный логин или пароль.";
                                LoginLabel.Content = "Неверный логин или пароль.";
                            }
                        }
                    }
                    if (loginbool_for_sing_In == false)
                    {
                        LoginLabel.Content = "Неверный логин или пароль.";
                        PassLabel.Content  = "Неверный логин или пароль.";
                    }
                }
            }
        }
        public void InfoForFeedback()
        {
            using (course_work cw = new course_work())
            {
                var info = cw.Feedback.ToList();
                infoforfeedback = new ObservableCollection <AppViewFeedback>();
                foreach (var i in info)
                {
                    AppViewFeedback allFeedback = new AppViewFeedback();

                    allFeedback.AddFeedback(i.login, i.feedback1, i.dateFeedback, i.feedbackID);
                    infoforfeedback.Add(allFeedback);
                }
                ListBoxFeedbacks.ItemsSource = infoforfeedback;
            }
        }
示例#9
0
 public void InfoForListBox()
 {
     using (course_work cw = new course_work())
     {
         int[] idFilms     = new int[30];
         bool  coincidence = true;
         var   info        = cw.Film.ToList();
         infoforfilm = new ObservableCollection <AppView>();
         var forBD = cw.Database.SqlQuery <Session>($"select * from Session");
         foreach (var check in forBD)
         {
             if (check.date == Datepic.SelectedDate.Value)
             {
                 foreach (var i in info)
                 {
                     for (int f = 0; f < idFilms.Length; f++)
                     {
                         if (idFilms[f] == Convert.ToInt32(i.filmID))
                         {
                             coincidence = false;
                         }
                     }
                     if (i.filmID == check.filmID && coincidence == true)
                     {
                         AppView allFilms = new AppView();
                         allFilms.Add(i.filmName, (int)i.year, i.genres, (float)i.rating, i.countries, i.director, (int)i.duration, i.poster, i.filmID.Trim());
                         infoforfilm.Add(allFilms);
                         for (int n = 0; n < idFilms.Length; n++)
                         {
                             if (idFilms[n] != Convert.ToInt32(i.filmID))
                             {
                                 idFilms[n] = Convert.ToInt32(i.filmID);
                             }
                         }
                     }
                     coincidence = true;
                 }
             }
         }
         ListBoxFilms.ItemsSource = infoforfilm;
     }
 }
        private void Button_Del_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var contentListBox = ListBoxTicket.SelectedItem as AppViewTickets;
                if (contentListBox != null)
                {
                    course_work context  = new course_work();
                    Ticket      customer = context.Ticket
                                           .Where(c => c.ticketID == contentListBox.TicketID)
                                           .FirstOrDefault();

                    context.Ticket.Remove(customer);
                    context.SaveChanges();
                }
                InfoForListBox();
            }
            catch (Exception)
            {
            }
        }
示例#11
0
 public void InfoForListBox()
 {
     using (course_work cw = new course_work())
     {
         var info = cw.Session.ToList();
         infoforsession = new ObservableCollection <AppViewSession>();
         foreach (var i in info)
         {
             if (i.date == DateSession && i.filmID.Trim() == FilmID.Trim())
             {
                 AppViewSession allSession = new AppViewSession();
                 var            forBD      = cw.Database.SqlQuery <Film>($"select * from film where Film.filmID = '{i.filmID}'");
                 foreach (var check in forBD)
                 {
                     allSession.InfoForListBox(i.sessionID, i.filmID, i.date, i.time, i.hallID, i.number_of_free_seats, i.price_for_place, check.filmName);
                     infoforsession.Add(allSession);
                 }
             }
         }
         ListBoxSession.ItemsSource = infoforsession;
     }
 }
 public void TicketsSingleton()
 {
     using (course_work cw = new course_work())
     {
         var forBD = cw.Database.SqlQuery <Ticket>($"select * from Ticket where Ticket.sessionID = '{SESSID}'");
         foreach (var check in forBD)
         {
             if (check.row == 1)
             {
                 if (check.place == 1)
                 {
                     Singleton singleton = new Singleton();
                     r1p1.Background = singleton.bgColor;
                 }
                 if (check.place == 2)
                 {
                     Singleton singleton = new Singleton();
                     r1p2.Background = singleton.bgColor;
                 }
                 if (check.place == 3)
                 {
                     Singleton singleton = new Singleton();
                     r1p3.Background = singleton.bgColor;
                 }
                 if (check.place == 4)
                 {
                     Singleton singleton = new Singleton();
                     r1p4.Background = singleton.bgColor;
                 }
                 if (check.place == 5)
                 {
                     Singleton singleton = new Singleton();
                     r1p5.Background = singleton.bgColor;
                 }
                 if (check.place == 6)
                 {
                     Singleton singleton = new Singleton();
                     r1p6.Background = singleton.bgColor;
                 }
                 if (check.place == 7)
                 {
                     Singleton singleton = new Singleton();
                     r1p7.Background = singleton.bgColor;
                 }
                 if (check.place == 8)
                 {
                     Singleton singleton = new Singleton();
                     r1p8.Background = singleton.bgColor;
                 }
                 if (check.place == 9)
                 {
                     Singleton singleton = new Singleton();
                     r1p9.Background = singleton.bgColor;
                 }
                 if (check.place == 10)
                 {
                     Singleton singleton = new Singleton();
                     r1p10.Background = singleton.bgColor;
                 }
                 if (check.place == 11)
                 {
                     Singleton singleton = new Singleton();
                     r1p11.Background = singleton.bgColor;
                 }
                 if (check.place == 12)
                 {
                     Singleton singleton = new Singleton();
                     r1p12.Background = singleton.bgColor;
                 }
                 if (check.place == 13)
                 {
                     Singleton singleton = new Singleton();
                     r1p13.Background = singleton.bgColor;
                 }
                 if (check.place == 14)
                 {
                     Singleton singleton = new Singleton();
                     r1p14.Background = singleton.bgColor;
                 }
                 if (check.place == 15)
                 {
                     Singleton singleton = new Singleton();
                     r1p15.Background = singleton.bgColor;
                 }
                 if (check.place == 16)
                 {
                     Singleton singleton = new Singleton();
                     r1p16.Background = singleton.bgColor;
                 }
                 if (check.place == 17)
                 {
                     Singleton singleton = new Singleton();
                     r1p17.Background = singleton.bgColor;
                 }
                 if (check.place == 18)
                 {
                     Singleton singleton = new Singleton();
                     r1p18.Background = singleton.bgColor;
                 }
             }
             if (check.row == 2)
             {
                 if (check.place == 1)
                 {
                     Singleton singleton = new Singleton();
                     r2p1.Background = singleton.bgColor;
                 }
                 if (check.place == 2)
                 {
                     Singleton singleton = new Singleton();
                     r2p2.Background = singleton.bgColor;
                 }
                 if (check.place == 3)
                 {
                     Singleton singleton = new Singleton();
                     r2p3.Background = singleton.bgColor;
                 }
                 if (check.place == 4)
                 {
                     Singleton singleton = new Singleton();
                     r2p4.Background = singleton.bgColor;
                 }
                 if (check.place == 5)
                 {
                     Singleton singleton = new Singleton();
                     r2p5.Background = singleton.bgColor;
                 }
                 if (check.place == 6)
                 {
                     Singleton singleton = new Singleton();
                     r2p6.Background = singleton.bgColor;
                 }
                 if (check.place == 7)
                 {
                     Singleton singleton = new Singleton();
                     r2p7.Background = singleton.bgColor;
                 }
                 if (check.place == 8)
                 {
                     Singleton singleton = new Singleton();
                     r2p8.Background = singleton.bgColor;
                 }
                 if (check.place == 9)
                 {
                     Singleton singleton = new Singleton();
                     r2p9.Background = singleton.bgColor;
                 }
                 if (check.place == 10)
                 {
                     Singleton singleton = new Singleton();
                     r2p10.Background = singleton.bgColor;
                 }
                 if (check.place == 11)
                 {
                     Singleton singleton = new Singleton();
                     r2p11.Background = singleton.bgColor;
                 }
                 if (check.place == 12)
                 {
                     Singleton singleton = new Singleton();
                     r2p12.Background = singleton.bgColor;
                 }
                 if (check.place == 13)
                 {
                     Singleton singleton = new Singleton();
                     r2p13.Background = singleton.bgColor;
                 }
                 if (check.place == 14)
                 {
                     Singleton singleton = new Singleton();
                     r2p14.Background = singleton.bgColor;
                 }
                 if (check.place == 15)
                 {
                     Singleton singleton = new Singleton();
                     r2p15.Background = singleton.bgColor;
                 }
                 if (check.place == 16)
                 {
                     Singleton singleton = new Singleton();
                     r2p16.Background = singleton.bgColor;
                 }
                 if (check.place == 17)
                 {
                     Singleton singleton = new Singleton();
                     r2p17.Background = singleton.bgColor;
                 }
                 if (check.place == 18)
                 {
                     Singleton singleton = new Singleton();
                     r2p18.Background = singleton.bgColor;
                 }
             }
             if (check.row == 3)
             {
                 if (check.place == 1)
                 {
                     Singleton singleton = new Singleton();
                     r3p1.Background = singleton.bgColor;
                 }
                 if (check.place == 2)
                 {
                     Singleton singleton = new Singleton();
                     r3p2.Background = singleton.bgColor;
                 }
                 if (check.place == 3)
                 {
                     Singleton singleton = new Singleton();
                     r3p3.Background = singleton.bgColor;
                 }
                 if (check.place == 4)
                 {
                     Singleton singleton = new Singleton();
                     r3p4.Background = singleton.bgColor;
                 }
                 if (check.place == 5)
                 {
                     Singleton singleton = new Singleton();
                     r3p5.Background = singleton.bgColor;
                 }
                 if (check.place == 6)
                 {
                     Singleton singleton = new Singleton();
                     r3p6.Background = singleton.bgColor;
                 }
                 if (check.place == 7)
                 {
                     Singleton singleton = new Singleton();
                     r3p7.Background = singleton.bgColor;
                 }
                 if (check.place == 8)
                 {
                     Singleton singleton = new Singleton();
                     r3p8.Background = singleton.bgColor;
                 }
                 if (check.place == 9)
                 {
                     Singleton singleton = new Singleton();
                     r3p9.Background = singleton.bgColor;
                 }
                 if (check.place == 10)
                 {
                     Singleton singleton = new Singleton();
                     r3p10.Background = singleton.bgColor;
                 }
                 if (check.place == 11)
                 {
                     Singleton singleton = new Singleton();
                     r3p11.Background = singleton.bgColor;
                 }
                 if (check.place == 12)
                 {
                     Singleton singleton = new Singleton();
                     r3p12.Background = singleton.bgColor;
                 }
                 if (check.place == 13)
                 {
                     Singleton singleton = new Singleton();
                     r3p13.Background = singleton.bgColor;
                 }
                 if (check.place == 14)
                 {
                     Singleton singleton = new Singleton();
                     r3p14.Background = singleton.bgColor;
                 }
                 if (check.place == 15)
                 {
                     Singleton singleton = new Singleton();
                     r3p15.Background = singleton.bgColor;
                 }
                 if (check.place == 16)
                 {
                     Singleton singleton = new Singleton();
                     r3p16.Background = singleton.bgColor;
                 }
                 if (check.place == 17)
                 {
                     Singleton singleton = new Singleton();
                     r3p17.Background = singleton.bgColor;
                 }
                 if (check.place == 18)
                 {
                     Singleton singleton = new Singleton();
                     r3p18.Background = singleton.bgColor;
                 }
             }
             if (check.row == 4)
             {
                 if (check.place == 1)
                 {
                     Singleton singleton = new Singleton();
                     r4p1.Background = singleton.bgColor;
                 }
                 if (check.place == 2)
                 {
                     Singleton singleton = new Singleton();
                     r4p2.Background = singleton.bgColor;
                 }
                 if (check.place == 3)
                 {
                     Singleton singleton = new Singleton();
                     r4p3.Background = singleton.bgColor;
                 }
                 if (check.place == 4)
                 {
                     Singleton singleton = new Singleton();
                     r4p4.Background = singleton.bgColor;
                 }
                 if (check.place == 5)
                 {
                     Singleton singleton = new Singleton();
                     r4p5.Background = singleton.bgColor;
                 }
                 if (check.place == 6)
                 {
                     Singleton singleton = new Singleton();
                     r4p6.Background = singleton.bgColor;
                 }
                 if (check.place == 7)
                 {
                     Singleton singleton = new Singleton();
                     r4p7.Background = singleton.bgColor;
                 }
                 if (check.place == 8)
                 {
                     Singleton singleton = new Singleton();
                     r4p8.Background = singleton.bgColor;
                 }
                 if (check.place == 9)
                 {
                     Singleton singleton = new Singleton();
                     r4p9.Background = singleton.bgColor;
                 }
                 if (check.place == 10)
                 {
                     Singleton singleton = new Singleton();
                     r4p10.Background = singleton.bgColor;
                 }
                 if (check.place == 11)
                 {
                     Singleton singleton = new Singleton();
                     r4p11.Background = singleton.bgColor;
                 }
                 if (check.place == 12)
                 {
                     Singleton singleton = new Singleton();
                     r4p12.Background = singleton.bgColor;
                 }
                 if (check.place == 13)
                 {
                     Singleton singleton = new Singleton();
                     r4p13.Background = singleton.bgColor;
                 }
                 if (check.place == 14)
                 {
                     Singleton singleton = new Singleton();
                     r4p14.Background = singleton.bgColor;
                 }
                 if (check.place == 15)
                 {
                     Singleton singleton = new Singleton();
                     r4p15.Background = singleton.bgColor;
                 }
                 if (check.place == 16)
                 {
                     Singleton singleton = new Singleton();
                     r4p16.Background = singleton.bgColor;
                 }
                 if (check.place == 17)
                 {
                     Singleton singleton = new Singleton();
                     r4p17.Background = singleton.bgColor;
                 }
                 if (check.place == 18)
                 {
                     Singleton singleton = new Singleton();
                     r4p18.Background = singleton.bgColor;
                 }
             }
             if (check.row == 5)
             {
                 if (check.place == 1)
                 {
                     Singleton singleton = new Singleton();
                     r5p1.Background = singleton.bgColor;
                 }
                 if (check.place == 2)
                 {
                     Singleton singleton = new Singleton();
                     r5p2.Background = singleton.bgColor;
                 }
                 if (check.place == 3)
                 {
                     Singleton singleton = new Singleton();
                     r5p3.Background = singleton.bgColor;
                 }
                 if (check.place == 4)
                 {
                     Singleton singleton = new Singleton();
                     r5p4.Background = singleton.bgColor;
                 }
                 if (check.place == 5)
                 {
                     Singleton singleton = new Singleton();
                     r5p5.Background = singleton.bgColor;
                 }
                 if (check.place == 6)
                 {
                     Singleton singleton = new Singleton();
                     r5p6.Background = singleton.bgColor;
                 }
                 if (check.place == 7)
                 {
                     Singleton singleton = new Singleton();
                     r5p7.Background = singleton.bgColor;
                 }
                 if (check.place == 8)
                 {
                     Singleton singleton = new Singleton();
                     r5p8.Background = singleton.bgColor;
                 }
                 if (check.place == 9)
                 {
                     Singleton singleton = new Singleton();
                     r5p9.Background = singleton.bgColor;
                 }
                 if (check.place == 10)
                 {
                     Singleton singleton = new Singleton();
                     r5p10.Background = singleton.bgColor;
                 }
                 if (check.place == 11)
                 {
                     Singleton singleton = new Singleton();
                     r5p11.Background = singleton.bgColor;
                 }
                 if (check.place == 12)
                 {
                     Singleton singleton = new Singleton();
                     r5p12.Background = singleton.bgColor;
                 }
                 if (check.place == 13)
                 {
                     Singleton singleton = new Singleton();
                     r5p13.Background = singleton.bgColor;
                 }
                 if (check.place == 14)
                 {
                     Singleton singleton = new Singleton();
                     r5p14.Background = singleton.bgColor;
                 }
                 if (check.place == 15)
                 {
                     Singleton singleton = new Singleton();
                     r5p15.Background = singleton.bgColor;
                 }
                 if (check.place == 16)
                 {
                     Singleton singleton = new Singleton();
                     r5p16.Background = singleton.bgColor;
                 }
                 if (check.place == 17)
                 {
                     Singleton singleton = new Singleton();
                     r5p17.Background = singleton.bgColor;
                 }
                 if (check.place == 18)
                 {
                     Singleton singleton = new Singleton();
                     r5p18.Background = singleton.bgColor;
                 }
             }
         }
     }
 }
示例#13
0
        private void Button_Reg_Click(object sender, RoutedEventArgs e)
        {
            if (emailbool == false)
            {
                EmailLabel.Content = "Неверно введеён E-mail.";
            }
            if (loginbool == false)
            {
                LoginLabel.Content = "Логин должен содержать от 4 до 30 символов.";
            }
            if (pass1bool == false)
            {
                Pass1Label.Content = "Пароль должен содержать от 4 до 30 символов и совпадать с другим паролем.";
            }
            if (pass2bool == false)
            {
                Pass2Label.Content = "Пароль должен содержать от 4 до 30 символов и совпадать с другим паролем.";
            }
            using (course_work cw = new course_work())
            {
                var forBD = cw.Database.SqlQuery <UsersBD>($"select * from UsersBD where UsersBD.login = '******'");
                foreach (var check in forBD)
                {
                    if (check.login != null)
                    {
                        LoginLabel.Content = "Такой логин уже зарегестрирован";
                        loginbool          = false;
                    }
                }

                forBD = cw.Database.SqlQuery <UsersBD>($"select * from UsersBD where UsersBD.EmailBD = '{EmailTextBox.Text.Trim()}'");
                foreach (var usercheck in forBD)
                {
                    if (usercheck.EmailBD != null)
                    {
                        EmailLabel.Content = "Такая почта уже зарегестрирована";
                        emailbool          = false;
                    }
                }
            }

            if (emailbool == true && loginbool == true && pass1bool == true && pass2bool == true)
            {
                try
                {
                    using (course_work cw = new course_work())
                    {
                        UsersBD user = new UsersBD()
                        {
                            userID   = UserID.Trim(),
                            login    = LoginTextBox.Text.Trim(),
                            password = GetHashPassword(Pass1.Password.Trim()),
                            EmailBD  = EmailTextBox.Text.Trim(),
                            admin    = false,
                        };
                        cw.UsersBD.Add(user);
                        cw.SaveChanges();
                    }
                    MessageBox.Show("Регистрация прошла успешно.");

                    Close();
                    Sing_In sing_In = new Sing_In();
                    sing_In.Show();
                }
                catch (Exception)
                {
                    MessageBox.Show("Ошибка");
                }
            }
        }