示例#1
0
        /// <summary>
        /// Is In Use
        /// </summary>
        /// <param name="projectId">ProjectId</param>
        /// <param name="errorMessage">Error Message (out)</param>
        /// <returns>0 if no errors</returns>
        public int IsInUse(int projectId, out string errorMessage)
        {
            ProjectGateway projectGateway = new ProjectGateway(new DataSet());

            if (projectGateway.IsUsedInProjectTime(projectId))
            {
                errorMessage = "The project has Timesheets associated, you cannot delete it.";
                return 1;
            }

            if (projectGateway.IsUsedInTeamProjectTime(projectId))
            {
                errorMessage = "The project has been used in the Add Team Project Time wizard, you cannot delete it.";
                return 2;
            }

            if (projectGateway.IsUsedInTeamProjectTimeDetail(projectId))
            {
                errorMessage = "The project has been used in the Add Team Project Time wizard, you cannot delete it.";
                return 3;
            }

            errorMessage = "";
            return 0;
        }