Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MD5 md = new MD5CryptoServiceProvider();

            using (AchievmentsEntities ach = new AchievmentsEntities())
            {
                Password p = ach.Passwords.Where(x => x.Name == TextBoxName.Text).FirstOrDefault();
                byte[]b= Encoding.UTF8.GetBytes(PassBoxP.Password);
                if (p != null)
                    if (b.SequenceEqual(p.Password1))
                    {
                        App.curPnID = p.ID;
                        MainWindow mw = new MainWindow();
                        mw.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Неверный пароль");
                    }
                else
                    MessageBox.Show("Такой пользователь не зарегистрирован");
            }
        }
Example #2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (!detailedInfo)
     {
         MainWindow mw = new MainWindow();
         mw.Show();
     }
     
 }
 private void ButtonBack_Click(object sender, RoutedEventArgs e)
 {
     MainWindow mw=new MainWindow();
     mw.Show();
     this.Close();
 }
        /// <summary>
        /// Добавление нового достижения
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            using (AchievmentsEntities ach = new AchievmentsEntities())
            {
                Password p=ach.Passwords.Where(t=>t.ID==App.curPnID).FirstOrDefault();
                Theme th = ach.Themes.Where(t => t.Name == ComboBoxTheme.SelectedValue.ToString()).FirstOrDefault();
                Subtheme sth=new Subtheme();
                try 
                { 
                  sth= ach.Subthemes.Where(t => t.Name == ComboBoxSubtheme.SelectedValue.ToString()).FirstOrDefault();
                }
                catch { }
                AchieveInfo achI = new AchieveInfo()
                {
                    Date = TextBlockDate.SelectedDate.Value.Date,
                    Points = (int)PointsSlider.Value,
                    Name = TextBlockName.Text,
                    Subscribe = TextBoxSubscr.Text,
                    Password = p,
                    Theme=th
                };
                if (sth != null)
                    achI.Subtheme = sth;
                
                ach.AchieveInfoes.Add(achI);
                ach.SaveChanges();

                MainWindow mw = new MainWindow();
                mw.Show();
                this.Close();
            }
        }