コード例 #1
0
        public void btn_Agregar_Agregarcliente_Click(object sender, EventArgs e)
        {
            form_cliente fi   = new form_cliente();
            Home         home = new Home();

            try
            {
                datos.agregarUsuario("INSERT INTO Cliente (`cedula`, `nombre`, `apellido`, `direccion`, `correo`, `observaciones`, `codCiudad`) VALUES('" + txt_cedula_Agregarcliente.Text + "',' " + txt_Nombre_Agregarcliente.Text + "',' " + txt_Apellidos_Agregarcliente.Text + "',' " + txt_dirrecion_Agregarcliente.Text + "',' " + txt_Correo_Agregarcliente.Text + "',' " + txt_descripcion_Agregarcliente.Text + "', '1')");
                limpiarForm();
                home.limpiarPanel();
                fi.cliente();
                home.AbrirFormEnPanel(fi);
                MessageBox.Show("Correcto");
                this.Close();
            }
            catch
            {
                MessageBox.Show("Error");
            }
        }
コード例 #2
0
        public void btn_Agregar_Agregarcliente_Click(object sender, EventArgs e)
        {
            form_cliente fi       = new form_cliente();
            Home         home     = new Home();
            string       consulta = cb_ciudad_Agregarcliente.Text;

            //MySqlDataReader temporal;
            if (verifivarVacio() == true)
            {
                //temporal = datos.consultarDatos("select id from ciudad where upper(nombre)=upper('" + consulta + "')");
                //temporal.Read();
                if (txt_cedula_Agregarcliente.Text != logica.comprobarSiYaExiste("cedula", "Cliente", txt_cedula_Agregarcliente.Text))
                {
                    try
                    {
                        //txt_descripcion_Agregarcliente.Text = datos.consultarDatos("a");
                        //datos.insertarDatos("INSERT INTO Cliente (`cedula`, `nombre`, `apellido`, `direccion`, `correo`, `observaciones`, `codCiudad`) VALUES('" + txt_cedula_Agregarcliente.Text + "',' " + txt_Nombre_Agregarcliente.Text + "',' " + txt_Apellidos_Agregarcliente.Text + "',' " + txt_dirrecion_Agregarcliente.Text + "',' " + txt_Correo_Agregarcliente.Text + "',' " + txt_descripcion_Agregarcliente.Text + "', '" + temporal.GetValue(0).ToString() + "')");
                        logica.insertarDatos("INSERT INTO Cliente (`cedula`, `nombre`, `apellido`, `direccion`, `correo`, `observaciones`, `codCiudad`) VALUES('" + txt_cedula_Agregarcliente.Text + "',' " + txt_Nombre_Agregarcliente.Text + "',' " + txt_Apellidos_Agregarcliente.Text + "',' " + txt_dirrecion_Agregarcliente.Text + "',' " + txt_Correo_Agregarcliente.Text + "',' " + txt_descripcion_Agregarcliente.Text + "', '" + logica.covertirCiudad("select id from ciudad where upper(nombre)=upper('" + consulta + "')") + "')");
                        constructor();
                        fi.cliente();
                        home.AbrirFormEnPanel(fi);
                        MessageBox.Show("Correcto");
                        home.limpiarPanel();
                        this.Refresh();
                        this.Close();
                    }
                    catch
                    {
                        MessageBox.Show("Error");
                    }
                }
                else
                {
                    MessageBox.Show("El cliente " + txt_Nombre_Agregarcliente.Text + " " + txt_Apellidos_Agregarcliente.Text + " ya esta registrado con cedula  " + txt_cedula_Agregarcliente.Text);
                }
            }
        }