Esempio n. 1
0
 private void button_Save_Click(object sender, EventArgs e)
 {
     if (textBox_Title_Playlist.Text != "")
     {
         if (dataGridView1.DataSource != null)
         {
             TimeSpan          full_duration = new TimeSpan(); //заглушка
             DatabaseFunctions functions     = new DatabaseFunctions();
             functions.PlaylistEdit(command, list_id, user_Tracks, author, surname, name, textBox_Title_Playlist.Text, full_duration);
         }
         else
         {
             MessageBox.Show("В данном плейлисте отсутствуют композиции");
         }
     }
     else
     {
         MessageBox.Show("Введите название плейлиста");
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox_Login.Text != "" && textBox_Pass.Text != "" && textBox_Surname.Text != "" && textBox_Name.Text != "" && textBox_Email.Text != "" && textBox_Phone.Text != "")
            {
                DatabaseFunctions functions = new DatabaseFunctions();
                string            role      = "Тренер";
                string            login     = textBox_Login.Text;
                string            pass      = textBox_Pass.Text;
                string            name      = textBox_Name.Text;
                string            surname   = textBox_Surname.Text;
                string            email     = textBox_Email.Text;
                int    phone = Convert.ToInt32(textBox_Phone.Text);
                string path  = "path"; // заглушка

                try
                {
                    functions.UserEdit("Добавить", -1, role, login, pass, name, surname, email, phone, path);
                }
                catch (DbEntityValidationException ex)
                {
                    foreach (var eve in ex.EntityValidationErrors)
                    {
                        MessageBox.Show(String.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                      eve.Entry.Entity.GetType().Name, eve.Entry.State));
                        foreach (var ve in eve.ValidationErrors)
                        {
                            MessageBox.Show(String.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                          ve.PropertyName, ve.ErrorMessage));
                        }
                    }
                    throw;
                }
            }
            else
            {
                MessageBox.Show("Заполните все поля");
            }
        }
Esempio n. 3
0
        //-----------------//-------------------//-------------------------//-----------------------------//-----------------------//---------


        /// <summary>
        /// Действия по нажатию на кнопку "Сохранить".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (muzoFon.ListTrackOptions.Count != 0)
            {
                //Кусок кода для проверки
                int downloader             = 1; //Крашилось на нуле
                DatabaseFunctions function = new DatabaseFunctions();
                foreach (TrackOptions element in muzoFon.ListSelectTrackOptions)
                {
                    try
                    {
                        function.TrackEdit("Добавить", 0, downloader, element.Artist, element.Track, "жанр", "настроение", 0, element.DownloadUrl, "path", TimeSpan.Parse("00:" + element.Duration));
                    }
                    catch (DbEntityValidationException ex)
                    {
                        foreach (var eve in ex.EntityValidationErrors)
                        {
                            MessageBox.Show(String.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                          eve.Entry.Entity.GetType().Name, eve.Entry.State));
                            foreach (var ve in eve.ValidationErrors)
                            {
                                MessageBox.Show(String.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                              ve.PropertyName, ve.ErrorMessage));
                            }
                        }
                        throw;
                    }
                }


                //form2 = new Form2(this);
                //form2.Show();
                //form2.PanelSelectedTracks.Controls.Clear();
                //ShowSelectToForm(listSelectTrackOptions, form2.PanelSelectedTracks);
                //form2.Activate();
            }
        }