コード例 #1
0
ファイル: FavTMRep.cs プロジェクト: cassianosilva/AppLoterias
        public static void Inserir(FavTM pFavTM)
        {
            DataBase db = GetDataBase();

            db.FavoritosTimemania.InsertOnSubmit(pFavTM);
            db.SubmitChanges();
        }
コード例 #2
0
        private void appBarAddFav_Click(object sender, EventArgs e)
        {
            if (pvtSorteios.SelectedIndex == 0)
            {
                FavMS addFavMs = new FavMS();

                if (SorteioMSDoJson != null)
                {
                    if (MessageBox.Show("Deseja adicionar este sorteio aos favoritos?") == MessageBoxResult.OK)
                    {
                        addFavMs.lerDados(SorteioMSDoJson);
                        FavMSRep.Inserir(addFavMs);
                    }
                }
                else
                {
                    MessageBox.Show("Não foi possível adicionar.");
                }
            }
            else if (pvtSorteios.SelectedIndex == 1)
            {
                FavQU addFavQu = new FavQU();

                if (SorteioQUDoJson != null)
                {
                    if (MessageBox.Show("Deseja adicionar este sorteio aos favoritos?") == MessageBoxResult.OK)
                    {
                        addFavQu.lerDados(SorteioQUDoJson);
                        FavQURep.Inserir(addFavQu);
                    }
                }
                else
                {
                    MessageBox.Show("Não foi possível adicionar.");
                }
            }
            else
            {
                FavTM addFavTm = new FavTM();

                if (SorteioTMDoJson != null)
                {
                    if (MessageBox.Show("Deseja adicionar este sorteio aos favoritos?") == MessageBoxResult.OK)
                    {
                        addFavTm.lerDados(SorteioTMDoJson);
                        FavTMRep.Inserir(addFavTm);
                    }
                    else
                    {
                        MessageBox.Show("Não foi possível adicionar.");
                    }
                }
            }
        }
コード例 #3
0
ファイル: FavTMRep.cs プロジェクト: cassianosilva/AppLoterias
        public static void Delete(FavTM pFavTM)
        {
            DataBase db = GetDataBase();

            var query = from timemania in db.FavoritosTimemania 
                        where timemania.Id == pFavTM.Id 
                        select timemania;

            db.FavoritosTimemania.DeleteOnSubmit(query.ToList()[0]);
            db.SubmitChanges();
        }
コード例 #4
0
 private void Timemania_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Timemania = (sender as ListBox).SelectedItem as FavTM;
 }
コード例 #5
0
 private void Timemania_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Timemania = (sender as ListBox).SelectedItem as FavTM;
 }
コード例 #6
0
        private void appBarAddFav_Click(object sender, EventArgs e)
        {
            if (pvtSorteios.SelectedIndex == 0)
            {
                FavMS addFavMs = new FavMS();

                if (SorteioMSDoJson != null)
                {
                    if (MessageBox.Show("Deseja adicionar este sorteio aos favoritos?") == MessageBoxResult.OK)
                    {
                        addFavMs.lerDados(SorteioMSDoJson);
                        FavMSRep.Inserir(addFavMs);
                    }
                }
                else
                {
                    MessageBox.Show("Não foi possível adicionar.");
                }
            }
            else if (pvtSorteios.SelectedIndex == 1)
            {
                FavQU addFavQu = new FavQU();

                if (SorteioQUDoJson != null)
                {
                    if (MessageBox.Show("Deseja adicionar este sorteio aos favoritos?") == MessageBoxResult.OK)
                    {
                        addFavQu.lerDados(SorteioQUDoJson);
                        FavQURep.Inserir(addFavQu);
                    }
                }
                else
                {
                    MessageBox.Show("Não foi possível adicionar.");
                }
            }
            else
            {
                FavTM addFavTm = new FavTM();

                if (SorteioTMDoJson != null)
                {
                    if (MessageBox.Show("Deseja adicionar este sorteio aos favoritos?") == MessageBoxResult.OK)
                    {
                        addFavTm.lerDados(SorteioTMDoJson);
                        FavTMRep.Inserir(addFavTm);
                    }
                    else
                    {
                        MessageBox.Show("Não foi possível adicionar.");
                    }
                }
            }
        }