Exemple #1
0
        private void onLoadData(object sender, EventArgs e)
        {
            OperatorCriterias crit = new OperatorCriterias();
            uid sentUid            = new uid();

            sentUid.location_id = StationRepository.GetUid(ChangeTracker.CurrentUser).location_id;
            sentUid.account_id  = StationRepository.GetUid(ChangeTracker.CurrentUser).account_id;

            globalCollection = new ObservableCollection <OperatorWithShift>(WsdlRepository.GetAllOperatorsWithShifts(sentUid));

            ObservableCollection <OperatorWithShift> tempCollection = new ObservableCollection <OperatorWithShift>();

            if ((currentPosition + pageSize) < globalCollection.Count)
            {
                for (int i = currentPosition; i < pageSize; i++)
                {
                    tempCollection.Add(globalCollection[i]);
                }
            }
            else
            {
                for (int i = currentPosition; i < globalCollection.Count; i++)
                {
                    tempCollection.Add(globalCollection[i]);
                }
            }

            this.Operators = new ObservableCollection <OperatorWithShift>(tempCollection);

            OnPropertyChanged("Operators");
            if (this.Operators.Count > 0)
            {
                SelectedOperator = this.Operators[0];
            }
        }
Exemple #2
0
        private decimal RegisterMoney(uid userUID, bool cashIn, ref string sError, out DateTime startdate, out DateTime enddate)
        {
            startdate = DateTime.MinValue;
            enddate   = DateTime.MinValue;
            if (!cashIn)
            {
                try
                {
                    var amount = WsdlRepository.CashOut(userUID, StationRepository.StationNumber, out startdate, "Get Money out of cash box", out enddate);
                    ChangeTracker.LastCashoutDate = startdate;
                    return(amount);
                }
                catch (FaultException <HubServiceException> ex)
                {
                    Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                    throw;
                }
                catch (Exception ex)
                {
                    sError = ex.Message;
                    Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                }
            }

            return(0M);
        }
 public accountBalance Deposit(string sTransactionId, uid uId, decimal decMoneyAmount, bool realMoney, CashAcceptorType?type, bool depositFromCashpool)
 {
     _tempBalance += decMoneyAmount;
     return(new accountBalance {
         amount = _tempBalance, reserved = 0
     });
 }
Exemple #4
0
        private int SaveTicketOnHub(string sTransactionId, uid UserSession, TicketWS ticketData, string sStationNumber, bool bIsOffLineTicket, ref string sError)
        {
            uid anonUID = UserSession;

            if (StationRepository.AllowAnonymousBetting)
            {
                if (anonUID.account_id == "0")
                {
                    anonUID = null;
                }
            }

            try
            {
                long[] tipItems;
                long[] tournamentLock;
                string sResult = WsdlRepository.SaveTicket(sTransactionId, anonUID, ticketData, bIsOffLineTicket, sStationNumber, out tipItems, out tournamentLock);
                return(Convert.ToInt32(sResult));
            }
            catch (FaultException <HubServiceException> ex)
            {
                Logger.ErrorFormat("SaveTicket ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                throw;
            }
            catch (Exception ex)
            {
                sError = ex.Message;
                Logger.ErrorFormat("SaveTicket ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
            }


            return(Ticket.TICKET_SAVE_FAILED);
        }
Exemple #5
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 new uid GetUsernameUid()
        {
            uid uid = StationRepository.GetBasicUid();

            uid.username = Username;
            return(uid);
        }
Exemple #7
0
 public void PutDepositByTicketIntoTransactionQueue(string sTransactionId, uid User, string number, string code, string creditnumber, string creditCode, string desc)
 {
     CreateAndSaveTransactionQueue(eTransactionQueueType.DepositByTicket, desc, sTransactionId, User, number + code, // Object 1
                                   creditnumber + creditCode,                                                        // Object 2
                                   null, null,                                                                       // Tag1
                                   null);                                                                            // Tag 2
 }
Exemple #8
0
 public void PutRegisterMoneyIntoTransactionQueue(uid userUID, string sTransactionId, decimal money, bool cashIn, string sDescription)
 {
     CreateAndSaveTransactionQueue(eTransactionQueueType.Cash, sDescription, sTransactionId, userUID, null, money.ToString(), // Object 1
                                   cashIn.ToString(),                                                                         // Object 2
                                   null,                                                                                      // Tag1
                                   null);                                                                                     // Tag 2
 }
        public profileForm LoadProfile(uid uid)
        {
            profileForm profForm = new profileForm();

            profForm.fields = new formField[1];

            formField usernameField = new formField();

            usernameField.name       = "username";
            usernameField.mandatory  = true;
            usernameField.@readonly  = true;
            usernameField.searchable = true;
            usernameField.hidden     = false;
            usernameField.type       = "STRING";
            usernameField.sequence   = 1;

            switch (uid.account_id)
            {
            case "1":
                usernameField.value = "test";
                break;

            case "2":
                usernameField.value = "test1";
                break;

            default:
                usernameField.value = "";
                break;
            }

            profForm.fields[0] = usernameField;

            return(profForm);
        }
        public valueField[][] AccountSearch(criteria[] criterias, uid uid)
        {
            foreach (var criteria in criterias)
            {
                if (criteria.value.Contains("test"))
                {
                    valueField username = new valueField();
                    username.name  = "username";
                    username.value = "test";

                    valueField active = new valueField();
                    active.name  = "active";
                    active.value = "true";

                    valueField account_id = new valueField();
                    account_id.name  = "account_id";
                    account_id.value = "1";

                    valueField verified = new valueField();
                    verified.name  = "verified";
                    verified.value = "1";

                    valueField cardStatus = new valueField();
                    cardStatus.name  = "card_status";
                    cardStatus.value = _accountIdWithIdCard == 1 ? "1" : "0";

                    valueField[] account1 = new valueField[] { username, active, account_id, verified, cardStatus };

                    valueField username2 = new valueField();
                    username2.name  = "username";
                    username2.value = "test1";

                    valueField active2 = new valueField();
                    active2.name  = "active";
                    active2.value = "true";

                    valueField account_id2 = new valueField();
                    account_id2.name  = "account_id";
                    account_id2.value = "2";

                    valueField verified2 = new valueField();
                    verified2.name  = "verified";
                    verified2.value = "1";

                    valueField cardStatus2 = new valueField();
                    cardStatus2.name  = "card_status";
                    cardStatus2.value = _accountIdWithIdCard == 2 ? "1" : "0";

                    valueField[] account2 = new valueField[] { username2, active2, account_id2, verified2, cardStatus2 };

                    valueField[][] retVal = new valueField[][] { account1, account2 };

                    return(retVal);
                }
            }
            return(null);
        }
Exemple #11
0
 /**
  * try to log in with the provided credentials
  *
  * @param string uid
  * @param string password
  * @return boolean|null
  * @throws LoginException
  */
 public function login(uid, password)
 {
     this.session.regenerateId();
     if (this.validateToken(password, uid))
     {
         return(this.loginWithToken(password));
     }
     return(this.loginWithPassword(uid, password));
 }
Exemple #12
0
 public void PutTicketIntoTransactionQueue(string sTransactionId, uid User, TicketWS ticketData, string sStationNumber, bool bIsOffLineTicket, string sDescription)
 {
     CreateAndSaveTransactionQueue(eTransactionQueueType.Ticket, sDescription, sTransactionId, User,  //SerializeHelper.SerializableObjectToString<uid>(uId),
                                   SerializeHelper.DataContractObjectToString <TicketWS>(ticketData), // Object 1
                                   null,                                                              // Object 2
                                   null, SerializeHelper.SerializableObjectToString <TicketData>(new TicketData {
         StationNumber = sStationNumber, IsOffLineTicket = bIsOffLineTicket
     }),                                  // Tag1
                                   null); // Tag 2
 }
Exemple #13
0
            //public bool Equals(uid s)
            //{
            //    if (s == null)
            //        return false;

            //    return min.Equals(s.min) && sno_id.Equals(s.sno_id);
            //}

            public override bool Equals(Object obj)
            {
                if (obj == null)
                {
                    return(false);
                }

                uid u = obj as uid;

                return(min.Equals(u.min) && sno_id.Equals(u.sno_id));
                //return Equals(u);
            }
Exemple #14
0
        public void PutDepositIntoTransactionQueue(string sTransactionId, uid User, decimal decAmount, bool realMoney, string sDescription, CashAcceptorType?type)
        {
            string typeValue = "";

            if (type != null)
            {
                typeValue = type.Value.ToString();
            }
            CreateAndSaveTransactionQueue(eTransactionQueueType.Deposit, sDescription, sTransactionId, User, decAmount.ToString("G"), // Object 1
                                          typeValue,                                                                                  // Object 2
                                          realMoney.ToString(), null,                                                                 // Tag1
                                          null);                                                                                      // Tag 2
        }
 public string SaveTicket(string transactionId, uid uid, TicketWS ticketData, bool isOffLineTicket, string station_id,
                          out long[] tipLock, out long[] tournamentLock)
 {
     if (ConnectionProblem)
     {
         throw new EndpointNotFoundException();
     }
     _ticketsList.Add(ticketData);
     _tempBalance  -= ticketData.stake;
     tipLock        = null;
     tournamentLock = null;
     return("1");
 }
Exemple #16
0
        public int TryStoreTicketOnHub(string sTransactionId, uid uidSession, TicketWS ticketDataWs, string sStationNumber, bool bIsOffLineTicket, string pin)
        {
            string sErrors = string.Empty;
            int    iResult = StoreTicket(sTransactionId, uidSession, ticketDataWs, sStationNumber, bIsOffLineTicket, pin, ref sErrors);

            // Uncomment line bellow to force testing TransactionQueueHelper
            // TransactionQueueHelper.PutTicketIntoTransactionQueue(sTransactionId, uidSession, ticketDataWs, sStationNumber, bIsOffLineTicket, "Test save ticket:\r\n" + sErrors);

            if (iResult == Ticket.TICKET_SAVE_SUCCESSFUL)
            {
                Logger.InfoFormat("{0} successfully saved", ticketDataWs);
            }

            return(iResult);
        }
Exemple #17
0
        public accountBalance TryDepositMoneyOnHub(string sTransactionId, uid User, decimal money, bool realMoney, ref Exception error, CashAcceptorType?type)
        {
            accountBalance iResult = SaveDepositOnHub(sTransactionId, User, money, realMoney, ref error, type);

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

                PutDepositIntoTransactionQueue(sTransactionId, User, money, realMoney, "Cannot store Deposit:\r\n" + error.Message, type);
            }
            return(iResult);
        }
        public void LoadFromTransactionQueueAndSaveIncorectTicketsTest()
        {
            ConfigurationManager.AppSettings["CreateDatabase"] = "1";
            StationSettingsUtils.m_sStartupPath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(DatabaseTests)).Location);
            DatabaseManager.EnsureDatabase(false);
            DatabaseCache.EnsureDatabaseCache();
            SportRadar.DAL.NewLineObjects.LineSr.EnsureFromCache();

            var uid = new uid()
            {
                account_id = "1", session_id = "1", station_id = "123"
            };
            var ticket = new TicketWS();



            long[] tiplock        = new long[1];
            long[] tournamentLock = new long[1];
            WsdlRepository.Setup(x => x.SaveTicket("0123", uid, ticket, false, "1234", out tiplock, out tournamentLock)).Throws(new Exception("test"));

            StationRepository.Setup(x => x.StationNumber).Returns("1234");

            MessageMediator.Setup(x => x.SendMessage(It.IsAny <object>(), It.IsAny <string>())).Returns(true);
            var TransactionQueueHelper = new TransactionQueueHelper();

            TransactionQueueHelper.TrySaveTicketOnHub("0123", uid, ticket, "1234", false);


            int count = TransactionQueueHelper.GetCountTransactionQueue();

            Assert.IsTrue(count > 0);


            WsdlRepository.Setup(x => x.SaveTicket(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <TicketWS>(), It.IsAny <bool>(), It.IsAny <string>(), out tiplock, out tournamentLock)).Throws(new FaultException <HubServiceException>(new HubServiceException()));



            TransactionQueueHelper.TryToSaveTransactionObjectsOnHub();


            int count2 = TransactionQueueHelper.GetCountTransactionQueue();

            Assert.AreEqual(0, count2);
        }
Exemple #19
0
        public int TrySaveTicketOnHub(string sTransactionId, uid uid, TicketWS ticketDataWs, string sStationNumber, bool bIsOffLineTicket)
        {
            string error   = string.Empty;
            int    iResult = SaveTicketOnHub(sTransactionId, uid, ticketDataWs, sStationNumber, bIsOffLineTicket, ref error);


            if (iResult == Ticket.TICKET_SAVE_SUCCESSFUL)
            {
                Logger.InfoFormat("{0} successfully saved", ticketDataWs);
            }
            else if (uid.account_id == "1" && error != null && ticketDataWs.ticketTyp == Ticket.TICKET_TYP_SPORTBET)
            {
                iResult = Ticket.TICKET_SAVE_SUCCESSFUL;
                Logger.ErrorFormat("{0} was not saved. Errors:\r\n{1}", new Exception(), ticketDataWs, error);

                PutTicketIntoTransactionQueue(sTransactionId, uid, ticketDataWs, sStationNumber, bIsOffLineTicket, "Cannot save ticket:\r\n" + error);
            }

            return(iResult);
        }
Exemple #20
0
        public bool TryDepositByCreditNoteMoneyOnHub(string sTransactionId, uid User, string number, string checkSum, ref string error)
        {
            bool iResult = DepositByCreditNoteOnHub(sTransactionId, User, number, checkSum, ref error);


            if (iResult)
            {
                Logger.InfoFormat("{0} successfully deposited", number);
            }
            else if (error != null)
            {
                Logger.ErrorFormat("{0} was not deposited. Errors:\r\n{1}", new Exception(), number, error);

                var lostConnection = new Tuple <string, string, bool, int>("LostInternetConnection", "", false, 0);
                Mediator.SendMessage(lostConnection, "Error");
                PutDepositByCreditNoteIntoTransactionQueue(sTransactionId, User, number, checkSum, "Cannot Deposit by credit note:\r\n" + error);
            }

            return(iResult);
        }
Exemple #21
0
        private int StoreTicket(string sTransactionId, uid uid, TicketWS ticketDataWs, string sStationNumber, bool bIsOffLineTicket, string pin, ref string sErrors)
        {
            try
            {
                string sResult = WsdlRepository.StoreTicket(sTransactionId, uid, ticketDataWs, pin, bIsOffLineTicket, sStationNumber);

                return(Convert.ToInt32(sResult));
            }
            catch (FaultException <HubServiceException> ex)
            {
                Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                throw;
            }
            catch (Exception ex)
            {
                sErrors = ex.Message;
                Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
            }

            return(Ticket.TICKET_SAVE_FAILED); //this line actually never executed
        }
        private void onLoadData(bool b)
        {
            uid accountUid = new uid();

            //accountUid.account_id = 466.ToString(CultureInfo.InvariantCulture);

            accountUid = StationRepository.GetUid(ChangeTracker.CurrentUser);

            settlementHistoryCollection = new ObservableCollection <SettlementHistory>(WsdlRepository.GetSettlementHistory(accountUid));

            _Checkpoints = new ObservableCollection <SettlementHistory>(settlementHistoryCollection);
            OnPropertyChanged("Checkpoints");

            _listOfCheckpoints.Clear();
            foreach (var checkpoint in _Checkpoints)
            {
                var cPoint = new HistoryCheckpoint(checkpoint.startDate, checkpoint.endDate, (int)checkpoint.id, checkpoint.settlement_saldo);
                _listOfCheckpoints.Add(cPoint);
            }
            OnPropertyChanged("ListOfCheckpoints");
            OnPropertyChanged("SelectedCheckpoint");
        }
Exemple #23
0
        private bool DepositByTicketOnHub(string sTransactionId, uid uId, String ticketNumber, String ticketCode, string creditNoteNumber, string creditNoteCode, ref string sError)
        {
            Debug.Assert(!string.IsNullOrEmpty(sTransactionId));
            Debug.Assert(uId != null);
            try
            {
                return(WsdlRepository.DepositByTicket(sTransactionId, uId, ticketNumber, ticketCode, creditNoteNumber, creditNoteCode));
            }
            catch (FaultException <HubServiceException> ex)
            {
                Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                throw;
            }
            catch (Exception ex)
            {
                sError = ex.Message;
                Logger.ErrorFormat("SaveDepositByTicket ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
            }


            return(false);
        }
Exemple #24
0
        private bool DepositByCreditNoteOnHub(string sTransactionId, uid uId, String noteNumber, string checkSum, ref string sError)
        {
            Debug.Assert(!string.IsNullOrEmpty(sTransactionId));
            Debug.Assert(uId != null);

            try
            {
                return(WsdlRepository.DepositByCreditNote(sTransactionId, uId, noteNumber, checkSum));
            }
            catch (FaultException <HubServiceException> ex)
            {
                Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                throw ex;
            }
            catch (Exception ex)
            {
                sError = ex.Message;
                Logger.ErrorFormat("DepositByCreditNote ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
            }

            return(false);
        }
        public void TicketSavePassedTest()
        {
            StationSettingsUtils.m_sStartupPath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(DatabaseTests)).Location);
            DatabaseManager.EnsureDatabase(false);
            DatabaseCache.EnsureDatabaseCache();
            SportRadar.DAL.NewLineObjects.LineSr.EnsureFromCache();

            var uid = new uid()
            {
                account_id = "1", session_id = "1", station_id = "123"
            };
            var ticket = new TicketWS();


            var TransactionQueueHelper = new TransactionQueueHelper();
            int countBeforeSaving      = TransactionQueueHelper.GetCountTransactionQueue();

            long[] tiplock        = new long[1];
            long[] tournamentLock = new long[1];
            WsdlRepository.Setup(x => x.SaveTicket("0123", uid, ticket, false, "1234", out tiplock, out tournamentLock)).Throws(new System.ServiceModel.FaultException <HubServiceException>(new HubServiceException()));

            StationRepository.Setup(x => x.StationNumber).Returns("1234");

            MessageMediator.Setup(x => x.SendMessage(It.IsAny <object>(), It.IsAny <string>())).Returns(true);

            try
            {
                TransactionQueueHelper.TrySaveTicketOnHub("0123", uid, ticket, "1234", false);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetType() == typeof(FaultException <HubServiceException>));
            }


            int count = TransactionQueueHelper.GetCountTransactionQueue();

            Assert.AreEqual(countBeforeSaving, count);
        }
        public void NoConnectionTest()
        {
            ConfigurationManager.AppSettings["CreateDatabase"] = "1";
            StationSettingsUtils.m_sStartupPath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(DatabaseTests)).Location);
            DatabaseManager.EnsureDatabase(false);
            DatabaseCache.EnsureDatabaseCache();
            SportRadar.DAL.NewLineObjects.LineSr.EnsureFromCache();
            TestWsdlRepository repository = new TestWsdlRepository();

            IoCContainer.Kernel.Rebind <IWsdlRepository>().ToConstant(repository).InSingletonScope();
            repository.ConnectionProblem = true;
            var TransactionQueueHelper = new TransactionQueueHelper();

            IoCContainer.Kernel.Rebind <ITransactionQueueHelper>().ToConstant(TransactionQueueHelper).InSingletonScope();
            var uid = new uid()
            {
                account_id = "1", session_id = "1", station_id = "123"
            };
            var ticket = new TicketWS();

            TransactionQueueHelper.TrySaveTicketOnHub("0123", uid, ticket, "1234", false);

            StationRepository.Setup(x => x.StationNumber).Returns("1234");

            MessageMediator.Setup(x => x.SendMessage(It.IsAny <object>(), "Error")).Returns(true);
            MainViewModel footerViewModel = new MainViewModel();
            int           count           = TransactionQueueHelper.GetCountTransactionQueue();

            Assert.IsTrue(count > 0);
            repository.ConnectionProblem = false;
            footerViewModel.TryToSaveTransactionObjectsOnHub();


            //TransactionQueueHelper.TryToSaveTransactionObjectsOnHub();

            count = TransactionQueueHelper.GetCountTransactionQueue();
            Assert.AreEqual(0, count);
            //MessageMediator.Verify(x => x.SendMessage(It.IsAny<object>(), "Error"));;
        }
Exemple #27
0
        private accountBalance SaveDepositOnHub(string sTransactionId, uid uId, decimal decMoneyAmount, bool realMoney, ref Exception sError, CashAcceptorType?type)
        {
            Debug.Assert(!string.IsNullOrEmpty(sTransactionId));
            Debug.Assert(uId != null);

            try
            {
                return(WsdlRepository.Deposit(sTransactionId, uId, decMoneyAmount, realMoney, type, !realMoney));
            }
            catch (FaultException <HubServiceException> ex)
            {
                Logger.ErrorFormat("CashOut ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
                sError = ex;
                throw;
            }
            catch (Exception ex)
            {
                sError = ex;

                Logger.ErrorFormat("SaveDeposit ERROR: {0}\r\n{1}", ex, ex.Message, ex.StackTrace);
            }

            return(null);
        }
Exemple #28
0
 if (!Resolve(uid, ref status, false) || !HasStatusEffect(uid, key, status))
 {
 public bool RegisterCash(uid uid, decimal amount)
 {
     throw new NotImplementedException();
 }
 public bool EditUserComments(long uid, uid operatorId, int commentId, string comment)
 {
     throw new NotImplementedException();
 }