public SynchronizePresenter(SynchronizeView view, SynchronizeModel syncrhonize) { _synchronizeView = view; _synchronizeModel = syncrhonize; _hardcardContext = new HardcardEntities(); IQueryable<String> events = from p in _hardcardContext.Events orderby p.EventName select p.EventName; List<String> tmpEventsList = events.ToList(); tmpEventsList.Insert(0, "All"); EventsList = new ObservableCollection<String>(tmpEventsList); }
public EventRepository(HardcardEntities i_hardcardContext) { try { hardcardContext =i_hardcardContext; //hardcardContext = new HardcardEntities(); IQueryable<Event> events = from p in hardcardContext.Events where p.Deleted == false orderby p.EventLocation select p; _eventStore = events.ToList(); } catch (Exception ex) { /*Need better error logging or display*/ //System.Console.WriteLine(ex.Message); MessageBox.Show("Exception in EventRepository():" + ex.Message); } }
public CompetitorRepository(HardcardEntities i_hardcardContext) { try { //EU 02/19/2012 // connect to db // too many objects of HardcardEntities hardcardContext = i_hardcardContext; //hardcardContext = new HardcardEntities(); IQueryable<Competitor> competitors = from p in hardcardContext.Competitors where p.Deleted == false //orderby p.FirstName orderby p.Id select p; _competitorStore = competitors.ToList(); } catch (Exception ex) { /*Need better error logging or display*/ //System.Console.WriteLine(ex.Message); MessageBox.Show("Exception in CompetitorRepository():" + ex.Message); } }
//private List<ComboCompetitor> _comboCompetitors = new List<ComboCompetitor>(); //Reposotory's list should have property ICollection<>???!!! //private List<Widget> _widgets = new List<Widget>(); //public ICollection<Widget> Widgets{get{return _widgets;}} public ComboCompetitorRepository(HardcardEntities hardcardContext) { try { this._hardcardContext = hardcardContext; IQueryable<ComboCompetitor> competitors = from Competitor c in hardcardContext.Competitors from Athlete a in hardcardContext.Athletes from EventClass e in hardcardContext.EventClasses where c.AthleteId == a.Id && c.EventClassId == e.EventClassID && c.Deleted == false orderby a.FirstName select new ComboCompetitor() { AthleteId = (long)c.AthleteId, CompetitorId = (long)c.Id, EventClassId = (long)c.EventClassId, FirstName = a.FirstName, LastName = a.LastName, DOB = a.DOB, Gender = a.Gender, AddressLine1 = a.AddressLine1, AddressLine2 = a.AddressLine2, AddressLine3 = a.AddressLine3, City = a.City, State = a.State, PostalCode = a.PostalCode, Country = a.Country, Phone = a.Phone, VehicleType = c.VehicleType, VehicleModel = c.VehicleModel, VehicleCC = (int)c.VehicleCC, Competitor = c }; //foreach (string na=me in query) Console.WriteLine(name); //foreach (var p in competitors) // _comboCompetitorStore.Add(); _comboCompetitorStore = competitors.ToList(); } catch (Exception ex) { /*Need better error logging or display*/ //System.Console.WriteLine(ex.Message); MessageBox.Show("Exception in CompetitorRepository():" + ex.Message); }; }