コード例 #1
0
        public static BusinessObject GetRealCompanyUnit(Guid companyUnitID)
        {
            GECompanyUnitsInfo comUnit = new GECompanyUnitsController().GetObjectByID(companyUnitID) as GECompanyUnitsInfo;

            if (comUnit == null)
            {
                return(null);
            }

            if (!comUnit.FK_GECompanyUnitTypeID.HasValue)
            {
                return(null);
            }

            GECompanyUnitTypesInfo comUnitType = new GECompanyUnitTypesController().GetObjectByID(comUnit.FK_GECompanyUnitTypeID.Value) as GECompanyUnitTypesInfo;

            if (comUnitType == null)
            {
                return(null);
            }

            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(comUnitType.TableName);

            if (ctrl != null)
            {
                return(ctrl.GetObjectByNo(comUnit.No));
            }

            return(null);
        }