Ejemplo n.º 1
0
        public static List <Country> GetCountryForAutocomplete(int?start, int?numItems, string filter, string idiomaId, ref int?totalRows)
        {
            List <Country> theList = new List <Country>();
            Country        theData = null;

            try
            {
                CountryTableAdapter        localAdapter = new CountryTableAdapter();
                CountryDS.CountryDataTable theTable     =
                    localAdapter.GetCountryForAutocomplete(numItems, start, filter, idiomaId, ref totalRows);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (CountryDS.CountryRow theRow in theTable.Rows)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error al obtener la lista de Departamentos de la Base de Datos", exc);
                throw exc;
            }
            return(theList);
        }
Ejemplo n.º 2
0
        public static Country GetRecordById(string countryId, string idiomaId)
        {
            CountryTableAdapter localAdapter = new CountryTableAdapter();

            if (string.IsNullOrEmpty(countryId))
            {
                throw new ArgumentException("El identificador countryId no puede ser null o vacio");
            }

            if (string.IsNullOrEmpty(idiomaId))
            {
                throw new ArgumentException("El identificador idiomaId no puede ser null o vacio");
            }

            Country theData = null;

            try
            {
                CountryDS.CountryDataTable theTable =
                    localAdapter.GetCountryById(countryId, idiomaId);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    CountryDS.CountryRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía el country de id =" + countryId, exc);
                throw exc;
            }

            return(theData);
        }