private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            if (TextBoxValue.Text == string.Empty)
            {
                TextBoxValue.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe o valor da transferência"));
                return;
            }

            if (DatePickerData.Text == string.Empty)
            {
                DatePickerData.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a data da transferência"));
                return;
            }

            if (ComboBoxOut.Text == string.Empty)
            {
                ComboBoxOut.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a conta de saída"));
                return;
            }

            if (ComboBoxIn.Text == string.Empty)
            {
                ComboBoxIn.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a conta de entrada"));
                return;
            }

            Double   value      = Double.Parse(TextBoxValue.Text, NumberStyles.Currency);
            DateTime date       = DatePickerData.SelectedDate ?? DateTime.Now;
            var      accountOut = ComboBoxOut.SelectedItem;
            var      accountIn  = ComboBoxIn.SelectedItem;

            if (accountIn == accountOut)
            {
                ComboBoxIn.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("A conta de saída deve ser diferente da conta de entrada!"));
                return;
            }

            control.SaveTransferCash(value, date, accountOut, accountIn);
            LoadTransfers();

            TextBoxValue.Text         = string.Empty;
            ComboBoxOut.SelectedIndex = -1;
            ComboBoxIn.SelectedIndex  = -1;
            DatePickerData.Text       = string.Empty;
        }
Exemplo n.º 2
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            if (TextBoxValue.Text == string.Empty)
            {
                TextBoxValue.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Entrez la valeur de transfert"));
                return;
            }

            if (DatePickerData.Text == string.Empty)
            {
                DatePickerData.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Indiquez la date de transfert"));
                return;
            }

            if (ComboBoxOut.Text == string.Empty)
            {
                ComboBoxOut.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Déclarer le compte de sortie"));
                return;
            }

            if (ComboBoxIn.Text == string.Empty)
            {
                ComboBoxIn.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Saisir le compte d'entrée"));
                return;
            }

            Double   value      = Double.Parse(TextBoxValue.Text, NumberStyles.Currency);
            DateTime date       = DatePickerData.SelectedDate ?? DateTime.Now;
            var      accountOut = ComboBoxOut.SelectedItem;
            var      accountIn  = ComboBoxIn.SelectedItem;

            control.SaveTransferCash(value, date, accountOut, accountIn);
            LoadTransfers();

            TextBoxValue.Text         = string.Empty;
            ComboBoxOut.SelectedIndex = -1;
            ComboBoxIn.SelectedIndex  = -1;
            DatePickerData.Text       = string.Empty;
        }