/// <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); }
/// <summary> /// Cascade set UserSearchModel Result /// </summary> /// <param name="user"></param> /// <returns></returns> public static UserSearchModel SetUserSearchModelCascade(ApplicationUser user) { if (user == null) { return(null); } var userSearchModel = new UserSearchModel { UserId = user.Id, UserName = user.UserName, Groups = user.UserGroups.Select(v => GroupOperator.SetGroupSubSearchModel(v.Group)), Locations = user.UserLocations.Select(v => LocationOperator.SetLocationSubSearchModel(v.Location)) }; return(userSearchModel); }
/// <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); }
/// <summary> /// Cascade set AlarmSearchModel Result /// </summary> /// <param name="alarm"></param> /// <returns></returns> public static AlarmSearchModel SetAlarmSearchModelCascade(Alarm alarm) { if (alarm == null) { return(null); } var alarmSearchModel = new AlarmSearchModel { AlarmId = alarm.AlarmId, AlarmMessageId = alarm.AlarmMessageId, LocationId = alarm.LocationId, CreateDate = alarm.CreateDate, Location = LocationOperator.SetLocationSubSearchModel(alarm.Location), AlarmMessage = AlarmMessageOperator.SetAlarmMessageSubSearchModel(alarm.AlarmMessage) }; return(alarmSearchModel); }
/// <summary> /// Cascade set LogSearchModel Result /// </summary> /// <param name="log"></param> /// <returns></returns> public static LogSearchModel SetLogSearchModelCascade(Log log) { if (log == null) { return(null); } var logSearchModel = new LogSearchModel { LogId = log.LogId, Comment = log.Comment, LogDescriptionId = log.LogDescriptionId, LocationId = log.LocationId, Creator = log.Creator, CreateDate = log.CreateDate, Modifier = log.Modifier, ModifiedDate = log.ModifiedDate, LogDescription = LogDescriptionOperator.SetLogDescriptionSubSearchModel(log.LogDescription), Location = LocationOperator.SetLocationSubSearchModel(log.Location) }; return(logSearchModel); }
/// <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); }