예제 #1
0
파일: Historia.cs 프로젝트: Kenczapi/IO_P
        private void UpdateCzasZatrzymania()
        {
            if (this.Player.currentMedia != null && !czyYT)
            {
                DataClasses1DataContext Polaczenie = new DataClasses1DataContext();
                var query =
                    from Film in Polaczenie.ObejrzaneFilmies
                    where Film.Id == ID_Filmu - 1
                    select Film;     //znajduje ostatni dodany do historii film

                ObejrzaneFilmy nowy = new ObejrzaneFilmy();
                foreach (ObejrzaneFilmy FM in query)
                {
                    FM.MomentZatrzymania = this.Player.Ctlcontrols.currentPosition;
                    try
                    {
                        Polaczenie.SubmitChanges();
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(exc.ToString());
                    }
                }
            }
            else if (this.Player.currentMedia != null && czyYT == true)
            {
                DataClasses2DataContext Conn = new DataClasses2DataContext();
                var query =
                    from YT in Conn.YTs
                    where YT.Id == ID_YT - 1
                    select YT;

                YT nowy = new YT();
                foreach (YT x in query)
                {
                    x.MomentZatrzymania = this.Player.Ctlcontrols.currentPosition;
                    try
                    {
                        Conn.SubmitChanges();
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(exc.ToString());
                    }
                }
            }
        }
예제 #2
0
 partial void DeleteYT(YT instance);
예제 #3
0
 partial void UpdateYT(YT instance);
예제 #4
0
 partial void InsertYT(YT instance);
예제 #5
0
파일: Historia.cs 프로젝트: Kenczapi/IO_P
        private void DodajDoHistorii()
        {
            if (!czyYT)
            {
                if (this.Player.currentMedia != null)
                {
                    try
                    {
                        using (DataClasses1DataContext PolaczenieZBaza = new DataClasses1DataContext())
                        {
                            var Dane = new ObejrzaneFilmy
                            {
                                Id = ID_Filmu++,
                                MomentZatrzymania = this.Player.Ctlcontrols.currentPosition,
                                SciezkaDoPliku    = CurrentVideoPath
                            };
                            if (Title.Length < 50)
                            {
                                Dane.Tytul = Title;
                            }
                            else
                            {
                                Dane.Tytul = Title.Substring(0, 50);
                            }

                            PolaczenieZBaza.ObejrzaneFilmies.InsertOnSubmit(Dane);
                            PolaczenieZBaza.SubmitChanges();
                        }
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(exc.ToString());
                    }
                }
            }
            else
            {
                if (this.Player.currentMedia != null)
                {
                    using (DataClasses2DataContext PolaczenieZBazaYT = new DataClasses2DataContext())
                    {
                        var Dane = new YT
                        {
                            Id = ID_YT++,
                            MomentZatrzymania = this.Player.Ctlcontrols.currentPosition,
                            URL = szukanie1.Url,
                        };
                        if (szukanie1.TitleYT.Length < 50)
                        {
                            Dane.Title = szukanie1.TitleYT;
                        }
                        else
                        {
                            Dane.Title = szukanie1.TitleYT.Substring(0, 50);
                        }

                        try
                        {
                            PolaczenieZBazaYT.YTs.InsertOnSubmit(Dane);
                            PolaczenieZBazaYT.SubmitChanges();
                        }
                        catch (Exception exc)
                        {
                            MessageBox.Show(exc.ToString());
                        }
                    }
                }
            }
        }