Esempio n. 1
0
    public object Get_ComboxPadre(String co_maestro, String co_padre)
    {
        ComboBL     oComboBL     = new ComboBL();
        ComboBE     oComboBE     = new ComboBE();
        ComboBEList oComboBEList = oComboBL.Get_Combo(co_maestro, co_padre);

        //return oComboBEList;
        System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        return(serializer.Serialize(oComboBEList));
    }
Esempio n. 2
0
        public ComboBEList Get_Combo(String co_maestro, String co_padre)
        {
            ComboBEList oComboBEList = new ComboBEList();

            SqlConnection cn = new SqlConnection(DataBaseHelper.GetDbConnectionString());

            /*Propiedades del SqlCommand*/
            SqlCommand             = new SqlCommand();
            SqlCommand.CommandText = "src_sps_combo_FO";
            SqlCommand.Connection  = cn;
            SqlCommand.CommandType = CommandType.StoredProcedure;

            /*Agregar Parametros al SqlCommand */
            SqlCommand.Parameters.AddWithValue("@vi_co_maestro", co_maestro);
            SqlCommand.Parameters.AddWithValue("@vi_co_padre", co_padre);

            SqlDataReader reader = null;

            try
            {
                cn.Open();
                reader = SqlCommand.ExecuteReader();

                while (reader.Read())
                {
                    int indice;

                    ComboBE oBE = new ComboBE();
                    indice    = reader.GetOrdinal("value");
                    oBE.value = reader.IsDBNull(indice) ? string.Empty : reader.GetString(indice);

                    indice     = reader.GetOrdinal("nombre");
                    oBE.nombre = reader.IsDBNull(indice) ? string.Empty : reader.GetString(indice);

                    oComboBEList.Add(oBE);
                }
                reader.Close();
            }
            catch (Exception)
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
                throw;
            }
            finally
            {
                cn.Close();
                cn.Dispose();
            }
            return(oComboBEList);
        }
    public static object Get_Inicial()
    {
        #region "Obtiene Tipo Documento"
        ComboBL       oComboBL          = new ComboBL();
        List <object> oComboTipoPersona = new List <object>();
        ComboBEList   listaTipoPersona  = oComboBL.Get_Combo("TIPO_PERSONA", "");
        if (listaTipoPersona != null)
        {
            foreach (ComboBE oTD in listaTipoPersona)
            {
                oComboTipoPersona.Add(new { value = oTD.value.Trim(), oTD.nombre });
            }
        }
        #endregion

        #region "Obtiene Tipo Documento"
        ClienteBL     oClienteBL          = new ClienteBL();
        List <object> oComboTipoDocumento = new List <object>();
        ClienteBEList oClienteBEList      = oClienteBL.ListarTipoDocumentos();
        if (oClienteBEList != null)
        {
            foreach (ClienteBE oTD in oClienteBEList)
            {
                oComboTipoDocumento.Add(new { value = oTD.cod_tipo_documento.Trim(), nombre = oTD.des_tipo_documento });
            }
        }
        #endregion "Obtiene Tipo Documento"

        #region "Obtiene Marcas"
        VehiculoBL     oVehiculoBL = new VehiculoBL();
        ArrayList      oComboMarca = new ArrayList();
        VehiculoBEList oMarcas     = oVehiculoBL.ListarMarcas();

        foreach (VehiculoBE oMarca in oMarcas)
        {
            object objMarca;
            objMarca = new { value = oMarca.nid_marca.ToString(), nombre = oMarca.no_marca };
            oComboMarca.Add(objMarca);
        }
        #endregion "Obtiene Marcas"

        object response = new
        {
            oComboTipoPersona,
            oComboTipoDocumento,
            oComboMarca
        };

        System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        return(serializer.Serialize(response));
    }
Esempio n. 4
0
 public ComboBEList Get_Combo(String co_maestro, String co_padre)
 {
     try
     {
         ComboBEList oComboBEList = oComboDA.Get_Combo(co_maestro, co_padre);
         return(oComboBEList);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
     }
 }