Ejemplo n.º 1
0
        public static List <Area> GetAreaJoinModuloListForSearch(string whereSql)
        {
            if (string.IsNullOrEmpty(whereSql))
            {
                whereSql = "1 = 1";
            }

            List <Area>      theList    = new List <Area>();
            Area             theUser    = null;
            AreaTableAdapter theAdapter = new AreaTableAdapter();

            try
            {
                AreaDS.AreaDataTable table = theAdapter.GetAreaJoinModuloForSearch(whereSql);

                if (table != null && table.Rows.Count > 0)
                {
                    foreach (AreaDS.AreaRow row in table.Rows)
                    {
                        theUser = FillUserRecord(row);
                        theList.Add(theUser);
                    }
                }
            }
            catch (Exception q)
            {
                log.Error("el error ocurrio mientras obtenia la lista del Area de la base de datos", q);
                //return null;
            }
            return(theList);
        }
Ejemplo n.º 2
0
        public static List <Area> GetArea()
        {
            List <Area>      theList    = new List <Area>();
            Area             theUser    = null;
            AreaTableAdapter theAdapter = new AreaTableAdapter();

            try
            {
                AreaDS.AreaDataTable table = theAdapter.GetArea();

                if (table != null && table.Rows.Count > 0)
                {
                    foreach (AreaDS.AreaRow row in table.Rows)
                    {
                        theUser = FillUserRecord(row);
                        theList.Add(theUser);
                    }
                }
            }
            catch (Exception q)
            {
                log.Error("el error ocurrio mientras obtenia la lista del Area de la base de datos", q);
                return(null);
            }
            return(theList);
        }
Ejemplo n.º 3
0
        //public static Area GetArea()
        //{
        //    AreaTableAdapter localAdapter = new AreaTableAdapter();

        //    Area theUser = null;
        //    try
        //    {
        //        AreaDS.AreaDataTable table = localAdapter.GetArea();

        //        if (table != null && table.Rows.Count > 0)
        //        {
        //            AreaDS.AreaRow row = table[0];
        //            theUser = FillUserRecord(row);
        //        }
        //    }
        //    catch (Exception q)
        //    {
        //        log.Error("Un error ocurrio mientras obtenia el Area de la base de dato", q);
        //        return null;
        //    }
        //    return theUser;
        //}
        public static Area GetAreaById(int idArea)
        {
            AreaTableAdapter localAdapter = new AreaTableAdapter();

            if (idArea <= 0)
            {
                return(null);
            }

            Area theUser = null;

            try
            {
                AreaDS.AreaDataTable table = localAdapter.GetAreaById(idArea);

                if (table != null && table.Rows.Count > 0)
                {
                    AreaDS.AreaRow row = table[0];
                    theUser = FillUserRecord(row);
                }
            }
            catch (Exception q)
            {
                log.Error("Un error ocurrio mientras obtenia el Area de la base de dato", q);
                return(null);
            }
            return(theUser);
        }
Ejemplo n.º 4
0
        public Area GetAreaByOrganizationAndName(int organizationId, string name)
        {
            if (organizationId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroOrganizationId);
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(Resources.Organization.MessageEmptyNameArea);
            }

            Area theData = null;

            try
            {
                AreaDS.AreaDataTable theTable = theAdapter.GetAreaByOrganizationAndArea(organizationId, name);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    AreaDS.AreaRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía el area de nombre: " + name, exc);
                throw exc;
            }

            return(theData);
        }
Ejemplo n.º 5
0
        public List <Area> GetAreasByOrganization(int organizationId)
        {
            if (organizationId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroOrganizationId);
            }

            string      userName = HttpContext.Current.User.Identity.Name;
            List <Area> theList  = new List <Area>();
            Area        theData  = null;

            try
            {
                AreaDS.AreaDataTable theTable = theAdapter.GetAreasByOrganization(organizationId, userName);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (AreaDS.AreaRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetAreasByOrganization para organizationId: " + organizationId.ToString() + " y userName: " + userName, exc);
                throw new ArgumentException(Resources.DataDetails.MessageErrorAreasByOrganization);
            }

            return(theList);
        }
Ejemplo n.º 6
0
        public static Area GetAreaById(int areaId)
        {
            if (areaId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroAreaId);
            }

            Area theData = null;

            try
            {
                AreaTableAdapter     localAdapter = new AreaTableAdapter();
                AreaDS.AreaDataTable theTable     = localAdapter.GetAreaById(areaId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    AreaDS.AreaRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía el area de id: " + areaId, exc);
                throw exc;
            }

            return(theData);
        }
Ejemplo n.º 7
0
        public static List <Area> GetAreasForAutocomplete(int organizationId, string filter)
        {
            List <Area> theList = new List <Area>();
            Area        theData = null;

            try
            {
                AreaTableAdapter     localAdapter = new AreaTableAdapter();
                AreaDS.AreaDataTable theTable     = localAdapter.GetAreasForAutocomplete(organizationId, filter);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (AreaDS.AreaRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                throw exc;
            }
            return(theList);
        }