예제 #1
0
 private void btn_set_Click(object sender, RoutedEventArgs e)
 {
     using (Vacancy_ModelContainer db = new Vacancy_ModelContainer())
     {
         Work_with_class.setVacancies(tbLink.Text, tbName.Text);
         lvSync.ItemsSource = db.CategorySet.ToList();
     }
 }
예제 #2
0
 public SetWindow()
 {
     InitializeComponent();
     using (Vacancy_ModelContainer db = new Vacancy_ModelContainer())
     {
         lvSync.ItemsSource = db.CategorySet.ToList();
     }
 }
        private void btn_search_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                using (Vacancy_ModelContainer db = new Vacancy_ModelContainer())
                {
                    if (tbtitle.Text != "")
                    {
                        lvSync.ItemsSource = from a in db.CategorySet.ToList() where a.Category_Name == tbtitle.Text select a.Id into id from v in db.VacancySet where v.CategoryId == id select v;  //db.CategorySet.ToList().Where(w => w.Category_Name == tbtitle.Text).Single().Vacancy;



                        if (tbdes.Text != "")
                        {
                            lvSync.ItemsSource = from a in db.CategorySet.ToList() where a.Category_Name == tbtitle.Text select a.Id into id from v in db.VacancySet where v.CategoryId == id && v.description == tbdes.Text select v;
                        }
                        else if (tbauthor.Text != "")
                        {
                            lvSync.ItemsSource = from a in db.CategorySet.ToList() where a.Category_Name == tbtitle.Text select a.Id into id from v in db.VacancySet where v.CategoryId == id && v.author == tbauthor.Text select v;
                        }
                        else if (tbpubDate.Text != "")
                        {
                            lvSync.ItemsSource = from a in db.CategorySet.ToList() where a.Category_Name == tbtitle.Text select a.Id into id from v in db.VacancySet where v.CategoryId == id && v.pubDate == tbpubDate.Text select v;
                        }
                    }


                    else
                    {
                        if (tbdes.Text != "")
                        {
                            lvSync.ItemsSource = from a in db.VacancySet.ToList() where a.description == tbdes.Text select a;
                        }
                        else if (tbauthor.Text != "")
                        {
                            lvSync.ItemsSource = from a in db.VacancySet.ToList() where a.author == tbauthor.Text select a;
                        }
                        else if (tbpubDate.Text != "")
                        {
                            lvSync.ItemsSource = from a in db.VacancySet.ToList() where a.pubDate == tbpubDate.Text select a;
                        }
                        else
                        {
                            lvSync.ItemsSource = from v in db.VacancySet.ToList() select v;
                        }
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }


            //where a.author == tbauthor.Text || a.description == tbdes.Text || a.pubDate == tbpubDate.Text
            //  select a;
        }