Esempio n. 1
0
        private void inicializarStrings()
        {
            BL_Factura          blFactura = new BL_Factura();
            DO_PlantillaFactura plantilla = blFactura.obtenerPlantillaFactura();

            nombreLocal = plantilla.nombreEmpresa;
            direccion   = plantilla.direccion;
            ced         = plantilla.cedula;
            telefono    = plantilla.numeroTelefono;
        }
Esempio n. 2
0
        public DO_PlantillaFactura obtenerUltimaPlantilla()
        {
            int        codigo   = obtenerCodigoUltimaPlantilla();
            SqlCommand consulta = new SqlCommand("select * from PLANTILLA_FACTURA where PLANT_CODIGO = @codigo", conexion);

            consulta.Parameters.AddWithValue("@codigo", codigo);
            DO_PlantillaFactura plantillaFactura = new DO_PlantillaFactura();

            try
            {
                if (conexion.State != ConnectionState.Open)
                {
                    conexion.Open();
                }
                SqlDataReader lector = consulta.ExecuteReader();
                if (lector.HasRows)
                {
                    while (lector.Read())
                    {
                        plantillaFactura.codigo         = Convert.ToInt32(lector["PLANT_CODIGO"]);
                        plantillaFactura.nombreEmpresa  = (String)lector["PLANT_NOMBRE_EMPRESA"];
                        plantillaFactura.cedula         = (String)(lector["PLANT_CEDULA"]);
                        plantillaFactura.turno          = Convert.ToInt32(lector["PLANT_TURNO"]);
                        plantillaFactura.folio          = Convert.ToInt32(lector["PLANT_FOLIO"]);
                        plantillaFactura.numeroTelefono = (String)lector["PLANT_TELEFONO"];
                        plantillaFactura.direccion      = (String)lector["PLANT_DIRECCION"];
                    }
                    return(plantillaFactura);
                }
            }
            catch (SqlException)
            {
                return(null);
            }
            finally
            {
                if (conexion.State != ConnectionState.Closed)
                {
                    conexion.Close();
                }
            }
            return(null);
        }
Esempio n. 3
0
        public int ingresarPlantillaFactura(DO_PlantillaFactura plantillaFactura)
        {
            SqlCommand insert = new SqlCommand("insert into PLANTILLA_FACTURA " +
                                               "(PLANT_CODIGO, PLANT_NOMBRE_EMPRESA, PLANT_CEDULA, PLANT_TURNO, " +
                                               "PLANT_FOLIO, PLANT_TELEFONO, PLANT_DIRECCION" +
                                               "values (@codigo, @nombreEmpresa, @cedula, @turno, @folio, @telefono, @direccion)", conexion);

            insert.Parameters.AddWithValue("@codigo", plantillaFactura.codigo);
            insert.Parameters.AddWithValue("@nombreEmpresa", plantillaFactura.nombreEmpresa);
            insert.Parameters.AddWithValue("@cedula", plantillaFactura.cedula);
            insert.Parameters.AddWithValue("@turno", plantillaFactura.turno);
            insert.Parameters.AddWithValue("@folio", plantillaFactura.folio);
            insert.Parameters.AddWithValue("@telefono", plantillaFactura.numeroTelefono);
            insert.Parameters.AddWithValue("@direccion", plantillaFactura.direccion);

            try
            {
                if (conexion.State != ConnectionState.Open)
                {
                    conexion.Open();
                }

                if (insert.ExecuteNonQuery() > 0)
                {
                    return(obtenerCodigoUltimaPlantilla());
                }
                else
                {
                    return(0);
                }
            }
            catch (SqlException)
            {
                return(0);
            }
            finally
            {
                if (conexion.State != ConnectionState.Closed)
                {
                    conexion.Close();
                }
            }
        }
Esempio n. 4
0
        public bool actualizarPlantillaFactura(DO_PlantillaFactura plantillaFactura)
        {
            SqlCommand update = new SqlCommand("UPDATE PLANTILLA_FACTURA " +
                                               "SET PLANT_NOMBRE_EMPRESA = @nombreEmpresa," +
                                               " PLANT_CEDULA = @cedula," +
                                               " PLANT_DIRECCION = @direccion," +
                                               " PLANT_TELEFONO = @telefono " +
                                               "WHERE PLANT_CODIGO = @codigo", conexion);

            update.Parameters.AddWithValue("@cedula", plantillaFactura.cedula);
            update.Parameters.AddWithValue("@direccion", plantillaFactura.direccion);
            update.Parameters.AddWithValue("@telefono", plantillaFactura.numeroTelefono);
            update.Parameters.AddWithValue("@codigo", plantillaFactura.codigo);
            update.Parameters.AddWithValue("@nombreEmpresa", plantillaFactura.nombreEmpresa);

            try
            {
                if (conexion.State != ConnectionState.Open)
                {
                    conexion.Open();
                }
                update.ExecuteNonQuery();
                return(true);
            }
            catch (SqlException)
            {
                return(false);
            }
            finally
            {
                if (conexion.State != ConnectionState.Closed)
                {
                    conexion.Close();
                }
            }
        }
Esempio n. 5
0
 private void fillPlantilla()
 {
     plantillaFactura = factLogica.obtenerPlantillaFactura();
 }
Esempio n. 6
0
        public bool actualizarPlantillaFactura(DO_PlantillaFactura plantillaFactura)
        {
            DAO_Factura daoFactura = new DAO_Factura();

            return(daoFactura.actualizarPlantillaFactura(plantillaFactura));
        }
Esempio n. 7
0
        public int ingresarPlantillaFactura(DO_PlantillaFactura plantillaFactura)
        {
            DAO_Factura daoFactura = new DAO_Factura();

            return(daoFactura.ingresarPlantillaFactura(plantillaFactura));
        }