Esempio n. 1
0
        public static List <Organization> GetOrganizationsByUser(string whereClause)
        {
            List <Organization> theList = new List <Organization>();
            Organization        theData = null;

            string userName = HttpContext.Current.User.Identity.Name;

            try
            {
                OrganizationTableAdapter             localAdapter = new OrganizationTableAdapter();
                OrganizationDS.OrganizationDataTable theTable     = localAdapter.GetOrganizationsByUser(userName, whereClause);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (OrganizationDS.OrganizationRow theRow in theTable)
                    {
                        theData         = FillRecord(theRow);
                        theData.IsOwner = theRow.isOwner;
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error(Resources.Organization.MessageOrganizationList + whereClause, exc);
                throw new Exception(Resources.Organization.MessageOrganizationList);
            }

            return(theList);
        }
Esempio n. 2
0
        public static List <Organization> GetOrganizationsForAutocomplete(string filter)
        {
            string userName = HttpContext.Current.User.Identity.Name;

            List <Organization> theList = new List <Organization>();
            Organization        theData = null;

            try
            {
                OrganizationTableAdapter             localAdapter = new OrganizationTableAdapter();
                OrganizationDS.OrganizationDataTable theTable     = localAdapter.GetOrganizationsForAutocomplete(userName, filter);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (OrganizationDS.OrganizationRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error al obtener una organizacion for autocomplete.", exc);
                throw new Exception(Resources.Organization.MessageErrorObtainOrganization);
            }
            return(theList);
        }
Esempio n. 3
0
        public static Organization GetOrganizationById(int organizationId)
        {
            if (organizationId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroOrganizationId);
            }

            Organization theData = null;

            try
            {
                OrganizationTableAdapter             localAdapter = new OrganizationTableAdapter();
                OrganizationDS.OrganizationDataTable theTable     = localAdapter.GetOrganizationById(organizationId);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    OrganizationDS.OrganizationRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía la organización de id =" + organizationId.ToString(), exc);
                throw new Exception(Resources.Organization.MessageErrorObtainOrganization);
            }

            return(theData);
        }
Esempio n. 4
0
        public Organization GetOrganizationByName(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(Resources.Organization.MessageEmptyName);
            }

            Organization theData  = null;
            string       userName = HttpContext.Current.User.Identity.Name;

            try
            {
                OrganizationDS.OrganizationDataTable theTable = theAdapter.GetOrganizationByName(userName, name);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    OrganizationDS.OrganizationRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía la organización de nombre: " + name, exc);
                throw new Exception(Resources.Organization.MessageErrorObtainOrganization);
            }

            return(theData);
        }