예제 #1
0
        /// <summary>
        /// Fügt eine neue Kassenabrechnung der Datenbank hinzu
        /// </summary>
        /// <param name="cashClosureID">Die benötigte Kassenabschluss ID</param>
        /// <param name="printDone">Druck beendet</param>
        /// <param name="printDate">Druckdatum</param>
        /// <param name="printUserAccountID">Druck Benutzer</param>
        /// <param name="revenues">Einnahmen</param>
        /// <param name="expenses">Ausgaben</param>
        /// <param name="sum">Summe</param>
        /// <returns>Die ID des Eintrags in der Datenbank</returns>
        public static int Add(int cashClosureID, bool printDone, DateTime?printDate,
                              int?printUserAccountID = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var receipt = new CashClosureReceipt
                {
                    CashClosure      = db.CashClosures.Single(cc => cc.CashClosureID == cashClosureID),
                    PrintDone        = printDone,
                    PrintDate        = printDate,
                    PrintUserAccount = (printUserAccountID.HasValue) ? db.UserAccounts.Single(ua => ua.UserAccountID == printUserAccountID.Value) : null,
                };

                db.CashClosureReceipts.AddObject(receipt);
                db.SaveChanges();

                return(receipt.CashClosureReceiptID);
            }
        }
예제 #2
0
        /// <summary>
        /// Fügt eine neue Kassenabrechnung der Datenbank hinzu
        /// </summary>
        /// <param name="cashClosureID">Die benötigte Kassenabschluss ID</param>
        /// <param name="printDone">Druck beendet</param>
        /// <param name="printDate">Druckdatum</param>
        /// <param name="printUserAccountID">Druck Benutzer</param>
        /// <param name="revenues">Einnahmen</param>
        /// <param name="expenses">Ausgaben</param>
        /// <param name="sum">Summe</param>
        /// <returns>Die ID des Eintrags in der Datenbank</returns>
        public static int Add(int cashClosureID, bool printDone, DateTime? printDate,
            int? printUserAccountID = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var receipt = new CashClosureReceipt
                {
                    CashClosure = db.CashClosures.Single(cc => cc.CashClosureID == cashClosureID),
                    PrintDone = printDone,
                    PrintDate = printDate,
                    PrintUserAccount = (printUserAccountID.HasValue) ? db.UserAccounts.Single(ua => ua.UserAccountID == printUserAccountID.Value) : null,
                };

                db.CashClosureReceipts.AddObject(receipt);
                db.SaveChanges();

                return receipt.CashClosureReceiptID;
            }
        }
        /// <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 = "";
        }
예제 #4
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'CashClosureReceipts'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToCashClosureReceipts(CashClosureReceipt cashClosureReceipt)
 {
     base.AddObject("CashClosureReceipts", cashClosureReceipt);
 }
예제 #5
0
 /// <summary>
 /// Erstellt ein neues CashClosureReceipt-Objekt.
 /// </summary>
 /// <param name="cashClosureReceiptID">Anfangswert der Eigenschaft CashClosureReceiptID.</param>
 /// <param name="printDone">Anfangswert der Eigenschaft PrintDone.</param>
 public static CashClosureReceipt CreateCashClosureReceipt(global::System.Int32 cashClosureReceiptID, global::System.Boolean printDone)
 {
     CashClosureReceipt cashClosureReceipt = new CashClosureReceipt();
     cashClosureReceipt.CashClosureReceiptID = cashClosureReceiptID;
     cashClosureReceipt.PrintDone = printDone;
     return cashClosureReceipt;
 }