コード例 #1
0
        private void Consultabutton_Click(object sender, EventArgs e)
        {
            int id;

            switch (TipocomboBox.SelectedIndex)
            {
            //ID
            case 0:
                LimpiarError();
                if (SetError(1))
                {
                    MessageBox.Show("Introduce un numero");
                    return;
                }
                id      = Convert.ToInt32(CriteriotextBox.Text);
                filtrar = t => t.EntradaInversionID == id && (t.Fecha.Day >= DesdedateTimePicker.Value.Day) && (t.Fecha.Month >= DesdedateTimePicker.Value.Month) && (t.Fecha.Year >= DesdedateTimePicker.Value.Year) &&
                          (t.Fecha.Day <= HastadateTimePicker.Value.Day) && (t.Fecha.Month <= HastadateTimePicker.Value.Month) && (t.Fecha.Year <= HastadateTimePicker.Value.Year);
                ;
                break;

            //Listar Todo
            case 1:

                filtrar = t => true;
                break;
            }

            inversions = EntradaInversionBLL.GetList(filtrar);

            ConsultadataGridView.DataSource = inversions;
        }
コード例 #2
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            bool paso = false;


            EntradaInversion entrada = Llenaclase();

            if (Utilities.Utils.ToInt(EntradaInversionIDTextbox.Text) == 0)
            {
                paso = EntradaInversionBLL.Guardar(entrada);
            }
            else
            {
                int id    = Convert.ToInt32(EntradaInversionIDTextbox.Text);
                var entry = EntradaInversionBLL.Buscar(id);

                if (entry != null)
                {
                    paso = EntradaInversionBLL.Editar(entrada);
                }
                else
                {
                    Utilities.Utils.ShowToastr(this, "ID no existe", "Fallido", "error");
                }
                Limpiar();
            }



            if (paso)
            {
                Utilities.Utils.ShowToastr(this, "Guardado", "exito", "exito");
                Limpiar();
            }
            else
            {
                Utilities.Utils.ShowToastr(this, "No se pudo Guardar", "Fallido", "error");
            }
        }
コード例 #3
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            if (validar(3))
            {
                MessageBox.Show("Dijite un Monto");
                return;
            }

            if (validar(4))
            {
                MessageBox.Show("Digite un monto", "Validar");
                return;
            }
            if (validar(2))
            {
                MessageBox.Show("Favor de Llenar las Casillas");
                return;
            }

            else
            {
                bool paso = false;


                EntradaInversion entrada = Llenaclase();

                if (EntradaInversionIDnumericUpDown.Value == 0)
                {
                    paso = EntradaInversionBLL.Guardar(entrada);
                }
                else
                {
                    int id    = Convert.ToInt32(EntradaInversionIDnumericUpDown.Value);
                    var entry = EntradaInversionBLL.Buscar(id);

                    if (entry != null)
                    {
                        paso = EntradaInversionBLL.Editar(entrada);
                    }
                    else
                    {
                        MessageBox.Show("Id no existe", "Falló",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }


                EntradaInversionIDnumericUpDown.Value = 0;
                FechadateTimePicker.Value             = DateTime.Now;
                MontotextBox.Clear();
                InversionerrorProvider.Clear();
                if (paso)
                {
                    MessageBox.Show("Guardado!", "Exitoso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    EntradaInversionIDnumericUpDown.Value = 0;
                    FechadateTimePicker.Value             = DateTime.Now;
                    MontotextBox.Clear();
                    InversionerrorProvider.Clear();
                }
                else
                {
                    MessageBox.Show("No pudo Guardar!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }