Exemplo n.º 1
0
        /// <summary>
        /// IsInUse
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="companyId">companyId</param>
        /// <returns>int</returns>
        public int IsInUse(int unitId, int companyId)
        {
            UnitsGateway unitsGateway = new UnitsGateway(new DataSet());

            if (unitsGateway.IsUsedInProjectTime(unitId))
            {
                return 1;
            }

            if (unitsGateway.IsUsedInTeamProjectTime(unitId))
            {
                return 2;
            }

            if (unitsGateway.IsUsedInTeamProjectTimeDetail(unitId))
            {
                return 3;
            }

            if (unitsGateway.IsUnitWithServicesActives(unitId, companyId))
            {
                return 4;
            }

            return 0;
        }