示例#1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtnombre.Text == string.Empty)
                {
                    mensajeerror("Falta ingresar algunos datos, serán remarcados");



                    if (this.textBox1.Text.Length == 0)
                    {
                        errorProvider1.SetError(this.textBox1, "ingrese el Nombre del Año");
                    }
                    else
                    {
                        errorProvider1.SetError(this.textBox1, "");
                    }
                }
                else
                {
                    if (this.isnuevo)
                    {
                        rpta = NPago.Insertar(Convert.ToInt32(textBox1.Text), Convert.ToInt32(txtnombre.Text), dateTimePicker1.Value, Convert.ToInt32(textBox3.Text));
                    }
                    else
                    {
                        rpta = NPago.Editar(Convert.ToInt32(this.txtiddamnificado.Text), Convert.ToInt32(textBox1.Text), Convert.ToInt32(txtnombre.Text), dateTimePicker1.Value, Convert.ToInt32(textBox3.Text));
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.isnuevo)
                        {
                            this.mensajeok("Se Insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.mensajeok("Se Actualizó de forma correcta el registro");
                        }
                    }
                    else
                    {
                        this.mensajeerror(rpta);
                    }

                    this.isnuevo  = false;
                    this.iseditar = false;
                    this.habilitar(false);
                    this.botones();
                    this.Limpiar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
示例#2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (dtpFechaPago.Text == string.Empty || txtMonto.Text == string.Empty)
            {
                MessageBox.Show("¡No se admiten campos vacios");
            }
            else
            {
                try
                {
                    frmSeleccionarChofer frm = new frmSeleccionarChofer(this);
                    int idPago = NPago.Insertar(dtpFechaPago.Value.Day.ToString(), dtpFechaPago.Value.Month.ToString(), dtpFechaPago.Value.Year.ToString(), dtpFechaPago.Value.Hour.ToString() + ":" + dtpFechaPago.Value.Minute.ToString(), Convert.ToInt32(miid), Convert.ToDouble(txtMonto.Text));
                    // GuardarDatosImpresion(dtpFechaPago.Value.Day.ToString()+"/"+dtpFechaPago.Value.Month.ToString() + "/" + dtpFechaPago.Value.Year.ToString(), dtpFechaPago.Value.Hour.ToString() + ":" + dtpFechaPago.Value.Minute.ToString());
                    MostrarTodosLosPagos();
                    btnNuevo.Enabled = true;

                    int Result = Negocio.NDeuda.VincularPago(idPago, MIidDeuda);

                    if (Result > 0)
                    {
                        MessageBox.Show("Pago completado correctamente");
                        BloquearCampos(false);
                        Limpiar();
                        lblChofer.Text = "Chofer";
                    }
                    else
                    {
                        //TODO Aca lo que pasa si falla el update
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
        }