Пример #1
0
 /// <summary>
 /// Kind of a copy constructor that moves data from a <see cref="Rechnungsposition"/>
 /// to the flat structure of the RechnungspositionFlat
 /// </summary>
 /// <param name="rp">Rechnungsposition</param>
 public RechnungspositionFlat(Rechnungsposition rp)
 {
     // todo: make this reflection based. this is pita.
     this.Positionsnummer = rp.Positionsnummer;
     this.LieferungVon    = rp.LieferungVon;
     this.LieferungBis    = rp.LieferungBis;
     this.Positionstext   = rp.Positionstext;
     this.LokationsId     = rp.LokationsId;
     this.VertragsId      = rp.VertragsId;
     this.VertragskontoId = rp.VertragskontoId;
     if (rp.Einzelpreis != null)
     {
         this.PreisWert       = rp.Einzelpreis.Wert;
         this.PreisEinheit    = rp.Einzelpreis.Einheit;
         this.PreisBezugswert = rp.Einzelpreis.Bezugswert;
         this.PreisStatus     = rp.Einzelpreis.Status;
     }
     if (rp.PositionsMenge != null)
     {
         this.PositionsMengeEinheit = rp.PositionsMenge.Einheit;
         this.PositionsMengeWert    = rp.PositionsMenge.Wert;
     }
     else
     {
         this.PositionsMengeEinheit = null;
         this.PositionsMengeWert    = null;
     }
     this.Guid   = rp.Guid;
     this.Status = rp.Status;
 }
Пример #2
0
        /// <summary>
        /// converts a <see cref="RechnungspositionFlat"/> as returned from SAP OData service into a BO4E <see cref="Rechnungsposition"/>. Basically reverts <seealso cref="RechnungspositionFlat(Rechnungsposition)"/>.
        /// </summary>
        /// <returns>Rechnungsposition</returns>
        public Rechnungsposition ToRechnungsposition()
        {
            // todo: make this reflection based. this is pure pita. in fact the whole process of the flat structure is pita for sap
            Rechnungsposition result = new Rechnungsposition()
            {
                Positionsnummer = Positionsnummer,
                LieferungVon    = LieferungVon,
                LieferungBis    = LieferungBis,
                Positionstext   = Positionstext,
                LokationsId     = LokationsId,
                VertragsId      = VertragsId,
                VertragskontoId = VertragskontoId,
                Einzelpreis     = new Preis()
                {
                    Wert       = PreisWert,
                    Einheit    = PreisEinheit,
                    Bezugswert = PreisBezugswert,
                    Status     = PreisStatus ?? Preisstatus.VORLAEUFIG // poor default choice
                },
                PositionsMenge = new Menge()
                {
                    Einheit = PositionsMengeEinheit ?? Mengeneinheit.KWH, // poor default choice
                    Wert    = PositionsMengeWert ?? 0.0M,                 // poor default choice
                },
                Guid   = Guid,
                Status = Status
            };

            return(result);
        }
Пример #3
0
        /// <summary>
        /// Kind of a copy constructor that moves data from a <see cref="Rechnungsposition"/>
        /// to the flat structure of the RechnungspositionFlat
        /// </summary>
        /// <param name="rp">Rechnungsposition</param>
        public RechnungspositionFlat(Rechnungsposition rp)
        {
            // todo: make this reflection based. this is pita.
            this.Positionsnummer = rp.Positionsnummer;
            this.LieferungVon    = rp.LieferungVon;
            this.LieferungBis    = rp.LieferungBis;
            this.Positionstext   = rp.Positionstext;
            this.LokationsId     = rp.LokationsId;
            this.VertragsId      = rp.VertragsId;
#pragma warning disable CS0618 // Type or member is obsolete
            this.VertragskontoId = rp.VertragskontoId;
#pragma warning restore CS0618 // Type or member is obsolete
            if (rp.Einzelpreis != null)
            {
                this.PreisWert       = rp.Einzelpreis.Wert;
                this.PreisEinheit    = rp.Einzelpreis.Einheit;
                this.PreisBezugswert = rp.Einzelpreis.Bezugswert;
                this.PreisStatus     = rp.Einzelpreis.Status;
            }
            if (rp.PositionsMenge != null)
            {
                this.PositionsMengeEinheit = rp.PositionsMenge.Einheit;
                this.PositionsMengeWert    = rp.PositionsMenge.Wert;
            }
            else
            {
                this.PositionsMengeEinheit = null;
                this.PositionsMengeWert    = null;
            }
            this.Guid   = rp.Guid;
            this.Status = rp.Status;
        }