public ServerViewModel(DataRow dr, int serverID) { RestartTimeString = SqlUtility.ConvertTimeTicksToStringInt(ref dr, "RestartTime"); RestartTime = SqlUtility.GetValueOrDefault <int>(dr, "RestartTime", 0); Status = SqlUtility.GetValueOrDefault <string>(dr, "Status", "Offline"); ServerID = serverID; }
public void ConvertTimeTicksToString_NullData_Success() { DataTable table = new DataTable("FakeTable"); table.Columns.Add("Blah", typeof(int)); DataRow row = table.NewRow(); string timestring = SqlUtility.ConvertTimeTicksToStringInt(ref row, "Blah"); Assert.That(timestring == "00:00:00"); }
public void ConvertTimeTicksToString_WithData_Success() { DataTable table = new DataTable("FakeTable"); table.Columns.Add("Time", typeof(int)); DataRow row = table.NewRow(); row.ItemArray = new object[] { 90330 }; // 25 hours, 5 minutes, 30 seconds string timestring = SqlUtility.ConvertTimeTicksToStringInt(ref row, "Time"); Assert.That(timestring == "25:05:30"); }
public GameModel(int serverID, DataRow dr) { ServerID = serverID; ServerName = dr.Field <string>("ServerName"); ServerDescription = dr.Field <string>("ServerDescription"); IPAddress = dr.Field <string>("IPAddress"); SimpleRadioEnabled = dr.Field <ulong>("SimpleRadioEnabled") == 1; SimpleRadioIPAddress = dr.Field <string>("SimpleRadioIPAddress"); OnlinePlayersCount = Convert.ToInt32(dr.Field <long>("OnlinePlayerCount")); RestartTime = SqlUtility.GetValueOrDefault(dr, "RestartTime", 0); RestartTimeString = SqlUtility.ConvertTimeTicksToStringInt(ref dr, "RestartTime"); Status = SqlUtility.GetValueOrDefault(dr, "Status", "Offline"); Map = dr.Field <string>("Map"); }