Example #1
0
        private void btnaceptar_Click(object sender, EventArgs e)
        {
            Recibo formRecibo = Owner as Recibo;

            formRecibo.txtcompra.Text        = dataGridView1.CurrentRow.Cells["Nombre"].Value.ToString();
            formRecibo.ClientProducId        = dataGridView1.CurrentRow.Cells["ClientProducId"].Value.ToString();
            formRecibo.txtmontoabono.Enabled = true;
            formRecibo.montoProducto         = dataGridView1.CurrentRow.Cells["Nuevo_Saldo"].Value.ToString();

            this.Close();
        }
Example #2
0
        private void btnguardar_Click(object sender, EventArgs e)
        {
            bool sucess = false;

            sucess = ReciboValidacion();

            if (sucess)
            {
                Recibo     recibo = new Recibo();
                VentaModel venta  = new VentaModel();

                venta.recibo.Codigo         = Convert.ToString(txtCodigo.Text);
                venta.recibo.ClienteId      = new Guid(clienteId);
                venta.recibo.FechaAbono     = (DateTime)dpfechaabono.Value;
                venta.recibo.Concepto       = Convert.ToString(txtconcepto.Text);
                venta.recibo.MontoAbono     = Convert.ToDecimal(txtmontoabono.Text);
                venta.recibo.NuevoSaldo     = Convert.ToDecimal(txtnuevosaldo.Text);
                venta.recibo.ClientProducId = new Guid(ClientProducId);

                if (Editar == false)
                {
                    if (controller.InsertarRecibo(venta.recibo))
                    {
                        LimpiarTextBox();
                        ListRecibos();
                    }
                }
                if (Editar == true)
                {
                    venta.recibo.ReciboId = new Guid(reciboId);
                    try
                    {
                        if (controller.ActualizarRecibo(venta.recibo))
                        {
                            LimpiarTextBox();
                            ListRecibos();
                            Editar = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("No se pudo insertar los datos por: " + ex);
                    }
                }
            }
        }