Exemplo n.º 1
0
        private void CalculateAgeDiff()
        {
            DateTime Now          = DateTime.Now;
            var      splittedDate = DOB.Split('/');
            DateTime itemdateTime = new DateTime(Convert.ToInt32(splittedDate[2]), Convert.ToInt32(splittedDate[0]), Convert.ToInt32(splittedDate[1]));
            int      Years        = new DateTime(DateTime.Now.Subtract(itemdateTime).Ticks).Year - 1;
            DateTime PastYearDate = itemdateTime.AddYears(Years);
            int      Months       = 0;

            for (int i = 1; i <= 12; i++)
            {
                if (PastYearDate.AddMonths(i) == Now)
                {
                    Months = i;
                    break;
                }
                else if (PastYearDate.AddMonths(i) >= Now)
                {
                    Months = i - 1;
                    break;
                }
            }
            TotalAgeinMonths = Months + (Years * 12);
            _commonDataService.TotalAgeinMonths = TotalAgeinMonths;
            if (Years > 0)
            {
                Age = Years + " years, " + Months + " months";
            }
            else
            {
                Age = Months + " months";
            }
        }
Exemplo n.º 2
0
 public override string ToString()
 {
     return(Name + "\n"
            + Gender.ToString() + ", " + GetCurrentAge().ToString() + "\n"
            + DOB.ToShortDateString() + "\n"
            + Education.ToString());
 }
Exemplo n.º 3
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (DOB.GetValueOrDefault() > DateTime.Today)
     {
         yield return(new ValidationResult("Date of Birth cannot be in the future.", new[] { "DOB" }));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Load the selected friend into the form.
        /// </summary>
        private void LoadFriend(int index)
        {
            //make sure the friend isnt the current friend.
            if (index != currentFriend)
            {
                //Set the current friend.
                currentFriend = index;

                //Set the row to selected.
                data.Rows[index].Selected = true;

                //Set the scroll index.
                data.FirstDisplayedScrollingRowIndex = data.SelectedRows[0].Index;

                //Get the selected friend.
                Friend friend = friends[index];

                //Set the name text.
                Name_Text.Text = friend.name;

                //Set the likes text.
                Likes_Text.Text = friend.likes;

                //Set the dislikes text.
                Dislikes_Text.Text = friend.dislikes;

                //Set the D.O.B text.
                DateTime dob = DateTime.Parse(friend.dob);
                DOB.SetDate(dob);

                //Set button to false.
                button = false;
            }
        }
Exemplo n.º 5
0
 //method -- override toString to show info of object
 public override string ToString()
 {
     return("EMP" + EmpID.ToString().PadLeft(3, '0').PadRight(7, ' ') +
            FirstName.PadRight(10, ' ') +
            LastName.PadRight(10, ' ') +
            Email.PadRight(25, ' ') +
            DOB.ToShortDateString().PadRight(15, ' ') +
            Phone);
 }
Exemplo n.º 6
0
 public string[] ToListViewItem()
 {
     return new string[] {
         ID.ToString("000000"),
         Name,
         Address,
         DOB.ToShortDateString()
     };
 }
Exemplo n.º 7
0
 public void FillIn(string FName, string LName, string Em, string Gen, string Mob, string Birth, string Subjects, string Hobbies, string CAddress, string State, string City)
 {
     FirstName.SendKeys(FName);
     LastName.SendKeys(LName);
     Email.SendKeys(Em);
     Gender.SendKeys(Gen);
     Mobile.SendKeys(Mob);
     DOB.SendKeys(Birth);
     CurrentAddress.SendKeys(CAddress);
 }
Exemplo n.º 8
0
        public override string ToString()
        {
            var rv = Name + ", dob-" + DOB.ToShortDateString() + "(" + Age + "yo), " + FormatGradeLevel(GradeLevel) + ", since:" + DateEnrolled.ToShortDateString();

            if (DateWithdrawn != null)
            {
                rv += ", withdrawn:" + DateWithdrawn.Value.ToShortDateString();
            }
            return(rv);
        }
Exemplo n.º 9
0
 private void cmbBoxMStatus_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         DOB.Focus();
         e.Handled = true;
     }
     else
     {
         e.Handled = false;
     }
 }
Exemplo n.º 10
0
        // return student data
        public override string ToString()
        {
            string        studentStatus = String.Format("{0}", Status == true ? "Undergraduate" : "Postgraduate");
            StringBuilder buffer        = new StringBuilder();

            buffer.AppendLine($"Student ID: {ID}");
            buffer.AppendLine($"Status: {studentStatus}");
            buffer.AppendLine($"Name: {Name}");
            buffer.AppendLine($"Date of birth: {DOB.ToShortDateString()}");
            buffer.AppendLine($"PPSN: {PPSN}");
            buffer.AppendLine($"Email: {Email}");
            buffer.AppendLine($"Address: {PostalAddress}");
            buffer.AppendLine($"Fees: {CalculateCourseFee():C}");
            return(buffer.ToString());
        }
Exemplo n.º 11
0
        private int ValidatePersonalPage()
        {
            int flag = 0;

            if (surname.Trim() == "")
            {
                tbSurname.Focus();
                epUserAccount.SetError(tbSurname, "Fill in The surname");
                flag = 1;
            }
            if (firstname.Trim() == "")
            {
                tbFirstname.Focus();
                epUserAccount.SetError(tbFirstname, "Fill in The firstname");
                flag = 1;
            }
            if (othername.Trim() == "")
            {
                tbUsername.Focus();
                epUserAccount.SetError(tbUsername, "Fill in The username");
                flag = 1;
            }
            if (residence.Trim() == "")
            {
                tbRessidence.Focus();
                epUserAccount.SetError(tbRessidence, "Requires a Category");
                flag = 1;
            }
            if ((rbfemale.Checked == false) && (rbmale.Checked == false))
            {
                gbGender.Focus();
                epUserAccount.SetError(gbGender, "Select a Gender");
                flag = 1;
            }
            if (phonenumber.Trim() == "")
            {
                tbPhonenumber.Focus();
                epUserAccount.SetError(tbPhonenumber, "Requires Phonenumber");
                flag = 1;
            }
            if (DOB.Trim() == "")
            {
                dtpDOB.Focus();
                epUserAccount.SetError(dtpDOB, "Requires Date of Birth");
                flag = 1;
            }
            return(flag);
        }
Exemplo n.º 12
0
            public override string ToString()
            {
                string str = $"{Id}\t{FullName}\t\t\t" +
                             $"{Gender}\t\t" +
                             $"{DOB.ToString("dd MMM yyyy")}\t\t" +
                             $"{Age}";

                str = $"{str}\n\tName\n\tScore";

                foreach (var course in Courses)
                {
                    str = $"{str}\n\t{course.ToString()}";
                }
                str = $"{str}\n\t\t Arverage {Average}";
                return(str);
            }
Exemplo n.º 13
0
        public AboutViewModel(User user, UserProfile userProfile, Image profilePicture)
        {
            ProfilePictureName = profilePicture.FileName;
            ProfilePicturePath = (profilePicture.Path != "no-image.png") ? user.UserID + "/" + profilePicture.Path : profilePicture.Path;
            HomeTown           = (userProfile.HomeTown != null) ? PlaceViewModel.GetPlaceObjectt(userProfile.HomeTown) : new PlaceViewModel();
            if (userProfile.PastLocal != null)
            {
                string[] userProfilePastLocals = userProfile.PastLocal.Split(',');
                foreach (string pl in userProfilePastLocals)
                {
                    if (pl != "")
                    {
                        PastLocals.Add(PlaceViewModel.GetPlaceObjectt(pl));
                    }
                }
            }
            else
            {
                PastLocals.Add(new PlaceViewModel());
            }
            LastTraveled = (userProfile.LastTraveled != null) ? PlaceViewModel.GetPlaceObjectt(userProfile.LastTraveled) : new PlaceViewModel();
            if (userProfile.FavoritePlace != null)
            {
                string[] userProfileFavoritePlaces = userProfile.FavoritePlace.Split(',');
                foreach (string fp in userProfileFavoritePlaces)
                {
                    if (fp != "")
                    {
                        FavoritePlaces.Add(PlaceViewModel.GetPlaceObjectt(fp));
                    }
                }
            }
            FirstName = user.FirstName;
            LastName  = user.LastName;
            DOB       = userProfile.DOB;
            DateTime now = DateTime.Today;

            Age = (now.Year - DOB.Year);
            if (now < DOB.AddYears(Age))
            {
                Age--;
            }
            About       = userProfile.About;
            Birthday    = String.Format("{0:MMMM d}", DOB);
            MemberSince = String.Format("{0:M/d/yyyy}", user.DateJoined);
        }
Exemplo n.º 14
0
        public int CompareTo(object obj)
        {
            if (!(obj is Student st))
            {
                return(0);
            }

            var firstCompare = FirstName?.CompareTo(st.FirstName) ?? 0;

            if (firstCompare != 0)
            {
                return(firstCompare);
            }

            var secondCompare = NumberCard.CompareTo(st.NumberCard);

            return(secondCompare == 0 ? DOB.CompareTo(st.DOB) : secondCompare);
        }
Exemplo n.º 15
0
        public override string ToString()
        {
            var res = new StringBuilder();

            res.AppendLine(PERSON_DATA);
            res.AppendLine();
            res.AppendLine("Salary = " + GetSalary());
            res.AppendLine("Phone = " + GetPhone());
            res.AppendLine("Name = " + Name);
            res.AppendLine("DOB = " + DOB.ToShortDateString());
            res.AppendLine("Height = " + Height);
            res.AppendLine("Country = " + Country);
            res.AppendLine("Ages of children = " + bytesToString());
            res.AppendLine(@"// Instance of configuration node");
            res.AppendLine("Address[\"zipcode\"] = " + Address["zipcode"].Value);
            res.AppendLine("Address.AttrByName(\"city\") = " + Address.AttrByName("city").Value);
            return(res.ToString());
        }