Пример #1
0
        }         // GetHashCode

        public void Validate(List <string> result, string errorPrefix)
        {
            if (string.IsNullOrWhiteSpace(FirstName))
            {
                result.Add(string.Format("{0} and no director first name specified.", errorPrefix));
            }

            if (string.IsNullOrWhiteSpace(LastName))
            {
                result.Add(string.Format("{0} and no director last name specified.", errorPrefix));
            }

            if (DateOfBirth < longAgo)
            {
                result.Add(string.Format(
                               "{0} and director is too old (born on {1}).",
                               errorPrefix,
                               DateOfBirth.ToString("d/MMM/yyyy", CultureInfo.InvariantCulture)
                               ));
            }             // if

            if (string.IsNullOrWhiteSpace(Postcode))
            {
                result.Add(string.Format("{0} and no director postcode specified.", errorPrefix));
            }

            if (string.IsNullOrWhiteSpace(HouseNumber))
            {
                result.Add(string.Format("{0} and no director house name/number specified.", errorPrefix));
            }
        }         // Validate
 public void Display()
 {
     Console.WriteLine("Student : " + FirstName + " " + LastName);
     Console.WriteLine("CGPA : " + CGPA);
     Console.WriteLine("Date Of Birth : " + DateOfBirth.ToString());
     Console.WriteLine("Completed Courses : " + CompletedCourse.ToString());
 }
Пример #3
0
 public virtual void ShowInfo()
 {
     Console.WriteLine("Имя: " + Name);
     Console.WriteLine("Дата рождения: " + DateOfBirth.ToString("dd/MM/yyyy"));
     Console.WriteLine("Возраст: " + Age);
     Console.WriteLine("Факультет: " + Faculty);
 }
        public XDocument CreateFileDataXML()
        {
            XDocument xDoc = new XDocument(
                new XDeclaration("1.0", "utf-8", "yes"),
                new XElement("TTBNHT", new XAttribute("id", Patient_ID.ToString()), new XAttribute("code", Patient_Code),
                             new XElement("BasicInfor",
                                          new XElement("fullName", FullName),
                                          new XElement("dateOfBirth", DateOfBirth.ToString()),
                                          new XElement("phoneNumber", PhoneNo),
                                          new XElement("email", Email),
                                          new XElement("levelId", LevelID),
                                          new XElement("job", Job),
                                          new XElement("nationalInfor", new XAttribute("nationID", NationID), new XAttribute("classID", ClassID), new XAttribute("provinceCode", ProvinceCode), new XAttribute("districtCode", DistrictCode)),
                                          new XElement("CMNDInfor", new XAttribute("noCMND", CMND_No), new XAttribute("dateOfId", CMND_DateOfID.ToString()), new XAttribute("address", CMND_Address), new XAttribute("addressOfId", CMND_AddressOfID)),
                                          new XElement("marriageInformation", new XAttribute("isMarried", IsMarried), new XAttribute("hasChild", HasChild), new XAttribute("numberOfChild", NoOfChild), new XAttribute("yearOfChildLast", YearOfChildLast), new XAttribute("dayOfHaveBaby", DayOfHaveBaby)),
                                          new XElement("HeathStatus", new XAttribute("heathStatus", HeathStatus), new XAttribute("historyOfPatient", HistoryOfPatient), new XAttribute("historyOfFamily", HistoryOfFamily)),
                                          new XElement("FP",
                                                       new XElement("FPRightThumb", FPRightThumb),
                                                       new XElement("FPLeftThumb", FPLeftThumb),
                                                       new XElement("FPRightIndex", FPRightIndex),
                                                       new XElement("FPLeftIndex", FPLeftIndex)),
                                          new XElement("WifeInfors", new XAttribute("wifeName", WifeName), new XAttribute("wIdentify", WIdentify), new XAttribute("wDateOfId", WDateOfID), new XAttribute("wAddress", WAddress), new XAttribute("wPhone", WPhone), new XAttribute("wEmail", WEmail)),
                                          new XElement("createdDate", CreatedDate.ToString()))));

            return(xDoc);
        }
Пример #5
0
        public override string ToString()
        {
            StringBuilder userSB = new StringBuilder();

            userSB.Append($"ID: {Id}. Name: {Name}. Date of birth: {DateOfBirth.ToString("dd.MM.yyyy",new System.Globalization.CultureInfo("ru-RU"))}. ");
            userSB.Append($"Age: {Age}");
            return(userSB.ToString());
        }
Пример #6
0
 public override string ToString()
 {
     return(String.Format("Contact {0} {1}", FirstName, LastName) + Environment.NewLine +
            String.Format("\tEmail: {0}", Email) + Environment.NewLine +
            String.Format("\tPhone: {0}", Phone) + Environment.NewLine +
            String.Format("\tDateOfBirth: {0}", DateOfBirth.ToString("dd/MM/yyyy")) + Environment.NewLine +
            String.Format("\tState: {0}", State));
 }
Пример #7
0
        //public virtual int Age
        //{
        //    get { return DateTime.Now.Year - _dateOfBirth.Year; }
        //    protected set {} ;
        //}

        protected virtual void DisplayPersonInfo()
        {
            Console.WriteLine("Name: {0} {1}", FName, LName);
            Console.WriteLine("Birth Date: " + DateOfBirth.ToString("dd/MM/yyyy") + ".");
            //Console.WriteLine("Age: {0}", Age);
            //Console.WriteLine();
            //Console.WriteLine("Skills: ");
            //ShowSkills();
        }
Пример #8
0
        public override string ToString()
        {
            string info = string.Format("Работник {0} {1}, дата рождения: {2}, возраст: {3}," +
                                        " стаж работы: лет - {4}, месяцев - {5}, должность: {6}",
                                        Name, Surname, DateOfBirth.ToString("dd.MM.yyyy"), Age(),
                                        GetExperience()[0], GetExperience()[1], Position);

            return(info);
        }
Пример #9
0
        public override string ToString()
        {
            var str = new StringBuilder();

            str.Append(FirstName).Append(" " + LastName).Append(" " + DateOfBirth.ToString("dd/mm/yyyy"));
            return(DateOfDeath != null
                ? str.Append(" " + DateOfDeath).ToString()
                : str.ToString());
        }
Пример #10
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     ByteBufUtils.WriteUTF8(byteBuf, FirstName);
     ByteBufUtils.WriteUTF8(byteBuf, LastName);
     ByteBufUtils.WriteUTF8(byteBuf, Town);
     ByteBufUtils.WriteUTF8(byteBuf, DateOfBirth.ToString());
     byteBuf.WriteInt((int)Gender);
     return(byteBuf);
 }
Пример #11
0
 //String representation of the class
 public override string ToString()
 {
     return("Name:  " + FirstName +
            " " + LastName +
            "   Address:  " + Address +
            "   DOB:  " + DateOfBirth.ToString("dd/MM/yyyy") +
            "  Contact:  " + ContactNumber +
            "  Email:  " + Email +
            "   Total Balance:  " + SumBalance().ToString("0,0.0"));
 }
Пример #12
0
        public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager)
        {
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);

            userIdentity.AddClaim(new Claim("FirstName", FirstName));
            userIdentity.AddClaim(new Claim("Surname", SurName));
            userIdentity.AddClaim(new Claim(ClaimTypes.Gender, Gender));
            userIdentity.AddClaim(new Claim(ClaimTypes.DateOfBirth, DateOfBirth.ToString()));
            return(userIdentity);
        }
Пример #13
0
 /// <summary>
 ///     Retrieves information about this animal
 /// </summary>
 /// <returns>
 ///     A string containing the information of this animal.
 /// </returns>
 public override string ToString()
 {
     return(string.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                          ChipRegistrationNumber.ToString("D5"),
                          DateOfBirth == null ? "00-00-0000" : DateOfBirth.ToString(),
                          string.IsNullOrEmpty(Name) ? "noname" : Name,
                          Reserved ? "reserved" : "not reserved",
                          Price.ToString("C"),
                          Gender));
 }
Пример #14
0
        private void BackToMainImplementation()
        {
            //return (DateOfBirth != DateTime.MinValue) && !string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName) && !string.IsNullOrWhiteSpace(Email);
            MessageBox.Show(DateOfBirth.ToString());
            MessageBox.Show(FirstName);
            MessageBox.Show(LastName);
            MessageBox.Show(Email);

            NavigationManager.Instance.Navigate(ViewType.Main);
        }
Пример #15
0
        public override string ToString()
        {
            var interests = Interests == null || Interests.Length == 1
                ? "None"
                : string.Join(",", Interests);

            return($"Id: {Id}; Name: {FirstName} {LastName};" +
                   $" Dob: {DateOfBirth.ToString("d")};" +
                   $" Interests: {interests}");
        }
Пример #16
0
        }         // Validate

        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        public override string ToString()
        {
            return(string.Format(
                       "{0} {1} {2} at {3} ({4})",
                       FirstName,
                       LastName,
                       DateOfBirth.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
                       Postcode,
                       string.IsNullOrWhiteSpace(HouseNumber) ? "unnumbered" : HouseNumber
                       ));
        }         // ToString
Пример #17
0
 public void IdentifyDriverLicense()
 {
     Console.WriteLine("Full name: " + FullName);
     Console.WriteLine("Date of birth: " + DateOfBirth.ToString("d"));
     Console.WriteLine("Place of birth: " + PlaceOfBirth);
     Console.WriteLine("Date of issue: " + DateOfIssue.ToString("d"));
     Console.WriteLine("Date of expiration: " + DateOfExpiration.ToString("d"));
     Console.WriteLine("Issuing by: " + IssuingBy);
     Console.WriteLine("Serial number: " + SerialNumber);
     Console.WriteLine("Category: " + Category);
 }
 public string GetInfo()
 {
     return(string.Format(
                "The registrant name is {0} \n" +
                "The registration number is {1} \n" +
                "The registrant address is {2} {3} {4} {5} {6}\n" +
                "The registrant date of birth is {7} \n" +
                "The phone Number of the registrant is {8:(###) ###-####}\n"
                , Name, RegistrationNumber, Address.StreetNumber, Address.StreetName, Address.ZipCode,
                Address.State, Address.Country, DateOfBirth.ToString("MMMM dd, yyyy"), TelephoneNumber));
 }
Пример #19
0
        public void TestDateOfBirth()
        {
            var         id  = "9107220306085";
            DateOfBirth dob = new DateOfBirth(id);

            Assert.AreEqual("1991-07-22", dob.ToString());
            Assert.AreEqual("July", dob.Month);
            Assert.AreEqual(dob.MonthOfBirth, 7);
            Assert.AreEqual(dob.YearOfBirth, 1991);
            Assert.AreEqual(dob.DayOfBirth, 22);
        }
Пример #20
0
 public override string ToString()
 {
     return(string.Format(
                "FirstName='{0}' Surname='{1}' Gender='{2}' DateOfBirth='{3}' Time at address={4}",
                FirstName,
                Surname,
                Gender,
                DateOfBirth.ToString("d/MMM/yyyy", CultureInfo.InvariantCulture),
                TimeAtAddress
                ));
 } // ToString
Пример #21
0
        public string GetStudentInfo()
        {
            string info = $"{FirstName} {LastName} ({DateOfBirth.ToString("dd.MM.yyyy")})\nLista na predmeti:\n";

            for (int i = 0; i < NumberOfSubjects; i++)
            {
                info += $"{i + 1}. {Subjects[i].Name} ({Subjects[i].NumberOfClasses})\n";
            }

            return(info);
        }
Пример #22
0
 public override string ToString()
 {
     return(GetType().Name + ":\n" +
            "Id = " + Id + '\n' +
            "Name = " + Name + '\n' +
            "SecondName = " + SecondName + '\n' +
            "ThirdName = " + ThirdName + '\n' +
            "Gender = " + Gender + '\n' +
            "Adress = " + Address + '\n' +
            "DateOfBirth = " + DateOfBirth.ToString("yyyy-MM-dd") + '\n');
 }
Пример #23
0
        public override string ToString()
        {
            string result;

            result = $"Name: {Name}\n" +
                     $"Address:\n{Address}" +
                     $"Phone: {PhoneNumber}\n" +
                     $"DOB: {DateOfBirth.ToString()}\n" +
                     $"Reg number: {RegNumber}\n" +
                     $"Club: {Club?.Name ?? "not assigned"}\n";
            return(result);
        }
Пример #24
0
        public string DiplayPerson()
        {
            var typeOfDivision = GetType().Name == "Student" ? "CLASS" : "DEPARTMENT";

            return
                ("ID: " + ID +
                 " | NAME: " + Name +
                 " | DATE OF BIRTH: " + DateOfBirth.ToString("dd-MM-yyyy") +
                 " | EMAIL: " + Email +
                 " | ADDRESS: " + Address +
                 " | " + typeOfDivision + ": " + Division);
        }
Пример #25
0
        public string DiplayUsers()
        {
            var typeOfType = GetType().Name == "Student" ? "BATCH" : "DEPARTMENT";

            return
                ("ID: " + ID +
                 " || NAME: " + Name +
                 " || DATE OF BIRTH: " + DateOfBirth.ToString("dd-MM-yyyy") +
                 " || EMAIL: " + Email +
                 " || ADDRESS: " + Address +
                 " || " + typeOfType + ": " + Type);
        }
Пример #26
0
        public override string ToString()
        {
            int    claims = PreviousClaims?.Count() ?? 0;
            string result = $"{Name} ({Occupation}) {DateOfBirth.ToString("dd/MM/yyyy")}";

            if (claims > 0)
            {
                string plural = claims > 1 ? "s" : string.Empty;
                return($"{result} ({claims} previous claim{plural})");
            }

            return(result);
        }
Пример #27
0
        }                  // идентификатор пользователя в БД

        public bool Save() // метод сохранения объекта в БД
        {
            try
            {
                DBProvider _provider = new DBProvider(Program.DbPath);
                UserId = _provider.AddUser(FirstName, SecondName, Gender, DateOfBirth.ToString("yyyy-MM-dd"), MiddleName);
                return(true);
            }
            catch (Exception e)
            {
                Log.Error("Error in process saving user in DB: {0}", e.Message);
                return(false);
            }
        }
Пример #28
0
        public override string ToString()
        {
            var surname     = System.Web.HttpUtility.UrlEncode(Surname);
            var givenNames  = System.Web.HttpUtility.UrlEncode(GivenNames);
            var dateOfBirth = System.Web.HttpUtility.UrlEncode(DateOfBirth.ToString("dd/MM/yyyy"));
            var streetName  = System.Web.HttpUtility.UrlEncode(StreetName);

            var queryString = $"{nameof(Surname)}={surname}&" +
                              $"{nameof(GivenNames)}={givenNames}&" +
                              $"{nameof(DateOfBirth)}={dateOfBirth}&" +
                              $"{nameof(StreetName)}={streetName}";

            return(queryString);
        }
Пример #29
0
        public void Test_NullableDateTime_To_DateOfBirthCasting()
        {
            // Arrange
            DateTime?date = new DateTime(2019, 1, 1);

            // Act
            DateOfBirth dateOfBirth = date;

            // Assert
            Assert.Equal(dateOfBirth, date.Value, new TimeSpan(1, 0, 0, 0));
            Assert.Equal(date.GetHashCode(), date.GetHashCode());
            Assert.Equal(date.Value.ToString("yyyy-MM-dd"), dateOfBirth.ToString());
            Assert.True(dateOfBirth.Equals(date));
        }
Пример #30
0
        public void Test_DateOfBirth_To_DateTimeCasting()
        {
            // Arrange
            DateOfBirth dateOfBirth = new DateOfBirth(new DateTime(2019, 1, 1));

            // Act
            DateTime date = dateOfBirth;

            // Assert
            Assert.Equal(dateOfBirth, date, new TimeSpan(1, 0, 0, 0));
            Assert.Equal(dateOfBirth.GetHashCode(), date.GetHashCode());
            Assert.Equal(dateOfBirth.ToString(), date.ToString("yyyy-MM-dd"));
            Assert.True(dateOfBirth.Equals(date));
        }