Exemple #1
0
 public Contract(string BID, string ChID, bool FM, bool T, DateTime St, DateTime E)
 {
     if (!MyFunctions.CheckContract(E, St))
     {
         throw new Exception("Invalid hours");
     }
     if (!MyFunctions.CheckID(BID))
     {
         throw new Exception("Invalid ID");
     }
     if (!MyFunctions.CheckID(ChID))
     {
         throw new Exception("Invalid ID");
     }
     babySitterID = BID;
     childID      = ChID;
     firsMeating  = FM;
     start        = St;
     end          = E;
     salaryType   = T;
     payment      = 0;
     discount     = 0;
 }
 public Nanny(string ID, string LN, string FN, string PN, string addr, DateTime birth, bool elev, int FB, int EY, int MK,
              int MinA, int MaxA, bool HR, float HS, float MS, bool[] WD, TimeSpan[,] WH, bool VD, string recomm)
 {
     if (!MyFunctions.CheckID(ID))
     {
         throw new Exception("Invalid ID");
     }
     if (!MyFunctions.CheckName(LN))
     {
         throw new Exception("Invalid name");
     }
     if (!MyFunctions.CheckName(FN))
     {
         throw new Exception("Invalid name");
     }
     if (!MyFunctions.CheckPhoneNumber(PN))
     {
         throw new Exception("Invalid phone number");
     }
     if (!MyFunctions.CheckAddress(addr))
     {
         throw new Exception("Invalid address");
     }
     if (!MyFunctions.CheckDatePast(birth))
     {
         throw new Exception("Invalid date");
     }
     if (!MyFunctions.CheckArraySize1(WD))
     {
         throw new Exception("Invalid arrays sizes");
     }
     if (!MyFunctions.CheckArraySize2(WH))
     {
         throw new Exception("Invalid arrays sizes");
     }
     if (!MyFunctions.CheckMaxKids(MK))
     {
         throw new Exception("Invalid max kids");
     }
     if (!MyFunctions.CheckMinAge(MinA))
     {
         throw new Exception("Invalid min age");
     }
     if (!MyFunctions.CheckHourSalary(HS))
     {
         throw new Exception("Invalid hour salary");
     }
     if (!MyFunctions.CheckMonthSalary(MS))
     {
         throw new Exception("Invalid month salary");
     }
     id              = ID;
     lastName        = LN;
     firstName       = FN;
     phoneNumber     = PN;
     address         = addr;
     birthday        = birth;
     elevator        = elev;
     floorBuilding   = FB;
     experienceYears = EY;
     maxKids         = MK;
     minAge          = MinA;
     maxAge          = MaxA;
     hourlyRate      = HR;
     hourSalary      = HS;
     monthSalary     = MS;
     workDays        = new bool[6];
     workDays        = WD;
     workHours       = new TimeSpan[6, 2];
     workHours       = WH;
     vacationDaysITE = VD;
     recommendations = recomm;
     numOfKids       = 0;
 }