Esempio n. 1
0
        public List <Project> GetProjectBySearch(string whereClause)
        {
            if (string.IsNullOrEmpty(whereClause))
            {
                whereClause = "1=1";
            }

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

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

            try
            {
                ProjectDS.ProjectsDataTable theTable = theAdapter.GetProjectBySearch(userName, whereClause);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (ProjectDS.ProjectsRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía los proyectos by search " + whereClause, exc);
                throw new Exception(Resources.Project.MessageErrorLoadProject);
            }

            return(theList);
        }
Esempio n. 2
0
        public static List <Project> GetProjectsForAutocomplete(int organizationId, int areaId, string filter)
        {
            string userName = HttpContext.Current.User.Identity.Name;

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

            try
            {
                ProjectsTableAdapter        localAdapter = new ProjectsTableAdapter();
                ProjectDS.ProjectsDataTable theTable     = localAdapter.GetProjectForAutocomplete(userName, organizationId, areaId, filter);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (ProjectDS.ProjectsRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error(Resources.Project.MessageErrorLoadProject + " for autocomplete.", exc);
                throw new Exception(Resources.Project.MessageErrorLoadProject);
            }
            return(theList);
        }
Esempio n. 3
0
        public List <Project> GetProjectsByOrganization(int organizationId)
        {
            if (organizationId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroOrganizationId);
            }

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

            try
            {
                ProjectDS.ProjectsDataTable theTable = theAdapter.GetProjectByOrganization(organizationId, userName);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (ProjectDS.ProjectsRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetProjectByOrganization para organizationId: " + organizationId.ToString() + " y userName: " + userName, exc);
                throw new ArgumentException(Resources.Project.MessageErrorLoadProjectByOrganization);
            }

            return(theList);
        }
Esempio n. 4
0
        public static Project GetProjectById(int projectId)
        {
            if (projectId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroProjectId);
            }

            Project theData = null;

            try
            {
                ProjectsTableAdapter        localAdapter = new ProjectsTableAdapter();
                ProjectDS.ProjectsDataTable theTable     = localAdapter.GetProjectById(projectId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    ProjectDS.ProjectsRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error(Resources.Project.MessageErrorLoadAProject + " ID:" + projectId, exc);
                throw new Exception(Resources.Project.MessageErrorLoadAProject);
            }

            return(theData);
        }