public static KoloNotification UnsuffisantBalanceNotification(Customer c, KoloConstants.Operation.Category category)
        {
            KoloNotification n = new KoloNotification();

            n.Title        = "Insufficant Balance";
            n.Message      = "Dear " + c.Person.Firstname + " your balance (" + c.Balance + ") is insuffisant for this operation : " + category.ToString();
            n.Category     = category.ToString();
            n.CreationDate = DateTime.Now;
            n.Readed       = false;
            n.ExpiryDate   = DateTime.Now.AddDays(3);

            return(n);
        }
        public static List <KoloNotification> GenerateNotification <T>(T t, KoloConstants.Operation.Category category, KoloAndroidEntities db, out string error)
        {
            error = "";
            List <KoloNotification> notifications = new List <KoloNotification>();

            if (t.GetType() == typeof(TransfertP2p))
            {
                var tmp = t as TransfertP2p;
                KoloNotification senderNotification   = new KoloNotification();
                KoloNotification recieverNotification = new KoloNotification();

                senderNotification.IdCustomer   = tmp.IdSendingCustomer;
                recieverNotification.IdCustomer = (int)tmp.IdReceiverCustomer;

                notifications.Add(senderNotification);
                notifications.Add(recieverNotification);

                FillNotifications(tmp, ref notifications, db);
            }
            else if (t.GetType() == typeof(EneoBillPayment))
            {
                var tmp = t as EneoBillPayment;
                KoloNotification notification = new KoloNotification();

                notification.IdCustomer = tmp.IdCustomer;

                notifications.Add(notification);

                FillNotifications(tmp, ref notifications, db);
            }
            else if (t.GetType() == typeof(TopUp))
            {
                var tmp = t as TopUp;
                KoloNotification notification = new KoloNotification();

                notification.IdCustomer = tmp.IdCustomer;

                notifications.Add(notification);

                FillNotifications(tmp, ref notifications, db);
            }
            return(notifications);
        }
        private static CustomerBalanceHistory CreateCustomerHistory(Customer customer, KoloConstants.Operation.Category category, KoloConstants.Operation.BalanceUpdateDirection balanceDirection, int amount, out string error)
        {
            CustomerBalanceHistory cBH = new CustomerBalanceHistory();

            error                 = "";
            cBH.Amount            = amount;
            cBH.IdCustomerAccount = customer.IdCustomer;
            cBH.OperationTypeCode = category.ToString();
            cBH.OldBalance        = customer.Balance;
            if (balanceDirection == KoloConstants.Operation.BalanceUpdateDirection.REMOVE)
            {
                cBH.NewBalance    = customer.Balance - amount;
                customer.Balance -= amount;
            }
            if (balanceDirection == KoloConstants.Operation.BalanceUpdateDirection.ADD)
            {
                cBH.NewBalance    = customer.Balance + amount;
                customer.Balance += amount;
            }
            cBH.HistoryDate = DateTime.Now;
            return(cBH);
        }