Пример #1
0
        /// <summary>
        /// To add a contract
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddContractButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (App.bl.GetAllChild().Count() == 0 ||
                    App.bl.GetAllNanny().Count() == 0)
                {
                    throw new Exception("To create a contract you need at least one child and one nanny.\nYou can consult our database to check which data already exists.");
                }

                AddWindow       add_w      = new AddWindow();
                ContractControl contract_c = new ContractControl();
                contract_c.HelpDataContext('a');

                contract_c.Margin = new Thickness(10);
                add_w.myGrid.Children.Add(contract_c);
                Grid.SetRow(contract_c, 0);

                add_w.ShowDialog();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "WARNING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Пример #2
0
        /// <summary>
        /// On select other contract
        /// </summary>
        private void OnSelectedContractChanged()
        {
            ContractControl contract_c = null;

            if (SelectedComponent != 3)
            {
                return;
            }
            contract_c = new ContractControl();
            contract_c.OnDeletingItem += this.RefreshDataGrid;
            contract_c.OnUpdatingItem += this.RefreshDataGrid;

            ItemDetails.Content = contract_c;
            contract_c.Margin   = new Thickness(20);

            contract_c.UserTitle.Content       = "Update the contract";
            contract_c.ButtonContent.Content   = "Update";
            contract_c.DeleteButton.Visibility = Visibility.Visible;

            contract_c.contract = (Contract)ContractDetails.SelectedItem;
            if (contract_c.contract.Signed == false)
            {
                contract_c.Background = new RadialGradientBrush(Colors.White, Colors.Red);
            }
            contract_c.DataContext = new Contract(contract_c.contract);
            contract_c.DoDataContext();
            contract_c.ChildComboBox.IsEnabled = false;
            contract_c.NannyComboBox.IsEnabled = false;
            contract_c.ContractStart.IsEnabled = false;

            contract_c.Signed.Visibility           = Visibility.Visible;
            contract_c.SignedCheckBox.Visibility   = Visibility.Visible;
            contract_c.Distance.Visibility         = Visibility.Visible;
            contract_c.ContractDistance.Visibility = Visibility.Visible;
            contract_c.Cost.Visibility             = Visibility.Visible;
            contract_c.SalaryText.Visibility       = Visibility.Visible;
        }