Пример #1
0
        private void button_Delete_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                int CurrentRow = row.Index;
                //    //получить значение id выбранной строки
                int valueId = Convert.ToInt32(dataGridView1[0, CurrentRow].Value);

                Intensiv2018Entities       context = new Intensiv2018Entities();
                List <User_Track_Playlist> user_Track_Playlists = context.User_Track_Playlist.Where(a => a.playlist_id == valueId).ToList();

                List <Track> tracks = new List <Track>();
                foreach (User_Track_Playlist temp in user_Track_Playlists)
                {
                    tracks.Add(context.Tracks1.Where(a => a.id == temp.track_id).FirstOrDefault());
                }

                List <User_Track> list = new List <User_Track>();
                foreach (Track track in tracks)
                {
                    User_Track user = context.User_Track.Where(a => a.track_id == track.id).FirstOrDefault();
                    list.Add(context.User_Track.Where(a => a.track_id == track.id).FirstOrDefault());
                }

                functions.PlaylistEdit("Удалить", valueId, list);
            }
            RefreshDGV();
        }
Пример #2
0
        private void button_Edit_Click(object sender, EventArgs e)
        {
            int CurrentRow = dataGridView1.SelectedCells[0].RowIndex;
            //    //получить значение id выбранной строки
            int valueId = Convert.ToInt32(dataGridView1[0, CurrentRow].Value);
            Intensiv2018Entities       context = new Intensiv2018Entities();
            List <User_Track_Playlist> user_Track_Playlists = context.User_Track_Playlist.Where(a => a.playlist_id == valueId).ToList();

            List <Track> tracks = new List <Track>();

            foreach (User_Track_Playlist temp in user_Track_Playlists)
            {
                tracks.Add(context.Tracks1.Where(a => a.id == temp.track_id).FirstOrDefault());
            }

            List <User_Track> list = new List <User_Track>();

            //List<User_Track_for_Playlist> list = new List<User_Track_for_Playlist>();
            foreach (Track track in tracks)
            {
                User_Track user = context.User_Track.Where(a => a.track_id == track.id).FirstOrDefault();

                //User_Track_for_Playlist _For_Playlist = new User_Track_for_Playlist();
                //_For_Playlist.artist = user.artist;
                //_For_Playlist.author = user.author;
                //_For_Playlist.bitrate = user.bitrate;
                //_For_Playlist.date_add = user.date_add;
                //_For_Playlist.duration = user.duration;
                //_For_Playlist.genre = user.genre;
                //_For_Playlist.id = user.id;
                //_For_Playlist.mood = user.mood;
                //_For_Playlist.path = user.path;
                //_For_Playlist.source = user.source;
                //_For_Playlist.title = user.title;
                //_For_Playlist.track_id = user.track_id;
                //_For_Playlist.user_track_playlist_id = 0;
                //list.Add(_For_Playlist);

                list.Add(context.User_Track.Where(a => a.track_id == track.id).FirstOrDefault());
            }

            Edit_MyPlaylist f = new Edit_MyPlaylist("Редактировать", list, valueId, author_id, login, name, surname);

            f.ShowDialog();
        }
Пример #3
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            Intensiv2018Entities asd = new Intensiv2018Entities();

            SysUser user = new SysUser();

            user = asd.SysUsers.Where(a => a.login == textBox1.Text && a.pass == textBox2.Text).FirstOrDefault();
            if (user.role != "Тренер" && user.role != "Администратор")
            {
                MessageBox.Show("Такого пользователя в системе нет");
            }
            else
            {
                Form ifrm = new loadForm(user.id, user.login, user.name, user.surname);
                this.Hide();       // скрываем форму авторизации
                ifrm.ShowDialog(); // отображаем Главную форму
                this.Show();       //Снова открываем авторизацию
            }
        }