private void Buscarbutton_Click(object sender, EventArgs e)
        {
            int     id      = Convert.ToInt32(reciboIdNumericUpDown.Value);
            Recibos recibos = ReciboBLL.Buscar(id);

            if (recibos != null)
            {
                LlenaCampos(recibos);


                if (MessageBox.Show("¿Desea Imprimir el Recibo?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (var item in  ReciboBLL.GetList(X => true))
                    {
                        if (item.ReciboId == reciboIdNumericUpDown.Value)
                        {
                            VentanaReciboReporte abrir = new VentanaReciboReporte(ReciboBLL.GetList(X => X.ReciboId == item.ReciboId));
                            abrir.Show();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("No se encontro!", "Fallo",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
        public void GetListTest()
        {
            var listar = ReciboBLL.GetList(x => true);

            Assert.IsNotNull(listar);
        }
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            if (Validar(2))
            {
                MessageBox.Show("Debe Agregar Algun Producto al Grid", "Validación",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                foreach (var item in BLL.ActivodeNegocioBLL.GetList(x => x.ActivodeNegocioId == 1))
                {
                    if (item.Activo < Convert.ToDecimal(montoTotalTextBox.Text))
                    {
                        MessageBox.Show("La Compraventa No dispone de Esa Cantidad de dinero ", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                Recibos recibos = LlenaClase();
                bool    Paso    = false;

                //Determinar si es Guardar o Modificar


                if (reciboIdNumericUpDown.Value == 0)
                {
                    Paso = ReciboBLL.Guardar(recibos);
                    HayErrores.Clear();
                }
                else
                {
                    var V = ReciboBLL.Buscar(Convert.ToInt32(reciboIdNumericUpDown.Value));

                    if (V != null)
                    {
                        Paso = ReciboBLL.Editar(recibos);
                    }
                    HayErrores.Clear();
                }


                if (MessageBox.Show("¿Desea Imprimir el Recibo?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    List <Recibos> list = ReciboBLL.GetList(X => true);

                    List <Recibos> nuevo = new List <Recibos>();

                    nuevo.Add(list.Last());

                    VentanaReciboReporte abrir = new VentanaReciboReporte(nuevo);
                    abrir.Show();
                }


                //Informar el resultado
                if (Paso)
                {
                    MessageBox.Show("Guardado!!", "Exito",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo guardar!!", "Fallo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }