private void NewContract_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         DateTime tmp   = new DateTime(month: 1, day: 1, year: 2019);
         Nanny    nanny = (Nanny)nannyDataGrid.SelectedItem;
         GlobalContract = new Contract()
         {
             ChildId     = GlobalChild.ID,
             MotherId    = ContractMother.ID,
             NannyId     = nanny.ID,
             HourlyWage  = nanny.HourlyWage,
             MonthlyWage = nanny.MonthlyWage,
             Rate        = ContractMother.MonthlyOrHourly,
             Salary      = BL_Tool.CalculateSalary(nanny, ContractMother),
             StartDate   = DateTime.Now,
             EndDate     = tmp
         };
         var contractWindow = new newContractWindow(GlobalContract);
         contractWindow.Closed += ContractWindow_Closed;
         contractWindow.ShowDialog();
     }
     catch (Exception exception)
     {
         MessageBox.Show($"Error - {exception.Message}", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#2
0
        public void CheckCalculator()
        {
            var bl      = BLSingleton.GetBL;
            var mothers = bl.GetMothers()?.ToList();
            var child   = bl.GetChildrenByMother(mothers[0].ID)?.ToList();
            var nannies = BL_Tool.MatchingNannies(child[0].ID);

            foreach (var nanny in nannies)
            {
                Console.WriteLine(nanny);
                Console.WriteLine();
            }
        }
示例#3
0
        public void TestGrouping()
        {
            var imp   = BLSingleton.GetBL;
            var group = BL_Tool.AgeGroup(true, true);

            foreach (var VARIABLE in group)
            {
                Console.WriteLine($"Key: {VARIABLE.Key}");
                foreach (var nanny in VARIABLE)
                {
                    Console.WriteLine(nanny);
                    Console.WriteLine();
                }
            }
        }
        private List <Nanny> NannyList(Child child)
        {
            try
            {
                List <Nanny> nannyList;
                nannyList = BL_Tool.MatchingNannies(child.ID).ToList();
                var boolArray =
                    BL_Tool.MotherRequirements(bl.GetNanny(nannyList[0].ID), child, bl.GetMother(child.MotherID)).Any(n => n == false);

                this.Dispatcher.Invoke(new Action(() => { nannyDataGrid.ItemsSource = nannyList;

                                                          nannyDataGrid.RowBackground =
                                                              boolArray ? new SolidColorBrush(Colors.Yellow) : new SolidColorBrush(Colors.LawnGreen); }));
                return(nannyList);
            }
            catch (Exception e)
            {
                MessageBox.Show($"Error - {e.Message}", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(new List <Nanny>());
            }
        }
示例#5
0
 public void MatchigDifference_HalfHoursOfDifference()
 {
     try
     {
         var imp = BLSingleton.GetBL;
         imp.AddNanny(new Nanny
         {
             Address  = "hgefen 3, hashmonaim",
             Schedule = new Schedule[6]
             {
                 new Schedule {
                     EndTime = new Time(16, 0), IsWorking = true, StartTime = new Time(8, 0)
                 },
                 new Schedule {
                     EndTime = new Time(16, 58), IsWorking = false, StartTime = new Time(8, 23)
                 },
                 new Schedule {
                     EndTime = new Time(16, 0), IsWorking = true, StartTime = new Time(8, 0)
                 },
                 new Schedule {
                     EndTime = new Time(15, 30), IsWorking = true, StartTime = new Time(7, 30)
                 },
                 new Schedule {
                     IsWorking = false
                 },
                 new Schedule {
                     EndTime = new Time(16, 58), IsWorking = true, StartTime = new Time(8, 23)
                 }
             },
             ID             = 8080,
             Birthday       = new DateTime(day: 23, month: 11, year: 1999),
             Experience     = 5,
             FirstName      = "Barcha",
             LastName       = "Shmuelovitch",
             Floor          = 2,
             HourlyWage     = 29.35,
             IsElevator     = true,
             MinimumAge     = 3,
             MaximumAge     = 15,
             KidsCapacity   = 6,
             MonthlyWage    = 5000,
             Vacation       = true,
             KosherFood     = true,
             Recommendation = "very good!",
             Telephone      = "0545444564"
         });
         imp.AddMother(new Mother
         {
             ID              = 305,
             Address         = "Hatavor 4,chashmonaim",
             FirstName       = "aliza",
             LastName        = "shtauber",
             MonthlyOrHourly = MonthlyOrHourly.Monthly,
             SearchArea      = "chashmonaim,IL",
             Schedule        = new Schedule[6]
             {
                 new Schedule {
                     IsWorking = true, StartTime = new Time(8, 30), EndTime = new Time(15, 30)
                 },
                 new Schedule {
                     IsWorking = false, StartTime = new Time(8, 30), EndTime = new Time(15, 30)
                 },
                 new Schedule {
                     IsWorking = true, StartTime = new Time(8, 30), EndTime = new Time(15, 30)
                 },
                 new Schedule {
                     IsWorking = true, StartTime = new Time(8, 30), EndTime = new Time(16, 0)
                 },
                 new Schedule {
                     IsWorking = false, StartTime = new Time(8, 0), EndTime = new Time(16, 0)
                 },
                 new Schedule {
                     IsWorking = false, StartTime = new Time(8, 30), EndTime = new Time(15, 30)
                 }
             },
             Telephone = "0524847200"
         });
         var x = BL_Tool.GetMomNannyHourDifference(imp.GetNanny(8080), imp.GetMother(305));
         var y = BL_Tool.GetHoursSum(imp.GetMother(305));
         Console.WriteLine($"x: {x}");
         Console.WriteLine($"y: {y}");
         Console.WriteLine(y - x);
         Assert.AreEqual(y - x, 0.5);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }