Beispiel #1
0
        private static void cashin_CashIn(object sender, CashInEventArgs e)
        {
            lock (oLock)
            {
                LogCash(e.MoneyIn);

                string name         = "Terminal";
                var    loggedInUser = CurrentUser as SportBetting.WPF.Prism.Models.LoggedInUser;
                if (loggedInUser != null)
                {
                    name = loggedInUser.Username;
                }
                else
                {
                    var operatorUser = CurrentUser as SportBetting.WPF.Prism.Models.OperatorUser;
                    if (operatorUser != null)
                    {
                        name = operatorUser.Username;
                    }
                }

                StationCashSr cash = new StationCashSr()
                {
                    Cash = e.MoneyIn, MoneyIn = true, OperationType = "STATION_CASH_IN", OperatorID = name, CashCheckPoint = false, DateModified = DateTime.Now
                };

                using (var con = ConnectionManager.GetConnection())
                {
                    cash.Save(con, null);
                }
            }
            IoCContainer.Kernel.Get <IChangeTracker>().MouseClickLastTime = DateTime.Now;
        }
Beispiel #2
0
        public decimal TryRegisterMoneyOnHub(uid userUID, string sTransactionId, bool cashIn, string operationType, int operatorId, bool checkpoint, out DateTime startdate, out DateTime enddate)
        {
            string error = string.Empty;
            var    money = RegisterMoney(userUID, cashIn, ref error, out startdate, out enddate);

            var cash = new StationCashSr {
                Cash = money, MoneyIn = cashIn, OperationType = operationType, OperatorID = operatorId.ToString(), CashCheckPoint = checkpoint, DateModified = DateTime.Now
            };

            using (IDbConnection con = ConnectionManager.GetConnection())
            {
                cash.Save(con, null);
            }

            if (money > 0)
            {
                Logger.InfoFormat("{0} successfully saved", money);
            }
            else if (error != null)
            {
                Logger.ErrorFormat("{0} was not saved. Errors:\r\n{1}", new Exception(), money, error);
                var lostConnection = new Tuple <string, string, bool, int>("LostInternetConnection", "", false, 0);
                Mediator.SendMessage(lostConnection, "Error");

                PutRegisterMoneyIntoTransactionQueue(userUID, sTransactionId, money, cashIn, "Cannot register money:\r\n" + error);
            }

            return(0);
        }
        public static Dictionary <Decimal, int> GetNotesValuesAndCount(long startId, long endId = long.MaxValue)
        {
            var cashinNotes = new Dictionary <decimal, int>();

            try
            {
                var lParams = new List <IDbDataParameter> {
                    SqlObjectFactory.CreateParameter("lastCashoutStartId", startId, string.Empty), SqlObjectFactory.CreateParameter("lastCashoutEndId", endId, string.Empty)
                };


                List <StationCashSr> lStationCash = StationCashSr.GetStationCashListByQuery("SELECT * FROM StationCash where stationcashid >= @lastCashoutStartId and stationcashid <= @lastCashoutEndId order by stationcashid desc", lParams);


                foreach (StationCashSr stationCashBo in lStationCash)
                {
                    if (stationCashBo.MoneyIn)
                    {
                        if (cashinNotes.ContainsKey(stationCashBo.Cash))
                        {
                            cashinNotes[stationCashBo.Cash]++;
                        }
                        else
                        {
                            cashinNotes.Add(stationCashBo.Cash, 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(cashinNotes);
        }
        public static long GetLastCashoutId()
        {
            long lastCashoutId = 0;

            try
            {
                List <StationCashSr> lStationCash = StationCashSr.GetStationCashListByQuery("SELECT * From StationCash where StationCash.CashCheckPoint = 1 order by stationcashid desc", new List <IDbDataParameter>());

                if (lStationCash.Count > 0)
                {
                    lastCashoutId = lStationCash[0].StationCashID;
                }
            }
            catch (Exception ex)
            {
            }
            return(lastCashoutId);
        }