Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public Unit GetUnit()
 {
     if (SUnit == null)
     {
         SUnit = SaveAndLoad.GetUnit(sunit_id);
     }
     return(SUnit);
 }
Exemplo n.º 3
0
 public SportType GetSportType()
 {
     if (SType == null)
     {
         SType = SaveAndLoad.GetSport(stype_id);
     }
     return(SType);
 }
Exemplo n.º 4
0
 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());
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
            }
        }