Exemple #1
0
        //-----------------------------------------------
        // Select: Interface por (nIntClase and nIntTipo)
        //-----------------------------------------------
        public DataTable Get_Interface(BE_ReqInterface Request)
        {
            DataTable dt = new DataTable();

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Get_Interface]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("nIntClase", Request.nIntClase);
                        cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo);
                        cm.Parameters.AddWithValue("cFlag", Request.cFlag);

                        cm.Connection = cn;

                        using (SqlDataReader dr = cm.ExecuteReader())
                            dt.Load(dr);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
        public DataTable Get_Interface_Datareader(BE_ReqInterface Request)
        {
            DataTable    dt;
            DA_Interface Obj = new DA_Interface();

            dt = Obj.Get_Interface_DataTable(Request);
            return(dt);
        }
        //para Update Interface
        public BE_ResGenerico UpdInterface(BE_ReqInterface Request)
        {
            BE_ResGenerico Item = new BE_ResGenerico();
            DA_Interface   Obj  = new DA_Interface();

            Item = Obj.UpdInterface(Request);
            return(Item);
        }
        //-----------------------------------------------
        // Select: Get_Interface_IntInterface por (nIntClase and nIntCodigo)
        //-----------------------------------------------
        public DataTable Get_Interface_IntInterface(long nIntClase, long nIntCodigo)
        {
            BE_ReqInterface Request = new BE_ReqInterface();
            DA_Interface    da      = new DA_Interface();

            Request.nIntClase  = nIntClase;
            Request.nIntCodigo = nIntCodigo;

            return(da.Get_Interface_IntInterface(Request));
        }
        //----------------
        // Get_Interface
        //----------------
        //para buscar Interface
        public DataTable Get_Interface(long nIntClase, long nIntTipo, string cFlag)
        {
            BE_ReqInterface Request = new BE_ReqInterface();
            DA_Interface    da      = new DA_Interface();

            Request.nIntClase = nIntClase;
            Request.nIntTipo  = nIntTipo;
            Request.cFlag     = cFlag;

            return(da.Get_Interface(Request));
        }
        public DataTable Get_Bien_By_Jerarquia_Descripcion(string cBieDescripcion, string cBieJerarquia, int Orden, string cPerJurCodigo, int nNivel)
        {
            BE_ReqInterface Request = new BE_ReqInterface();
            DA_Interface    da      = new DA_Interface();

            Request.cIntDescripcion = cBieDescripcion;
            Request.cIntJerarquia   = cBieJerarquia;
            Request.nIntTipo        = Orden;
            Request.cPerJurCodigo   = cPerJurCodigo;
            Request.nFlag           = nNivel;

            return(da.Get_Bien_By_Jerarquia_Descripcion(Request));
        }
Exemple #7
0
        public IList <BE_Res_Interface> Get_InterfaceDR(BE_ReqInterface Request)
        {
            BE_Res_Interface Item = new BE_Res_Interface();
            var lista             = new List <BE_Res_Interface>();

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "usp_Get_Interface";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("nIntClase", Request.nIntClase);
                        cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo);
                        cm.Connection = cn;
                        using (SqlDataReader dr = cm.ExecuteReader())
                        {
                            lista.Clear();
                            while (dr.Read())
                            {
                                Item                 = new BE_Res_Interface();
                                Item.nIntClase       = dr.GetInt32(dr.GetOrdinal("nIntClase"));
                                Item.nIntCodigo      = dr.GetInt32(dr.GetOrdinal("nIntCodigo"));
                                Item.nIntTipo        = dr.GetInt32(dr.GetOrdinal("nIntTipo"));
                                Item.cIntDescripcion = dr.GetString(dr.GetOrdinal("cIntDescripcion")).Trim();
                                Item.cIntJerarquia   = dr.GetString(dr.GetOrdinal("cIntJerarquia")).Trim();
                                Item.cIntNombre      = dr.GetString(dr.GetOrdinal("cIntNombre")).Trim();
                                lista.Add(Item);
                            }
                            dr.Close();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(lista);
        }
Exemple #8
0
        //Obtener correlativo cIntJerarquia para la Tabla [Interface]
        public string Get_NewIdcIntJerarquia(BE_ReqInterface Request) //BE_ReqSolCorrelativo Request)
        {
            string nNewId = "";

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");
                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "usp_Get_NewIdcIntJerarquia";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("nIntClase", Request.nIntClase);
                        cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo);
                        cm.Connection = cn;

                        SqlParameter pCod = new SqlParameter();
                        pCod.ParameterName = "nNewId";
                        pCod.DbType        = DbType.String;
                        pCod.Size          = 25;
                        pCod.Direction     = ParameterDirection.Output;

                        cm.Parameters.Add(pCod);
                        cm.ExecuteNonQuery();
                        nNewId = cm.Parameters["nNewId"].Value.ToString();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(nNewId);
        }
Exemple #9
0
        //-------------------
        // Update: Interface
        //-------------------
        public BE_ResGenerico UpdInterface(BE_ReqInterface Request)
        {
            BE_ResGenerico Item      = new BE_ResGenerico();
            long           Resultado = 0;

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Upd_Interface]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("nIntCodigo", Request.nIntCodigo);
                        cm.Parameters.AddWithValue("nIntClase", Request.nIntClase);
                        cm.Parameters.AddWithValue("cIntJerarquia", Request.cIntJerarquia);
                        cm.Parameters.AddWithValue("cIntNombre", Request.cIntNombre);
                        cm.Parameters.AddWithValue("cIntDescripcion", Request.cIntDescripcion);
                        cm.Parameters.AddWithValue("nIntTipo", Request.nIntTipo);
                        cm.Connection  = cn;
                        Resultado      = cm.ExecuteNonQuery();
                        Item.Resultado = Resultado;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Item);
        }
Exemple #10
0
        public DataTable Get_Bien_By_Jerarquia_Descripcion(BE_ReqInterface Request)
        {
            DataTable dt = new DataTable();

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "usp_Logistica_Get_Bien_By_Jerarquia_Descripcion";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cBieDescripcion", Request.cIntDescripcion);
                        cm.Parameters.AddWithValue("cBieJerarquia", Request.cIntJerarquia);
                        cm.Parameters.AddWithValue("Orden", Request.nIntTipo);
                        cm.Parameters.AddWithValue("cPerJurCodigo", Request.cPerJurCodigo);
                        cm.Parameters.AddWithValue("nNivel", Request.nFlag);

                        cm.Connection = cn;

                        using (SqlDataReader dr = cm.ExecuteReader())
                            dt.Load(dr);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
        //Genera nuevo Codigo servicio
        public string Get_NewIdcIntJerarquia(BE_ReqInterface Request) //BE_ReqSolCorrelativo Request)
        {
            DA_Interface Obj = new DA_Interface();

            return(Obj.Get_NewIdcIntJerarquia(Request));
        }
        //-----------------------------------------------
        // en SqlDataReader: Interface por (nIntClase and nIntTipo)
        //-----------------------------------------------
        public IList <BE_Res_Interface> Get_InterfaceDR(BE_ReqInterface Request)
        {
            DA_Interface Obj = new DA_Interface();

            return(Obj.Get_InterfaceDR(Request));
        }
        //---------------------------------
        // Get_Interface and cIntJerarquia
        //---------------------------------
        //para buscar Interface
        public DataTable Get_Interface_and_cIntJerarquia(BE_ReqInterface Request)
        {
            DA_Interface Obj = new DA_Interface();

            return(Obj.Get_Interface_and_cIntJerarquia(Request));
        }
Exemple #14
0
        public List <MetaPromotor> Get_MetaPromotor(MetaPromotor objeto)
        {
            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    List <MetaPromotor> metaPromotors = new List <MetaPromotor>();
                    MetaPromotor        metaPromotor;


                    cn.Open();
                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Get_MetaPromotor]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("@cPerJurCodigo", objeto.cPerJurCodigo);
                        cm.Parameters.AddWithValue("@nIntSrcCodigo", objeto.nIntSrcCodigo);
                        cm.Parameters.AddWithValue("@nPrdCodigo", objeto.nPrdCodigo);
                        cm.Parameters.AddWithValue("@cPerPromCodigo", objeto.cPerPromCodigo);

                        cm.Connection = cn;

                        using (SqlDataReader sqlDataReader = cm.ExecuteReader())
                        {
                            while (sqlDataReader.Read())
                            {
                                metaPromotor = new MetaPromotor();
                                BE_ReqInterface reqInterface = new BE_ReqInterface();

                                metaPromotor.cPerJurCodigo  = sqlDataReader.GetString(0);
                                metaPromotor.nIntSrcCodigo  = sqlDataReader.GetInt32(1);
                                metaPromotor.nPrdCodigo     = sqlDataReader.GetInt32(2);
                                metaPromotor.cPerPromCodigo = sqlDataReader.GetString(3);
                                metaPromotor.nIntDstCodigo  = sqlDataReader.GetInt32(4);
                                metaPromotor.nMetValor      = sqlDataReader.GetDecimal(5);
                                metaPromotor.cPerUsuCrea    = sqlDataReader.GetString(6);
                                metaPromotor.dFechaCrea     = sqlDataReader.GetDateTime(7);

                                //if (!sqlDataReader.IsDBNull(8))
                                //    metaPromotor.cPerUsuModi = sqlDataReader.GetString(8);
                                //else
                                //    metaPromotor.cPerUsuModi = "";

                                metaPromotor.cPerUsuModi = sqlDataReader.IsDBNull(8) ? "" : sqlDataReader.GetString(8);

                                //reader.IsDBNull(1) ? null : reader.GetString(reader.GetOrdinal("EMAIL")),

                                if (!sqlDataReader.IsDBNull(9))
                                {
                                    metaPromotor.dFechaModi = sqlDataReader.GetDateTime(9);
                                }
                                else
                                {
                                    metaPromotor.dFechaModi = DateTime.Now;
                                }

                                reqInterface.nIntCodigo      = sqlDataReader.GetInt32(4);
                                reqInterface.cIntNombre      = sqlDataReader.GetString(10);
                                reqInterface.cIntDescripcion = sqlDataReader.GetString(11);
                                //agregar linea (NO OLVIDAR)
                                metaPromotor.objInterface = reqInterface;

                                //si estas llenando en List<>
                                metaPromotors.Add(metaPromotor);
                            }
                        }
                        return(metaPromotors);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }