public bool Synchronize_Sessions(hardcardserver.SyncService ss) { bool result = true; List<hardcardserver.Session> sessionsPushList = new List<hardcardserver.Session>(); DateTime lastSync; try { /*Get the last synchronized timestamp*/ lastSync = GetLastSynchronized(); /*Get customer records to be syncrhonized to the server*/ IEnumerable<Session> sfound = from s in _hardcardContext.Sessions select s; foreach (var slocal in sfound) { hardcardserver.Session newSession = new hardcardserver.Session(); /*TODO: is there a better way to manage this assigment, maybe an overloaded operator*/ newSession.SessionID = (int)slocal.Id; newSession.EventClassID = (int)slocal.EventClassId; newSession.StartTime = slocal.StartTime; sessionsPushList.Add(newSession); } result = ss.SynchronizeSessionsDataWithClient(lastSync, sessionsPushList.ToArray()); } catch (Exception ex) { StatusText = "Syncrhonization of Sessions failed with error: " + ex.Message; System.Console.WriteLine(ex.Message); return false; } return true; }
public bool Synchronize_RaceClasses(hardcardserver.SyncService ss) { bool result = true; List<hardcardserver.RaceClass> raceclassPushList = new List<hardcardserver.RaceClass>(); DateTime lastSync; try { /*Get the last synchronized timestamp*/ lastSync = GetLastSynchronized(); /*Get customer records to be syncrhonized to the server*/ IEnumerable<RaceClass> rcfound = from rc in _hardcardContext.RaceClasses select rc; foreach (var rclocal in rcfound) { hardcardserver.RaceClass newRaceClass = new hardcardserver.RaceClass(); /*TODO: is there a better way to manage this assigment, maybe an overloaded operator*/ newRaceClass.ClassID = (int)rclocal.Id; newRaceClass.ClassName = rclocal.ClassName; newRaceClass.VehicleCC = (int) rclocal.VehicleCC; newRaceClass.Deleted = rclocal.Deleted; newRaceClass.MaxAge = rclocal.MaxAge; newRaceClass.MinAge = rclocal.MinAge; newRaceClass.LastUpdated = rclocal.LastUpdated; raceclassPushList.Add(newRaceClass); } result = ss.SynchronizeRaceClassesDataWithClient(lastSync, raceclassPushList.ToArray()); } catch (Exception ex) { StatusText = "Syncrhonization of RaceClasses failed with error: " + ex.Message; System.Console.WriteLine(ex.Message); return false; } return true; }
public bool Synchronize_Events(hardcardserver.SyncService ss) { bool result = true; List<hardcardserver.Event> eventsPushList = new List<hardcardserver.Event>(); DateTime lastSync; try { /*Get the last synchronized timestamp*/ lastSync = GetLastSynchronized(); /*Get customer records to be syncrhonized to the server*/ IEnumerable<Event> evfound = from ev in _hardcardContext.Events select ev; foreach (var evlocal in evfound) { hardcardserver.Event newEvent = new hardcardserver.Event(); /*TODO: is there a better way to manage this assigment, maybe an overloaded operator*/ newEvent.EventID = (int)evlocal.Id; newEvent.EventName = evlocal.EventName; newEvent.EventLocation = evlocal.EventLocation; eventsPushList.Add(newEvent); } result = ss.SynchronizeEventsDataWithClient(lastSync, eventsPushList.ToArray()); } catch (Exception ex) { StatusText = "Syncrhonization of Events failed with error: " + ex.Message; System.Console.WriteLine(ex.Message); return false; } return true; }
public bool Synchronize_Passings(hardcardserver.SyncService ss) { bool result = true; List<hardcardserver.Passing> passingsPushList = new List<hardcardserver.Passing>(); DateTime lastSync; try { /*Get the last synchronized timestamp*/ lastSync = GetLastSynchronized(); /*Get customer records to be syncrhonized to the server*/ IEnumerable<Passing> pfound = from p in _hardcardContext.Passings where (DateTime.Compare(p.LastUpdated.Value, lastSync) > 0) select p; foreach (var plocal in pfound) { hardcardserver.Passing newPassing = new hardcardserver.Passing(); /*TODO: is there a better way to manage this assigment, maybe an overloaded operator*/ newPassing.PassingID = plocal.Id; newPassing.RFID = plocal.RFID; newPassing.PassngTime = plocal.PassingTime; newPassing.RaceTime = plocal.RaceTime; newPassing.SessionID = (long)plocal.SessionId; passingsPushList.Add(newPassing); } result = ss.SynchronizePassingsDataWithClient(lastSync, passingsPushList.ToArray()); LogSynchronization(); } catch (Exception ex) { StatusText = "Syncrhonization of Competitors failed with error: " + ex.Message; System.Console.WriteLine(ex.Message); return false; } return true; }
public bool Synchronize_Competitors(hardcardserver.SyncService ss) { bool result = true; List<hardcardserver.Competitor> crPushList = new List<hardcardserver.Competitor>(); hardcardserver.Competitor[] crPullArray = null; DateTime lastSync; try { /*Get the last synchronized timestamp*/ lastSync = GetLastSynchronized(); /*Get customer records to be syncrhonized to the server*/ IEnumerable<Competitor> cfound = from c in _hardcardContext.Competitors where (DateTime.Compare(c.LastUpdated.Value, lastSync) > 0) select c; foreach (var clocal in cfound) { hardcardserver.Competitor cnew = new hardcardserver.Competitor(); /*TODO: is there a better way to manage this assigment, maybe an overloaded operator*/ /*EU cnew.CompetitorID = clocal.CompetitorID; cnew.FirstName = clocal.FirstName; cnew.LastName = clocal.LastName; cnew.Gender = clocal.Gender; cnew.DOB = clocal.DOB; cnew.VehicleType = clocal.VehicleType; cnew.VehicleModel = clocal.VehicleModel; cnew.VehicleCC = (int) clocal.VehicleCC; cnew.ClassID = clocal.ClassID; cnew.AddressLine1 = clocal.AddressLine1; cnew.AddressLine2 = clocal.AddressLine2; cnew.AddressLine3 = clocal.AddressLine3; cnew.City = clocal.City; cnew.State = clocal.State; cnew.Country = clocal.Country; cnew.PostalCode = clocal.PostalCode; cnew.Phone = clocal.Phone; crPushList.Add(cnew); */ } result = ss.SynchronizeCompetitorDataWithClient(lastSync, crPushList.ToArray(), out crPullArray); } catch (Exception ex) { StatusText = "Syncrhonization of Competitors failed with error: " + ex.Message; System.Console.WriteLine(ex.Message); return false; } return true; }