Example #1
0
        /// <summary>
        /// Cascade set ProjectSearchModel Result
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        public static ProjectSearchModel SetProjectSearchModelCascade(Project project)
        {
            if (project == null)
            {
                return(null);
            }
            var projectSearchModel = new ProjectSearchModel()
            {
                ProjectId    = project.ProjectId,
                ProjectNo    = project.ProjectNo,
                ProjectName  = project.ProjectName,
                CustomerId   = project.CustomerId,
                Completed    = project.Completed,
                Creator      = project.Creator,
                CreateDate   = project.CreateDate,
                Modifier     = project.Modifier,
                ModifiedDate = project.ModifiedDate,
                Customer     = CustomerOperator.SetCustomerSubSearchModel(project.Customer),
                Scenes       = SceneOperator.SetSceneSearchModelCascade(project.Scenes),
                Groups       = GroupOperator.SetGroupSearchModelCascade(project.Groups),
                Locations    = LocationOperator.SetLocationSearchModelCascade(project.Locations),
                Holidays     = HolidayOperator.SetHolidaySearchModelCascade(project.Holidays)
            };

            return(projectSearchModel);
        }
Example #2
0
        /// <summary>
        /// Cascade set DeviceSearchModel Result
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public static DeviceSearchModel SetDeviceSearchModelCascade(Device device)
        {
            if (device == null)
            {
                return(null);
            }
            var deviceSearchModel = new DeviceSearchModel
            {
                DeviceId  = device.DeviceId,
                Voltage   = device.Voltage,
                Diameter  = device.Diameter,
                Torque    = device.Torque,
                Locations = LocationOperator.SetLocationSearchModelCascade(device.Locations)
            };

            return(deviceSearchModel);
        }
Example #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);
        }