Exemple #1
0
        /// <summary>
        /// Prüfe ob Nullzeitraum überschritten wurde
        /// true: Periode überschritten
        /// </summary>
        /// <param name="period">Nullzeitraum</param>
        /// <returns>ob überschritten</returns>
        public static bool exceededZeroPeriod(ZeroPeriod period)
        {
            try
            {
                switch (period)
                {
                    case ZeroPeriod.EveryCashClosure:
                        return true;

                    case ZeroPeriod.Monthly:
                        int currentMonth = DateTime.Now.Month;
                        int lastClosureMonth = BookingsHelper.getDateOfLastCashClosure().Month;
                        return !(lastClosureMonth == currentMonth);

                    case ZeroPeriod.Annually:
                        int currentYear = DateTime.Now.Year;
                        int lastClosureYear = BookingsHelper.getDateOfLastCashClosure().Year;
                        return !(lastClosureYear == currentYear);

                    case ZeroPeriod.Never:
                        return false;

                    default:
                        return true;
                }
            }
            catch
            {
                return true;
            }
        }
Exemple #2
0
        /// <summary>
        /// Prüfe ob Nullzeitraum überschritten wurde
        /// true: Periode überschritten
        /// </summary>
        /// <param name="period">Nullzeitraum</param>
        /// <returns>ob überschritten</returns>
        public static bool exceededZeroPeriod(ZeroPeriod period)
        {
            try
            {
                switch (period)
                {
                case ZeroPeriod.EveryCashClosure:
                    return(true);

                case ZeroPeriod.Monthly:
                    int currentMonth     = DateTime.Now.Month;
                    int lastClosureMonth = BookingsHelper.getDateOfLastCashClosure().Month;
                    return(!(lastClosureMonth == currentMonth));

                case ZeroPeriod.Annually:
                    int currentYear     = DateTime.Now.Year;
                    int lastClosureYear = BookingsHelper.getDateOfLastCashClosure().Year;
                    return(!(lastClosureYear == currentYear));

                case ZeroPeriod.Never:
                    return(false);

                default:
                    return(true);
                }
            }
            catch
            {
                return(true);
            }
        }
Exemple #3
0
        /// <summary>
        /// Methode zum aktualisieren von Konten
        /// </summary>
        /// <param name="accountId">Konto ID welcher benötigt wird</param>
        /// <param name="accountName">Kontoname</param>
        /// <param name="accountNumber">Kontonummer</param>
        /// <param name="image">Optionales Bild</param>
        /// <param name="description">Beschreibung</param>
        public static void Update(int accountId, string accountName, int accountNumber,
                                  ZeroPeriod zeroPeriod, bool isOfficial, string description,
                                  double latestBalance, bool isCapital, bool isFixed = false)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var account = db.Accounts.Single(a => a.AccountID == accountId);
                account.Name          = accountName;
                account.Number        = accountNumber;
                account.Description   = description;
                account.ZeroPeriod    = (int)zeroPeriod;
                account.IsOfficial    = isOfficial;
                account.LatestBalance = latestBalance;
                account.IsFixed       = isFixed;
                account.IsCapital     = isCapital;

                db.SaveChanges();
            }
        }
        /// <summary>
        /// Wandelt den Nullzeitraum in einen lesbaren String um
        /// </summary>
        /// <param name="period">ZeroPeriod enum</param>
        /// <returns>text</returns>
        private string zeroPeriodToString(ZeroPeriod period)
        {
            switch (period)
            {
            case ZeroPeriod.EveryCashClosure:
                return(IniParser.GetSetting("ZEROPERIODS", "everyCashClosure"));

            case ZeroPeriod.Annually:
                return(IniParser.GetSetting("ZEROPERIODS", "annually"));

            case ZeroPeriod.Monthly:
                return(IniParser.GetSetting("ZEROPERIODS", "monthly"));

            case ZeroPeriod.Never:
                return(IniParser.GetSetting("ZEROPERIODS", "never"));

            default:
                return("");
            }
        }
Exemple #5
0
        /// <summary>
        /// Methode zum hinzufügen eines neuen Kontos
        /// </summary>
        /// <param name="name">Kontoname</param>
        /// <param name="accountNumber">Kontonummer</param>
        /// <param name="image">Bild</param>
        /// <param name="description">Optionale Beschreibung</param>
        /// <returns>Gibt den ID Wert des gespeicherten Eintrags in der Datenbank zurück</returns>
        public static int Add(string name, int accountNumber, bool isOfficial, ZeroPeriod zeroPeriod,
                              bool isFixed, double?latestBalance = null, string description = null, bool isCapital = false)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var account = new Account()
                {
                    Name          = name,
                    Number        = accountNumber,
                    Description   = description,
                    IsOfficial    = isOfficial,
                    ZeroPeriod    = (int)zeroPeriod,
                    IsFixed       = isFixed,
                    LatestBalance = ((latestBalance.HasValue) ? latestBalance.Value : 0),
                    IsCapital     = isCapital
                };

                db.Accounts.AddObject(account);
                db.SaveChanges();

                return(account.AccountID);
            }
        }
Exemple #6
0
        /// <summary>
        /// Methode zum hinzufügen eines neuen Kontos
        /// </summary>
        /// <param name="name">Kontoname</param>
        /// <param name="accountNumber">Kontonummer</param>
        /// <param name="image">Bild</param>
        /// <param name="description">Optionale Beschreibung</param>
        /// <returns>Gibt den ID Wert des gespeicherten Eintrags in der Datenbank zurück</returns>
        public static int Add(string name, int accountNumber, bool isOfficial, ZeroPeriod zeroPeriod,
        bool isFixed,  double? latestBalance = null, string description = null, bool isCapital = false)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var account = new Account()
                {
                    Name = name,
                    Number = accountNumber,
                    Description = description,
                    IsOfficial = isOfficial,
                    ZeroPeriod = (int)zeroPeriod,
                    IsFixed = isFixed,
                    LatestBalance = ((latestBalance.HasValue) ? latestBalance.Value : 0),
                    IsCapital=isCapital
                };

                db.Accounts.AddObject(account);
                db.SaveChanges();

                return account.AccountID;
            }
        }
        /// <summary>
        /// Wandelt den Nullzeitraum in einen lesbaren String um
        /// </summary>
        /// <param name="period">ZeroPeriod enum</param>
        /// <returns>text</returns>
        private string zeroPeriodToString(ZeroPeriod period)
        {
            switch (period)
            {
                case ZeroPeriod.EveryCashClosure:
                    return IniParser.GetSetting("ZEROPERIODS", "everyCashClosure");

                case ZeroPeriod.Annually:
                    return IniParser.GetSetting("ZEROPERIODS", "annually");

                case ZeroPeriod.Monthly:
                    return IniParser.GetSetting("ZEROPERIODS", "monthly");

                case ZeroPeriod.Never:
                    return IniParser.GetSetting("ZEROPERIODS", "never");

                default:
                    return "";
            }
        }
 public AccountZeroPeriodEnum(ZeroPeriod period)
 {
     this.period = period;
 }
Exemple #9
0
        /// <summary>
        /// Methode zum aktualisieren von Konten
        /// </summary>
        /// <param name="accountId">Konto ID welcher benötigt wird</param>
        /// <param name="accountName">Kontoname</param>
        /// <param name="accountNumber">Kontonummer</param>
        /// <param name="image">Optionales Bild</param>
        /// <param name="description">Beschreibung</param>
        public static void Update(int accountId, string accountName, int accountNumber,
             ZeroPeriod zeroPeriod, bool isOfficial, string description,
            double latestBalance, bool isCapital,bool isFixed = false)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var account = db.Accounts.Single(a => a.AccountID == accountId);
                account.Name = accountName;
                account.Number = accountNumber;
                account.Description = description;
                account.ZeroPeriod = (int)zeroPeriod;
                account.IsOfficial = isOfficial;
                account.LatestBalance = latestBalance;
                account.IsFixed = isFixed;
                account.IsCapital = isCapital;

                db.SaveChanges();
            }
        }
Exemple #10
0
 public AccountZeroPeriodEnum(ZeroPeriod period)
 {
     this.period = period;
 }