Exemple #1
0
        private void SearchBtn_Click(object sender, EventArgs e)
        {
            ctx_club.Dispose();
            ctx_club = new FCDataEF.DBFClubsEntities();
            var query = (from c in ctx_club.Clubs select c);

            if (!String.IsNullOrWhiteSpace(ClubNameTB.Text))
            {
                query = query.Where(c => c.ClubName.Contains(ClubNameTB.Text));
            }
            if (!String.IsNullOrWhiteSpace(DescriptionTB.Text))
            {
                query = query.Where(c => c.Description.Contains(DescriptionTB.Text));
            }
            if (minTrackBar.Value < maxTrackBar.Value)
            {
                query = query.Where(c => c.YearOfFoundation > minTrackBar.Value && c.YearOfFoundation < maxTrackBar.Value);
            }
            query.Load();
            source.DataSource = ctx_club.Clubs.Local.ToBindingList();
        }
Exemple #2
0
 protected override void OnClosing(CancelEventArgs e)
 {
     base.OnClosing(e);
     ctx.Dispose();
 }