Beispiel #1
0
 public MasterEntity(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus status)
     : this(id)
 {
     _DateCreated = dateCreated;
     _DateLastUpdated = dateLastUpdated;
     _Status = status;
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            Status = (EntityStatus) reader.ReadSByte();

            return this;
        }
Beispiel #3
0
        public bool CheckCommoditySupplierIsUsed(CommoditySupplier commoditySupplier, EntityStatus intendedStatus)
        {
            if (intendedStatus == EntityStatus.Inactive)
            {
                if ( _ctx.tblCommodityOwner.Any(n => n.CostCentreId == commoditySupplier.Id && n.IM_Status == (int) EntityStatus.Active))
                    return true;
                if (_ctx.tblCommodityProducer.Any(n => n.CostCentreId == commoditySupplier.Id && n.IM_Status == (int)EntityStatus.Active))
                    return true;
            }
            if (intendedStatus == EntityStatus.Deleted)
            {
                if (_ctx.tblCommodityOwner.Any(n => n.CostCentreId == commoditySupplier.Id &&
                                                    (n.IM_Status == (int) EntityStatus.Active ||
                                                     n.IM_Status == (int) EntityStatus.Inactive)
                    ))
                    return true;
                if (_ctx.tblCommodityProducer.Any(n => n.CostCentreId == commoditySupplier.Id &&
                                                       (n.IM_Status == (int) EntityStatus.Active ||
                                                        n.IM_Status == (int) EntityStatus.Inactive)
                    )) return true;
            }
            if (_ctx.tblSourcingDocument.Any(n => n.DocumentOnBehalfOfCostCentreId == commoditySupplier.Id))
                return true;

            return false;
        }
 public ChangeStatusForm(string entityName, string entityType, EntityStatus status)
 {
     InitializeComponent();
     lblMessage.Text = string.Format(status == EntityStatus.Active ? DisableFormat : EnableFormat,
                                     entityType ?? Unknown,
                                     entityName ?? Unknown);
     Width = lblMessage.Width + 72;
 }
Beispiel #5
0
 public void EditCategory(Code code, Name name, bool showOn, EntityStatus status)
 {
     Code     = code;
     Name     = name;
     ShowOn   = showOn;
     Modified = DateTime.Now;
     Status   = status;
 }
 public ChangeStatusForm(string entityName, string entityType, EntityStatus status)
 {
     InitializeComponent();
     lblMessage.Text = string.Format(status == EntityStatus.Active ? DisableFormat : EnableFormat,
                                     entityType ?? Unknown,
                                     entityName ?? Unknown);
     Width = lblMessage.Width + 72;
 }
Beispiel #7
0
    public virtual void setStatus(EntityStatus status)
    {
        _status = status;

#if !DISABLE_ANIMATOR
        _animator.SetInteger("animation_state", (int)status);
#endif
    }
Beispiel #8
0
 public void SetStatus(string owner, EntityStatus status)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         this.SetStatus(db, owner, status);
         //db.SubmitChanges(); // Not needed, since we do a direct update
     }
 }
Beispiel #9
0
 public UC_Category(MainWindow parent)
 {
     InitializeComponent();
     this.parent        = parent;
     this.workingStatus = WorkingStatus.NEW;
     this.entityStatus  = EntityStatus.UNATTACHED;
     Initalize();
 }
Beispiel #10
0
        public void SetUserStatus(string[] args)
        {
            string       username = args.GetRequiredValue(0);
            EntityStatus status   = args.GetRequiredEnum <EntityStatus>(1);

            m_manager.SetStatus(username, status);
            WriteLine("User status updated to '{0}'.", status);
        }
Beispiel #11
0
 public void SetStatus(long certificateID, EntityStatus status)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         this.SetStatus(db, certificateID, status);
         //db.SubmitChanges(); // Not needed, since we do a direct update
     }
 }
Beispiel #12
0
        public void BundleSetStatus(string[] args)
        {
            long         bundleId = args.GetRequiredValue <long>(0);
            EntityStatus status   = args.GetRequiredEnum <EntityStatus>(1);

            Client.SetBundleStatus(new long[] { bundleId }, status);
            WriteLine("ok");
        }
Beispiel #13
0
 private void Load(JsonObject data)
 {
     this.Question   = data.Get <string>("question", this.Question);
     this.Answer     = data.Get <string>("answer", this.Answer);
     this.Comments   = data.Get <string>("comments", this.Comments);
     this.AccessMode = data.Get <AccessMode>("accessMode", this.AccessMode);
     this.Status     = data.Get <EntityStatus>("status", this.Status);
 }
Beispiel #14
0
        /// <summary>
        /// Updates the range.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="omitExceptions">if set to <c>true</c> [omit exceptions].</param>
        /// <returns>Item1=operation result, Item2=List<typeparamref name="TEntity"/></returns>
        public Tuple <bool, List <TEntity> > UpdateRange(List <TEntity> entities, bool omitExceptions)
        {
            int id = 0;
            Tuple <bool, List <TEntity> > result = new Tuple <bool, List <TEntity> >(false, entities);

            try
            {
                foreach (var item in entities)
                {
                    id = 0;
                    _dbContext.Entry(item).State = EntityState.Modified;
                }

                _dbContext.SaveChanges();
                result = new Tuple <bool, List <TEntity> >(true, entities);
            }
            catch (DbEntityValidationException ex)
            {
                if (!omitExceptions)
                {
                    throw;
                }
                _status = new EntityStatus {
                    Id = id
                };
                _status.SetErrors(ex?.EntityValidationErrors);
            }
            catch (DbUpdateException ex)
            {
                if (!omitExceptions)
                {
                    throw;
                }
                var decodedErrors = TryDecodeDbUpdateException(ex);
                if (decodedErrors != null)
                {
                    _status = new EntityStatus {
                        Id = id
                    };
                    _status.SetErrors(decodedErrors);
                }
            }
            catch (Exception ex)
            {
                if (!omitExceptions)
                {
                    throw;
                }
                _status = new EntityStatus {
                    Id = id
                };
                _status.SetErrors(new List <ValidationResult> {
                    new ValidationResult(ex.Message)
                });
            }

            return(result);
        }
Beispiel #15
0
        public void SetStatus(ConfigDatabase db, long certificateID, EntityStatus status)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            db.Certificates.ExecUpdateStatus(certificateID, status);
        }
 public void Delete(string userId)
 {
     if (this.Status == EntityStatus.Active || this.Status == EntityStatus.Inactive)
     {
         this.DeletedBy    = userId;
         this.DeletionDate = DateTime.UtcNow;
         this.Status       = EntityStatus.Deleted;
     }
 }
Beispiel #17
0
 private void SetSelected(EntityStatus entityStatus)
 {
     if (!cbStatus.Items.Contains(entityStatus.ToString()))
     {
         throw new InvalidDataException($"Unexpected value {entityStatus} passed");
     }
     EntityStatus           = entityStatus;
     cbStatus.SelectedIndex = cbStatus.Items.IndexOf(entityStatus.ToString());
 }
Beispiel #18
0
        public void Reactivate()
        {
            if (this.Status != EntityStatus.Inactive)
            {
                throw new ApplicationException("The entity only can be reactivated when previous status is inactive");
            }

            this.Status = EntityStatus.Active;
        }
Beispiel #19
0
        public void Activate()
        {
            if (this.Status != EntityStatus.New)
            {
                throw new ApplicationException("The entity only can be activated when previous status is new");
            }

            this.Status = EntityStatus.Active;
        }
Beispiel #20
0
    public override void setStatus(EntityStatus status)
    {
        if (!_followingTarget && base.status == EntityStatus.MOVING)
        {
            fire(Actions.MOVEMENT_END);
        }

        base.setStatus(status);
    }
Beispiel #21
0
        public void SetStatus(ConfigDatabase db, long anchorID, EntityStatus status)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            db.Anchors.ExecUpdateStatus(anchorID, status);
        }
Beispiel #22
0
 public async Task <List <Entity> > GetEntities(EntityStatus status, EntityType type)
 {
     using (var context = _contextFactory.Create())
     {
         return(await context.Entities.Where(x =>
                                             x.Status == status &&
                                             x.EnityKind == type).ToListAsync());
     }
 }
Beispiel #23
0
 public void EditUnitOfMeasure(Name name
                               , decimal value
                               , EntityStatus status)
 {
     Name     = name;
     Value    = value;
     Status   = status;
     Modified = DateTime.Now;
 }
Beispiel #24
0
        public void DomainAddressStatusSet(string[] args)
        {
            string       name   = args.GetRequiredValue(0);
            EntityStatus status = args.GetRequiredEnum <EntityStatus>(1);

            Domain domain = this.DomainGet(name);

            AddressClient.SetDomainAddressesStatus(domain.ID, status);
        }
        public static Address GetAddressesOrDomain(this IAddressManager client, MailAddress address, EntityStatus? status)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            return client.GetAddressesOrDomain(address.Address, status);
        }
Beispiel #26
0
        public void SetStatus(ConfigDatabase db, string owner, EntityStatus status)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            db.Bundles.ExecUpdateStatus(owner, status);
        }
Beispiel #27
0
 public static string GetMessage(string title, EntityStatus entityStatus = EntityStatus.Create)
 {
     return(entityStatus switch
     {
         EntityStatus.Create => $"Yeni {title} Listeye Eklendi",
         EntityStatus.Update => $"{title} Başaryıla Güncellendi",
         EntityStatus.Delete => $"{title} Kalıcı Olarak Silindi",
         _ => "Bir Hata Meydana Geldi. İşlem Başarısız",
     });
        public async Task Execute_Should_UpdateEntityStatus()
        {
            // arrange
            var cancellationToken = CancellationToken.None;
            var dbContextFactory  = new DefaultDbContextFactory();
            var unitOfWorkFactory = new TransactionScopeUnitOfWorkFactory();
            var generator         = new CoreDbGenerator(unitOfWorkFactory, dbContextFactory);
            var handler           = new UpdateEntityStatusHandler(unitOfWorkFactory, dbContextFactory);

            using (var _ = unitOfWorkFactory.Create())
            {
                // arrange
                var item1 = new EntityStatus {
                    Uid = Guid.NewGuid(), DisplayOrder = 1, Code = "drafted", Name = "Draft"
                };
                var item2 = new EntityStatus {
                    Uid = Guid.NewGuid(), DisplayOrder = 2, Code = "published", Name = "Published"
                };

                await generator.InsertEntityStatus(item1, cancellationToken);

                await generator.InsertEntityStatus(item2, cancellationToken);

                // act
                var request = new UpdateEntityStatus
                {
                    EntityTypeCode = generator.EntityTypeCode,
                    EntityUid      = generator.EntityUid,
                    Item           = new EntityStatus
                    {
                        Uid          = item1.Uid,
                        Code         = "draft",
                        Name         = "The Draft",
                        DisplayOrder = 10
                    }
                };

                var result = await handler.Handle(request, cancellationToken);

                // assert
                Assert.IsNotNull(result);
                Assert.AreEqual(1, result.AffectedRows);

                var statuses = await generator.GetEntityStatuses(cancellationToken);

                Assert.AreEqual(2, statuses.Rows.Count);

                Assert.AreEqual(2, statuses.Rows[0].DisplayOrder);
                Assert.AreEqual("published", statuses.Rows[0].Code);
                Assert.AreEqual("Published", statuses.Rows[0].Name);

                Assert.AreEqual(10, statuses.Rows[1].DisplayOrder);
                Assert.AreEqual("draft", statuses.Rows[1].Code);
                Assert.AreEqual("The Draft", statuses.Rows[1].Name);
            }
        }
Beispiel #29
0
        public void Delete()
        {
            if ( this.EntityStatus == EntityStatus.New )
                throw new InvalidOperationException();

            this.entityStatus = EntityStatus.Deleted;
            Client.Current.DeleteEntity( this );

            this.OnPropertyChanged( "EntityStatus" );
        }
Beispiel #30
0
        public virtual void OnError(EntityStatus entityStatus)
        {
            transaction?.Rollback();
            EntityStatus = entityStatus;

            foreach (var error in entityStatus.Errors)
            {
                Log4Net.WriteLog($"Error: {error.ErrorMessage} - Member: {error.MemberNames}", Log4Net.Level.ERROR);
            }
        }
Beispiel #31
0
 /// <summary>
 /// Adds the error.
 /// </summary>
 /// <param name="efStatus">The ef status.</param>
 /// <param name="id">The identifier.</param>
 public void AddError(EntityStatus efStatus, int id = 0)
 {
     if (!efStatus.IsValid)
     {
         foreach (var errorStatus in efStatus.EfErrors)
         {
             _errors.Add(new NotificationError("Error validando entidad.", new ValidationException(errorStatus.ErrorMessage), id));
         }
     }
 }
Beispiel #32
0
 public Generator(IGraphSession session, IMetadataFactory metadataFactory, ProxyGenerator generator, ProxyGenerationOptions options, EntityStatus status = EntityStatus.Clean)
 {
     _generator       = generator;
     _session         = session;
     _metadataFactory = metadataFactory;
     _state           = session.State;
     _status          = status;
     _dependencyStack = new Stack <EntityReference>();
     _options         = options;
 }
Beispiel #33
0
        public override bool GetBucketForImport(TrelloCaseEntityBucket bucket, BCSyncStatus syncstatus)
        {
            CardData card = Client.Get <CardData>(
                String.Format("/cards/{0}?key=<>f&token=<>", syncstatus.ExternID));

            MappedCase   obj    = bucket.Case = bucket.Case.Set(card, card.Id, card.LastActivity);
            EntityStatus status = EnsureStatus(obj, SyncDirection.Import);

            return(status == EntityStatus.Pending);
        }
Beispiel #34
0
 public UnitOfMeasure(Name name
                      , decimal value
                      , DateTime created
                      , EntityStatus status = EntityStatus.Active)
 {
     Name    = name;
     Value   = value;
     Created = created == DateTime.MinValue ? DateTime.Now : created;
     Status  = status;
 }
Beispiel #35
0
 protected void OnEntityPropertyUpdated()
 {
     switch (this.EntityStatus)
     {
     case EntityStatus.Clean:
         this.data.Revision++;
         this.entityStatus = EntityStatus.Dirty;
         break;
     }
 }
Beispiel #36
0
 public void ResetStatus(EntityStatus oldES, EntityStatus newES)
 {
     Items.ForEach(e =>
     {
         if (e.S == oldES)
         {
             e.S = newES;
         }
     });
 }
 public Domain[] GetDomains(string[] domainNames, EntityStatus? status)
 {
     try
     {
         return Store.Domains.Get(domainNames, status);
     }
     catch (Exception ex)
     {
         throw CreateFault("GetDomains", ex);
     }
 }
 public static CertainValueCertainProductDiscount MakeDiscount(decimal value = 100, int effectiveDateOffset = -1,
     int endDateOffset = 1, EntityStatus status = EntityStatus.Active)
 {
     return new CertainValueCertainProductDiscount(Guid.NewGuid())
     {
         CertainValueCertainProductDiscountItems =
             new List<CertainValueCertainProductDiscount.CertainValueCertainProductDiscountItem>
             {
                 MakeItem(value, effectiveDateOffset, endDateOffset, status)
             }
     };
 }
 public static CertainValueCertainProductDiscount.CertainValueCertainProductDiscountItem MakeItem(decimal value = 100, int effectiveDateOffset = -1,
     int endDateOffset = 1, EntityStatus status = EntityStatus.Active)
 {
     return new CertainValueCertainProductDiscount.CertainValueCertainProductDiscountItem(Guid.NewGuid())
     {
         EffectiveDate = DateTime.Now.AddDays(effectiveDateOffset),
         EndDate = DateTime.Now.AddDays(endDateOffset),
         CertainValue = value,
         IsActive = status,
         _Status = status
     };
 }
Beispiel #40
0
        public IEntityPage<IPost> GetPostPage(int? tagId, int? seriesId, EntityStatus status, int skipCount, int takeCount)
        {
            //Get total count
            var postCount = AppCache.PostCounts.GetOrAddCount(() => GetPostCounts(tagId, seriesId, status)
                , tagId, seriesId, status);

            //Get posts for the requested page
            var sql = GetPostsPageSql(false, tagId, seriesId, status, skipCount, takeCount);
            var posts = this.dbContext.Query<Post, Series>(sql).Select(p => SetupPostAfterLoad(p, false));

            return new EntityPage<IPost>(skipCount, takeCount, postCount, posts);
        }
Beispiel #41
0
 public static IEnumerable<Address> Get(this Table<Address> table, string[] emailAddresses, EntityStatus? status)
 {
     if (emailAddresses.IsNullOrEmpty())
     {
         throw new ArgumentException("value was null or empty", "emailAddresses");
     }
     //
     // We cannot precompile this (throws at runtime) because emailAddresses.Length can change at runtime
     //
     return from address in table.GetDB().Addresses
            where emailAddresses.Contains(address.EmailAddress) && address.Status == status
            select address;
 }
Beispiel #42
0
 public static IEnumerable<Domain> Get(this Table<Domain> table, string[] domains, EntityStatus status)
 {
     if (domains.IsNullOrEmpty())
     {
         throw new ArgumentException("value was null or empty", "domains");
     }
     //
     // We cannot precompile this (throws at runtime) because domains.Length can change at runtime
     //
     return from domain in table.GetDB().Domains
            where domains.Contains(domain.Name) && domain.Status == status
            select domain;
 }
Beispiel #43
0
 public bool CheckCommodityOwnerTypeIsUsed(CommodityOwnerType commodityOwnerType, EntityStatus intendedStatus)
 {
     if (intendedStatus == EntityStatus.Inactive)
     {
         if (_ctx.tblCommodityOwner.Any(n => n.CommodityOwnerTypeId == commodityOwnerType.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
     }
     else if (intendedStatus == EntityStatus.Deleted)
     {
         if (_ctx.tblCommodityOwner.Any(n => n.CommodityOwnerTypeId == commodityOwnerType.Id &&
             (n.IM_Status == (int)EntityStatus.Inactive || n.IM_Status == (int)EntityStatus.Active)))
             return true;
     }
     return false;
 }
        public static Domain GetDomain(this DomainManagerClient client, string domainName, EntityStatus? status)
        {
            if (string.IsNullOrEmpty(domainName))
            {
                throw new ArgumentException("value was null or empty", "domainName");
            }

            Domain[] domains = client.GetDomains(new string[] { domainName }, status);
            if (domains.IsNullOrEmpty())
            {
                return null;
            }

            return domains[0];
        }
        public static Address GetAddressesOrDomain(this IAddressManager client, string emailAddress, EntityStatus? status)
        {
            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentException("value was null or empty", "emailAddress");
            }

            Address[] addresses = client.GetAddressesOrDomain(new string[] { emailAddress }, status);
            if (addresses.IsNullOrEmpty())
            {
                return null;
            }

            return addresses[0];
        }
Beispiel #46
0
        public void Save()
        {
            switch ( this.EntityStatus )
            {
                case EntityStatus.Dirty:
                    Client.Current.UpdateEntity( this );
                    this.entityStatus = EntityStatus.Clean;
                    break;

                case EntityStatus.New:
                    Client.Current.CreateEntity( this );
                    this.entityStatus = EntityStatus.Clean;
                    break;

                case EntityStatus.Deleted:
                case EntityStatus.Conflict:
                    throw new InvalidOperationException();
            }
        }
Beispiel #47
0
 public static Status ToStatus(EntityStatus status)
 {
     switch (status)
     {
         case EntityStatus.Idle:
             return MemoryAPI.Status.Standing;
         case EntityStatus.Engaged:
             return MemoryAPI.Status.Fighting;
         case EntityStatus.Dead:
             return MemoryAPI.Status.Dead1;
         case EntityStatus.DeadEngaged:
             return MemoryAPI.Status.Dead2;
         case EntityStatus.Event:
             return MemoryAPI.Status.Event;
         case EntityStatus.Healing:
             return MemoryAPI.Status.Healing;
         default:
             return MemoryAPI.Status.Unknown;
     }
 }
Beispiel #48
0
 public Competitor(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive)
     : base(id, dateCreated, dateLastUpdated, isActive)
 { 
 
 }
Beispiel #49
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Status = (EntityStatus)stream.ReadUInt8();
 }
Beispiel #50
0
 public EntityStatusPacket(int entityId, EntityStatus status)
 {
     EntityId = entityId;
     Status = status;
 }
Beispiel #51
0
        public Containment(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive)
            : base(id, dateCreated, dateLastUpdated, isActive)
        {

        }
Beispiel #52
0
 public override void Read()
 {
     EID = Int;
     Status = (EntityStatus)Byte; //TODO: EntityStatus Enum
 }
Beispiel #53
0
 public CentreType(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive)
     : base(id, dateCreated, dateLastUpdated, isActive) { }
Beispiel #54
0
 public BankBranch(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive)
    : base(id, dateCreated, dateLastUpdated, isActive){}
Beispiel #55
0
 public InventorySerials(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus status) : base(id, dateCreated, dateLastUpdated, status)
 {
 }
Beispiel #56
0
        public ProductBrand(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive)
            : base(id, dateCreated, dateLastUpdated, isActive)
        {

        }
Beispiel #57
0
 public CommoditySupplier(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive) : base(id, dateCreated, dateLastUpdated, isActive)
 {
     CostCentreType = CostCentreEntities.CostCentreType.CommoditySupplier;
 }
 public CertainValueCertainProductDiscount(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive, List<CertainValueCertainProductDiscountItem> certainValueCertainProductDiscount)
      : base(id, dateCreated, dateLastUpdated, isActive)
  {
      CertainValueCertainProductDiscountItems = certainValueCertainProductDiscount;
  }
 public CertainValueCertainProductDiscountItem(Guid id, DateTime dateCreated, DateTime dateLastUpdated, EntityStatus isActive)
     : base(id, dateCreated, dateLastUpdated, isActive) { }
Beispiel #60
0
 internal void _SetStatus(EntityStatus status )
 {
     _Status = status;
 }