コード例 #1
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);
        }