Ejemplo n.º 1
0
        public ClasseForm(OperacaoEnum operacaoEnum, int idBanco)
        {
            InitializeComponent();
            Application.DoEvents();

            this.operacaoEnum = operacaoEnum;

            switch (operacaoEnum)
            {
            case OperacaoEnum.Inclusao:
                labelTitulo.Text = "Classe - Novo ";
                TextBoxID.Text   = "Automático";
                break;

            case OperacaoEnum.Alteracao:
                labelTitulo.Text = "Classe - Alteração ";
                break;

            case OperacaoEnum.Exclusao:
                labelTitulo.Text          = "Classe - Exclusão ";
                TextBoxID.ReadOnly        = true;
                TextBoxDescricao.ReadOnly = true;
                TextBoxEmpresaID.ReadOnly = true;
                break;

            default:
                MessageBox.Show("Operação não definida!");
                return;
            }

            servico.DataRepositorio = servico.BuscarID(idBanco);
            if (servico.DataRepositorio == null)
            {
                //tituloLabel.Text = "Banco - Novo ";
                //IDtextBox.Text = "Automático";
                TextBoxID.ReadOnly = true;
                TextBoxDescricao.Focus();

                TextBoxEmpresaID.ReadOnly = true;
                //TextBoxEmpresaID.Text = SistemaService.EmpresaLogada.ID;

                //banco = new Banco();
                servico.NewModel();
            }
            else
            {
                TextBoxID.ReadOnly = true;
                TextBoxDescricao.Focus();

                TextBoxID.Text        = servico.DataRepositorio.ID.ToString();
                TextBoxDescricao.Text = servico.DataRepositorio.Nome;
                TextBoxEmpresaID.Text = servico.DataRepositorio.EmpresaId;
            }
        }
Ejemplo n.º 2
0
        public ClasseForm()
        {
            InitializeComponent();
            Application.DoEvents();

            labelTitulo.Text   = "Classe - Novo ";
            TextBoxID.Text     = "Automático";
            TextBoxID.ReadOnly = true;
            TextBoxDescricao.Focus();

            this.operacaoEnum = OperacaoEnum.Inclusao;

            servico.NewModel();
        }
Ejemplo n.º 3
0
        private void ButtonSalvar_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            DateTime dataCompra;

            if (String.IsNullOrEmpty(TextBoxDescricao.Text))
            {
                TextBoxDescricao.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe a descrição da despesa."));
                return;
            }

            if (String.IsNullOrEmpty(TextBoxValor.Text))
            {
                TextBoxValor.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe o valor da despesa."));
                return;
            }

            if (DatePickerCompra.SelectedDate == null)
            {
                DatePickerCompra.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Data da compra não informada."));
                return;
            }
            else
            {
                dataCompra = DatePickerCompra.SelectedDate.Value;
            }

            if (participantes.Count == 0)
            {
                TabablzControlDespesa.SelectedIndex = 2;
                Task.Factory.StartNew(() => messageQueue.Enqueue("Selecione os participantes da despesa."));
                return;
            }

            if (control.Salvar(TextBoxDescricao.Text, TextBoxValor.Text, dataCompra, ListViewItens.ItemsSource, participantes))
            {
                ControlDashboard.LoadWindow(new UserControlListarDespesa());
            }
        }