void ILauncherData.UpdateServer(ServerInfo theServerInfo) { LauncherDataContext dc = new LauncherDataContext(); //find the server try { tServer theServer = (from ts in dc.tServers where ts.ServerId == theServerInfo.ServerId select ts).Single(); //update the details theServer.Address = theServerInfo.Address; theServer.CharsCreated = theServerInfo.CharsCreated; theServer.Description = theServerInfo.Description; theServer.LastUpdated = DateTime.Now; theServer.Name = theServerInfo.ServerName; theServer.NewsUrl = theServerInfo.RSSFeedUrl; theServer.Population = theServerInfo.Population; theServer.Port = theServerInfo.Port; theServer.LauncherPort = theServerInfo.LauncherPort; } catch { //make a new one then tServer theNewServer = new tServer(); theNewServer.Address = theServerInfo.Address; theNewServer.CharsCreated = theServerInfo.CharsCreated; theNewServer.Description = theServerInfo.Description; theNewServer.LastUpdated = DateTime.Now; theNewServer.Name = theServerInfo.ServerName; theNewServer.NewsUrl = theServerInfo.RSSFeedUrl; theNewServer.Population = theServerInfo.Population; theNewServer.Port = theServerInfo.Port; theNewServer.LauncherPort = theServerInfo.LauncherPort; dc.tServers.InsertOnSubmit(theNewServer); } dc.SubmitChanges(); }
partial void DeletetServer(tServer instance);
partial void UpdatetServer(tServer instance);
partial void InserttServer(tServer instance);