Esempio n. 1
0
        /// <summary>
        /// Fügt einen neuen Kassenabschlussbeleg der Datenbank hinzu
        /// </summary>
        /// <param name="cashClosureID">Kassenabschluss ID</param>
        /// <param name="printDone">Wurde gedruckt</param>
        /// <param name="printUserAccountID">Druckuser</param>
        /// <param name="printDate">Druckdatum</param>
        /// <param name="done">Erledigt</param>
        /// <param name="doneDate">Erledigungsdatum</param>
        /// <param name="doneUserAccountID">Erledigungs User</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, bool done,
            DateTime? doneDate, int? printUserAccountID = null, int? doneUserAccountID = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var cashClosureReport = new CashClosureReport
                {
                    CashClosure = db.CashClosures.Single(cc => cc.CashClosureID == cashClosureID),
                    PrintDone = printDone,
                    PrintDate = printDate,
                    Done = done,
                    DoneDate = doneDate,
                };

                if (printUserAccountID.HasValue)
                {
                    cashClosureReport.PrintUserAccount = db.UserAccounts.Single(ua => ua.UserAccountID == printUserAccountID.Value);
                }

                if (doneUserAccountID.HasValue)
                    cashClosureReport.DoneUserAccount = db.UserAccounts.Single(ua => ua.UserAccountID == doneUserAccountID.Value);

                db.CashClosureReports.AddObject(cashClosureReport);
                db.SaveChanges();

                return cashClosureReport.CashClosureReportID;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Fügt einen neuen Kassenabschlussbeleg der Datenbank hinzu
        /// </summary>
        /// <param name="cashClosureID">Kassenabschluss ID</param>
        /// <param name="printDone">Wurde gedruckt</param>
        /// <param name="printUserAccountID">Druckuser</param>
        /// <param name="printDate">Druckdatum</param>
        /// <param name="done">Erledigt</param>
        /// <param name="doneDate">Erledigungsdatum</param>
        /// <param name="doneUserAccountID">Erledigungs User</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, bool done,
                              DateTime?doneDate, int?printUserAccountID = null, int?doneUserAccountID = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var cashClosureReport = new CashClosureReport
                {
                    CashClosure = db.CashClosures.Single(cc => cc.CashClosureID == cashClosureID),
                    PrintDone   = printDone,
                    PrintDate   = printDate,
                    Done        = done,
                    DoneDate    = doneDate,
                };

                if (printUserAccountID.HasValue)
                {
                    cashClosureReport.PrintUserAccount = db.UserAccounts.Single(ua => ua.UserAccountID == printUserAccountID.Value);
                }

                if (doneUserAccountID.HasValue)
                {
                    cashClosureReport.DoneUserAccount = db.UserAccounts.Single(ua => ua.UserAccountID == doneUserAccountID.Value);
                }

                db.CashClosureReports.AddObject(cashClosureReport);
                db.SaveChanges();

                return(cashClosureReport.CashClosureReportID);
            }
        }
        /// <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 = "";
        }
Esempio n. 4
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'CashClosureReports'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToCashClosureReports(CashClosureReport cashClosureReport)
 {
     base.AddObject("CashClosureReports", cashClosureReport);
 }
Esempio n. 5
0
 /// <summary>
 /// Erstellt ein neues CashClosureReport-Objekt.
 /// </summary>
 /// <param name="cashClosureReportID">Anfangswert der Eigenschaft CashClosureReportID.</param>
 /// <param name="printDone">Anfangswert der Eigenschaft PrintDone.</param>
 /// <param name="done">Anfangswert der Eigenschaft Done.</param>
 public static CashClosureReport CreateCashClosureReport(global::System.Int32 cashClosureReportID, global::System.Boolean printDone, global::System.Boolean done)
 {
     CashClosureReport cashClosureReport = new CashClosureReport();
     cashClosureReport.CashClosureReportID = cashClosureReportID;
     cashClosureReport.PrintDone = printDone;
     cashClosureReport.Done = done;
     return cashClosureReport;
 }