public void updateDiary(MyDate first, MyDate last) { for (MyDate temp = Cloning.Clone(first); temp.CompareTo(last) != 0; temp.addDays(1)) { Diary[temp] = true; } }
public static MyDate Clone(this MyDate original) { MyDate target = new MyDate(); target.Day = original.Day; target.Month = original.Month; target.Year = original.Year; return(target); }
public bool checkEmpty(MyDate first, MyDate last) { for (MyDate temp = Cloning.Clone(first); temp.CompareTo(last) != 0; temp.addDays(1)) { if (Diary[temp] == true) { return(false); } } return(true); }
//indexer public bool this[MyDate date] { get { return(diary[date.Month - 1, date.Day - 1]); } set { diary[date.Month - 1, date.Day - 1] = value; } }
//Constructors public Person(string id, string lastName, string firstName, MyDate dateOfBirth, GenderEnum gender, string phoneNumber, AddressStruct address, string emailAddress) { Id = id; LastName = lastName; FirstName = firstName; DateOfBirth = dateOfBirth; Gender = gender; PhoneNumber = phoneNumber; Address = address; EmailAddress = emailAddress; }
//Constructors public Trainee(string id, string lastName, string firstName, MyDate dateOfBirth, GenderEnum gender, string phoneNumber, AddressStruct address, string emailAddress, CarTypeEnum carType, GearTypeEnum gearType, DrivingSchool drivingSchool, string drivingTeacher, int drivingLessonsCount) : base(id, lastName, firstName, dateOfBirth, gender, phoneNumber, address, emailAddress) { CarType = carType; GearType = gearType; FullDrivingSchoolDetails = drivingSchool; DrivingSchoolTeacher = drivingTeacher; DrivingLessonsCount = drivingLessonsCount; OwnedLisences = new List <Lisence>(); ScheduleList = new List <ScheduleStruct>(); }
//Constructors public Tester(string id, string lastName, string firstName, MyDate dateOfBirth, GenderEnum gender, string phoneNumber, AddressStruct address, string emailAddress, int yearsOfExperience, int maximalWeeklylTests, CarTypeEnum carType, bool[,] workTime, int maximalDistance, int weeklyTestsCount, List <ScheduleStruct> scheduleList) : base(id, lastName, firstName, dateOfBirth, gender, phoneNumber, address, emailAddress) { YearsOfExperience = yearsOfExperience; MaximalWeeklyTests = maximalWeeklylTests; CarType = carType; WorkTime = workTime; MaximalDistance = maximalDistance; WeeklyTestsCount = 0; foreach (ScheduleStruct schedule in scheduleList) { ScheduleList.Add(schedule); } }
/// <summary> /// compare to with icomparable interface /// </summary> /// <param name="obj"></param> /// <returns></returns> public int CompareTo(object obj) { if (obj == null) { return(1); } MyDate otherDate = obj as MyDate; if (this.Year > otherDate.Year) { return(1); } if (this.Year < otherDate.Year) { return(-1); } if (this.Month > otherDate.Month) { return(1); } if (this.Month < otherDate.Month) { return(-1); } if (this.Day > otherDate.Day) { return(1); } if (this.Day < otherDate.Day) { return(-1); } return(0); }
/// <summary> /// Convert MyDate type to DateTime type. /// </summary> /// <param name="dateTime">MyDaate to be converted to DateTime.</param> /// <returns></returns> public static DateTime ConvertToDateTime(MyDate myDate) { return(new DateTime(myDate.Year, myDate.Month, myDate.Day)); }
/// <summary> /// Convert MyDate type to DateTime type. /// </summary> /// <param name="dateTime">MyDaate to be converted to DateTime.</param> /// <returns></returns> private DateTime ConvertToDateTime(MyDate myDate) { return(new DateTime(myDate.Year, myDate.Month, myDate.Day)); }