Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox2.Text != "")
                {
                    var v = new DTipoDeCliente();
                    v.Idtipo     = Convert.ToInt32(textBox1.Text);
                    v.nombretipo = textBox2.Text.ToUpper();

                    if (NTipoDeCliente.Agregar(v))
                    {
                        MessageBox.Show("Datos guardados correctamente.");
                        id();
                        limpiar();
                        listado();
                    }
                    else
                    {
                        MessageBox.Show("Error, Verifique que los datos sean correctos.");
                    }
                }

                else
                {
                    MessageBox.Show("Debe ingresar datos en los dos campos.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                var v = new DTipoDeCliente();
                v.Idtipo     = Convert.ToInt32(textBox1.Text);
                v.nombretipo = textBox2.Text.ToUpper();

                if (NTipoDeCliente.Actualizar(v))
                {
                    MessageBox.Show("Se actualizo correctamente");
                    id();
                    limpiar();
                    listado();
                    button1.Enabled = true;
                    button2.Enabled = false;
                    button3.Enabled = false;
                    button4.Enabled = false;
                }
                else
                {
                    MessageBox.Show("Error, Verifique que los datos sean correctos.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        // metodos
        public static DTipoDeCliente EntidadTipoCliente(MySqlDataReader entidad)
        {
            var e = new DTipoDeCliente();

            e.Idtipo     = Convert.ToInt32(entidad["Id_Categoria"]);
            e.nombretipo = Convert.ToString(entidad["Nombre"]);
            return(e);
        }
Beispiel #4
0
        //Eliminar

        public static bool Eliminar(DTipoDeCliente c)
        {
            try
            {
                MySqlConnection cn  = new MySqlConnection(Conexion.Cadena);
                MySqlCommand    cmd = new MySqlCommand();

                // setear parametros del command
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = cn;
                cmd.CommandText = "EliminarCategoriaCliente";

                cmd.Parameters.AddWithValue("@id", c.Idtipo);
                cn.Open();
                return(Convert.ToBoolean(cmd.ExecuteNonQuery()));
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #5
0
 public static bool Eliminar(DTipoDeCliente e)
 {
     return(AdTipoDeCliente.Eliminar(e));
 }
Beispiel #6
0
 public static bool Actualizar(DTipoDeCliente e)
 {
     return(AdTipoDeCliente.Actualizar(e));
 }
Beispiel #7
0
 public static bool Agregar(DTipoDeCliente e)
 {
     return(AdTipoDeCliente.Agregar(e));
 }