Ejemplo n.º 1
0
        /// <summary>
        /// Fügt einen neuen Kassenabschluss der Datenbank hinzu
        /// </summary>
        /// <param name="cashClosureUserAccountID">Die UserAccount ID</param>
        /// <param name="closureDate">Datum des Kassenabschlusses</param>
        /// <param name="comment">Kommentar</param>
        /// <returns></returns>
        public static int Add(int cashClosureUserAccountID, DateTime closureDate, double revenue, double expense, string comment = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var cashClosure = new CashClosure
                {
                    ClosureDate = closureDate,
                    ClosureUserAccount = db.UserAccounts.Single(u => u.UserAccountID == cashClosureUserAccountID),
                    Comment = comment,
                    Sum = (revenue - expense),
                    Expense = expense,
                    Revenue = revenue
                };

                db.CashClosures.AddObject(cashClosure);
                db.SaveChanges();

                return cashClosure.CashClosureID;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fügt einen neuen Kassenabschluss der Datenbank hinzu
        /// </summary>
        /// <param name="cashClosureUserAccountID">Die UserAccount ID</param>
        /// <param name="closureDate">Datum des Kassenabschlusses</param>
        /// <param name="comment">Kommentar</param>
        /// <returns></returns>
        public static int Add(int cashClosureUserAccountID, DateTime closureDate, double revenue, double expense, string comment = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var cashClosure = new CashClosure
                {
                    ClosureDate        = closureDate,
                    ClosureUserAccount = db.UserAccounts.Single(u => u.UserAccountID == cashClosureUserAccountID),
                    Comment            = comment,
                    Sum     = (revenue - expense),
                    Expense = expense,
                    Revenue = revenue
                };

                db.CashClosures.AddObject(cashClosure);
                db.SaveChanges();

                return(cashClosure.CashClosureID);
            }
        }
        /// <summary>
        /// Füllt die Felder aus
        /// Benötigt Kassenabschluss-Instanz und die zugehörigen Kassenabrechnung-Instanz und Kassenabschlussbeleg-Instanz
        /// </summary>
        /// <param name="cashClosure">Kassenabschluss-Instanz</param>
        /// <param name="cashClosureReport">Kassenabschlussbeleg-Instanz</param>
        /// <param name="cashClosureReceipt">Kassenabrechnung-Instanz</param>
        public CashClosureManagerDataGridModel(CashClosure cashClosure, CashClosureReport cashClosureReport, CashClosureReceipt cashClosureReceipt)
        {
            this.cashClosure = cashClosure;
            this.cashClosureReport = cashClosureReport;
            this.cashClosureReceipt = cashClosureReceipt;

            this.cashClosureID = cashClosure.CashClosureID;
            this.closureDate = SafeStringParser.safeParseToStr(cashClosure.ClosureDate, true);
            this.comment = SafeStringParser.safeParseToStr(cashClosure.Comment);
            this.revenues = SafeStringParser.safeParseToMoney(cashClosure.Revenue, true);
            this.expenses = SafeStringParser.safeParseToMoney(cashClosure.Expense, true);
            this.sum = SafeStringParser.safeParseToMoney(cashClosure.Sum, true);
            this.reportPrinted = cashClosureReport.PrintDone;
            this.reportPrintDate = SafeStringParser.safeParseToStr(cashClosureReport.PrintDate, true);
            this.reportDone = cashClosureReport.Done;
            this.reportDoneBoxEnabled = !(cashClosureReport.Done);
            this.reportDoneDate = SafeStringParser.safeParseToStr(cashClosureReport.DoneDate, true);
            this.receiptPrinted = cashClosureReceipt.PrintDone;
            this.receiptPrintedDate = SafeStringParser.safeParseToStr(cashClosureReceipt.PrintDate, true);

            if (cashClosure.ClosureUserAccount != null)
                this.closureUser = SafeStringParser.safeParseToStr(cashClosure.ClosureUserAccount.Username);
            else
                this.closureUser = "";

            if (cashClosureReport.PrintUserAccount != null)
                this.reportPrintUser = SafeStringParser.safeParseToStr(cashClosureReport.PrintUserAccount.Username);
            else
                this.reportPrintUser = "";

            if (cashClosureReport.DoneUserAccount != null)
                this.reportDoneUser = SafeStringParser.safeParseToStr(cashClosureReport.DoneUserAccount.Username);
            else
                this.reportDoneUser = "";

            if (cashClosureReceipt.PrintUserAccount != null)
                this.receiptPrintedUser = SafeStringParser.safeParseToStr(cashClosureReceipt.PrintUserAccount.Username);
            else
                this.receiptPrintedUser = "";
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'CashClosures'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToCashClosures(CashClosure cashClosure)
 {
     base.AddObject("CashClosures", cashClosure);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Erstellt ein neues CashClosure-Objekt.
 /// </summary>
 /// <param name="cashClosureID">Anfangswert der Eigenschaft CashClosureID.</param>
 /// <param name="closureDate">Anfangswert der Eigenschaft ClosureDate.</param>
 /// <param name="sum">Anfangswert der Eigenschaft Sum.</param>
 /// <param name="revenue">Anfangswert der Eigenschaft Revenue.</param>
 /// <param name="expense">Anfangswert der Eigenschaft Expense.</param>
 public static CashClosure CreateCashClosure(global::System.Int32 cashClosureID, global::System.DateTime closureDate, global::System.Double sum, global::System.Double revenue, global::System.Double expense)
 {
     CashClosure cashClosure = new CashClosure();
     cashClosure.CashClosureID = cashClosureID;
     cashClosure.ClosureDate = closureDate;
     cashClosure.Sum = sum;
     cashClosure.Revenue = revenue;
     cashClosure.Expense = expense;
     return cashClosure;
 }