public childDetails(BE.Child temp) { childTemp = temp; InitializeComponent(); bl = BL.FactoryBL.getBL(); mainGrid.DataContext = temp; }
private void addChildButton_Click(object sender, RoutedEventArgs e) { BL.FactoryBl.getBL().AddChild(mychild); mychild = new BE.Child(); DataContext = mychild; DialogResult = true; }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (child.ChildId > 999999999) { throw new Exception("your id is not valid"); } if (child.ChildId == 0) { throw new Exception("your id is not valid"); } if (child.ChildMotherId == 0) { throw new Exception("your mother id is not valid"); } if (child.ChildMotherId > 999999999) { throw new Exception("your mother id is not valid"); } bl.AddChild(child); //Add the child object to the "child" list in the BL database child = new BE.Child(); //initialize child as an empty object of the child type this.DataContext = child; //Set the fields of the screen to child } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void IdChild_comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ComboBox && ((ComboBox)sender).SelectedIndex > -1) { child = bl.FindChilAcordId(GetSelectedChildId()); List <BE.Child> c = new List <BE.Child>(); c.Add(child); listBox.ItemsSource = c; FriendCheckBox.IsChecked = bl.IsHaveFriend(c.FirstOrDefault()); IsDiapercheckBox.IsChecked = c.FirstOrDefault().IsDiaper; if (c.FirstOrDefault().IsDiaper) { if ("" + c.FirstOrDefault().TheLastReplaceDiaper == "00:00:00") { this.lastReplace_textBox.Text = ""; } else { this.lastReplace_textBox.Text = "" + c.FirstOrDefault().TheLastReplaceDiaper; } } else { lastReplace_textBox.Text = ""; } } }
private void deleteDataGridButton_Click(object sender, RoutedEventArgs e) { try { if (this.ChildDataGrid.SelectedItem is BE.Child) { MessageBoxResult result = MessageBox.Show( "Are you sure?", "Delete Child", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { child = (BE.Child) this.ChildDataGrid.SelectedItem; bl.RemoveChild(child.Id); refreshData(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public addChildWindow() { InitializeComponent(); childToAdd = new BE.Child(); this.DataContext = childToAdd; bl = BL.FactoryBL.GetBL(); }
/// <summary> /// reload the page data, to get empty fields /// </summary> private void refreshData() { try { childToBeUpdated = new BE.Child(); this.DataContext = childToBeUpdated; this.idComboBox.SelectedItem = null; this.idComboBox.ItemsSource = bl.GetChildList(); this.childDetailsGrid.IsEnabled = false; this.isBreastMilkCheckBox.IsEnabled = false; this.isMedicinesAllergyCheckBox.IsEnabled = false; this.isFoodAllergyCheckBox.IsEnabled = false; this.isSpecialNeedsChildCheckBox.IsEnabled = false; this.commentsExpander.IsEnabled = false; this.UpdateChildButton.IsEnabled = false; this.commentsExpander.IsEnabled = false; } catch { var myWindow = Window.GetWindow(this); myWindow.Close(); } }
BL.IBL bl; //Builds an IBL type object public AddChild() { InitializeComponent(); //Startup (initializes component) child = new BE.Child(); this.DataContext = child; //Displays on the screen the fields of the object being built bl = BL.FactoryBL.GetBL(); //Links the panel to the BL database }
private void Button_Click(object sender, RoutedEventArgs e) { corentchild = myBL.SearchChild(x => x.ChildId == idchildtxt.Text).FirstOrDefault(); List <BE.Child> list = new List <BE.Child>(); list.Add(corentchild); listBox.ItemsSource = list; }
private void AddChildButton_Click(object sender, RoutedEventArgs e) { BL.FactoryBL.getBL().AddChild(child); MessageBox.Show(child.ToString()); child = new BE.Child(); DataContext = child; this.Close(); }
public void AddChild(BE.Child C) {//adds child to list after checking that he does not exist already if (checkChild(C) == true) { throw new Exception("Child already exists"); } listOfChilds.Add(C); }
private void comboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (comboBox.SelectedItem != null) { child = new BE.Child(comboBox.SelectedItem as BE.Child); DataContext = child; } }
public void AddChild(BE.Child child) { if (dimp.SearchMother(x => x.MomId == child.MomId) == null) { throw new Exception("we dont find your mother "); } dimp.AddChild(child); }
private void dgData_selection_cehanged(object sender, SelectionChangedEventArgs e) { if (dgData.SelectedItem != null) { child = new BE.Child(dgData.SelectedItem as BE.Child); DataContext = child; } }
private void selection_change_dataGrid(object sender, SelectionChangedEventArgs e) { if (dataGrid.SelectedItem != null) { child = new BE.Child(dataGrid.SelectedItem as BE.Child); DataContext = child; } }
private void AddChildClick(object sender, RoutedEventArgs e) { string tmp = ""; int count_ec = 0; try { bool check1 = first_NameTextBox.Text.Any(who => char.IsLetter(who)); if (first_NameTextBox.Text != null) { if (!check1) { first_NameTextBox.BorderBrush = Brushes.Red; tmp += "Invalid First name! \n"; first_NameTextBox.Text = ""; count_ec++; } } if ((DateTime)dateDatePicker.SelectedDate >= (DateTime.Today)) { tmp += "Invalid Date!"; count_ec++; } bool check = iDTextBox.Text.Any(who => !char.IsLetter(who)); if ((iDTextBox.Text != null) && (iDTextBox.Text != "0")) { if (!check) { iDTextBox.BorderBrush = Brushes.Red; tmp += "Invalid ID Number! \n"; iDTextBox.Text = ""; count_ec++; } } if (count_ec != 0) { throw new Exception(tmp); } else { bl.Add_Chaild(child); MessageBox.Show("Add child successful"); child = new BE.Child(); this.DataContext = child; Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); first_NameTextBox.BorderBrush = Brushes.Black; iDTextBox.BorderBrush = Brushes.Black; } }
public Child() { InitializeComponent(); corentchild = new BE.Child(); this.momIdComboBox.ItemsSource = myBL.GetMotherList(); this.momIdComboBox.DisplayMemberPath = "MomId"; this.momIdComboBox.SelectedValuePath = "MomId"; this.grid1.DataContext = corentchild; }
private void datalist_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (datalist.SelectedItem != null) { child = new BE.Child(datalist.SelectedItem as BE.Child); DataContext = child; AddButton.IsEnabled = true; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { corentchild = myBL.SearchChild(x => x.ChildId == childIdTextBox.Text).FirstOrDefault(); if (corentchild == null) { MessageBox.Show("canot fint this child"); } this.grid1.DataContext = corentchild; }
public newChild() { InitializeComponent(); bl = BL.FactoryBL.getBL(); Child = new BE.Child(); grid1.DataContext = Child; grid2.DataContext = Child; grid3.DataContext = Child; }
public AnotherFunChild_Window() { InitializeComponent(); child = new BE.Child(); bl = BL.FactoryBL.GetBL(); this.IdChild_comboBox.ItemsSource = bl.GetAllChildren(); this.IdChild_comboBox.DisplayMemberPath = "Id"; this.IdChild_comboBox.SelectedValuePath = "Id"; }
private void addChildTab_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { comboBoxMom.ItemsSource = bl.getAllMothers(); comboBoxMom.DisplayMemberPath = "fullName"; comboBoxMom.SelectedIndex = -1; child = new BE.Child(); child.birthdayKid = new DateTime(1990, 1, 1); addChildTab.DataContext = child; }
public List <BE.Nanny> bestNannies(BE.Child child) { List <BE.Nanny> nannies = bestNannies(motherOfTheChild(child.Id)); nannies = nannies.Where(x => x.maxAgeChildren > monthsOld(child.dateOfBirth) && x.minAgeChildren < monthsOld(child.dateOfBirth)).ToList(); nannies = nannies.Where(x => childrenByNanny(x).Count < x.maxChildren).ToList(); return(nannies); }
private void Id_comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ComboBox && ((ComboBox)sender).SelectedIndex > -1) { child = bl.FindChilAcordId(GetSelectedChildId()); this.DetailsChildGrid.DataContext = child; } // this.DetailsChildGrid.Text = GetSelectedChildName(); // this.refreshDataGrid(GetSelectedChildName()); }
public void updateChild(BE.Child child) { BE.Child temp = DS.DataSource.childrenList.Find(x => x.Id == child.Id); if (temp == null) { throw new Exception("The is no child to update"); } DS.DataSource.childrenList.Remove(temp); DS.DataSource.childrenList.Add(child); }
/// <summary> /// Constructor of UpdateChildWin /// </summary> public UpdateChildWin() { InitializeComponent(); child = new BE.Child(); this.DataContext = child; bl = BL.FactoryBL.GetBL(); iDComboBox.ItemsSource = bl.GetAllChilds(); iDComboBox.DisplayMemberPath = "MainDetails"; iDComboBox.SelectedValuePath = "ID"; }
//public double LengthInAdrress(string ad1,string ad2) //{ // return GoogleMapsApi.GoogleMaps. //} public List <BE.Nanny> PotentionNanny(BE.Child child) { if (child == null) { throw new Exception("הילד המבוקש לא נימצא!"); } BE.Mother motherDetails = new BE.Mother(); motherDetails = SearchMother(x => x.MomId == child.MomId).FirstOrDefault(); List <BE.Nanny> templist = new List <BE.Nanny>(); List <BE.Nanny> allnanny = this.GetNannyList(); bool flag = false; foreach (BE.Nanny item in allnanny) { flag = false; for (int i = 0; i < 6; i++) { if (item.Days[i] == false && motherDetails.Days[i] == true || (item.MaxAge <WhatAge(child.ChildBirth) || item.MinAge> WhatAge(child.ChildBirth))) { flag = false; } if (motherDetails.Days[i] == true && item.Days[i] == true) //need this day { if (this.HoursStart(i, motherDetails) > this.HoursStart(i, item) || (this.HoursStart(i, motherDetails) == this.HoursStart(i, item) && (this.MinutesStart(i, motherDetails) <= MinutesStart(i, item)))) //שעת התחלה מוקדמת מהרצוי { if ((this.HourEnd(i, motherDetails) < this.HourEnd(i, item)) || (this.HourEnd(i, motherDetails) == this.HourEnd(i, item) && this.MinutesEnd(i, motherDetails) <= this.MinutesEnd(i, item))) //שעת סיום מאוחרת מהרצוי { flag = true; } } else { flag = false; } ////שעת התחלה שווה לרצוי //if (this.HoursStart(i, motherDetails) == this.HoursStart(i, item) && (this.MinutesStart(i, motherDetails) <= MinutesStart(i, item))) //{ // if ((this.HourEnd(i, motherDetails) < this.HourEnd(i, item)) || (this.HourEnd(i, motherDetails) == this.HourEnd(i, item) && this.MinutesEnd(i, motherDetails) <= this.MinutesEnd(i, item)))//שעת סיום מאוחרת מהרצוי // flag = true; //} } if (flag == false) { i = 6; } } if (flag) { templist.Add(item); } } return(templist); }
public void RemoveChild(BE.Child C) { //remove child from program listOfChilds.Remove(C); foreach (BE.Contract item in listOfContracts) //removes contracts that child is in { if (C.ChildId == item.ChildId) { RemoveContract(item); } } }
public void AddChild(BE.Child C) {//adds child to list after checking that he does not exist already XElement root = BasicXML.LoadData(); if (checkChild(C) == true) { throw new Exception("Child already exists"); } root.Add(ExtensionBE.ToXML(C)); BasicXML.Save(root); }
public bool checkChild(BE.Child N2) {//checks if child is already in list foreach (BE.Child item in GetListOfChildS()) { if (N2.ChildId == item.ChildId) { return(true); } } return(false); }