private void Calculate()
        {
            if (Birthdate.CalculateAge(BDate) > 135)
            {
                MessageBox.Show("Error! You are too old!");
            }
            else if (BDate.CompareTo(DateTime.Today) > 0)
            {
                MessageBox.Show("Error! You don't exist yet!");
            }

            else if (BDate.Month.CompareTo(DateTime.Today.Month) == 0 && BDate.Day.CompareTo(DateTime.Today.Day) == 0)
            {
                MessageBox.Show("Happy Birthday! Enjoy your special day!");
                _bDate.CalculateAge();
                _bDate.Westerngoroscope();
                _bDate.Chinesegoroscope();

                OnPropertyChanged("Age");
                OnPropertyChanged("WGoroscope");
                OnPropertyChanged("CGoroscope");
            }
            else
            {
                _bDate.CalculateAge();
                _bDate.Westerngoroscope();
                _bDate.Chinesegoroscope();

                OnPropertyChanged("Age");
                OnPropertyChanged("WGoroscope");
                OnPropertyChanged("CGoroscope");
            }
            Thread.Sleep(1000);
        }
Beispiel #2
0
 /// <summary>
 /// Returns the Female class values: FirstName, LastName, Title, Age, Birthdate
 /// </summary>
 /// <returns>Title, FirstName, LastName, Age, Birthdate</returns>
 public override string ToString()
 {
     return("\n  [ ====== Male Person ====== ]" + "\n First Name     : " + title + ". " + firstName + "\n Last Name      : "
            + maleLastName + "\n SSN            : " + SocialSecurityNumber.ToString() + "\n Email          : " + maleEmail + "\n Age Today      : "
            + GetAge() + "\n BirthDate      : " + Birthdate.ToShortDateString() + maleInternet.ToString()
            + maleFavoriteColor.ToString() + address.ToString() + company);
 }
        public void Edit()
        {
            var newCandidate = new DataLayer.EfClasses.Candidate
            {
                CandidateNumber        = CandidateToEdit.CandidateNumber,
                CandidateFirstName     = FirstName,
                CandidateMiddleName    = MiddleName,
                CandidateLastName      = LastName,
                CandidateGender        = Gender,
                CandidateAddress       = Address,
                CandidateBirthDate     = Birthdate,
                CandidateContactNumber = ContactNum,
                CandidateEmail         = Email
            };

            CandidateToEdit.FirstName     = FirstName;
            CandidateToEdit.MiddleName    = MiddleName;
            CandidateToEdit.LastName      = LastName;
            CandidateToEdit.Gender        = Gender;
            CandidateToEdit.Birthdate     = Birthdate.ToShortDateString();
            CandidateToEdit.Address       = Address;
            CandidateToEdit.Email         = Email;
            CandidateToEdit.ContactNumber = ContactNum;
            CandidateToEdit.Age           = newCandidate.CandidateAge;


            _candidateService.UpdateCandidate(newCandidate);
        }
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <param name="obj">The object to compare with the current object.</param>
        /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            var result = false;

            if (obj is IdentityDTO item)
            {
                result  = ID == item.ID;
                result &= GUID.Equals(item.GUID);
                result &= Name.Equals(item.Name);
                result &= Surname.Equals(item.Surname);
                result &= Midname.Equals(item.Midname);
                result &= Birthdate.Equals(item.Birthdate);
                result &= Gender.Equals(item.Gender);
                result &= Country.Equals(item.Country);
                result &= City.Equals(item.City);
                result &= Phone.Equals(item.Phone);
                result &= Email.Equals(item.Email);
                result &= Department.Equals(item.Department);
                result &= Group.Equals(item.Group);
                result &= Status.Equals(item.Status);
                result &= Role.Equals(item.Role);
                return(result);
            }
            return(false);
        }
 private void FormMyAccount_Load(object sender, EventArgs e)
 {
     if (UserInfo.instance.Type == UserType.Doctor)
     {
         RadioDoc_Click(this, new EventArgs());
         txtSpecialize.Text = UserInfo.instance.DocSpecialization;
         txthrs.Text        = UserInfo.instance.hrworks;
         txtClinic.Text     = UserInfo.instance.clinic_location;
     }
     else
     {
         RadioUser_Click(this, new EventArgs());
     }
     txtFullName.Text = UserInfo.instance.Name;
     txtPhoneNum.Text = UserInfo.instance.Phone;
     Birthdate.Value  = UserInfo.instance.Date;
     Birthdate.Refresh();
     if (UserInfo.instance.Gender == "ذكر")
     {
         radioMan.Checked   = true;
         radioWoman.Checked = false;
     }
     else
     {
         radioWoman.Checked = true;
         radioMan.Checked   = false;
     }
 }
Beispiel #6
0
        public void Given_value_object_should_instantiate()
        {
            var birthdate = new Birthdate(DateTime.UtcNow);

            birthdate.Should().NotBeNull();
            birthdate.Value.Should().Be(DateTime.UtcNow.Date);
        }
        public void GeneratePayslip(string root)
        {
            string path = root + " " + $"{Name}.txt";

            using StreamWriter sw = File.CreateText(path);
            {
                sw.WriteLine("------------------------------------------------------");
                sw.WriteLine($"PAYSLIP {DateTime.Now.ToString("MMMM yyyy")}");
                sw.WriteLine("------------------------------------------------------");
                sw.WriteLine($"Name                        :   {Name}");
                sw.WriteLine($"Social Securty              :   {SocialSecNr}");
                sw.WriteLine($"Bank account                :   {Bankaccount}");
                sw.WriteLine($"Sex                         :   {(Sex ? "Male" : "Female")}");
                sw.WriteLine($"Birthdate                   :   {Birthdate.ToShortDateString()}");
                sw.WriteLine($"Join date                   :   {JoinDate.ToShortDateString()}");
                sw.WriteLine($"Function                    :   {Title}");
                sw.WriteLine($"Fulltime                    :   {Hours}");
                sw.WriteLine($"Company car                 :   {(CompanyCar ? "Yes" : "No")}");
                sw.WriteLine("------------------------------------------------------");
                sw.WriteLine($"Starting salary             :   €{Print(StartingSalary)}");
                sw.WriteLine($"Seniority                   : + €{Print(AddSeniority())}");
                sw.WriteLine($"                            :   €{Print(Salary)}");
                sw.WriteLine($"Social security             : - €{Print(DeductSocialSecurity())}");
                sw.WriteLine($"                            :   €{Print(Salary)}");
                sw.WriteLine($"Withholding tax             : - €{Print(DeductWitholdingTax())}");
                sw.WriteLine($"                            :   €{Print(Salary)}");
                sw.WriteLine($"Net salary                  :   €{Print(Salary)}");
            }
        }
Beispiel #8
0
 public bool CheckBirth(string year)
 {
     if (Birthdate.EndsWith(year))
     {
         return(true);
     }
     return(false);
 }
Beispiel #9
0
 public void Print()
 {
     Console.WriteLine("ФИО:{0} {1} {2}", Surname, Name, Patronymic);
     Console.WriteLine("Дата рождения:{0}", Birthdate.ToShortDateString());
     Console.WriteLine("Возраст: {0}", Age);
     Console.WriteLine("Должность: {0}", Post);
     Console.WriteLine("Стаж работы: {0}", WorkExperience);
 }
Beispiel #10
0
 public override string ToString()
 {
     return($"~ Číslo účtu: {AccountNumber,2}; " +
            $"Jméno a příjmení: {Name,2} {Surname,0}; " +
            $"Datum narození: {Birthdate.ToShortDateString(),2}; " +
            $"Typ účtu: {AccountType,2}; " +
            $"Finance: {MoneyValue,2} Kč");
 }
Beispiel #11
0
        public void Given_value_object_when_set_primitive_value_and_valueof_is_null_should_throw()
        {
            Birthdate birthdate = null;

            Func <DateTime> action = () => birthdate;

            action.Should().Throw <ArgumentNullException>();
        }
        public async Task CreateNewUser(Name name, Birthdate birthdate)
        {
            var user = _userFactory.NewUser(name, birthdate);
            await _userRepository.AddAsync(user);

            await _unitOfWork.Save();

            _outputPort?.Ok(user);
        }
 public string Serialize()
 => string.Join(";",
                FirstName,
                LastName,
                Email,
                Birthdate.ToString("d.M.yyyy.", null),
                Enum.GetName(typeof(WorkStatuses), WorkStatus),
                IsAccreditationPrinted.ToString(),
                CreatedOn.ToString(Constants.DateTimeFormat, null));
Beispiel #14
0
        public void CheckBirthdate(string year)
        {
            string birthdateYear = Birthdate.Substring(Birthdate.Length - 4);

            if (birthdateYear == year)
            {
                Console.WriteLine(Birthdate);
            }
        }
Beispiel #15
0
        public void Given_value_objects_when_same_values_should_be_equal()
        {
            var birthdate1 = new Birthdate(DateTime.UtcNow);
            var birthdate2 = new Birthdate(DateTime.UtcNow);

            birthdate1.Should().Be(birthdate2);
            (birthdate1 == birthdate2).Should().BeTrue();
            (birthdate1 != birthdate2).Should().BeFalse();
        }
Beispiel #16
0
 public override string ToString()
 {
     return("Id: " + Id
            + "\r\nEmployeeName: " + EmployeeName
            + "\r\nBirthdate:  " + Birthdate.ToString("MM/dd/yyyy")
            + "\r\nSalary:  " + Salary
            + "\r\nDateHired: " + DateHired.ToString("MM/dd/yyyy")
            + "\r\nInvalid: " + (Invalid ? "invalid" : "valid")
            + "\r\n\r\n");
 }
Beispiel #17
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = FirstName.GetHashCode();
         hashCode = (hashCode * 397) ^ LastName.GetHashCode();
         hashCode = (hashCode * 397) ^ Birthdate.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #18
0
 public override object Clone()
 {
     return(new Manager(
                FirstName,
                LastName,
                Birthdate.ToString("d"),
                Pesel,
                gender,
                experience
                ));
 }
Beispiel #19
0
 public string ToString()
 {
     return($"STUDENT: {Environment.NewLine}" +
            $"Index: {Index.ToString()}, {Environment.NewLine}" +
            $"Imie:  { FirstName.ToString() }, Naziwsko: {LastName.ToString()},{Environment.NewLine}" +
            $"Data Urodzenia: {Birthdate.ToString()},{Environment.NewLine}" +
            $"Email: {Email.ToString()},{Environment.NewLine}" +
            $"Imie Matki: {MothersName.ToString()}, Imie Ojca: {FathersName.ToString()}, {Environment.NewLine}" +
            $"Kierunek Studiów: {StudiesName.ToString()}, Tryb: {StudiesType.ToString()}{Environment.NewLine}" +
            $"##########################################################################  {Environment.NewLine }  {Environment.NewLine }"
            );
 }
        // Generate new social security number based on birthdate.
        public void GenerateSocialSec()
        {
            Random rng = new Random();

            SocialSecNr = Birthdate.ToString("yyMMdd") + rng.Next(99).ToString().PadLeft(2, '0');

            for (int i = 1; i <= 2; i++)
            {
                int randomnr = rng.Next(9999);
                SocialSecNr += " " + randomnr.ToString().PadLeft(4, '0');
            }
        }
Beispiel #21
0
 public override object Clone()
 {
     return(new Member(
                FirstName,
                LastName,
                Birthdate.ToString("d"),
                Pesel,
                gender,
                position,
                registrationDate.ToString("d")
                ));
 }
Beispiel #22
0
 public override string ToString()
 {
     return($"1. Фамилия: {Lastname}\n" +
            $"2. Имя: {Firstname}\n" +
            $"3. Отчество: {(Midname != null && Midname.Length > 0 ? Midname : "не указано")}\n" +
            $"4. Номер телефона: {Phonenumber}\n" +
            $"5. Страна: {Country}\n" +
            $"6. Дата рождения: {(Birthdate.Ticks != 0 ? Birthdate.ToString("dd.MM.yyyy") : "не указано")}\n" +
            $"7. Организация: {(Organisation != null && Organisation.Length > 0 ? Organisation : "не указано")}\n" +
            $"8. Должность: {(Position != null && Position.Length > 0 ? Position : "не указано")}\n" +
            $"9. Заметки: {(Other != null && Other.Length > 0 ? Other : "не указано")}\n");
 }
Beispiel #23
0
 public override string ToString()
 {
     return
         ("---" + Environment.NewLine +
          "ID " + Id + Environment.NewLine +
          "   Name        : " + FirstName + " " + LastName + Environment.NewLine +
          "   Birthdate   : " + Birthdate.ToString() + " nullable " + (NullableBirthdate != null ? NullableBirthdate.ToString() : "(null)") + Environment.NewLine +
          "   Age         : " + Age + " nullable " + (NullableAge != null ? NullableAge.ToString() : "(null)") + Environment.NewLine +
          "   Type        : " + Type.ToString() + " nullable " + NullableType + Environment.NewLine +
          "   Notes       : " + Notes + Environment.NewLine +
          "   Handsome    : " + IsHandsome);
 }
Beispiel #24
0
        public string ToJson()
        {
            return($@"
{{
""Id"": ""{Id}"", ""Number"": {Number}, ""Address"": 
{{
""Street"": ""{Address.Street}"", ""HouseNumber"": ""{Address.HouseNumber}""
}}, 
""UserName"": ""{UserName}"", 
""Birthdate"": ""{Birthdate.ToString("s")}""
}}".Replace("\r\n", ""));
        }
Beispiel #25
0
        //internal void SetAge()
        //{
        //    var today = DateTime.Today;
        //    // Calculate the age.
        //    Age = today.Year - Birthdate.GetValueOrDefault().Year;
        //    // Go back to the year the person was born in case of a leap year
        //    if (Birthdate.GetValueOrDefault().Date > today.AddYears(-Age)) Age--;
        //}

        public int GetAge(DateTime asOfDate)
        {
            var age = asOfDate.Year - Birthdate.GetValueOrDefault().Year;

            // Go back to the year the person was born in case of a leap year
            if (Birthdate.GetValueOrDefault().Date > asOfDate.AddYears(-age))
            {
                age--;
            }

            return(age);
        }
Beispiel #26
0
        public void CalculateAge()
        {
            TimeSpan age   = DateTime.Now - Birthdate;
            int      years = DateTime.Now.Year - Birthdate.Year;

            if (Birthdate.AddYears(years) > DateTime.Now)
            {
                years--;
            }

            Age = years;
        }
Beispiel #27
0
    public void WriteString()
    {
        Clear();
        Write("Для вывода введите номер элемента\n 0 - выход\n 1 - имя\n 2 - фамилия\n 3 - возраст\n 4 - рост\n 5 - вес\n 6 - национальность\n" +
              " 7 - день рождения\n 8 - пол\n 9 - имя отца\n 10 - имя матери\n 11 - оклад\n 12 - трудовой стаж\n 13 - стаж в руководящей должности\n" +
              " 14 - множитель за другие заслуги\n 15 - кол-во дней больничного\n 16 - кол-во дней отпуска\n 17 - образование\n" +
              " 18 - специализация\n 19 - должность\n ");
        int choose = int.Parse(ReadLine());

        switch (choose)
        {
        case 0:  return;

        case 1:  WriteLine(_Name.Name); break;

        case 2:  WriteLine(_Name.Surname); break;

        case 3:  WriteLine(Age); break;

        case 4:  WriteLine(High); break;

        case 5:  WriteLine(Weight); break;

        case 6:  WriteLine(Nationality); break;

        case 7:  WriteLine(Birthdate.ToString("D")); break;

        case 8:  WriteLine(Sex); break;

        case 9:  WriteLine(_parent[0]); break;

        case 10: WriteLine(_parent[1]); break;

        case 11: WriteLine(Salary); break;

        case 12: WriteLine(EmploymentHistory); break;

        case 13: WriteLine(ManagerialExperience); break;

        case 14: WriteLine(OtherAllowances); break;

        case 15: WriteLine(DaysOfSick); break;

        case 16: WriteLine(DaysOfVacation); break;

        case 17: WriteLine(Education); break;

        case 18: WriteLine(Specialization); break;

        case 19: WriteLine(Job); break;
        }
    }
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();

            BlockerView.SetBounds(View.Bounds.ToRectF( ));
            ResultView.SetBounds(View.Bounds.ToRectF( ));

            HeaderView.Frame = new CGRect(View.Frame.Left, View.Frame.Top, View.Frame.Width, StyledTextField.StyledFieldHeight);
            ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height);
            NickName.SetFrame(new CGRect(-10, View.Frame.Height * .05f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            LastName.SetFrame(new CGRect(-10, NickName.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            Email.SetFrame(new CGRect(-10, LastName.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            CellPhone.SetFrame(new CGRect(-10, Email.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            Street.SetFrame(new CGRect(-10, CellPhone.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            City.SetFrame(new CGRect(-10, Street.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            State.SetFrame(new CGRect(-10, City.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            Zip.SetFrame(new CGRect(-10, State.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            Gender.SetFrame(new CGRect(-10, Zip.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            GenderButton.Frame = Gender.Background.Frame;
            Birthdate.SetFrame(new CGRect(-10, Gender.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            BirthdayButton.Frame = Birthdate.Background.Frame;
            HomeCampus.SetFrame(new CGRect(-10, Birthdate.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            HomeCampusButton.Frame = HomeCampus.Background.Frame;

            DoneButton.Frame   = new CGRect(View.Frame.Left + 10, HomeCampus.Background.Frame.Bottom + 20, View.Bounds.Width - 20, ControlStyling.ButtonHeight);
            LogoutButton.Frame = new CGRect((View.Frame.Width - ControlStyling.ButtonWidth) / 2, DoneButton.Frame.Bottom + 20, ControlStyling.ButtonWidth, ControlStyling.ButtonHeight);

            nfloat controlBottom = LogoutButton.Frame.Bottom + (View.Bounds.Height * .25f);

            ScrollView.ContentSize = new CGSize(0, (nfloat)Math.Max(controlBottom, View.Bounds.Height * 1.05f));

            // setup the header shadow
            UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds);

            HeaderView.Layer.MasksToBounds = false;
            HeaderView.Layer.ShadowColor   = UIColor.Black.CGColor;
            HeaderView.Layer.ShadowOffset  = new CGSize(0.0f, .0f);
            HeaderView.Layer.ShadowOpacity = .23f;
            HeaderView.Layer.ShadowPath    = shadowPath.CGPath;

            if (LogoView != null)
            {
                LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0);
            }

            BirthdatePicker.LayoutChanged( );
            GenderPicker.LayoutChanged( );

            GenderPicker.TogglePicker(false, false);
            BirthdatePicker.TogglePicker(false, false);
        }
Beispiel #29
0
 public RegisterCustomerCommand(
     int?gender,
     string firstname,
     string lastname,
     DateTime?birthdate,
     string comment
     )
 {
     Gender    = gender.HasValue ? (Gender)gender : Gender.Unset;
     Firstname = Name.From(firstname);
     Lastname  = Name.From(lastname);
     Birthdate = Birthdate.From(birthdate);
     Comment   = comment;
 }
Beispiel #30
0
        public virtual bool Equals(IBaseDto dto)
        {
            var result = false;

            if (dto.GetType() == typeof(BaseFilmPersonDto))
            {
                var that = (BaseFilmPersonDto)dto;
                result = Title.Equals(that.Title) &&
                         Year.Equals(that.Year) &&
                         LastName.Equals(that.LastName) &&
                         Birthdate.Equals(that.Birthdate) &&
                         Role.Equals(that.Role);
            }
            return(result);
        }
Beispiel #31
0
        private string CreateIsoDateJson()
        {
            var bd = new Birthdate();
            bd.Value = new DateTime(1910, 9, 25, 9, 30, 25, DateTimeKind.Utc);

            return JsonConvert.SerializeObject(bd, new IsoDateTimeConverter());
        }