Beispiel #1
0
        private void btnFormClienteGuardar_Click(object sender, EventArgs e)
        {
            string msg = this.ValidarCliente();

            if (msg.Equals(string.Empty))
            {
                clsCliente cliente = new clsCliente(tbDni.Text, tbNombre.Text, tbApellido.Text, tbCorreo.Text, tbTelefono.Text, tbDireccion.Text);
                //Se esta guardando registro nuevo
                //se esta actualizando registro, por lo tanto no esta disponible btnLimpiar
                msg = (btnFormClienteLimpiar.Visible) ? cliente.Guardar() : cliente.Actualizar();
                if (msg.Equals(string.Empty))
                {
                    dgvClienteConfig();
                    btnFormClienteCancelar.PerformClick();
                    tbBuscar.Clear();
                }
                else
                {
                    MessageBox.Show(msg, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(msg, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            string sNombre, sPrimerApellido, sDocumento, sSegundoApellido, sTelefono, sEmail;

            sDocumento       = txtDocumento.Text;
            sNombre          = txtNombre.Text;
            sPrimerApellido  = txtPrimerApellido.Text;
            sSegundoApellido = txtSegundoApellido.Text;
            sTelefono        = txtTelefono.Text;
            sEmail           = txtEmail.Text;

            clsCliente oCliente = new clsCliente();

            oCliente.Documento       = sDocumento;
            oCliente.Nombre          = sNombre;
            oCliente.PrimerApellido  = sPrimerApellido;
            oCliente.SegundoApellido = sSegundoApellido;
            oCliente.Telefono        = sTelefono;
            oCliente.Email           = sEmail;

            if (oCliente.Actualizar())
            {
                lblError.Text = "Actualizó";
            }
            else
            {
                lblError.Text = oCliente.Error;
            }
            oCliente = null;
        }
Beispiel #3
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            string strDocumento, strNombre, strPrimerApellido, strSegundoApellido;
            string strDireccion;

            strDocumento       = txtDocumento.Text;
            strNombre          = txtNombre.Text;
            strPrimerApellido  = txtPrimerApellido.Text;
            strSegundoApellido = txtSegundoApellido.Text;
            strDireccion       = txtDireccion.Text;


            clsCliente oCliente = new clsCliente();

            oCliente.Documento       = strDocumento;
            oCliente.Nombre          = strNombre;
            oCliente.PrimerApellido  = strPrimerApellido;
            oCliente.SegundoApellido = strSegundoApellido;
            oCliente.Direccion       = strDireccion;


            if (oCliente.Actualizar())
            {
                lblError.Text = "Actualizó";
            }
            else
            {
                lblError.Text = oCliente.Error;
            }

            oCliente = null;
        }
Beispiel #4
0
        public static void ActualizarRemitente(long parCedula, string parNombre, long parTelefono, string parCorreo, string parDireccion, string parMunicipio)
        {
            clsCliente varObjCliente = new clsCliente();

            atrMensajeResultado = varObjCliente.Actualizar(parCedula, parNombre, parTelefono, parCorreo, parDireccion, parMunicipio);
        }
Beispiel #5
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            string mensaje = "";

            try
            {
                errorProvider1.Clear();
                if (Utilidades.ValidarForm(this, errorProvider1) == false)
                {
                    return;
                }
                if (Program.Evento == 0)
                {
                    P.Nombre         = txtNombre.Text;
                    P.Idtipoc        = Convert.ToInt32(cbTipoCliente.SelectedValue);
                    P.Idgenero       = cbGenero.SelectedValue.ToString();
                    P.Idnacionalidad = Convert.ToInt32(cbNacionalidad.SelectedValue);
                    P.Limite         = Convert.ToDouble(txtLimite.Text);
                    mensaje          = P.Registrar();
                    if (mensaje == "1")
                    {
                        P.Identificacion = txtIdentificacion.Text;
                        if (cbTipoCliente.Text == "Empresa")
                        {
                            P.Idtipoi = 8;
                        }
                        else if (cbTipoCliente.Text == "Persona")
                        {
                            P.Idtipoi = 6;
                        }
                        mensaje = P.RegistrarI();
                        for (int x = 0; x < dtgContacto.Rows.Count; x++)
                        {
                            P.Contacto = dtgContacto.Rows[x].Cells[1].Value.ToString();
                            P.Idtipoc  = Convert.ToInt32(dtgContacto.Rows[x].Cells[2].Value);
                            mensaje    = P.RegistrarC();
                        }
                        for (int x = 0; x < dtgDireccion.Rows.Count; x++)
                        {
                            P.Direccion = dtgDireccion.Rows[x].Cells[1].Value.ToString();
                            P.Idbarrio  = Convert.ToInt32(dtgDireccion.Rows[x].Cells[2].Value);
                            P.Idciudad  = Convert.ToInt32(dtgDireccion.Rows[x].Cells[3].Value);
                            P.Idregion  = Convert.ToInt32(dtgDireccion.Rows[x].Cells[4].Value);
                            mensaje     = P.RegistrarD();
                        }
                        if (mensaje == "1")
                        {
                            MessageBoxEx.Show("Registrado con éxito", "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Limpiar();
                        }
                    }
                }
                else if (Program.Evento == 1)
                {
                    P.Idcliente      = Program.Codigo;
                    P.Nombre         = txtNombre.Text;
                    P.Idtipoc        = Convert.ToInt32(cbTipoCliente.SelectedValue);
                    P.Idgenero       = cbGenero.SelectedValue.ToString();
                    P.Idnacionalidad = Convert.ToInt32(cbNacionalidad.SelectedValue);
                    P.Limite         = Convert.ToDouble(txtLimite.Text);
                    mensaje          = P.Actualizar();
                    if (mensaje == "1")
                    {
                        P.Identificacion = txtIdentificacion.Text;
                        if (cbTipoCliente.Text == "Empresa")
                        {
                            P.Idtipoi = 8;
                        }
                        else if (cbTipoCliente.Text == "Persona")
                        {
                            P.Idtipoi = 6;
                        }
                        mensaje = P.ActualizarI();
                        for (int x = 0; x < dtgContacto.Rows.Count; x++)
                        {
                            P.Idcontacto = Convert.ToInt32(dtgContacto.Rows[x].Cells[0].Value);
                            P.Contacto   = dtgContacto.Rows[x].Cells[1].Value.ToString();
                            P.Idtipoc    = Convert.ToInt32(dtgContacto.Rows[x].Cells[2].Value);
                            mensaje      = P.ActualizarC();
                        }
                        for (int x = 0; x < dtgDireccion.Rows.Count; x++)
                        {
                            P.Iddireccion = Convert.ToInt32(dtgDireccion.Rows[x].Cells[0].Value);
                            P.Direccion   = dtgDireccion.Rows[x].Cells[1].Value.ToString();
                            P.Idbarrio    = Convert.ToInt32(dtgDireccion.Rows[x].Cells[2].Value);
                            P.Idciudad    = Convert.ToInt32(dtgDireccion.Rows[x].Cells[3].Value);
                            P.Idregion    = Convert.ToInt32(dtgDireccion.Rows[x].Cells[4].Value);
                            mensaje       = P.ActualizarD();
                        }
                        if (mensaje == "1")
                        {
                            MessageBoxEx.Show("Actualizado con éxito", "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Limpiar();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }
        }