Exemplo n.º 1
0
        /// <summary>
        /// Cascade set HolidaySearchModel Result
        /// </summary>
        /// <param name="holiday"></param>
        /// <returns></returns>
        public static HolidaySearchModel SetHolidaySearchModelCascade(Holiday holiday)
        {
            if (holiday == null)
            {
                return(null);
            }
            var holidaySearchModel = new HolidaySearchModel()
            {
                HolidayId    = holiday.HolidayId,
                ProjectId    = holiday.ProjectId,
                Day          = holiday.Day,
                Creator      = holiday.Creator,
                CreateDate   = holiday.CreateDate,
                Modifier     = holiday.Modifier,
                ModifiedDate = holiday.ModifiedDate,
                Project      = ProjectOperator.SetProjectSubSearchModel(holiday.Project)
            };

            return(holidaySearchModel);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Cascade set LocationSearchModel Result
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public static LocationSearchModel SetLocationSearchModelCascade(Location location)
        {
            if (location == null)
            {
                return(null);
            }
            var locationSearchModel = new LocationSearchModel()
            {
                LocationId           = location.LocationId,
                ProjectId            = location.ProjectId,
                Building             = location.Building,
                CommAddress          = location.CommAddress,
                CommMode             = location.CommMode,
                CurrentPosition      = location.CurrentPosition,
                Description          = location.Description,
                DeviceSerialNo       = location.DeviceSerialNo,
                DeviceId             = location.DeviceId,
                DeviceType           = location.DeviceType,
                FavorPositionFirst   = location.FavorPositionFirst,
                FavorPositionrSecond = location.FavorPositionrSecond,
                FavorPositionThird   = location.FavorPositionThird,
                Floor = location.Floor,
                InstallationNumber = location.InstallationNumber,
                Orientation        = location.Orientation,
                RoomNo             = location.RoomNo,
                Creator            = location.Creator,
                CreateDate         = location.CreateDate,
                Modifier           = location.Modifier,
                ModifiedDate       = location.ModifiedDate,
                Groups             = location.GroupLocations.Select(gl => GroupOperator.SetGroupSearchModelCascade(gl.Group)),
                Logs    = LogOperator.SetLogSearchModelCascade(location.Logs),
                Alarms  = AlarmOperator.SetAlarmSearchModelCascade(location.Alarms),
                Project = ProjectOperator.SetProjectSubSearchModel(location.Project),
                Device  = DeviceOperator.SetDeviceSubSearchModel(location.Device)
            };

            return(locationSearchModel);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Cascade set GroupSearchModel Result
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public static GroupSearchModel SetGroupSearchModelCascade(Group group)
        {
            if (group == null)
            {
                return(null);
            }
            var groupSearchModel = new GroupSearchModel()
            {
                GroupId      = group.GroupId,
                GroupName    = group.GroupName,
                ProjectId    = group.ProjectId,
                SceneId      = group.SceneId,
                Creator      = group.Creator,
                CreateDate   = group.CreateDate,
                Modifier     = group.Modifier,
                ModifiedDate = group.ModifiedDate,
                Project      = ProjectOperator.SetProjectSubSearchModel(group.Project),
                Scene        = SceneOperator.SetSceneSubSearchModel(group.Scene),
                Locations    = group.GroupLocations.Select(v => LocationOperator.SetLocationSearchModelCascade(v.Location))
            };

            return(groupSearchModel);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Cascade set SceneSearchModel Result
        /// </summary>
        /// <param name="scene"></param>
        /// <returns></returns>
        public static SceneSearchModel SetSceneSearchModelCascade(Scene scene)
        {
            if (scene == null)
            {
                return(null);
            }
            var sceneSearchModel = new SceneSearchModel()
            {
                SceneId       = scene.SceneId,
                SceneName     = scene.SceneName,
                ProjectId     = scene.ProjectId,
                Enable        = scene.Enable,
                Creator       = scene.Creator,
                CreateDate    = scene.CreateDate,
                Modifier      = scene.Modifier,
                ModifiedDate  = scene.ModifiedDate,
                Project       = ProjectOperator.SetProjectSubSearchModel(scene.Project),
                SceneSegments = SceneSegmentOperator.SetSceneSegmentSearchModelCascade(scene.SceneSegments),
                Groups        = GroupOperator.SetGroupSearchModelCascade(scene.Groups)
            };

            return(sceneSearchModel);
        }