public override IOTag GetSyncFromDB(IOTag _Entity)
        {
            IOTag ret = new IOTag();

            var FoundEntity = context.Set <IOTag>().FirstOrDefault(e => e.Name == _Entity.Name && e.PLC.Name == _Entity.PLC.Name);

            if (FoundEntity == null)
            {
                ret = new IOTag()
                {
                    Name  = _Entity.Name,
                    PLC   = PLCs.GetSyncFromDB(_Entity.PLC),
                    PLCID = PLCs.GetID(_Entity.PLC.Name)
                };
            }
            else
            {
                FoundEntity.PLC = PLCs.GetSyncFromDB(_Entity.PLC);
                ret             = FoundEntity;
            }
            return(ret);
        }
Example #2
0
        public override PLCTag GetSyncFromDB(PLCTag _Entity)
        {
            PLCTag ret = new PLCTag();

            var FoundEntity = context.Set <PLCTag>().FirstOrDefault(e => e.Name == _Entity.Name && e.PLC.Name == _Entity.PLC.Name);

            if (FoundEntity == null)
            {
                ret = new PLCTag()
                {
                    Name  = _Entity.Name,
                    PLC   = PLCs.GetSyncFromDB(_Entity.PLC),
                    PLCID = PLCs.GetID(_Entity.PLC.Name),
                    Rack  = _Entity.Rack, Slot = _Entity.Slot, Point = _Entity.Point
                };
            }
            else
            {
                FoundEntity.PLC  = PLCs.GetSyncFromDB(_Entity.PLC);
                FoundEntity.Rack = _Entity.Rack; FoundEntity.Slot = _Entity.Slot; FoundEntity.Point = _Entity.Point;
                ret = FoundEntity;
            }
            return(ret);
        }