Ejemplo n.º 1
0
        private void btn_Add_Performer_Click(object sender, EventArgs e)
        {
            string Dest_path = DestPath;

            if (NameAuthorTextBox_AddPerformer.Text == "" || Country_TextBox_AddPerformer.Text == "")
            {
                if (AuthorComboBox.Items.Contains(NameAuthorTextBox_AddPerformer.Text))
                {
                    MessageBox.Show("Такой автор уже есть!\nВведите другого автора или выйдите из этой формы", "Уже существует!");
                    return;
                }
                else
                {
                    MessageBox.Show("Проверьте вводимые данные!\nВозможно одно из полей осталось незаполненным", "Не все данные заполнены!");
                    return;
                }
            }
            MyQuery = $"EXEC [AddPerformer] '{NameAuthorTextBox_AddPerformer.Text}','{Country_TextBox_AddPerformer.Text}'";
            StoredProcedureEXEC.ExecuteProcedure(MyQuery, "Автор успешно добавлен!", null);

            System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Dest_path + @"\");
            if (!dirInfo.Exists)
            {
                dirInfo.Create();
            }

            dirInfo.CreateSubdirectory(NameAuthorTextBox_AddPerformer.Text);

            btn_Cancel_AddPerformer_Click(sender, e);
        }
Ejemplo n.º 2
0
 private void MusicListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         SongName    = MusicName[MusicListBox.SelectedIndex].Name;
         axMusic.URL = $"{MusicName[MusicListBox.SelectedIndex].Song_path}\\{MusicName[MusicListBox.SelectedIndex].Name}.mp3";
         answer      = StoredProcedureEXEC.ExecuteProcedureWithoutput("CheckStatusSong", login, MusicName[MusicListBox.SelectedIndex].Name);
     }
     catch (ArgumentOutOfRangeException)
     {
         return;
     }
     if (answer == "Err")
     {
         I_LikeIconPlayer.Visible   = false;
         I_NoLikeIconPlayer.Visible = false;
         return;
     }
     else if (answer == "Like")
     {
         I_LikeIconPlayer.Visible   = true;
         I_NoLikeIconPlayer.Visible = false;
     }
     else if (answer == "Not Like")
     {
         I_LikeIconPlayer.Visible   = false;
         I_NoLikeIconPlayer.Visible = true;
     }
 }
Ejemplo n.º 3
0
 private void I_LikeIconPlayer_Click(object sender, EventArgs e)
 {
     MyQuery = $"EXEC [MusicChooseNotLike] '{login}', '{SongName}'";
     StoredProcedureEXEC.ExecuteProcedure(MyQuery, "", null);
     I_LikeIconPlayer.Visible   = false;
     I_NoLikeIconPlayer.Visible = true;
 }
Ejemplo n.º 4
0
 /// Добавление новой песни в БД
 ///
 private void btnAddTrack_Click(object sender, EventArgs e)
 {
     if (TrackNameTextBox.TextLength < 1 || AuthorComboBox.SelectedItem == null || AlbomComboBox.SelectedItem == null || GenreComboBox.SelectedItem == null)
     {
         MessageBox.Show("Проверьте вводимые данные!\nВозможно какое-то поле осталось незаполненным", "Ошибка!!!");
         return;
     }
     MyQuery = $"EXEC [AddTrack] " +
               $"'{TrackNameTextBox.Text}'," +
               $"'{AuthorComboBox.SelectedItem}'," +
               $"'{AlbomComboBox.SelectedItem}'," +
               $"'{GenreComboBox.SelectedItem}'";
     StoredProcedureEXEC.ExecuteProcedure(MyQuery, "Трек успешно добавлен!", this);
 }
Ejemplo n.º 5
0
 private void I_NoLikeIconPlayer_Click(object sender, EventArgs e)
 {
     answer = StoredProcedureEXEC.ExecuteProcedureWithoutput("MusicChooseLike", login, SongName);
     if (answer == "Err" || answer == "NO")
     {
         MessageBox.Show("Произошла ошибка", "Ошибка!");
         return;
     }
     else if (answer == "YES")
     {
         I_LikeIconPlayer.Visible   = true;
         I_NoLikeIconPlayer.Visible = false;
     }
 }
Ejemplo n.º 6
0
        private void btnAddNewUser_Click(object sender, EventArgs e)
        {
            role = "Слушатель";
            if (NewAdmin_CheckBox.Checked && PasswordOtherAdminTextBox_Registration.TextLength < 5)
            {
                PasswordOtherAdminTextBox_Registration.Clear();
                MessageBox.Show("Для регистрации в качестве модератора\nНужен пароль другого модератора");
                return;
            }
            else if (NewAdmin_CheckBox.Checked && !PssMdr.Contains(PasswordOtherAdminTextBox_Registration.Text))
            {
                PasswordOtherAdminTextBox_Registration.Clear();
                MessageBox.Show("Пароль от старого модератора введен неверно!");
                return;
            }
            else if (NewAdmin_CheckBox.Checked && PssMdr.Contains(PasswordOtherAdminTextBox_Registration.Text))
            {
                role = "Модератор";
            }
            if (LoginTextBox_Registration.TextLength < 3 || PasswordTextBox_Registration.TextLength < 8)
            {
                MessageBox.Show("Проверьте данные\nВозможно какое то поле осталось незаполненным");
                return;
            }
            else
            {
                if (RepeatPassTextBox_Registration.TextLength < 8)
                {
                    MessageBox.Show("Заполните  форму - повторите пароль");
                    return;
                }
                else if (RepeatPassTextBox_Registration.Text != PasswordTextBox_Registration.Text)
                {
                    MessageBox.Show("Пароли не совпадают!\nПопробуйте еще раз");
                    return;
                }
            }
            string MyQuery = $"EXEC [CreateNewUser] '{LoginTextBox_Registration.Text}','{PasswordTextBox_Registration.Text}',{role}";

            StoredProcedureEXEC.ExecuteProcedure(MyQuery, "Новый пользователь успешно создан!", null);
            LoginText.Text = LoginTextBox_Registration.Text;
            PassText.Text  = PasswordTextBox_Registration.Text;
            btnCancelRegistration_Click(sender, e);
        }