예제 #1
0
        public FactorParametroBE RegistraParametroFactor(FactorParametroBE entidad)
        {
            try
            {
                using (IDbConnection db = new OracleConnection(CadenaConexion))
                {
                    string sp = sPackage + "USP_MNT_FACTOR_PARAMETRO";
                    var    p  = new OracleDynamicParameters();
                    p.Add("PI_ID_FACTOR", entidad.ID_FACTOR);
                    p.Add("PI_ID_DETALLE", entidad.ID_DETALLE);
                    p.Add("PI_ID_TIPO_CONTROL", entidad.ID_TIPO_CONTROL);
                    p.Add("PI_ID_PARAMETRO", entidad.ID_PARAMETRO);
                    p.Add("PI_NOMBRE_DETALLE", entidad.NOMBRE_DETALLE);
                    p.Add("PI_ORDEN", entidad.ORDEN);
                    db.Execute(sp, p, commandType: CommandType.StoredProcedure);
                }

                entidad.OK = true;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                entidad.OK      = false;
                entidad.message = ex.Message;
            }

            return(entidad);
        }
예제 #2
0
        public static FactorBE RegistraFactor(FactorBE entidad)
        {
            entidad = factorDA.RegistraFactor(entidad);
            if (entidad.OK)
            {
                if (entidad.ListaFactorParametro != null)
                {
                    entidad = factorDA.EliminaParametroFactor(entidad);
                    if (entidad.OK)
                    {
                        foreach (var item in entidad.ListaFactorParametro)
                        {
                            item.ID_FACTOR = entidad.ID_FACTOR;
                            FactorParametroBE resultado = factorDA.RegistraParametroFactor(item);
                            if (!resultado.OK)
                            {
                                entidad.OK      = resultado.OK;
                                entidad.message = resultado.message;
                                break;
                            }
                        }
                    }
                }
            }

            return(entidad);
        }
예제 #3
0
        public List <FactorParametroBE> listarCuerpoFactor(FactorParametroBE entidad)
        {
            List <FactorParametroBE> Lista = null;

            try
            {
                using (IDbConnection db = new OracleConnection(CadenaConexion))
                {
                    string sp = sPackage3 + "USP_SEL_CUERPO_FACTOR";
                    var    p  = new OracleDynamicParameters();
                    p.Add("pID_FACTOR", entidad.ID_FACTOR);
                    p.Add("pRefcursor", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);
                    Lista = db.Query <FactorParametroBE>(sp, p, commandType: CommandType.StoredProcedure).ToList();
                }

                foreach (var item in Lista)
                {
                    if (item.ID_TIPO_CONTROL == 1)
                    {
                        item.listaDetalle = DetalleFactorParametro(item.ID_PARAMETRO);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return(Lista);
        }
예제 #4
0
        public static FactorBE RegistraFactor(FactorBE entidad)
        {
            entidad = factorDA.RegistraFactor(entidad);
            if (entidad.OK)
            {
                if (entidad.ListaFactorParametro != null)
                {
                    entidad = factorDA.EliminaParametroFactor(entidad);
                    if (entidad.OK)
                    {
                        foreach (var item in entidad.ListaFactorParametro)
                        {
                            item.ID_FACTOR = entidad.ID_FACTOR;
                            FactorParametroBE resultado = factorDA.RegistraParametroFactor(item);
                            if (!resultado.OK)
                            {
                                entidad.OK      = resultado.OK;
                                entidad.message = resultado.message;
                                break;
                            }
                        }
                        factorDA.RegistraFactorValor(new FactorParametroBE {
                            ID_FACTOR = entidad.ID_FACTOR, ID_DETALLE = entidad.ID_DETALLE, NOMBRE_DETALLE = "FACTOR " + entidad.UNIDAD_MEDIDA
                        });                                                                                                                                                                         //add 29-03-20
                    }
                }
            }

            return(entidad);
        }
예제 #5
0
        public List <FactorParametroBE> listarCabeceraFactor(FactorParametroBE entidad)
        {
            List <FactorParametroBE> Lista = null;

            try
            {
                using (IDbConnection db = new OracleConnection(CadenaConexion))
                {
                    string sp = sPackage3 + "USP_SEL_CABECERA_FACTOR";
                    var    p  = new OracleDynamicParameters();
                    p.Add("pID_FACTOR", entidad.ID_FACTOR);
                    p.Add("pRefcursor", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);
                    Lista = db.Query <FactorParametroBE>(sp, p, commandType: CommandType.StoredProcedure).ToList();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return(Lista);
        }
예제 #6
0
        public FactorParametroBE GetUnidadFactor(FactorParametroBE entidad)
        {
            try
            {
                using (IDbConnection db = new OracleConnection(CadenaConexion))
                {
                    string sp = sPackage + "USP_GET_UNIDAD_FACTOR";
                    var    p  = new OracleDynamicParameters();
                    p.Add("PI_ID_FACTOR", entidad.ID_FACTOR);
                    p.Add("PO_CURSOR", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);
                    entidad = db.Query <FactorParametroBE>(sp, p, commandType: CommandType.StoredProcedure).FirstOrDefault();
                    string cad = entidad.NOMBRE_DETALLE;
                    entidad.NOMBRE_DETALLE = cad.Substring(6, cad.Length - 6).Trim();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return(entidad);
        }
예제 #7
0
 public static List <FactorParametroBE> ListarCuerpoFactor(FactorParametroBE entidad)
 {
     return(factorDA.listarCuerpoFactor(entidad));
 }
예제 #8
0
 public static FactorParametroBE GetUnidadFactor(FactorParametroBE entidad)
 {
     return(factorDA.GetUnidadFactor(entidad));
 }