コード例 #1
0
        public UserModel(TblUser row)
        {
            Id        = row.Id;
            Name      = row.Name;
            LastName  = row.LastName;
            TelNumber = row.TelNumber;
            Email     = row.Email;
            Active    = row.Active;
            ClubId    = row.ClubId;
            TrainerId = row.TrainerId;
            BirthYear = row.BirthYear;
            Lytis     = row.Lytis;
            Name2     = Name + " " + LastName;

            if (BirthYear.ToString().Length == 22)
            {
                BirthYear2 = BirthYear.ToString().Substring(0, 10);
            }
            else if (BirthYear.ToString().Length == 20)
            {
                BirthYear2 = BirthYear.ToString().Substring(0, 8);
            }
            else
            {
                BirthYear2 = BirthYear.ToString().Substring(0, 9);
            }

            String[] datearray = BirthYear2.Split('/');
            BirthYear2 = datearray[2] + "-";
            if (datearray[0].Length == 1)
            {
                BirthYear2 += "0" + datearray[0] + "-";
            }
            else
            {
                BirthYear2 += datearray[0] + "-";
            }

            if (datearray[1].Length == 1)
            {
                BirthYear2 += "0" + datearray[1];
            }
            else
            {
                BirthYear2 += datearray[1];
            }
        }
コード例 #2
0
 public override string ToString()
 {
     return (FirstName.PadRight(20) + LastName.PadRight(20)
         + LicensedDriver.ToString().PadRight(20) + BirthYear.ToString().PadRight(20)
         + FavoriteColor.ToString().PadRight(20));
 }
コード例 #3
0
 public override string ToString()
 {
     return($"{Color} animal was born in {BirthYear.ToString("dd/MM/yyyy")}, his age is {GetAge(BirthYear)}, he say - " + Voice());
 }