示例#1
0
        public static RSMDB.ExternalApplicationKey Insert(this ExternalEntity entity, RSMDB.RSMDataModelDataContext context)
        {
            var row = new RSMDB.ExternalApplicationKey
            {
                InternalId = entity.InternalId,
                SystemId   = entity.ExternalSystemId,
                EntityType = Enum.GetName(typeof(EntityType), entity.EntityType),
                ExternalId = entity.ExternalId,
                Added      = entity.KeysAdded
            };

            context.ExternalApplicationKeys.InsertOnSubmit(row);

            context.SubmitChanges();

            return(row);
        }
示例#2
0
        public static T ToModel <T>(this RSMDB.ExternalApplicationKey from, T existing = null)
            where T : ExternalEntity, new()
        {
            var entity = existing == null ? new T() : existing;

            entity.InternalId       = from.InternalId;
            entity.ExternalId       = from.ExternalId;
            entity.ExternalSystemId = from.SystemId;
            entity.EntityType       = (EntityType)Enum.Parse(typeof(EntityType), from.EntityType);
            entity.KeysAdded        = from.Added;

            if (from.ExternalSystem != null)
            {
                entity.ExternalSystem = from.ExternalSystem.ToModel(entity.ExternalSystem);
            }

            return(entity);
        }
示例#3
0
        public static RSMDB.ExternalApplicationKey InsertKeys(this ExternalEntity entity, RSMDB.RSMDataModelDataContext context)
        {
            var row = new RSMDB.ExternalApplicationKey
            {
                InternalId = entity.InternalId,
                SystemId   = entity.ExternalSystemId,
                EntityType = Enum.GetName(typeof(EntityType), entity.EntityType),
                ExternalId = entity.ExternalId,
                Added      = entity.KeysAdded
            };

            if (entity.ExternalUpdated != default(DateTime))
            {
                row.ExternalEntityLastUpdated = entity.ExternalUpdated;
            }

            context.ExternalApplicationKeys.InsertOnSubmit(row);

            context.SubmitChanges();

            return(row);
        }