public string ToString() { string str; if (SDate < DateTime.Now) { str = ToStringClassic(); } else { if (SUnit == null) { SUnit = SaveAndLoad.GetUnit(sunit_id); } if (SType == null) { SType = SaveAndLoad.GetSport(stype_id); } string format = @"dd\d\ hh\:mm\:ss"; string countdown = (SDate - DateTime.Now).ToString(format); str = ToStringClassic() + " : " + countdown; } return(str); }
public Unit GetUnit() { if (SUnit == null) { SUnit = SaveAndLoad.GetUnit(sunit_id); } return(SUnit); }
public SportType GetSportType() { if (SType == null) { SType = SaveAndLoad.GetSport(stype_id); } return(SType); }
public string ToStringClassic() { if (SUnit == null) { SUnit = SaveAndLoad.GetUnit(sunit_id); } if (SType == null) { SType = SaveAndLoad.GetSport(stype_id); } return(SType.Name + " : " + Quantity + " " + SUnit.Code + " " + SDate.ToShortDateString()); }
public float GetUnitCoef() { if (SUnit == null) { SUnit = SaveAndLoad.GetUnit(sunit_id); } if (SType == null) { SType = SaveAndLoad.GetSport(stype_id); } return(SUnit.GetCoef() * (1 + Weight / 10)); }
public string ToJson() { if (SUnit == null) { SUnit = SaveAndLoad.GetUnit(sunit_id); } if (SType == null) { SType = SaveAndLoad.GetSport(stype_id); } string json = JsonConvert.SerializeObject(new SimpleSession(this)); return(json); }
public Session() { // default Weight = 0; WUnit = "kg"; Saved = false; user_id = SaveAndLoad.GetUser().Id; if (SUnit == null) { SUnit = SaveAndLoad.GetUnit(sunit_id); } if (SType == null) { SType = SaveAndLoad.GetSport(stype_id); } }