示例#1
0
 public void DeleteFormato(FormatoExport f)
 {
     dataFormatos = new DataFormatos();
     try
     {
         dataFormatos.Delete(f);
     }
     catch (AppException appex)
     {
         throw appex;
     }
     catch (Exception ex)
     {
         throw new AppException("Error no controlado durante la baja del formato.", "Fatal", ex);
     }
 }
示例#2
0
 public void InsertFormato(FormatoExport f)
 {
     dataFormatos = new DataFormatos();
     try
     {
         dataFormatos.Insert(f);
     }
     catch (AppException appex)
     {
         throw appex;
     }
     catch (Exception ex)
     {
         throw new AppException("Error no controlado durante la creación del nuevo formato.", "Fatal", ex);
     }
 }
示例#3
0
        public void Update(FormatoExport f)
        {
            IDbCommand cmd   = null;
            string     query = "UPDATE Formatos SET Nombre='" + f.Nombre + "', CodEntrada='" + f.CodEntrada + "', CodSalida='" + f.CodSalida + "', FormatoFecha='" + f.FormatoFecha + "', FormatoHora='" + f.FormatoHora + "', LongitudLegajo=" + f.LongitudLegajo + ", LongitudReloj=" + f.LongitudReloj + ", SeparadorFecha='" + f.SeparadorFecha + "', " +
                               "Path='" + f.Path + "', PosicionFecha=" + f.PosicionFecha + ", PosicionHora=" + f.PosicionHora + ", PosicionLegajo=" + f.PosicionLegajo + ", PosicionMovimiento=" + f.PosicionMov + ", PosicionReloj=" + f.PosicionReloj + ", PrefijoReloj='" + f.PrefijoReloj + "', SeparadorCampos='" + f.SeparadorCampos + "', SeparadorHora='" + f.SeparadorHora +
                               "' WHERE IdFormato=" + f.Id;

            try
            {
                cmd = FactoryConnection.Instancia.GetCommand(query, FactoryConnection.Instancia.GetConnection());
                cmd.ExecuteNonQuery();
            }
            catch (AppException appex)
            {
                throw appex;
            }
            catch (DbException dbEx)
            {
                throw new AppException("Error al intentar actualizar los datos de los formatos", "Error", dbEx);
            }
            catch (Exception ex)
            {
                throw new AppException("Error desconocido al intentar actualizar los datos de los formatos", "Fatal", ex);
            }
            finally
            {
                try
                {
                    if (cmd != null)
                    {
                        cmd.Dispose();
                    }
                    FactoryConnection.Instancia.ReleaseConn();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
示例#4
0
        public void Delete(FormatoExport f)
        {
            IDbCommand cmd   = null;
            string     query = "DELETE FROM Formatos WHERE IdFormato=" + f.Id;

            try
            {
                cmd = FactoryConnection.Instancia.GetCommand(query, FactoryConnection.Instancia.GetConnection());
                cmd.ExecuteNonQuery();
            }
            catch (AppException appex)
            {
                throw appex;
            }
            catch (DbException dbEx)
            {
                throw new AppException("Error al intentar eliminar el formato de la base de datos", "Error", dbEx);
            }
            catch (Exception ex)
            {
                throw new AppException("Error desconocido al intentar eliminar el formato", "Fatal", ex);
            }
            finally
            {
                try
                {
                    if (cmd != null)
                    {
                        cmd.Dispose();
                    }
                    FactoryConnection.Instancia.ReleaseConn();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
示例#5
0
        public FormatoExport GetById(int id)
        {
            FormatoExport f     = new FormatoExport();
            IDataReader   dr    = null;
            string        query = "SELECT * FROM Formatos WHERE IdFormato=" + id + ";";

            try
            {
                dr = FactoryConnection.Instancia.GetReader(query, FactoryConnection.Instancia.GetConnection());
                if (dr.Read())
                {
                    f.Nombre          = dr["Nombre"].ToString();
                    f.Id              = Convert.ToInt32(dr["IdFormato"]);
                    f.CodEntrada      = dr["CodEntrada"].ToString();
                    f.CodSalida       = dr["CodSalida"].ToString();
                    f.FormatoFecha    = dr["FormatoFecha"].ToString();
                    f.FormatoHora     = dr["FormatoHora"].ToString();
                    f.LongitudLegajo  = Convert.ToInt32(dr["LongitudLegajo"]);
                    f.LongitudReloj   = Convert.ToInt32(dr["LongitudReloj"]);
                    f.Path            = dr["Path"].ToString();
                    f.PosicionFecha   = Convert.ToInt32(dr["PosicionFecha"]);
                    f.PosicionHora    = Convert.ToInt32(dr["PosicionHora"]);
                    f.PosicionLegajo  = Convert.ToInt32(dr["PosicionLegajo"]);
                    f.PosicionMov     = Convert.ToInt32(dr["PosicionMovimiento"]);
                    f.PosicionReloj   = Convert.ToInt32(dr["PosicionReloj"]);
                    f.PrefijoReloj    = dr["PrefijoReloj"].ToString();
                    f.SeparadorCampos = dr["SeparadorCampos"].ToString();
                    f.SeparadorFecha  = dr["SeparadorFecha"].ToString();
                    f.SeparadorHora   = dr["SeparadorHora"].ToString();
                }
                else
                {
                    throw new AppException("No se pudo encontrar el formato activo en la tabla formatos.");
                }
            }
            catch (AppException appex)
            {
                throw appex;
            }
            catch (DbException dbEx)
            {
                throw new AppException("Error al intentar obtener el formato activo", "Error", dbEx);
            }
            catch (Exception ex)
            {
                throw new AppException("Error desconocido al intentar obtener el formato activo", "Fatal", ex);
            }
            finally
            {
                try
                {
                    if (dr != null)
                    {
                        dr.Dispose();
                    }
                    FactoryConnection.Instancia.ReleaseConn();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(f);
        }