示例#1
0
        /// <summary>
        /// Create Confirmation or return existing one
        /// </summary>
        /// <param name="move">movement</param>
        /// <param name="checkExisting">if false, new confirmation is created</param>
        /// <returns>Confirmation</returns>
        public static MMovementConfirm Create(MMovement move, Boolean checkExisting)
        {
            if (checkExisting)
            {
                MMovementConfirm[] confirmations = move.GetConfirmations(false);
                for (int i = 0; i < confirmations.Length; i++)
                {
                    MMovementConfirm confirm1 = confirmations[i];
                    if (confirm1 != null)
                    {
                        return(confirm1);
                    }
                }
            }

            MMovementConfirm confirm = new MMovementConfirm(move);

            confirm.Save(move.Get_TrxName());
            MMovementLine[] moveLines = move.GetLines(false);
            for (int i = 0; i < moveLines.Length; i++)
            {
                MMovementLine        mLine = moveLines[i];
                MMovementLineConfirm cLine = new MMovementLineConfirm(confirm);
                cLine.SetMovementLine(mLine);
                cLine.Save(move.Get_TrxName());
            }
            return(confirm);
        }
 /// <summary>
 /// Parent constructor
 /// </summary>
 /// <param name="parent">parent</param>
 public MMovementLineConfirm(MMovementConfirm parent)
     : this(parent.GetCtx(), 0, parent.Get_TrxName())
 {
     SetClientOrg(parent);
     SetM_MovementConfirm_ID(parent.GetM_MovementConfirm_ID());
 }