public static void Db2O(EFData.LightElement dbObj, LightElement obj) { obj.Id = dbObj.Id; obj.Name = dbObj.Name; obj.PointType = (LS_Library.PointTypeEnum)dbObj.PointType; obj.StartPoint = dbObj.StartPoint; obj.PointCount = dbObj.PointCount; obj.Direction = (Direction)dbObj.Direction; obj.ColorSequence = dbObj.ColorSequence; obj.Remark = dbObj.Remark; obj.Partition = new Partition(); obj.ControlSpace = new ControlSpace(); Db2O(dbObj.Partition, obj.Partition); Db2O(dbObj.ControlSpace, obj.ControlSpace); if (dbObj.ControlChannel != null) { ControlChannel cCh = new ControlChannel(); Db2O(dbObj.ControlChannel, out cCh); obj.ControlChannel = cCh; } //if (obj.ControlSpace.Prefix == "AN" || obj.ControlSpace.Prefix == "DX") //{ // if (obj.PointType == LS_Library.PointTypeEnum.RGB) // obj.ColorSequenceList = LightElement.ColorSequenseRGB; // if (obj.PointType == LS_Library.PointTypeEnum.RGBW) // obj.ColorSequenceList = LightElement.ColorSequenseRGBW; //} }
/****************************************************************/ #region Control Channel public static void O2Db(ControlChannel obj, EFData.ControlChannel dbObj) { dbObj.Name = obj.Name; dbObj.HaveDimmer = obj.HaveDimmer; dbObj.ChannelNo = obj.ChannelNo; dbObj.PointType = (EFData.PointTypeEnum)obj.PointType; dbObj.HaveDimmer = obj.HaveDimmer; dbObj.Multilink = obj.Multilink; dbObj.DotNetType = obj.DotNetType; dbObj.Profile = obj.Profile; }
public static void Db2O(EFData.ControlChannel dbObj, out ControlChannel obj) { obj = (ControlChannel)Activator.CreateInstance(Type.GetType(dbObj.DotNetType)); obj.Id = dbObj.Id; obj.HaveDimmer = (bool)dbObj.HaveDimmer; obj.ChannelNo = dbObj.ChannelNo; obj.PointType = (LS_Library.PointTypeEnum)dbObj.PointType; obj.HaveDimmer = (bool)dbObj.HaveDimmer; obj.Multilink = (bool)dbObj.Multilink; obj.DotNetType = dbObj.DotNetType; obj.Profile = dbObj.Profile; }