예제 #1
0
        //private Type value;
        //private Type targetType;
        //private CultureInfo parameter;
        //private  System.Globalization. culture; culture;

        public AddNannyWindow(Nanny con = null)
        {
            InitializeComponent();
            if (con == null)
            {
                nanny = new Nanny();
            }

            else
            {
                this.Title             = "Update nanny";
                nanny                  = con;
                UpdateFlag             = true;
                AddNannybutton.Content = "Update nanny details";
                //nannyIdTextBox.IsReadOnly = true;
                nannyAddressTextBox.Text = nanny.NannyAddress;
                //this.UserControOfTheWeek.daysOfWork1[0] = true;

                this.UserControOfTheWeek.daysOfWork1  = nanny.NannyDaysOfWork.DeepClone();
                this.UserControOfTheWeek.tableOfWork1 = nanny.NannyTableOfWork.DeepClone();
                this.UserControOfTheWeek.Refreash(this.UserControOfTheWeek, new RoutedEventArgs());
            }
            this.grid0.DataContext = nanny;
            bl = FactoryIBL.getIBL();
            int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            this.nannyFloorTextBox.ItemsSource           = a;
            this.nannyMaxKidslimitTextBox.ItemsSource    = a;
            this.nannyYearsExperienceTextBox.ItemsSource = a;
            this.niceTextBox.ItemsSource = a;

            // this.UserControOfTheWeek.DaysOfWork1[0] = true;


            errorMessages = new List <string>();
            // nanny.NannyDaysOfWork = new bool[6] {true, false, false, false, false, false };
            //bool[] DaysOfWork1 = new bool[6] { true, false, false, false, false, false };

            //this.UserControOfTheWeek.daysOfWork1 =DaysOfWork1.DeepClone();
            //this.UserControOfTheWeek.TableOfWork1 = nanny.NannyTableOfWork.DeepClone();

            //  UserControOfTheWeek week = new UserControOfTheWeek(nanny.NannyDaysOfWork );
            // UserControOfTheWeek = week;
        }
예제 #2
0
        /// <summary>
        /// window constructor. read data from object to data context. disable priority fields.
        /// </summary>
        /// <param name="thisNanny"></param>
        public nanny_update_details(Nanny thisNanny)
        {
            InitializeComponent();
            this.MaxHeight = 700;
            this.MaxWidth  = 555;

            this.MinHeight = 700;
            this.MinWidth  = 555;

            nanny = thisNanny;
            this.NannyDetailsGrid.DataContext = thisNanny;

            firstNameInput.IsEnabled  = false;
            lastNameInput.IsEnabled   = false;
            nanny_id.IsEnabled        = false;
            nanny_birthday.IsEnabled  = false;
            nanny_seniority.IsEnabled = false;
            InsertHoursOfWork();
        }
예제 #3
0
 private void submit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         nanny.Address = addressTextBox.Text;
         Console.WriteLine(nanny.Address);
         Console.WriteLine(nanny);
         bl.AddNanny(nanny);
         nanny = bl.FindNanny(nanny.ID);
         Console.WriteLine(nanny);
         nanny = new Nanny();
         NannyDeatails.DataContext = nanny;
         Close();
     }
     catch (BLException ex)
     {
         MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
예제 #4
0
        public AddNannyWindow(IBL Bl)
        {
            InitializeComponent();
            bl    = Bl;
            nanny = new Nanny();
            // bind nanny
            NannyDeatails.DataContext = nanny;
            nannyAgeTextBox.Text      = "";
            DateTime dateTime = DateTime.Now.AddYears(-18);

            birthDateDatePicker.DisplayDateEnd = dateTime;

            // intialize min age list and bind to min age combobox
            minAgeList = new List <int>()
            {
                0, 6, 12, 18, 24, 30
            };
            minAgeTextBox.DataContext = minAgeList;
        }
예제 #5
0
        private void CalculateSalary()
        {
            string idChild = (string)(idChildComboBox.SelectedItem);
            string idNanny = (string)(idNannyComboBox.SelectedItem);

            if (idChild != null && idNanny != null)
            {
                int    counter = 1;
                Child  child   = bl.GetChild().Find(x => x.IdC == idChild);
                Nanny  nanny   = bl.GetNanny().Find(x => x.ID == idNanny);
                Mother mother  = bl.GetMother().Find(x => x.ID == child.IdM);

                contract.IsHour = (mother.IsHour && nanny.IsHour);
                double pay = nanny.SalaryMonth;

                foreach (Contract cont in bl.GetContract())
                {
                    string idM = bl.GetChild().Find(x => x.IdC == cont.IdChild).IdM;
                    if (cont.IdNanny == nanny.ID && idM == mother.ID)
                    {
                        counter++;
                    }
                }
                if (contract.IsHour)
                {
                    contract.PayHour = nanny.PayHour;
                    double time = 0;
                    for (int i = 0; i < 6; i++)
                    {
                        if (mother.NannyDay[i])
                        {
                            time += (mother.NannyTime[i, 1] - mother.NannyTime[i, 0]).Hours;
                            time += (mother.NannyTime[i, 1] - mother.NannyTime[i, 0]).Minutes / 60;
                        }
                    }
                    time *= 4;
                    pay   = time * nanny.PayHour;
                }

                contract.Salary     = pay - pay * (counter) * 0.2;
                salaryLabel.Content = contract.Salary.ToString();
            }
        }
 private void nannyIdTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (oneContract.NannyId != 0)
     {
         try
         {
             Nanny tempNanny = bl.GetNanny(oneContract.NannyId);
             oneContract.IsHourlyRate = tempNanny.IsHourlyRate;
             oneContract.RateOfHour   = tempNanny.SallaryPerHour;
             oneContract.RateOfMonth  = tempNanny.SallaryPerMonths;
             oneContract.Salary       = bl.SalaryPerMonth(tempNanny, oneContract.IsHourlyRate,
                                                          bl.getContractByDelegate(x => x.MotherId == oneContract.MotherId).Count());
         }
         catch (BLException exp)
         {
             MessageBox.Show(exp.Message);
         }
     }
 }
예제 #7
0
 // event when nanny selected
 private void NannySelected(object sender, EventArgs e)
 {
     nanny = (Nanny)NannyList.textComboBox.SelectedItem;
     if (nanny != null)
     {
         // if select nanny contracts
         if (RButton1.IsChecked == true)
         {
             NannyFunctionFrame.Visibility = Visibility.Visible;
             NannyFunctionFrame.Content    = new NannyContracts(bl, nanny);
         }
         // if select nanny children
         if (RButton2.IsChecked == true)
         {
             NannyFunctionFrame.Visibility = Visibility.Visible;
             NannyFunctionFrame.Content    = new NannyChildren(bl, nanny);
         }
     }
 }
예제 #8
0
 private void idComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     nanny            = new Nanny();
     nanny.ID         = ((string)(idComboBox.SelectedItem)).Split(',')[0];
     nanny            = bl.GetNanny().Find(x => x.ID == nanny.ID);
     Grid.DataContext = nanny;
     if (nanny.IsHour)
     {
         payHourLabel.Visibility   = Visibility.Visible;
         payHourTextBox.Visibility = Visibility.Visible;
     }
     if (nanny.WorkDay[0])
     {
         TP01.Text = Convert.ToString(nanny.WorkTime[0, 0]).Substring(0, 5);
         TP11.Text = Convert.ToString(nanny.WorkTime[0, 1]).Substring(0, 5);
     }
     if (nanny.WorkDay[1])
     {
         TP02.Text = Convert.ToString(nanny.WorkTime[1, 0]).Substring(0, 5);
         TP12.Text = Convert.ToString(nanny.WorkTime[1, 1]).Substring(0, 5);
     }
     if (nanny.WorkDay[2])
     {
         TP03.Text = Convert.ToString(nanny.WorkTime[2, 0]).Substring(0, 5);
         TP13.Text = Convert.ToString(nanny.WorkTime[2, 1]).Substring(0, 5);
     }
     if (nanny.WorkDay[3])
     {
         TP04.Text = Convert.ToString(nanny.WorkTime[3, 0]).Substring(0, 5);
         TP14.Text = Convert.ToString(nanny.WorkTime[3, 1]).Substring(0, 5);
     }
     if (nanny.WorkDay[4])
     {
         TP05.Text = Convert.ToString(nanny.WorkTime[4, 0]).Substring(0, 5);
         TP15.Text = Convert.ToString(nanny.WorkTime[4, 1]).Substring(0, 5);
     }
     if (nanny.WorkDay[5])
     {
         TP01.Text = Convert.ToString(nanny.WorkTime[5, 0]).Substring(0, 5);
         TP11.Text = Convert.ToString(nanny.WorkTime[5, 1]).Substring(0, 5);
     }
 }
예제 #9
0
        //===============

        /// <summary>
        /// Links the selected nanny to the fields on the page
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dataGrid.SelectedItem is Nanny)
            {
                nan = (dataGrid.SelectedItem as Nanny);

                //Displays the list of work hours of the selected nanny
                tempArray = nan.timeWorkofWeek;

                nameDey.Content = "Sunday";
                tempDay         = tempArray[0];
                if (tempDay == null)
                {
                    tempDay = new Day();
                }
                timeGrid.DataContext = tempDay;

                gridNanData.DataContext = nan;
            }
        }
예제 #10
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                nanny.PersonAddress = new Address()
                {
                    City = this.cityTextBox.Text, Country = countryTextBox.Text, Street = this.streetTextBox.Text, Number = Int32.Parse(numberTextBox.Text)
                };
                nanny.range = minChildrensAgeTextBox.Text + "-" + maxChildrensAgeTextBox.Text;
                myBL.AddNanny(nanny);
                nanny       = new Nanny();
                DataContext = nanny;
                this.Close();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void NannyIdOkBtn_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var input = NannyIdTextBox.Text;
         nannyMain = bl.GetNanny(Convert.ToInt32(input));
         if (nannyMain == null)
         {
             MessageBox.Show("Nanny doesn't exist", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             NannyWelcomeBanner.Content  = $"Welcome: {nannyMain.FirstName} {nannyMain.LastName}!";
             NannyOptionGrid.Visibility  = Visibility.Visible;
             NannyIdCheckGrid.Visibility = Visibility.Collapsed;
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        //private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{

        //    this.NannyDataGrid.DataContext = nanny;
        //    bl.UpdateNanny(nanny);

        //    //if (sender is DataGrid)
        //    //{
        //    //   ( (DataGrid)sender).Se
        //    //}

        //    //    this.refreshDataGrid(GetSelectedNannyId());
        //    //bl.UpdateNanny()
        //}

        private void ChangeDetails_button(object sender, RoutedEventArgs e)
        {
            //int nannyId = GetSelectedNannyId();
            //nanny = bl.GetNanny(nannyId);
            //nannyTarget = (this.nanny).DeepClone();
            //new AddNannyWindow(nannyTarget).ShowDialog();



            if (this.comboBox.SelectedItem is Nanny)
            {
                this.nannyTarget = ((Nanny)this.comboBox.SelectedItem).DeepClone();
                new AddNannyWindow(nannyTarget).ShowDialog();
                this.refreshDataGrid(GetSelectedNannyId());
                this.refreshCoBobox(GetSelectedNannyId());

                //this.comboBox.ItemsSource = bl.GetNannyIEnumerable();
                //this.comboBox.DisplayMemberPath = "NannyId";
                //this.comboBox.SelectedValuePath = "NannyId";
                // this.comboBox.ItemsSource = bl.GetNannyIEnumerable();
            }
        }
예제 #13
0
 /// <summary>
 /// build function of the class/window for add a contract
 /// </summary>
 /// <param name="temp_nanny">nanny in the contract</param>
 /// <param name="temp_mother">nother in the contract</param>
 public Contract_Menu(Nanny temp_nanny, Mother temp_mother)
 {
     InitializeComponent();
     bl = new BL.BL_imp();
     signing_a_contractCheckBox.IsEnabled = false;
     this.sign_nanny.IsEnabled            = false;
     this.cancel_nanny.IsEnabled          = false;
     contract               = new Contract();
     nanny                  = temp_nanny;
     mother                 = temp_mother;
     contract.name_nanny    = nanny.firstName;
     contract.name_mother   = mother.firstName;
     contract.MotherAddress = mother.address;
     this.name_mother.Text  = mother.firstName;
     contract.id_mother     = mother.id;
     contract.id_nanny      = nanny.id;
     contract.MotherAddress = mother.address;
     contract.per_hour      = nanny.hourly_rate;
     contract.per_month     = nanny.monthly_rate;
     contract.NannyAddres   = nanny.address;
     this.DataContext       = contract;
 }
        private void inti()
        {
            DateTime Birth = new DateTime(1991, 2, 3);

            #region NannyExample
            Nanny yafit = new Nanny("307471672", "Batito", "Yafit", "0547951348", "Pashos 29,Beer Sheva,israel",
                                    Birth, true, 3, 3, 7, 3, 55, true, (float)30.5, 0, getDays(), getHourNanny(), false, null);
            bl.addNanny(yafit);
            Birth = new DateTime(1989, 01, 01);
            Nanny shlomit = new Nanny("308922202", "shlomit", "batito", "0547951349", "Pashos 50,Beer Sheva,israel",
                                      Birth, false, 1, 2, 6, 3, 55, false, 0, 5000, getDays(), getHourNanny(), true, "good nanny");
            bl.addNanny(shlomit);
            #endregion
            #region MotherExample
            Mother galit = new Mother("309549079", "Gamliel", "galit", "0547951344", "Pashos 40,Beer Sheva,israel", "Pashos 40,Beer Sheva,israel", getDays(), getHourMother(), null);
            bl.addMother(galit);
            Mother hagit = new Mother("314370768", "Brok", "Hagit", "0547951366", "יפתח הגלעדי 49, אשקלון, ישראל", "יפתח הגלעדי 49, אשקלון, ישראל", getDays(), getHourMother(), null);
            bl.addMother(hagit);
            #endregion
            #region ChildExample
            Birth = new DateTime(2017, 05, 05);
            Child sunofgalit = new Child("317383297", "Yosef", "309549079", Birth, false, null);
            bl.addChild(sunofgalit);
            Birth = new DateTime(2017, 04, 04);
            Child sunofhagit = new Child("318000262", "Eliav", "314370768", Birth, true, "needs to take 3 pills a day");
            bl.addChild(sunofhagit);
            #endregion
            #region ContractExample
            Birth = new DateTime(2019, 01, 09);
            DateTime    End = new DateTime(2019, 05, 09);
            BE.Contract HagitContractAndYafit = new Contract("307471672", "318000262", true, true, Birth, End);
            bl.addContract(HagitContractAndYafit);
            Birth = new DateTime(2019, 01, 08);
            End   = new DateTime(2019, 05, 08);
            BE.Contract GalitContractAndshlomit = new Contract("308922202", "317383297", false, true, Birth, End);
            bl.addContract(GalitContractAndshlomit);
            #endregion ContractExample}
        }
예제 #15
0
 /// <summary>
 /// Enter a Nanny/Mother interface from the Admin window.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Interface_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Nannylist.IsChecked.Value)
         {
             if (dataGrid.SelectedItem != null)
             {
                 Nanny  selectedNanny   = (Nanny)dataGrid.SelectedItem;
                 Window nanny_interface = new NannyInterface(selectedNanny);
                 nanny_interface.ShowDialog();
             }
             else
             {
                 MessageBox.Show("No nanny was selected!", "Error");
                 return;
             }
         }
         if (Motherlist.IsChecked.Value)
         {
             if (dataGrid.SelectedItem != null)
             {
                 Mother selectedMother   = (Mother)dataGrid.SelectedItem;
                 Window mother_interface = new MoterInterface(selectedMother);
                 mother_interface.ShowDialog();
             }
             else
             {
                 MessageBox.Show("No mother was selected!", "Error");
                 return;
             }
         }
     }
     catch
     {
         MessageBox.Show("No object was selected", "Error!");
     }
 }
예제 #16
0
 public void idCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         id    = iDComboBox.SelectedValue.ToString();
         nanny = this.bl.GetNannyByID(id);
         this.grid1.DataContext = nanny;
         List <String> name = (from z in bl.GetBankBranchs()
                               select z.BankName).ToList();
         this.BankNameComboBox.ItemsSource    = name.Select(x => x = x.Trim('\n')).Distinct();
         this.BankBranchComboBox.SelectedItem = "";
         BankNameComboBox.SelectedItem        = nanny.NannyBank.BankName;
         BankBranchComboBox.SelectedItem      = nanny.NannyBank.BankBranch + "," + nanny.NannyBank.BankAdress;
     }
     catch (FormatException)
     {
         MessageBox.Show("Incorrect input");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void NannyRemoveBtn_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var result = MessageBox.Show($"Are you sure you want to remove {nannyMain.FirstName} {nannyMain.LastName}?",
                                      "Confirmation:",
                                      MessageBoxButton.OKCancel, MessageBoxImage.Information);
         if (result == MessageBoxResult.OK)
         {
             MessageBox.Show(
                 bl.RemoveNanny(nannyMain.ID)
                     ? $"{nannyMain.FirstName} {nannyMain.LastName} was removed!"
                     : $"{nannyMain.FirstName} {nannyMain.LastName} wasn't removed!", "Info", MessageBoxButton.OK,
                 MessageBoxImage.Information);
             NannyOptionGrid.Visibility = Visibility.Collapsed;
             nannyMain = new Nanny();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
예제 #18
0
 public AddNannyWindow()
 {
     try
     {
         InitializeComponent();
         //Schedules=new Schedule[6];
         nanny            = new Nanny();
         nanny.Birthday   = new DateTime(DateTime.Now.Year - 50, 1, 1);
         this.DataContext = nanny;
         bl = BLSingleton.GetBL;
         List <Time> times = new List <Time>();
         for (int i = 8; i < 20; i++)
         {
             times.Add(new Time(i - 1, 30));
             times.Add(new Time(i, 0));
         }
         StartTimeCmbx1.ItemsSource = times;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
예제 #19
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (idTextBox.Text.Count() == 0)
                {
                    throw new PlException("Threr is no mother to delete");
                }

                bl.removeNanny(int.Parse(this.idTextBox.Text));
                removeFromObserver(int.Parse(this.idTextBox.Text));

                nan             = new Nanny();
                nameDey.Content = "Sunday";
                tempArray       = nan.timeWorkofWeek; //create new array
                tempDay         = new Day();          //show the first day

                timeGrid.DataContext    = tempDay;
                gridNanData.DataContext = nan;
            }
            catch (PlException plExe) { MessageBox.Show(plExe.Message); }
            catch (BL.BLException exp) { MessageBox.Show(exp.Message); }
        }
예제 #20
0
        // item selected in combobox event
        private void ItemSelected(object sender, EventArgs e)
        {
            Entity entity = (Entity)EntityList.SelectedItem;

            if (searchList.Text != null)
            {
                // make frame visible
                selectedAction.Visibility = Visibility.Visible;
                // for each item selected, get the item
                // and open the frame with the item
                switch (entity)
                {
                case Entity.nanny:
                    nanny = bl.CloneNannyList().FirstOrDefault(nanny => nanny.ToString() == searchList.Text);
                    selectedAction.Content = new SearchNanny(bl, nanny);
                    break;

                case Entity.mother:
                    mother = bl.CloneMotherList().FirstOrDefault(mother => mother.ToString() == searchList.Text);
                    selectedAction.Content = new SearchMother(bl, mother);
                    break;

                case Entity.child:
                    child = bl.CloneChildList().FirstOrDefault(child => child.ToString() == searchList.Text);
                    selectedAction.Content = new SearchChild(bl, child);
                    break;

                case Entity.contract:
                    contract = bl.CloneContractList().FirstOrDefault(contract => contract.ToString() == searchList.Text);
                    selectedAction.Content = new SearchContract(bl, contract);
                    break;

                default:
                    break;
                }
            }
        }
예제 #21
0
        /// <summary>
        /// Event: display distance from a nanny every time the user select one
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Options.SelectedIndex == 4)
            {
                Nanny selected_nanny = dataGrid.SelectedItem as Nanny;
                if (selected_nanny == null)
                {
                    return;
                }

                Thread myThread = new Thread(() => { current_nanny_distance = myBL.distanceBetweenAddresses(thisMother.address, selected_nanny.address); });
                myThread.Start();
                myThread.Join();

                option_describe.Content = "Your Distance from " + selected_nanny.familyName + ' ' + selected_nanny.firstName + " is: "
                                          + current_nanny_distance.ToString() + " Km";

                option_describe.Opacity = 1;
            }
            else
            {
                return;
            }
        }
        private void nannyIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Nanny n = nannyIdComboBox.SelectedItem as Nanny;

            contract.NannyId = n.Id;
        }
예제 #23
0
        //adding entities to database
        private void init()
        {
            Mother m = new Mother
            {
                Address = new Address {
                    City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                ID        = 123,
                FirstName = "Chany",
                LastName  = "Cohen",
                Age       = 25,
                Pelephone = "03455666",
                WorkDays  = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(12, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(12, 14) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(12, 14) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(12, 14) }
                },
                BankAccount = new BankAccount {
                    AccountNumber = 100, Balance = 10000, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
            };
            Mother mmm = new Mother
            {
                Address = new Address {
                    City = "Jerusalem", Street = "Ben Tzvi", HouseNumber = 17, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                ID        = 124,
                FirstName = "Shirly",
                LastName  = "Cohen",
                Age       = 29,
                Pelephone = "0345566456",
                WorkDays  = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(12, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(12, 14) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(12, 14) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(12, 14) }
                },
                BankAccount = new BankAccount {
                    AccountNumber = 110, Balance = 10000, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
            };
            Mother m1 = new Mother
            {
                Address = new Address {
                    City = "Jerusalem", Street = "Yafo", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                ID        = 127,
                FirstName = "Chany",
                LastName  = "Shpiner",
                Age       = 25,
                Pelephone = "03454366",
                WorkDays  = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(09, 14) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(12, 14) }
                },
                BankAccount = new BankAccount {
                    AccountNumber = 100, Balance = 10000, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
            };
            Mother m2 = new Mother
            {
                Address = new Address {
                    City = "Tel Aviv", Street = "Hashalom", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                ID        = 133,
                FirstName = "Saly",
                LastName  = "Cohen",
                Age       = 25,
                Pelephone = "03455666",
                WorkDays  = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Thu, new KeyValuePair <int, int>(10, 14) }
                },
                BankAccount = new BankAccount {
                    AccountNumber = 100, Balance = 10000, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
            }; Mother m3 = new Mother

            {
                Address = new Address {
                    City = "Tel Aviv", Street = "Hashalom", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                ID        = 139,
                FirstName = "Chany",
                LastName  = "Banany",
                Age       = 25,
                Pelephone = "03477666",
                WorkDays  = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Mon, new KeyValuePair <int, int>(12, 20) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(12, 13) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(12, 19) }
                },

                BankAccount = new BankAccount {
                    AccountNumber = 100, Balance = 10000, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
            };
            Nanny nanny = new Nanny
            {
                ID          = 2243,
                FirstName   = "rivi",
                LastName    = "bar",
                Age         = 20,
                BankAccount = new BankAccount {
                    AccountNumber = 200, Balance = 10, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
                Address = new Address {
                    City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 11, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                BirthDate        = new DateTime(1995, 12, 26),
                ExperienceYears  = 0,
                HourlyRate       = 27,
                MaxNumOfChildren = 5,
                MinAgeOfChild    = 2,
                MonthlyRate      = 1000,
                Elevator         = true,
                WorkDays         = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(8, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(8, 14) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(8, 14) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(8, 14) }
                }
            };
            Nanny n = new Nanny
            {
                ID          = 243,
                FirstName   = "rivi2",
                LastName    = "bar2",
                Age         = 20,
                BankAccount = new BankAccount {
                    AccountNumber = 200, Balance = 10, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
                Address = new Address {
                    City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 11, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                BirthDate        = new DateTime(1995, 12, 26),
                ExperienceYears  = 0,
                HourlyRate       = 27,
                MaxNumOfChildren = 5,
                MinAgeOfChild    = 2,
                MonthlyRate      = 1000,
                Elevator         = true,
                WorkDays         = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(13, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(13, 14) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(13, 14) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(13, 14) }
                }
            };
            Nanny n2 = new Nanny
            {
                ID          = 247,
                FirstName   = "Can",
                LastName    = "Cucomber",
                Age         = 20,
                BankAccount = new BankAccount {
                    AccountNumber = 200, Balance = 10, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
                Address = new Address {
                    City = "Jerusalem", Street = "Yafo", HouseNumber = 11, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                BirthDate        = new DateTime(1995, 12, 26),
                ExperienceYears  = 0,
                HourlyRate       = 27,
                MaxNumOfChildren = 5,
                MinAgeOfChild    = 2,
                MonthlyRate      = 1000,
                Elevator         = true,
                WorkDays         = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(09, 20) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(09, 20) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(09, 20) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(09, 20) }
                }
            }; Nanny n3 = new Nanny

            {
                ID          = 253,
                FirstName   = "Old",
                LastName    = "Young",
                Age         = 20,
                BankAccount = new BankAccount {
                    AccountNumber = 200, Balance = 10, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
                Address = new Address {
                    City = "Tel Aviv", Street = "Hashalom", HouseNumber = 11, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                BirthDate        = new DateTime(1995, 12, 26),
                ExperienceYears  = 0,
                HourlyRate       = 27,
                MaxNumOfChildren = 5,
                MinAgeOfChild    = 2,
                MonthlyRate      = 1000,
                Elevator         = true,
                WorkDays         = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(10, 14) },
                    { BE.Days.Thu, new KeyValuePair <int, int>(10, 14) }
                }
            }; Nanny n4 = new Nanny
            {
                ID          = 293,
                FirstName   = "Golom",
                LastName    = "Whatever",
                Age         = 20,
                BankAccount = new BankAccount {
                    AccountNumber = 200, Balance = 10, BankName = "Leumi", BankNumber = 22, BranchAddress = new Address {
                        City = "Jerusalem", Street = "Beit Hadefus", HouseNumber = 7, Country = "Israel", Floor = 1, ZipCode = "zip"
                    }, BranchNumber = 65
                },
                Address = new Address {
                    City = "Tel Aviv", Street = "Hashalom", HouseNumber = 11, Country = "Israel", Floor = 1, ZipCode = "zip"
                },
                BirthDate        = new DateTime(1995, 12, 26),
                ExperienceYears  = 0,
                HourlyRate       = 27,
                MaxNumOfChildren = 5,
                MinAgeOfChild    = 2,
                MonthlyRate      = 1000,
                Elevator         = true,
                WorkDays         = new Dictionary <BE.Days, KeyValuePair <int, int> >()
                {
                    { BE.Days.Sun, new KeyValuePair <int, int>(09, 24) },
                    { BE.Days.Mon, new KeyValuePair <int, int>(09, 24) },
                    { BE.Days.Tue, new KeyValuePair <int, int>(09, 24) },
                    { BE.Days.Wed, new KeyValuePair <int, int>(09, 24) },
                    { BE.Days.Thu, new KeyValuePair <int, int>(09, 24) }
                }
            };
            Child ch = new Child
            {
                Age          = 3,
                Allergies    = false,
                BirthDate    = "01/08/2017",
                FirstName    = "Leiky",
                ID_child     = 1234,
                ID_Mother    = 123,
                SpecialNeeds = true
            };

            Child chhh = new Child
            {
                Age          = 3,
                Allergies    = false,
                BirthDate    = "01/08/2017",
                FirstName    = "Chany",
                ID_child     = 1235,
                ID_Mother    = 124,
                SpecialNeeds = true
            };
            Contract cccc = new Contract
            {
                ContractID = 100,
                ID_child   = ch.ID_child,
                ID_nanny   = n.ID,
                ID_mother  = m.ID,
                StartDate  = "15/11/2017"
            };
            Contract c = new Contract
            {
                ContractID = 101,
                ID_child   = ch.ID_child,
                ID_nanny   = n.ID,
                ID_mother  = m.ID,
                StartDate  = "15/10/2017"
            };

            factoryBL.get_bl().addMother(m);
            factoryBL.get_bl().addMother(m1);
            factoryBL.get_bl().addMother(m2);
            factoryBL.get_bl().addMother(m3);
            factoryBL.get_bl().addMother(mmm);
            factoryBL.get_bl().addNanny(nanny);
            factoryBL.get_bl().addNanny(n);
            factoryBL.get_bl().addNanny(n2);
            factoryBL.get_bl().addNanny(n3);
            factoryBL.get_bl().addNanny(n4);
            factoryBL.get_bl().addChild(ch);
            factoryBL.get_bl().addChild(chhh);
            factoryBL.get_bl().addContract(cccc);
            factoryBL.get_bl().addContract(c);
        }
예제 #24
0
        public UpdateNanny(Nanny nanny)
        {
            try
            {
                this.SizeChanged += OnSizeChanged;
                InitializeComponent();
                Schedules        = new Schedule[6];
                NannyCancel      = nanny.GetCopy();
                NannyGlobal      = nanny;
                this.DataContext = nanny;
                bl = BLSingleton.GetBL;
                List <Time> times = new List <Time>();
                for (int i = 8; i < 20; i++)
                {
                    times.Add(new Time(i - 1, 30));
                    times.Add(new Time(i, 0));
                }
                StartTimeCmbx1.ItemsSource = times;
                #region InitNanny
                Cb1.IsChecked = nanny.Schedule[0].IsWorking;
                if (nanny.Schedule[0].IsWorking)
                {
                    StartTimeCmbx1.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[0].StartTime) == 0);
                    EndTimeCmbx1.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[0].EndTime) == 0);
                }
                Cb2.IsChecked = nanny.Schedule[1].IsWorking;
                if (nanny.Schedule[1].IsWorking)
                {
                    StartTimeCmbx2.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[1].StartTime) == 0);
                    EndTimeCmbx2.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[1].EndTime) == 0);
                }
                Cb3.IsChecked = nanny.Schedule[2].IsWorking;
                if (nanny.Schedule[2].IsWorking)
                {
                    StartTimeCmbx3.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[2].StartTime) == 0);
                    EndTimeCmbx3.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[2].EndTime) == 0);
                }
                Cb4.IsChecked = nanny.Schedule[3].IsWorking;
                if (nanny.Schedule[3].IsWorking)
                {
                    StartTimeCmbx4.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[3].StartTime) == 0);
                    EndTimeCmbx4.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[3].EndTime) == 0);
                }
                Cb5.IsChecked = nanny.Schedule[4].IsWorking;
                if (nanny.Schedule[4].IsWorking)
                {
                    StartTimeCmbx5.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[4].StartTime) == 0);
                    EndTimeCmbx5.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[4].EndTime) == 0);
                }
                Cb6.IsChecked = nanny.Schedule[5].IsWorking;
                if (nanny.Schedule[5].IsWorking)
                {
                    StartTimeCmbx6.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[5].StartTime) == 0);
                    EndTimeCmbx6.SelectedItem =
                        times.FirstOrDefault(t => t.CompareTo(nanny.Schedule[5].EndTime) == 0);
                }


                #endregion
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        /// <summary>
        /// checks exceptions and adding the contract
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_ok(object sender, RoutedEventArgs e)
        {
            #region check exceptions

            try
            {
                if (comboBoxChilds.SelectedItem == null)
                {
                    throw new Exception("no child selected!");
                }

                if (contartEndDatePicker.SelectedDate < contartBeginDatePicker.SelectedDate)
                {
                    throw new Exception("invalid end date ");
                }

                if (salaryTypeCB.SelectedItem == null)
                {
                    throw new Exception("no salary type selected!");
                }

                if (nanniesListBox.SelectedItem == null)
                {
                    throw new Exception("select nanny!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            #endregion

            #region add the contract

            string nannyName = ((ListBoxItem)nanniesListBox.SelectedItem).Content.ToString().Split(':').First();
            Nanny  myNanny   = (myBl.NanniesByPredicate(x => (x.FirstName + " " + x.LastName) == nannyName)).First();

            Contract myContract = new Contract()
            {
                ChildId       = myChild.Id,
                NannyId       = myNanny.Id,
                Met           = metCheckBox.IsChecked.Value,
                ContractBegin = (DateTime)contartBeginDatePicker.SelectedDate,
                ContractEnd   = (DateTime)contartEndDatePicker.SelectedDate
            };


            if (((ComboBoxItem)salaryTypeCB.SelectedItem).Content.ToString() == "Hourly")  // checks the wanted contract type
            {
                myContract.ConType = ContractType.hourly;
            }
            else
            {
                myContract.ConType = ContractType.monthly;
            }

            try
            {
                myBl.AddContract(myContract);
            }
            catch (Exception mes)
            {
                MessageBox.Show(mes.Message, "ADD CONTRACT ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            #endregion

            MessageBox.Show("The contract added successfully :)", "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information);
            this.Close();
        }
예제 #26
0
 private void choose_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     n = (Nanny)choose.SelectedItem;
 }
예제 #27
0
 private void motherc_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     temp_n = (Nanny)motherc.SelectedItem;
 }
예제 #28
0
        /// <summary>
        /// this event will update the grids , and will link the specific object to the dataContext
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChoodsingCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dataType == "contract")
            {
                myContract = myBl.MatchedContracts(x => x.TransactionNumber == (int)ChoodsingCB.SelectedValue).First();
                contractGrid1.DataContext = myContract;
            }

            else if (dataType == "nanny")
            {
                myNanny = myBl.NanniesByPredicate(x => x.Id == (int)ChoodsingCB.SelectedValue).First();
                nannyGrid1.DataContext = myNanny;
                nannyGrid2.DataContext = myNanny;

                #region loading grid2

                NcheckSun.IsChecked = myNanny.WorkDays[0];
                NcheckMon.IsChecked = myNanny.WorkDays[1];
                NcheckTue.IsChecked = myNanny.WorkDays[2];
                NcheckWed.IsChecked = myNanny.WorkDays[3];
                NcheckThu.IsChecked = myNanny.WorkDays[4];
                NcheckFri.IsChecked = myNanny.WorkDays[5];
                NcheckSat.IsChecked = myNanny.WorkDays[6];

                if (myNanny.WorkDays[0])
                {
                    NenterSun.Text = myNanny.Schedule[0, 0].ToString();
                    NexitSun.Text  = myNanny.Schedule[1, 0].ToString();
                }

                if (myNanny.WorkDays[1])
                {
                    NenterMon.Text = myNanny.Schedule[0, 1].ToString();
                    NexitMon.Text  = myNanny.Schedule[1, 1].ToString();
                }

                if (myNanny.WorkDays[2])
                {
                    NenterTue.Text = myNanny.Schedule[0, 2].ToString();
                    NexitTue.Text  = myNanny.Schedule[1, 2].ToString();
                }

                if (myNanny.WorkDays[3])
                {
                    NenterWed.Text = myNanny.Schedule[0, 3].ToString();
                    NexitWed.Text  = myNanny.Schedule[1, 3].ToString();
                }

                if (myNanny.WorkDays[4])
                {
                    NenterThu.Text = myNanny.Schedule[0, 4].ToString();
                    NexitThu.Text  = myNanny.Schedule[1, 4].ToString();
                }

                if (myNanny.WorkDays[5])
                {
                    NenterFri.Text = myNanny.Schedule[0, 5].ToString();
                    NexitFri.Text  = myNanny.Schedule[1, 5].ToString();
                }

                if (myNanny.WorkDays[6])
                {
                    NenterSat.Text = myNanny.Schedule[0, 6].ToString();
                    NexitSat.Text  = myNanny.Schedule[1, 6].ToString();
                }

                #endregion
            }

            else if (dataType == "child")
            {
                myChild = myBl.ChildsByPredicate(x => x.Id == (int)ChoodsingCB.SelectedValue).First();
                childDataGrid.DataContext = myChild;
            }

            else if (dataType == "mother")
            {
                myMother = myBl.MothersByPredicate(x => x.Id == (int)ChoodsingCB.SelectedValue).First();
                motherGrid1.DataContext = myMother;
                motherGrid2.DataContext = myMother;

                #region loading grid 2

                checkSun.IsChecked = myMother.NannyDays[0];
                checkMon.IsChecked = myMother.NannyDays[1];
                checkTue.IsChecked = myMother.NannyDays[2];
                checkWed.IsChecked = myMother.NannyDays[3];
                checkThu.IsChecked = myMother.NannyDays[4];
                checkFri.IsChecked = myMother.NannyDays[5];
                checkSat.IsChecked = myMother.NannyDays[6];

                if (myMother.NannyDays[0])
                {
                    enterSun.Text = myMother.Schedule[0, 0].ToString();
                    exitSun.Text  = myMother.Schedule[1, 0].ToString();
                }

                if (myMother.NannyDays[1])
                {
                    enterMon.Text = myMother.Schedule[0, 1].ToString();
                    exitMon.Text  = myMother.Schedule[1, 1].ToString();
                }

                if (myMother.NannyDays[2])
                {
                    enterTue.Text = myMother.Schedule[0, 2].ToString();
                    exitTue.Text  = myMother.Schedule[1, 2].ToString();
                }

                if (myMother.NannyDays[3])
                {
                    enterWed.Text = myMother.Schedule[0, 3].ToString();
                    exitWed.Text  = myMother.Schedule[1, 3].ToString();
                }

                if (myMother.NannyDays[4])
                {
                    enterThu.Text = myMother.Schedule[0, 4].ToString();
                    exitThu.Text  = myMother.Schedule[1, 4].ToString();
                }

                if (myMother.NannyDays[5])
                {
                    enterFri.Text = myMother.Schedule[0, 5].ToString();
                    exitFri.Text  = myMother.Schedule[1, 5].ToString();
                }

                if (myMother.NannyDays[6])
                {
                    enterSat.Text = myMother.Schedule[0, 6].ToString();
                    exitSat.Text  = myMother.Schedule[1, 6].ToString();
                }

                #endregion
            }
        }
예제 #29
0
 public Recommendations(Nanny n)
 {
     InitializeComponent();
     See_Recommendations.Text += n.Recommendations;
 }
예제 #30
0
 private void NannySelected(object sender, SelectionChangedEventArgs e)
 {
     nanny = (Nanny)(sender as ComboBox).SelectedItem;
     searchNanny.DataContext = nanny;
 }