private void updateMother_Click(object sender, RoutedEventArgs e) { try { if (errorMessages.Any()) //errorMessages.Count > 0 { string err = "Exception:"; foreach (var item in errorMessages) { err += "\n" + item; } MessageBox.Show(err); return; } else { if (mother != null) { bl.updateMother(mother); } this.DataContext = mother = null; //updates the combo list after the update refreshData(); this.Close(); // this.updateNannyComboBox.ItemsSource = bl.getNanniesList(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void addMother(BE.Mother mother) { if (mothersList().FindAll(x => x.id == mother.id).Count != 0) { throw new Exception("tjere is mother with such id"); } XElement firstName = new XElement("firstName", mother.firstName); XElement lastName = new XElement("lastName", mother.lastName); XElement id = new XElement("id", mother.id); XElement address = new XElement("address", mother.address); XElement phoneNumber = new XElement("phoneNumber", mother.phoneNumber); XElement nannyRequestedAddress = new XElement("nannyRequestedAddress", mother.nannyRequestedAddress); XElement isNeedNannyToday = new XElement("neededDays"); XElement neededHours = new XElement("neededHours"); XElement notes = new XElement("notes", mother.notes); for (int i = 0; i < 6; i++) { isNeedNannyToday.Add(new XElement("day" + i.ToString().ToUpper(), ToXMLstring(mother.isNeedNannyToday[i]))); if (mother.isNeedNannyToday[i]) { neededHours.Add(new XElement("start" + i.ToString().ToUpper(), mother.neededHours[i, 0].ToString(@"hh\:mm\:ss"))); neededHours.Add(new XElement("end" + i.ToString().ToUpper(), mother.neededHours[i, 1].ToString(@"hh\:mm\:ss"))); } } motherRoot.Add(new XElement("mother", id, firstName, lastName, address, nannyRequestedAddress, phoneNumber, notes, isNeedNannyToday, neededHours)); motherRoot.Save(motherPath); }
private void deleteMomCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (deleteMomCombo.SelectedIndex != -1) { mother = (BE.Mother)deleteMomCombo.SelectedItem; } }
private void updateMotherComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Mother M = updateMotherComboBox.SelectedItem as Mother; if (M != null) { mother = M.getMotherCopy(); this.DataContext = mother; // this.SundayBeginningTimeComboBox.SelectedItem = M.NannysHours[0, 0]; this.SundayBeginningTimeComboBox.SelectedValue = M.NannysHours[0, 0]; this.MondayBeginningTimeComboBox.SelectedValue = M.NannysHours[0, 1]; this.TuesdayBeginningTimeComboBox.SelectedValue = M.NannysHours[0, 2]; this.WednesdayBeginningTimeComboBox.SelectedValue = M.NannysHours[0, 3]; this.ThursdayBeginningTimeComboBox.SelectedValue = M.NannysHours[0, 4]; this.FridayBeginningTimeComboBox.SelectedValue = M.NannysHours[0, 5]; this.SundayEndTimeComboBox.SelectedValue = M.NannysHours[1, 0]; this.MondayEndTimeComboBox.SelectedValue = M.NannysHours[1, 1]; this.TuesdayEndTimeComboBox.SelectedValue = M.NannysHours[1, 2]; this.WednesdayEndTimeComboBox.SelectedValue = M.NannysHours[1, 3]; this.ThursdayEndTimeComboBox.SelectedValue = M.NannysHours[1, 4]; this.FridayEndTimeComboBox.SelectedValue = M.NannysHours[1, 5]; } }
public AddingMother() { InitializeComponent(); this.UpdateButton.IsEnabled = false; bl = BL.FactoryBL.GetBL(); mother = new Mother(); }
private void DeleteMotherButton_Click(object sender, RoutedEventArgs e) { mother = BL.FactoryBL.getBL().GetMotherByID(mother.ID); BL.FactoryBL.getBL().DeleteMother(mother); MessageBox.Show("the mother is deleted"); mother = new BE.Mother(); DataContext = mother.ID; this.Close(); }
public void removeMother(BE.Mother mother) { foreach (var item in getChildOfMother(mother)) { removeContract(getContractOfChild(item)); removeChild(item); } dal.removeMother(mother); }
public deleteMother() { InitializeComponent(); DelMom = new BE.Mother(); this.DataContext = DelMom; bl = BL.FactoryBL.GetBL(); textBox.ItemsSource = bl.getAllMothers(); textBox.DisplayMemberPath = "_fullName"; }
public UpdateMotherWindow() { InitializeComponent(); bl = BL.FactoryBL.GetBL(); mom = new BE.Mother(); mom.startHour = new DateTime[6]; mom.endHour = new DateTime[6]; mom.DaysRequestMom = new bool[6]; }
public DeleteMotherWindow() { InitializeComponent(); mother = new Mother(); bl = FactoryBL.getBL(); this.grid1.DataContext = mother; this.IDComboBox.ItemsSource = from z in bl.GetMothers() select z.ID; }
public BL.IBL bl; // connect to BL layer public addMother() { InitializeComponent(); addMom = new BE.Mother(); addMom._startHour = new DateTime[6]; addMom._endHour = new DateTime[6]; addMom._daysRequestMom = new bool[6]; thisGrid.DataContext = addMom; bl = BL.FactoryBL.GetBL(); }
public AddMotherWindow() { InitializeComponent(); momToAdd = new BE.Mother(); momToAdd.startHour = new DateTime[6]; momToAdd.endHour = new DateTime[6]; momToAdd.DaysRequestMom = new bool[6]; AddMomGrid.DataContext = momToAdd; bl = BL.FactoryBL.GetBL(); }
public IEnumerable <BE.Child> getChildOfMother(BE.Mother Mother) { IEnumerable <BE.Child> temp = getAllChild(); var child = from ch in temp where ch.IdOfMom == Mother.Id select ch; return(child); }
private void IdMother_SelectionChanged(object temp, SelectionChangedEventArgs e) { if (temp is ComboBox && ((ComboBox)temp).SelectedIndex > -1) { try { addA_Mother = (Mother)IdMother.SelectedItem; thisGrid.DataContext = addA_Mother; MessageBox.Show("Mother was found, you can continue updating"); if (addA_Mother._daysRequestMom[0] == true) { SunCheck.IsChecked = true; SunStart.Value = addA_Mother._startHour[0].ToUniversalTime(); SunEnd.Value = addA_Mother._endHour[0].ToUniversalTime(); } if (addA_Mother._daysRequestMom[1] == true) { MonCheck.IsChecked = true; MonStart.Value = addA_Mother._startHour[1].ToUniversalTime(); MonEnd.Value = addA_Mother._endHour[1].ToUniversalTime(); } if (addA_Mother._daysRequestMom[2] == true) { TueCheck.IsChecked = true; TueStart.Value = addA_Mother._startHour[2].ToUniversalTime(); TueEnd.Value = addA_Mother._endHour[2].ToUniversalTime(); } if (addA_Mother._daysRequestMom[3] == true) { WedCheck.IsChecked = true; WedStart.Value = addA_Mother._startHour[3].ToUniversalTime(); WedEnd.Value = addA_Mother._endHour[3].ToUniversalTime(); } if (addA_Mother._daysRequestMom[4] == true) { ThuCheck.IsChecked = true; ThuStart.Value = addA_Mother._startHour[4].ToUniversalTime(); ThuEnd.Value = addA_Mother._endHour[4].ToUniversalTime(); } if (addA_Mother._daysRequestMom[5] == true) { FriCheck.IsChecked = true; FriStart.Value = addA_Mother._startHour[5].ToUniversalTime(); FriEnd.Value = addA_Mother._endHour[5].ToUniversalTime(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public BL.IBL bl; // connect to BL layer public addContract() { InitializeComponent(); addMom = new BE.Mother(); addCont = new BE.Contract(); // thisGrid.DataContext = addCont; bl = BL.FactoryBL.GetBL(); momBox.ItemsSource = bl.getAllMothers(); momBox.DisplayMemberPath = "_fullName"; }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (motherUpdateCombo.SelectedIndex != -1) { button3.IsEnabled = true; mother = (BE.Mother)motherUpdateCombo.SelectedItem; addressMomTextBox1.Text = mother.AddressMom; addressForNannyTextBox1.Text = mother.AddressForNanny; updateMomTab.DataContext = mother; } }
private void addMomTab_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (mother == null) { mother = new BE.Mother(); mother.startHour = new DateTime[6]; mother.endHour = new DateTime[6]; mother.DaysRequestMom = new bool[6]; addMomTab.DataContext = mother; } }
public updateMother() { InitializeComponent(); addA_Mother = new BE.Mother(); addA_Mother._startHour = new DateTime[6]; addA_Mother._endHour = new DateTime[6]; addA_Mother._daysRequestMom = new bool[6]; thisGrid.DataContext = addA_Mother; bl = BL.FactoryBL.GetBL(); IdMother.ItemsSource = bl.getAllMothers(); IdMother.DisplayMemberPath = "_fullName"; }
public void updateMother(BE.Mother mother) { foreach (BE.Mother item in ds.mothers) { if (item == mother) { ds.mothers.Remove(item); ds.mothers.Add(mother); break; } } }
private void momBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { addMom = (Mother)momBox.SelectedItem; // thisGrid.DataContext = addMom; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public List <BE.Nanny> getMatchNanniesList(BE.Mother mom) { IEnumerable <BE.Nanny> temp = dal.getAllNanny(); List <BE.Nanny> matchNannies = new List <BE.Nanny>(); List <BE.Nanny> fiveBest = new List <BE.Nanny>(); int count = 0; for (int j = 0; j < 6; j++) { if (mom.dayOfWork[j] == true) { count++;//the number days that the mom want nanny } } //groups of nannies according to compatibility to the mom days IEnumerable <IGrouping <int, BE.Nanny> > result = from nanny in temp group nanny by compareMomNannies(nanny, mom); var newResult = from IGrouping <int, BE.Nanny> item in result orderby item.Key descending select item; int i = -1; foreach (IGrouping <int, BE.Nanny> items in newResult) {//Run on the groups. if there is group of nannies that the key is same to count, //add all the nannies of its group to matchNannies list(its all the nannies that fits // perfectly to the mom. else take the 5 best if (items.Key == count) { foreach (BE.Nanny item in items) { matchNannies.Add(item); } return(matchNannies); } else { foreach (BE.Nanny item in items) { i++; if (i == 5) { return(fiveBest); } fiveBest.Add(item); } } } return(fiveBest); }
private void momIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { BE.Mother mother = momIdComboBox.SelectedItem as Mother; child.MomId = mother.Id; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//constractor public MotherWindow() { InitializeComponent(); bl = BL.FactoryBl.getBl(); option.SelectionChanged += Option_SelectionChanged; mother = new BE.Mother(); this.MotherDetailsGrid.DataContext = mother; idComboBox.ItemsSource = null; this.idComboBox.ItemsSource = bl.getMothers(); idComboBox.DisplayMemberPath = "idAndName"; idComboBox.SelectedValuePath = "id"; errorMessages = new List <string>(); }
private void button_Click(object sender, RoutedEventArgs e) { try { //mom.IdMom = Convert.ToInt64(idMomTextBox.Text); mom = bl.getMother(Convert.ToInt64(idMomTextBox.Text)); this.DataContext = mom; if (mom.DaysRequestMom[0] == true) { SunCheck.IsChecked = true; SunStart.Value = mom.startHour[0]; SunEnd.Value = mom.endHour[0]; } if (mom.DaysRequestMom[1] == true) { MonCheck.IsChecked = true; MonStart.Value = mom.startHour[1]; MonEnd.Value = mom.endHour[1]; } if (mom.DaysRequestMom[2] == true) { TueCheck.IsChecked = true; TueStart.Value = mom.startHour[2]; TueEnd.Value = mom.endHour[2]; } if (mom.DaysRequestMom[3] == true) { WedCheck.IsChecked = true; WedStart.Value = mom.startHour[3]; WedEnd.Value = mom.endHour[3]; } if (mom.DaysRequestMom[4] == true) { ThuCheck.IsChecked = true; ThuStart.Value = mom.startHour[4]; ThuEnd.Value = mom.endHour[4]; } if (mom.DaysRequestMom[5] == true) { FriCheck.IsChecked = true; FriStart.Value = mom.startHour[5]; FriEnd.Value = mom.endHour[5]; } } catch (Exception exception) { MessageBox.Show("check your input and try again"); } }
private void textBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ComboBox && ((ComboBox)sender).SelectedIndex > -1) { try { DelMom = (Mother)textBox.SelectedItem; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void buttonSearchContract_Click(object sender, RoutedEventArgs e) { try { contract = bl.getContract(Convert.ToInt32(idChildTextBox.Text)); this.DataContext = contract; mom = bl.getMother(bl.getChild(Convert.ToInt64(idChildTextBox.Text)).idMom); if (mom.DaysRequestMom[0] == true) { SunCheck.IsChecked = true; SunStart.Value = mom.startHour[0]; SunEnd.Value = mom.endHour[0]; } if (mom.DaysRequestMom[1] == true) { MonCheck.IsChecked = true; MonStart.Value = mom.startHour[1]; MonEnd.Value = mom.endHour[1]; } if (mom.DaysRequestMom[2] == true) { TueCheck.IsChecked = true; TueStart.Value = mom.startHour[2]; TueEnd.Value = mom.endHour[2]; } if (mom.DaysRequestMom[3] == true) { WedCheck.IsChecked = true; WedStart.Value = mom.startHour[3]; WedEnd.Value = mom.endHour[3]; } if (mom.DaysRequestMom[4] == true) { ThuCheck.IsChecked = true; ThuStart.Value = mom.startHour[4]; ThuEnd.Value = mom.endHour[4]; } if (mom.DaysRequestMom[5] == true) { FriCheck.IsChecked = true; FriStart.Value = mom.startHour[5]; FriEnd.Value = mom.endHour[5]; } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
public void removeMother(BE.Mother mother) { XElement motherElement; try { motherElement = (from mo in motherRoot.Elements() where int.Parse(mo.Element("id").Value) == mother.id select mo).FirstOrDefault(); motherElement.Remove(); } catch { throw new Exception("can not delete mother"); } }
public void addMother(BE.Mother mother) { if (searchMother(mother.Id) != null) { throw (new Exception("the Mother is already exist in the Mother list")); } if (mother.AreaOfLookFor == null) { mother.AreaOfLookFor = mother.Address; } dal.addMother(mother); }
private void buttonSerchChildNanny_Click(object sender, RoutedEventArgs e) { try { mom = bl.getMother(Convert.ToInt64(textBoxMom.Text)); childList = bl.getKids(a => a.idMom == mom.IdMom); dataGridChildList.ItemsSource = childList; nannyList = bl.getAllCompatibleNanny(mom); dataGridNannyList.ItemsSource = nannyList; } catch (Exception EX) { MessageBox.Show(EX.Message); } }
private void button1_Click(object sender, RoutedEventArgs e) { try { mother.AddressMom = addressMomTextBox.Text; mother.AddressForNanny = addressForNannyTextBox.Text; bl.addMom(mother); mother = null; addMomTab.DataContext = mother; MessageBox.Show("אם נוספה בהצלחה"); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }