/// <summary> /// when select nanny all the nanny details would automaticlly appear in the contract fieds /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NannyDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (nanny != null) { contract = new BE.Contract(); this.contract.ChildId = (int)this.selectChildComboBox.SelectedValue; this.contract.NannyId = nanny.Id; this.contract.MonthlyRate = nanny.MonthlyRate; this.contract.WeeklyHours = bl.CalculateContractWeeklyHours(contract); if (nanny.EnanblePayForHour == true) { this.contract.HourlyRate = nanny.HourlyRate; } this.contractDetailsGrid.DataContext = contract; if (contract.PayPerHourOrMonth == BE.PaymentPer.Hour && contract.HourlyRate == null || selectChildComboBox.SelectedIndex < 0) { return; } this.contract.NetoRate = bl.CalculateContractRate(contract); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }