Ejemplo n.º 1
0
        public static InOrderPos NewACObject(MyCompanyDB dbApp, IACObject parentACObject)
        {
            InOrderPos entity = new InOrderPos();

            entity.InOrderPosID = Guid.NewGuid();
            entity.DefaultValuesACObject();
            InOrder inOrder = parentACObject as InOrder;

            if (inOrder != null)
            {
                if (inOrder.EntityState != System.Data.EntityState.Added &&
                    inOrder.InOrderPos_InOrder != null &&
                    inOrder.InOrderPos_InOrder.Any())
                {
                    entity.Sequence = inOrder.InOrderPos_InOrder.Select(c => c.Sequence).Max() + 1;
                }
                else
                {
                    entity.Sequence = 1;
                }
                entity.InOrder = inOrder;
                inOrder.InOrderPos_InOrder.Add(entity);
            }
            entity.SetInsertAndUpdateInfo(Database.Initials, dbApp);
            return(entity);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Erstellt ein neues InOrderPos-Objekt.
        /// </summary>
        /// <param name="inOrderPosID">Anfangswert der Eigenschaft InOrderPosID.</param>
        /// <param name="inOrderID">Anfangswert der Eigenschaft InOrderID.</param>
        /// <param name="sequence">Anfangswert der Eigenschaft Sequence.</param>
        /// <param name="materialID">Anfangswert der Eigenschaft MaterialID.</param>
        /// <param name="targetQuantity">Anfangswert der Eigenschaft TargetQuantity.</param>
        /// <param name="insertName">Anfangswert der Eigenschaft InsertName.</param>
        /// <param name="insertDate">Anfangswert der Eigenschaft InsertDate.</param>
        /// <param name="updateName">Anfangswert der Eigenschaft UpdateName.</param>
        /// <param name="updateDate">Anfangswert der Eigenschaft UpdateDate.</param>
        public static InOrderPos CreateInOrderPos(global::System.Guid inOrderPosID, global::System.Guid inOrderID, global::System.Int32 sequence, global::System.Guid materialID, global::System.Double targetQuantity, global::System.String insertName, global::System.DateTime insertDate, global::System.String updateName, global::System.DateTime updateDate)
        {
            InOrderPos inOrderPos = new InOrderPos();

            inOrderPos.InOrderPosID   = inOrderPosID;
            inOrderPos.InOrderID      = inOrderID;
            inOrderPos.Sequence       = sequence;
            inOrderPos.MaterialID     = materialID;
            inOrderPos.TargetQuantity = targetQuantity;
            inOrderPos.InsertName     = insertName;
            inOrderPos.InsertDate     = insertDate;
            inOrderPos.UpdateName     = updateName;
            inOrderPos.UpdateDate     = updateDate;
            return(inOrderPos);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deletes this entity-object from the database
        /// </summary>
        /// <param name="database">Entity-Framework databasecontext</param>
        /// <param name="withCheck">If set to true, a validation happens before deleting this EF-object. If Validation fails message ís returned.</param>
        /// <param name="softDelete">If set to true a delete-Flag is set in the dabase-table instead of a physical deletion. If  a delete-Flag doesn't exit in the table the record will be deleted.</param>
        /// <returns>If a validation or deletion failed a message is returned. NULL if sucessful.</returns>
        public override MsgWithDetails DeleteACObject(IACEntityObjectContext database, bool withCheck, bool softDelete = false)
        {
            if (withCheck)
            {
                MsgWithDetails msg = IsEnabledDeleteACObject(database);
                if (msg != null)
                {
                    return(msg);
                }
            }
            int     sequence = Sequence;
            InOrder inOrder  = InOrder;

            if (inOrder.InOrderPos_InOrder.IsLoaded)
            {
                inOrder.InOrderPos_InOrder.Remove(this);
            }
            database.DeleteObject(this);
            InOrderPos.RenumberSequence(inOrder, sequence);
            return(null);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'InOrderPos'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToInOrderPos(InOrderPos inOrderPos)
 {
     base.AddObject("InOrderPos", inOrderPos);
 }