Exemple #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);
        }
Exemple #2
0
 public Unit GetUnit()
 {
     if (SUnit == null)
     {
         SUnit = SaveAndLoad.GetUnit(sunit_id);
     }
     return(SUnit);
 }
Exemple #3
0
 public SportType GetSportType()
 {
     if (SType == null)
     {
         SType = SaveAndLoad.GetSport(stype_id);
     }
     return(SType);
 }
Exemple #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());
 }
Exemple #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));
        }
Exemple #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);
        }
Exemple #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);
            }
        }