private void GetPointsBalancesFromDB(ref GetPointsBalanceResponse reply, String acctNo)
        {
            reply.Success = false;

            using (SqlConnection sqlConnection = new SqlConnection("user id=" + config.Cmp_User + ";" +
                                                                   "password="******";" +
                                                                   "server=" + config.Cmp_Server + ";" +
                                                                   "Trusted_Connection=false;" +
                                                                   "database=" + config.Cmp_Database + "; " +
                                                                   "connection timeout=120"))
            {
                sqlConnection.Open();
                using (SqlCommand sqlCommand = new SqlCommand(GetPointsBalancesQueryString(acctNo), sqlConnection))
                {
                    sqlCommand.CommandTimeout = config.SqlTimeOut;
                    using (SqlDataReader dataReader = sqlCommand.ExecuteReader())
                    {
                        if (dataReader.Read())
                        {
                            string checkedOutCasino = DBHelper.dbHelper.getDbStringVal(dataReader, "CasinoCode");
                            if (checkedOutCasino == "")
                            {
                                reply.CasinPoints   = DBHelper.dbHelper.getDbIntVal(dataReader, "PointsBal");
                                reply.LeisurePoints = DBHelper.dbHelper.getDbIntVal(dataReader, "CompBal");
                            }
                            else
                            {
                                reply.CheckedOutCasino = checkedOutCasino;
                                //lets call down to the unit
                                log.Info("Calling remote property: " + checkedOutCasino + ".");
                                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(checkedOutCasino + "BasicHttpBinding_SlotsInfoService"))
                                {
                                    svc.GetPointsBalancesRequest request = new svc.GetPointsBalancesRequest();
                                    request.AcctNo = acctNo;

                                    svc.GetPointsBalanceResponse response = new svc.GetPointsBalanceResponse();
                                    response = service.GetPointsBalances(request);

                                    reply.Success       = response.Success;
                                    reply.CasinPoints   = response.CasinPoints;
                                    reply.LeisurePoints = response.LeisurePoints;

                                    foreach (svc.ProcessError detail in response.Errors)
                                    {
                                        reply.Errors.Add(new ProcessError()
                                        {
                                            ErrorMessage = detail.ErrorMessage
                                        });
                                    }
                                }
                            }
                        }

                        reply.Success = true;
                    }
                }
            }
        }
        public GetSlotMachineJackpotResponse GetMachineJackpots(GetSlotMachineJackpotRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetSlotMachineJackpotResponse reply = new GetSlotMachineJackpotResponse();

            try
            {
                log.Info("GetMachineJackpots Request. Casino: " + reqst.Casino + ". MachineNo: " + reqst.SlotMachine + ". NumberOfLines: " + reqst.NumberOfLines + ".");

                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(reqst.Casino + "BasicHttpBinding_SlotsInfoService"))
                {
                    svc.GetSlotMachineJackpotRequest request = new svc.GetSlotMachineJackpotRequest();
                    request.SlotMachine   = reqst.SlotMachine;
                    request.NumberOfLines = reqst.NumberOfLines;

                    svc.GetSlotMachineJackpotResponse response = new svc.GetSlotMachineJackpotResponse();
                    response = service.GetMachineJackpots(request);

                    reply.Success = response.Success;
                    foreach (svc.JackpotDetail detail in response.Jackpots)
                    {
                        reply.Jackpots.Add(new JackpotDetail()
                        {
                            HitDate = detail.HitDate, Amount = detail.Amount, JPotType = detail.JPotType
                        });
                    }
                    foreach (svc.ProcessError detail in response.Errors)
                    {
                        reply.Errors.Add(new ProcessError()
                        {
                            ErrorMessage = detail.ErrorMessage
                        });
                    }
                }

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                reply.Success = true;
                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
        public GetGameCelebrationsResponse GetGameCelebrationsByMachine(GetGameCelebrationsMachineRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(config.Log4NetConfigPath));

            GetGameCelebrationsResponse reply = new GetGameCelebrationsResponse();

            reply.Payouts = new GameCelebrationsList();

            try
            {
                log.Info("GetGameCelebrationsByMachine(" + reqst.MachineNo + ")Above(" + reqst.Amount + ") Request.");

                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(reqst.Casino + "BasicHttpBinding_SlotsInfoService"))
                {
                    svc.GetGameCelebrationsMachineRequest request = new svc.GetGameCelebrationsMachineRequest();
                    request.MachineNo     = reqst.MachineNo;
                    request.Amount        = reqst.Amount;
                    request.NumberOfLines = reqst.NumberOfLines;

                    svc.GetGameCelebrationsResponse response = new svc.GetGameCelebrationsResponse();
                    response = service.GetGameCelebrationsByMachine(request);

                    reply.Success = response.Success;
                    if (response.Payouts != null)
                    {
                        foreach (svc.GameCelebrationsDetail detail in response.Payouts)
                        {
                            reply.Payouts.Add(new GameCelebrationsHits
                            {
                                Amount      = detail.Amount,
                                SlotMachine = detail.SlotMachine,
                                HitDate     = detail.HitDate
                            });
                        }
                    }
                    foreach (svc.ProcessError detail in response.Errors)
                    {
                        reply.Errors.Add(new ProcessError()
                        {
                            ErrorMessage = detail.ErrorMessage
                        });
                    }
                }

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                reply.Success = true;
                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
        public GetPointsTranansactionResponse GetPointsTrans(GetPointsTransactionRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetPointsTranansactionResponse reply = new GetPointsTranansactionResponse();

            try
            {
                log.Info("GetPointsTrans Request. Account Number: " + reqst.AcctNo + ". QueryDate: " + reqst.QueryDate.ToString("yyyy-MM-dd") + ". CasinoCode: " + reqst.CasinoCode);

                reply.Success = false;

                //lets call down to the unit
                log.Info("Calling remote property: " + reqst.CasinoCode + ".");
                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(reqst.CasinoCode + "BasicHttpBinding_SlotsInfoService"))
                {
                    svc.GetPointsTranRequest request = new svc.GetPointsTranRequest
                    {
                        AcctNo     = reqst.AcctNo,
                        QueryDate  = reqst.QueryDate,
                        CasinoCode = reqst.CasinoCode,
                        ZeroDate   = reqst.ZeroDate
                    };

                    svc.GetPointsTranResponse response = new svc.GetPointsTranResponse();
                    response = service.GetPointsTransaction(request);

                    reply.Success    = response.Success;
                    reply.PointsTran = new PointsTransaction
                    {
                        Date     = response.PointsTransaction.Date,
                        Property = response.PointsTransaction.Property,

                        //casino
                        EarnedCasino = response.PointsTransaction.EarnedCasino,
                        BonusCasino  = response.PointsTransaction.BonusCasino,
                        AdjPosCasino = response.PointsTransaction.AdjPosCasino,
                        RedeemCasino = response.PointsTransaction.RedeemCasino,
                        AdjNegCasino = response.PointsTransaction.AdjNegCasino,
                        ExpireCasino = response.PointsTransaction.ExpireCasino,

                        //leisure
                        EarnedLeisure = response.PointsTransaction.EarnedLeisure,
                        AdjPosLeisure = response.PointsTransaction.AdjPosLeisure,
                        RedeemLeisure = response.PointsTransaction.RedeemLeisure,
                        AdjNegLeisure = response.PointsTransaction.AdjNegLeisure,
                        ExpireLeisure = response.PointsTransaction.ExpireLeisure,

                        //tier credits
                        TierCredits = response.PointsTransaction.TierCredits
                    };

                    foreach (svc.ProcessError detail in response.Errors)
                    {
                        reply.Errors.Add(new ProcessError()
                        {
                            ErrorMessage = detail.ErrorMessage
                        });
                    }
                }

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }