예제 #1
0
        public void CheckDate(DateTime date)
        {
            var           age    = DateTime.Today.Date.Year - date.Date.Year;
            OperateZodiac zodiac = new OperateZodiac();

            if (zodiac.isBirthday(date.Date))
            {
                MessageBox.Show("Вітаємо з днем народження!");
            }
            try
            {
                Person TestPerson = new Models.Person();
                TestPerson.IsCorrectDateOfBirth(date);
                if (TestPerson.IsEmailValid(_email))
                {
                    MessageBox.Show("Email правильний");
                }
                else
                {
                    throw new IllegalEmailException();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            Person _mainPerson = new Person(_email, _name, _surname, date);

            _loginModel._storage.ChangeInfo(_mainPerson);
        }
예제 #2
0
파일: Person.cs 프로젝트: Voytsik/Lab04
        public Person(string name, string surname, string email, DateTime dateOfBirth)
        {
            IsCorrectDateOfBirth(dateOfBirth);
            IsEmailValid(email);
            Name        = name;
            Surname     = surname;
            Email       = email;
            DateOfBirth = dateOfBirth;
            OperateZodiac zodiac = new OperateZodiac();

            _isAdult     = CalcAdult();
            _sunSign     = zodiac.FindWestZodiac(DateOfBirth);
            _chineseSign = zodiac.FindChineseZodiac(DateOfBirth.Year);
            _isBirthday  = zodiac.isBirthday(DateOfBirth);
        }
예제 #3
0
        public void CheckDate(DateTime date)
        {
            var           age    = DateTime.Today.Date.Year - date.Date.Year;
            OperateZodiac zodiac = new OperateZodiac();

            if (zodiac.isBirthday(date.Date))
            {
                MessageBox.Show("Вітаємо з днем народження!");
            }
            IsCorrectDateOfBirth(date);
            IsEmailValid(_surname);
            Person _mainPerson = new Person(_email, _name, _surname, date);

            LModel._storage.ChangeInfo(_mainPerson);
        }
예제 #4
0
        public Person(string email, string name, string surname, DateTime dateOfBirth)
        {
            Email       = email;
            Name        = name;
            Surname     = surname;
            DateOfBirth = dateOfBirth;
            OperateZodiac zodiac = new OperateZodiac();

            _westernZodiac = zodiac.FindWestZodiac(DateOfBirth);
            _chineseZodiac = zodiac.FindChineseZodiac(DateOfBirth.Year);
            _isBirthday    = zodiac.isBirthday(DateOfBirth);
            if (DateTime.Today > DateOfBirth)
            {
                if (DateTime.Today.Month > DateOfBirth.Month)
                {
                    Age = DateTime.Today.Year - DateOfBirth.Year;
                }
                else if (DateTime.Today.Month == DateOfBirth.Month && DateTime.Today.Day > DateOfBirth.Day)
                {
                    Age = DateTime.Today.Year - DateOfBirth.Year;
                }
                else if (DateTime.Today.Month == DateOfBirth.Month && DateTime.Today.Day == DateOfBirth.Day)
                {
                    Age = DateTime.Today.Year - DateOfBirth.Year;
                }
                else
                {
                    Age = DateTime.Today.Year - DateOfBirth.Year - 1;
                }
            }
            else
            {
                Age = 0;
            }
            _isAdult = CalcAdult();
        }