コード例 #1
0
        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();
        }
コード例 #2
0
 partial void DeletetServer(tServer instance);
コード例 #3
0
 partial void UpdatetServer(tServer instance);
コード例 #4
0
 partial void InserttServer(tServer instance);