private void Change(object sender, RoutedEventArgs e)
 {
     if ((PR_SS.Text == "" && PR_VV.Text != "" && OldName.Text != "" && NewName.Text != "") || (PR_SS.Text != "" && PR_VV.Text == "" && OldName.Text != "" && NewName.Text != "") ||
         (PR_SS.Text != "" && PR_VV.Text != "" && OldName.Text == "" && NewName.Text != "") || (PR_SS.Text != "" && PR_VV.Text != "" && OldName.Text != "" && NewName.Text == ""))
     {
         MessageBox.Show("Все поля должны быть заполнены");
     }
     else if (Int32.Parse(PR_SS.Text) > Int32.Parse(PR_VV.Text))
     {
         MessageBox.Show("Ошибочные данные ");
     }
     else
     {
         ViewModel.Progress progress = new ViewModel.Progress();
         string             result   = progress.EditPr(UserID, Int32.Parse(PR_SS.Text) * 100 / Int32.Parse(PR_VV.Text), OldName.Text, NewName.Text);
         if (result == "NoSuch")
         {
             MessageBox.Show("Такое Имя не существует");
         }
         else if (result == "HaveSuch")
         {
             MessageBox.Show("Такое Имя уже существует");
         }
         else
         {
             this.Close();
         }
     }
 }
 public MainMenu(string _UserID)
 {
     InitializeComponent();
     UserID = _UserID;
     ViewModel.Progress progress = new ViewModel.Progress(UserID);
     DataContext = progress;
     MainStack.Children.Add(new Home(UserID));
 }
 private void Del(object sender, RoutedEventArgs e)
 {
     if (NameDel.Text == "")
     {
         MessageBox.Show("Введите имя дял удаления");
     }
     ViewModel.Progress progress = new ViewModel.Progress();
     if (progress.Del(UserID, NameDel.Text) == "HaveNo")
     {
         MessageBox.Show("Такая запись не существует");
     }
     this.Close();
 }
Example #4
0
 private void Add(object sender, RoutedEventArgs e)
 {
     if ((PR1_SS.Text.ToString() != "" && PR1_VV.Text.ToString() == "") || (PR1_SS.Text.ToString() == "" && PR1_VV.Text.ToString() != "") ||
         (PR2_SS.Text.ToString() != "" && PR2_VV.Text.ToString() == "") || (PR2_SS.Text.ToString() == "" && PR2_VV.Text.ToString() != "") ||
         (PR3_SS.Text.ToString() != "" && PR3_VV.Text.ToString() == "") || (PR3_SS.Text.ToString() == "" && PR3_VV.Text.ToString() != "") ||
         (PR4_SS.Text.ToString() != "" && PR4_VV.Text.ToString() == "") || (PR4_SS.Text.ToString() == "" && PR4_VV.Text.ToString() != "") ||
         (PR5_SS.Text.ToString() != "" && PR5_VV.Text.ToString() == "") || (PR5_SS.Text.ToString() == "" && PR5_VV.Text.ToString() != "") ||
         (PR6_SS.Text.ToString() != "" && PR6_VV.Text.ToString() == "") || (PR6_SS.Text.ToString() == "" && PR6_VV.Text.ToString() != "") ||
         (PR1_SS.Text != "" && PR1_VV.Text != "" && name1.Text == "") || (PR2_SS.Text != "" && PR2_VV.Text != "" && name2.Text == "") ||
         (PR3_SS.Text != "" && PR3_VV.Text != "" && name3.Text == "") || (PR4_SS.Text != "" && PR4_VV.Text != "" && name4.Text == "") ||
         (PR5_SS.Text != "" && PR5_VV.Text != "" && name5.Text == "") || (PR6_SS.Text != "" && PR6_VV.Text != "" && name6.Text == ""))
     {
         MessageBox.Show("Поля должны быть попарно заполнены!");
     }
     else
     {
         string             result;
         ViewModel.Progress progress = new ViewModel.Progress();
         if (PR1_SS.Text.ToString() != "")
         {
             if (Int32.Parse(PR1_SS.Text) > Int32.Parse(PR1_VV.Text))
             {
                 MessageBox.Show("Ошибочные данные в строке 1");
             }
             else
             {
                 result = progress.AddPr(UserID, (Int32.Parse(PR1_SS.Text) * 100) / Int32.Parse(PR1_VV.Text), name1.Text);
                 if (result == "Have")
                 {
                     MessageBox.Show("Такое поле есть!");
                 }
                 if (result == "Limit")
                 {
                     MessageBox.Show("Количество полей бльше 8!");
                 }
             }
         }
         if (PR2_SS.Text.ToString() != "")
         {
             if (Int32.Parse(PR2_SS.Text) > Int32.Parse(PR2_VV.Text))
             {
                 MessageBox.Show("Ошибочные данные в строке 1");
             }
             else
             {
                 result = progress.AddPr(UserID, (Int32.Parse(PR2_SS.Text) * 100) / Int32.Parse(PR2_VV.Text), name2.Text);
                 if (result == "Have")
                 {
                     MessageBox.Show("Такое поле есть!");
                 }
                 if (result == "Limit")
                 {
                     MessageBox.Show("Количество полей бльше 8!");
                 }
             }
         }
         if (PR3_SS.Text.ToString() != "")
         {
             if (Int32.Parse(PR3_SS.Text) > Int32.Parse(PR3_VV.Text))
             {
                 MessageBox.Show("Ошибочные данные в строке 1");
             }
             else
             {
                 result = progress.AddPr(UserID, (Int32.Parse(PR3_SS.Text) * 100) / Int32.Parse(PR3_VV.Text), name3.Text);
                 if (result == "Have")
                 {
                     MessageBox.Show("Такое поле есть!");
                 }
                 if (result == "Limit")
                 {
                     MessageBox.Show("Количество полей бльше 8!");
                 }
             }
         }
         if (PR4_SS.Text.ToString() != "")
         {
             if (Int32.Parse(PR4_SS.Text) > Int32.Parse(PR4_VV.Text))
             {
                 MessageBox.Show("Ошибочные данные в строке 1");
             }
             else
             {
                 result = progress.AddPr(UserID, (Int32.Parse(PR4_SS.Text) * 100) / Int32.Parse(PR4_VV.Text), name4.Text);
                 if (result == "Have")
                 {
                     MessageBox.Show("Такое поле есть!");
                 }
                 if (result == "Limit")
                 {
                     MessageBox.Show("Количество полей бльше 8!");
                 }
             }
         }
         if (PR5_SS.Text.ToString() != "")
         {
             if (Int32.Parse(PR5_SS.Text) > Int32.Parse(PR5_VV.Text))
             {
                 MessageBox.Show("Ошибочные данные в строке 1");
             }
             else
             {
                 result = progress.AddPr(UserID, (Int32.Parse(PR5_SS.Text) * 100) / Int32.Parse(PR5_VV.Text), name5.Text);
                 if (result == "Have")
                 {
                     MessageBox.Show("Такое поле есть!");
                 }
                 if (result == "Limit")
                 {
                     MessageBox.Show("Количество полей бльше 8!");
                 }
             }
         }
         if (PR6_SS.Text.ToString() != "")
         {
             if (Int32.Parse(PR6_SS.Text) > Int32.Parse(PR6_VV.Text))
             {
                 MessageBox.Show("Ошибочные данные в строке 1");
             }
             else
             {
                 result = progress.AddPr(UserID, (Int32.Parse(PR6_SS.Text) * 100) / Int32.Parse(PR6_VV.Text), name6.Text);
                 if (result == "Have")
                 {
                     MessageBox.Show("Такое поле есть!");
                 }
                 if (result == "Limit")
                 {
                     MessageBox.Show("Количество полей бльше 8!");
                 }
             }
         }
     }
     this.Close();
 }
 public void Prog_Loader(object sender, RoutedEventArgs e)
 {
     ViewModel.Progress progress = new ViewModel.Progress(UserID);
     DataContext = progress;
 }