Example #1
0
        public void Actualizar(Entidades.Fabricante fabricante)
        {
            try {
                SqlCommand sqlCommand = new SqlCommand("proc_FABRICANTESUpdate", Conexion.SqlConnection);
                sqlCommand.CommandTimeout = 20;
                sqlCommand.CommandType    = CommandType.StoredProcedure;

                sqlCommand.Parameters.AddWithValue("@IdFabricante", fabricante.IdFabricante);
                sqlCommand.Parameters.AddWithValue("@NombFabricant", fabricante.NombreFabricante);
                sqlCommand.Parameters.AddWithValue("@Direccion", fabricante.Direccion);
                sqlCommand.Parameters.AddWithValue("@Pais", fabricante.Pais);

                if (Conexion.SqlConnection.State == System.Data.ConnectionState.Closed)
                {
                    Conexion.SqlConnection.Open();
                }
                sqlCommand.ExecuteNonQuery();
            } catch (Exception ex) {
                MessageBox.Show("No se pudo Escribir " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            } finally {
                if (Conexion.SqlConnection.State == System.Data.ConnectionState.Open)
                {
                    Conexion.SqlConnection.Close();
                }
            }
        }
Example #2
0
        public object CreateReport()
        {
            var list   = new Datos.Fabricante();
            var result = list.Mostrar();

            var i = result.Tables[0].Columns.Count;

            ListObj = new List <Entidades.Fabricante>();
            foreach (System.Data.DataRow rows in result.Tables[0].Rows)
            {
                var ObjModel = new Entidades.Fabricante()
                {
                    IdFabricante     = Convert.ToInt32(rows[0]),
                    NombreFabricante = Convert.ToString(rows[1]),
                    Direccion        = Convert.ToString(rows[2]),
                    Pais             = Convert.ToString(rows[3])
                };
                ListObj.Add(ObjModel);
            }
            return(ListObj);
        }
        private void Agregar()
        {
            if (objEntidad == null)
            {
                objEntidad = new Entidades.Fabricante();
            }
            objEntidad.NombreFabricante = TB_Nombre.Text;
            objEntidad.Direccion        = TB_Direccion.Text;
            objEntidad.Pais             = TB_Pais.Text;

            if (objNegocio == null)
            {
                objNegocio = new Negocios.Fabricante();
            }
            objNegocio.Registrar(objEntidad);

            MessageBox.Show("Registro agregado con exito.", "Agregado", MessageBoxButtons.OK,
                            MessageBoxIcon.Information);

            Clear();
        }
Example #4
0
 public void Actualizar(Entidades.Fabricante entidad)
 {
     obj = new Datos.Fabricante();
     obj.Actualizar(entidad);
 }
Example #5
0
 public void Registrar(Entidades.Fabricante entidad)
 {
     obj = new Datos.Fabricante();
     obj.Registrar(entidad);
 }