Ejemplo n.º 1
0
        public bool GetWageredAndDrop(ref RTOnlineWageredDropDetail WageredDropDetail)
        {
            bool IsSuccessfull = false;
            DataSet TicketHistory = new DataSet();
            TicketHistory = redeemTicketDB.GetTicketHistory(WageredDropDetail);

            foreach (DataRow drTicketHistory in TicketHistory.Tables[0].Rows)
            {
                WageredDropDetail.WageredAmount = WageredDropDetail.WageredAmount + Convert.ToDouble(drTicketHistory["Credits_Wagered"]) / 100;
                WageredDropDetail.DropAmount = WageredDropDetail.DropAmount + (Convert.ToDouble(drTicketHistory["COINS_IN"]) + Convert.ToDouble(drTicketHistory["Notes_IN"]));
                IsSuccessfull = true;
            }
            return IsSuccessfull;
        }
        /// <summary>
        /// Returns the currency symbol.
        /// </summary>
        /// <returns></returns>
        public DataSet GetTicketHistory(RTOnlineWageredDropDetail WagDrop)
        {
            DataSet TicketHistory = new DataSet();

            try
            {

                //DataBaseServiceHandler.ConnectionString = CommonDataAccess.ExchangeConnectionString;
                TicketHistory = DataBaseServiceHandler.Fill(CommonDataAccess.ExchangeConnectionString, CommandType.StoredProcedure, DBConstants.CONST_RSP_GETTICKETHISTORY, TicketHistory,
                    DataBaseServiceHandler.AddParameter<string>(DBConstants.CONST_PARAM_VOUCHER, DbType.String, WagDrop.TicketString));
            }
            catch (Exception exTicketHistory)
            {
                ExceptionManager.Publish(exTicketHistory);
                TicketHistory = null;
            }
            return TicketHistory;
        }
Ejemplo n.º 3
0
        public bool CheckTicketCage(RTOnlineTicketDetail TicketDetail)
        {

            string LocalTicketorSiteCode;
            string sURL;
            ValidateSiteCode(TicketDetail.TicketString, out LocalTicketorSiteCode, out sURL);

            if (sURL.IsNullOrEmpty() || sURL == "INVALID") //Invalid Site Code or No rights to access other Site
            {
                LogManager.WriteLog("CheckTicketCage:Invalid URL(Site Code Mismatch) " + TicketDetail.TicketString, LogManager.enumLogLevel.Debug);
                TicketDetail.TicketStatus = "Site Code Mismatch";
                TicketDetail.TicketStatusCode = -99;
                TicketDetail.ValidTicket = false;
                //return TicketDetail;
            }
            else if (sURL.StartsWith("http")) // WebService Call in case of Different Site Code 
            {
                LogManager.WriteLog(string.Format("CheckVoucherCage:URL {0} : Voucher {1}  ", sURL, TicketDetail.TicketString), LogManager.enumLogLevel.Debug);
                EndpointAddress objEndpoint = new EndpointAddress(sURL);
                TicketingServiceClient objClient = new TicketingServiceClient(objEndpoint, LocalTicketorSiteCode);

                //EndpointAddress objEndpoint = new EndpointAddress("http://10.2.108.29/TicketingWCFService/TicketingService.svc"); //sURL
                //TicketingServiceClient objClient = new TicketingServiceClient(objEndpoint, "1001"); //LocalTicketorSiteCode);
                TicketDetail.ClientSiteCode = LocalTicketorSiteCode;
                TicketDetail.RedeemedMachine = Environment.MachineName + "_Cage";
                TicketDetail = objClient.RedeemOnlineTicket(TicketDetail);

                if (TicketDetail.ValidTicket)
                {
                    //Cross Ticketing- Insert Local Record 
                    if (!string.IsNullOrEmpty(TicketDetail.VoucherXMLData))
                    {
                        TicketDetail.RedeemedUser = Security.SecurityHelper.CurrentUser.UserName;
                        ImportVoucherDetails(TicketDetail);
                    }
                }
                else
                {
                    LogManager.WriteLog(string.Format("CheckVoucherCage:URL {0} : Voucher {1} STATUS {2}  ", sURL, TicketDetail.TicketString, TicketDetail.TicketStatus), LogManager.enumLogLevel.Debug);

                    string strStatus = string.Empty;
                    switch (TicketDetail.TicketStatus)
                    {
                        case "MessageID211":
                            strStatus = "BLANK VOUCHER";
                            break;
                        case "MessageID212":// Application.Current.FindResource("MessageID212") as string;  
                            strStatus = "NO DB CONNECTION";
                            break;
                        case "MessageID213":
                            strStatus = "VOUCHER NOT FOUND";// Application.Current.FindResource("MessageID213") as string; 

                            if (CheckOfflineRedeemEnabled())
                            {
                                if (OfflineTicket(ref TicketDetail))
                                {
                                    strStatus = "OFFILNE VOUCHER CLAIMED";// Application.Current.FindResource("MessageID214") as string;  
                                    TicketDetail.EnableTickerPrintDetails = true;
                                }
                                else
                                {
                                    TicketDetail.ShowOfflineTicketScreen = true;
                                }
                            }
                            break;
                        case "MessageID215":// Application.Current.FindResource("MessageID215") as string;  
                            strStatus = "ALREADY CLAIMED";
                            TicketDetail.EnableTickerPrintDetails = true;

                            GetTicketDetails(ref TicketDetail);

                            //if (HFXVHTicket.GetTicketDetails(ref TicketString))
                            //{
                            //    TicketDetail.RedeemedMachine = HFXVHTicket.PrintedMachine;
                            //    TicketDetail.RedeemedDevice = HFXVHTicket.RedeemedMachine;
                            //    TicketDetail.RedeemedDate = HFXVHTicket.RedeemedDate;                              
                            //    TicketDetail.RedeemedAmount = CommonUtilities.GetCurrency((Convert.ToDouble(HFXVHTicket.Value) / 100));
                            //}
                            //else
                            //{
                            //    TicketDetail.RedeemedMachine = "";
                            //    TicketDetail.RedeemedDevice = "";
                            //    TicketDetail.RedeemedDate = "";
                            //    TicketDetail.RedeemedAmount = "";
                            //}

                            break;
                        case "MessageID216":// Application.Current.FindResource("MessageID216") as string;  
                            strStatus = "NON PAYOUT TYPE";
                            break;
                        case "MessageID217":// Application.Current.FindResource("MessageID217") as string;  
                            strStatus = "INVALID VOUCHER TYPE";
                            break;
                        case "MessageID218":// Application.Current.FindResource("MessageID218") as string; 
                            strStatus = "INVALID VOUCHER";
                            break;
                        case "MessageID219":// Application.Current.FindResource("MessageID219") as string; 
                            strStatus = "VOUCHER EXPIRED";
                            break;
                        case "MessageID220":// Application.Current.FindResource("MessageID220") as string; 
                            strStatus = "VOUCHER VOIDED";
                            break;
                        case "MessageID221":// Application.Current.FindResource("MessageID221") as string;  
                            strStatus = "VOUCHER EXCEPTION";
                            break;
                        case "MessageID222":// Application.Current.FindResource("MessageID222") as string; 
                            strStatus = "PROMO VOUCHER";
                            break;
                        case "MessageID223": //Application.Current.FindResource("MessageID223") as string;   
                            strStatus = "INVALID - CANCELLED VOUCHER";
                            break;
                        case "MessageID306":// Application.Current.FindResource("MessageID306") as string;
                            strStatus = "NON CASHABLE VOUCHER";
                            break;
                        case "MessageID312":// Application.Current.FindResource("MessageID312") as string;
                            strStatus = "Site Code Mismatch";
                            break;
                        case "MessageID214":
                            CheckTicket(TicketDetail);
                            strStatus = "OFFILNE VOUCHER CLAIMED";// Application.Current.FindResource("MessageID214") as string;
                            break;
                        default:
                            strStatus = "UNSPECIFIED ERROR";// Application.Current.FindResource("MessageID224") as string; 
                            break;

                    }
                    TicketDetail.TicketStatus = strStatus;
                }
                return TicketDetail.ValidTicket;
            }

            int Return = 0;

            bool isValidTicket = false;

            string TicketStatus = "";
            string TicketString = TicketDetail.TicketString;

            //HFXVH.Ticket HFXVHTicket = new HFXVH.Ticket();
            RTOnlineWageredDropDetail WageredDropDetail = new RTOnlineWageredDropDetail();


            TicketDetail.ShowOfflineTicketScreen = false;
            try
            {

                //Return = HFXVHTicket.TicketIsValid(ref TicketString, ref ReturnValue);
                Return = TicketIsValidCage(TicketString, ref TicketDetail);
                //TicketDetail.TicketValue = ReturnValue;

                if (Return > -1)
                {
                    TicketStatus = "VALID VOUCHER" + "(" + CommonUtilities.GetCurrency(Convert.ToDouble(TicketDetail.TicketValue / 100)) + ")";
                    isValidTicket = true;
                }
                else
                {
                    switch (Return)
                    {
                        case -1:
                            TicketStatus = "BLANK VOUCHER";
                            break;
                        case -2:
                            TicketStatus = "NO DB CONNECTION";
                            break;
                        case -3:
                            TicketStatus = "VOUCHER NOT FOUND";

                            if (CheckOfflineRedeemEnabled())
                            {
                                if (OfflineTicket(ref TicketDetail))
                                {
                                    TicketStatus = "OFFILNE VOUCHER CLAIMED";
                                    TicketDetail.EnableTickerPrintDetails = true;
                                }
                                else
                                {
                                    TicketDetail.ShowOfflineTicketScreen = true;
                                }
                            }
                            break;
                        case -4:
                            TicketStatus = "ALREADY CLAIMED";
                            TicketDetail.EnableTickerPrintDetails = true;

                            GetTicketDetails(ref TicketDetail);

                            //if (HFXVHTicket.GetTicketDetails(ref TicketString))
                            //{
                            //    TicketDetail.RedeemedMachine = HFXVHTicket.PrintedMachine;
                            //    TicketDetail.RedeemedDevice = HFXVHTicket.RedeemedMachine;
                            //    TicketDetail.RedeemedDate = HFXVHTicket.RedeemedDate;                              
                            //    TicketDetail.RedeemedAmount = CommonUtilities.GetCurrency((Convert.ToDouble(HFXVHTicket.Value) / 100));
                            //}
                            //else
                            //{
                            //    TicketDetail.RedeemedMachine = "";
                            //    TicketDetail.RedeemedDevice = "";
                            //    TicketDetail.RedeemedDate = "";
                            //    TicketDetail.RedeemedAmount = "";
                            //}

                            break;
                        case -5:
                            TicketStatus = "NON PAYOUT TYPE";
                            break;
                        case -6:
                            TicketStatus = "INVALID VOUCHER TYPE";
                            break;
                        case -7:
                            TicketStatus = "INVALID VOUCHER";
                            break;
                        case -8:
                            TicketStatus = "VOUCHER EXPIRED";
                            break;
                        case -9:
                            TicketStatus = "VOUCHER VOIDED";
                            break;
                        case -10:
                            TicketStatus = "VOUCHER EXCEPTION";
                            break;
                        case -11:
                            TicketStatus = "PROMO VOUCHER";
                            break;
                        case -12:
                            TicketStatus = "INVALID - CANCELLED VOUCHER";
                            break;
                        case -13:
                            TicketStatus = "NON CASHABLE VOUCHER";
                            break;
                        case -14:
                            TicketStatus = "Site Code Mismatch";
                            break;
                        case -98:
                            CheckTicketCage(TicketDetail);
                            TicketStatus = "OFFILNE VOUCHER CLAIMED";
                            break;
                        default:
                            TicketStatus = "UNSPECIFIED ERROR";
                            break;
                    }
                }
                TicketDetail.TicketStatus = TicketStatus;

                if (isValidTicket || Return == -4)
                {
                    TicketDetail.ValidTicket = true;

                    GetTicketDetails(ref TicketDetail);

                    //if (HFXVHTicket.GetTicketDetails(ref TicketString))
                    //{
                    //    TicketDetail.RedeemedMachine = HFXVHTicket.PrintedMachine;
                    //    TicketDetail.RedeemedAmount = CommonUtilities.GetCurrency((Convert.ToDouble(HFXVHTicket.Value) / 100));
                    //}
                    //else
                    //{
                    //    TicketDetail.RedeemedMachine = "";
                    //    TicketDetail.RedeemedAmount = "";
                    //}

                    // Check laundering limits, if amount wagered is not enough of credits in, show warning
                    if (Settings.EnableLaundering)
                    {
                        double Wagered = 0;
                        double Drop = 0;
                        WageredDropDetail.WageredAmount = 0;
                        WageredDropDetail.DropAmount = 0;
                        WageredDropDetail.TicketString = TicketString;

                        bool isSuccess = GetWageredAndDrop(ref WageredDropDetail);

                        if (isSuccess)
                        {
                            Wagered = WageredDropDetail.WageredAmount;
                            Drop = WageredDropDetail.DropAmount;
                        }

                        if (Drop > 0)
                        {
                            if ((100 - (((Drop - Wagered) * 100) / Drop)) <= GetAmberCreditsWageredtoCashIn())
                                TicketDetail.TicketWarning = "Suspect Voucher..";
                        }
                    }
                    //Commecnted for cage
                    //if (CheckTicketValidateVoucherEnabled() && isValidTicket)
                    //{
                    //    BMC.Common.LogManagement.LogManager.WriteLog("Started RTOnlineReceiptDetail", BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);
                    //    RTOnlineReceiptDetail ReceiptDetail = new RTOnlineReceiptDetail();
                    //    TicketRedemptionReceiptCreate((TicketDetail.TicketValue / 100), "", TicketString, 0, ref ReceiptDetail);//HFXVHTicket.CurrentPayoutID);                        
                    //    CommonUtilities oCommonUtilities = new CommonUtilities();
                    //    oCommonUtilities.GetCommonValues(TicketDetail, ReceiptDetail);
                    //    BMC.Common.LogManagement.LogManager.WriteLog("Done RTOnlineReceiptDetail", BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);
                    //}

                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return TicketDetail.ValidTicket;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// For offline Ticket Check-Durga
        /// </summary>
        /// <param name="TicketDetail"></param>
        /// <returns></returns>
        public RTOnlineTicketDetail CheckTicket(RTOnlineTicketDetail TicketDetail)
        {

            string LocalTicketorSiteCode;
            string sURL;
            int Installation_No = 0;
            int ValidationLength = 0;
            bool OfflineTicketRedemption = false;
            bool isTISPrintedTicket = VoucherHelper.IsTISPrintedTicket(TicketDetail.TicketString);

            if (!isTISPrintedTicket)
            {
                LinqDataAccessDataContext linqDBExchange = new LinqDataAccessDataContext(CommonDataAccess.ExchangeConnectionString);
                IEnumerable<InstallationFromTicket> InstallationTicket = linqDBExchange.GetInstallationNumber(TicketDetail.TicketString);
                foreach (var item in InstallationTicket)
                {
                    Installation_No = item.installation_no.Value;
                }
                DataTable InstallationDetails = (new CommonDataAccess()).GetInstallationDetails(0, Installation_No, false, false);
                if (InstallationDetails.Rows.Count > 0)
                {
                    try
                    {
                        int.TryParse(InstallationDetails.Rows[0]["Validation_length"].ToString(), out ValidationLength);
                        if (ValidationLength == 0) ValidationLength = CONST_DEFAULT_TICKET_LENGTH;
                    }
                    catch { ValidationLength = CONST_DEFAULT_TICKET_LENGTH; }
                }
                if (ValidationLength == CONST_DEFAULT_TICKET_LENGTH)
                {
                    ValidateSiteCode(TicketDetail.TicketString, out LocalTicketorSiteCode, out sURL);

                    if (sURL.IsNullOrEmpty() || sURL == "INVALID") //Invalid Site Code or No rights to access other Site
                    {
                        TicketDetail.TicketStatus = "MessageID312";
                        TicketDetail.TicketStatusCode = -99;
                        TicketDetail.ValidTicket = false;
                        return TicketDetail;
                    }
                    else if (sURL.StartsWith("http")) // WebService Call in case of Different Site Code 
                    {
                        EndpointAddress objEndpoint = new EndpointAddress(sURL);
                        TicketingServiceClient objClient = new TicketingServiceClient(objEndpoint, LocalTicketorSiteCode);

                        //EndpointAddress objEndpoint = new EndpointAddress("http://10.2.108.29/TicketingWCFService/TicketingService.svc"); //sURL
                        //TicketingServiceClient objClient = new TicketingServiceClient(objEndpoint, "1001"); //LocalTicketorSiteCode);
                        return objClient.RedeemOnlineTicket(TicketDetail);

                    }
                }
            }
            else
            {
                if (!VoucherHelper.IsEffectiveDateActivated(TicketDetail.TicketString))
                {
                    TicketDetail.TicketStatus = "MessageID876";
                    TicketDetail.ValidTicket = false;
                    return TicketDetail;
                }
                //else if (VoucherHelper.IsCardRequired(TicketDetail.TicketString))
                //{
                //    TicketDetail.TicketStatus = "MessageID878";
                //    TicketDetail.ValidTicket = false;
                //    return TicketDetail;
                //}
            }

            // Local Site Code (Default)

            int Return = 0;

            bool isValidTicket = false;

            string TicketStatus = "";
            string TicketString = TicketDetail.TicketString;

            //HFXVH.Ticket HFXVHTicket = new HFXVH.Ticket();
            RTOnlineWageredDropDetail WageredDropDetail = new RTOnlineWageredDropDetail();


            TicketDetail.ShowOfflineTicketScreen = false;
            try
            {

                //Return = HFXVHTicket.TicketIsValid(ref TicketString, ref ReturnValue);
                Return = TicketIsValid(TicketString, isTISPrintedTicket, ref TicketDetail);
                //TicketDetail.TicketValue = ReturnValue;

                if (Return > -1)
                {
                    TicketStatus = "MessageID210";

                    //                        "VALID VOUCHER"+
                    //Application.Current.FindResource("MessageID210") as string 
                    //                  "(" + CommonUtilities.GetCurrency(Convert.ToDouble(TicketDetail.TicketValue / 100)) + ")";
                    isValidTicket = true;
                }
                else
                {
                    switch (Return)
                    {
                        case -1:
                            TicketStatus = "MessageID211";// Application.Current.FindResource("MessageID211") as string;
                            break;
                        case -2:
                            TicketStatus = "MessageID212";// Application.Current.FindResource("MessageID212") as string;  
                            break;
                        case -3:
                            TicketStatus = "MessageID213";// Application.Current.FindResource("MessageID213") as string; 

                            if (CheckOfflineRedeemEnabled())
                            {
                                if (OfflineTicket(ref TicketDetail))
                                {
                                    TicketStatus = "MessageID214";// Application.Current.FindResource("MessageID214") as string;  
                                    TicketDetail.EnableTickerPrintDetails = true;
                                }
                                else
                                {
                                    TicketDetail.ShowOfflineTicketScreen = true;
                                }
                            }
                            break;
                        case -4:
                            TicketStatus = "MessageID215";// Application.Current.FindResource("MessageID215") as string;  
                            TicketDetail.EnableTickerPrintDetails = true;

                            GetTicketDetails(ref TicketDetail);

                            //if (HFXVHTicket.GetTicketDetails(ref TicketString))
                            //{
                            //    TicketDetail.RedeemedMachine = HFXVHTicket.PrintedMachine;
                            //    TicketDetail.RedeemedDevice = HFXVHTicket.RedeemedMachine;
                            //    TicketDetail.RedeemedDate = HFXVHTicket.RedeemedDate;                              
                            //    TicketDetail.RedeemedAmount = CommonUtilities.GetCurrency((Convert.ToDouble(HFXVHTicket.Value) / 100));
                            //}
                            //else
                            //{
                            //    TicketDetail.RedeemedMachine = "";
                            //    TicketDetail.RedeemedDevice = "";
                            //    TicketDetail.RedeemedDate = "";
                            //    TicketDetail.RedeemedAmount = "";
                            //}

                            break;
                        case -5:
                            TicketStatus = "MessageID216";// Application.Current.FindResource("MessageID216") as string;  
                            break;
                        case -6:
                            TicketStatus = "MessageID217";// Application.Current.FindResource("MessageID217") as string;  
                            break;
                        case -7:
                            TicketStatus = "MessageID218";// Application.Current.FindResource("MessageID218") as string; 
                            break;
                        case -8:
                            TicketStatus = "MessageID219";// Application.Current.FindResource("MessageID219") as string; 
                            break;
                        case -9:
                            TicketStatus = "MessageID220";// Application.Current.FindResource("MessageID220") as string; 
                            break;
                        case -10:
                            TicketStatus = "MessageID221";// Application.Current.FindResource("MessageID221") as string;  
                            break;
                        case -11:
                            TicketStatus = "MessageID222";// Application.Current.FindResource("MessageID222") as string; 
                            break;
                        case -12:
                            TicketStatus = "MessageID223"; //Application.Current.FindResource("MessageID223") as string;   
                            break;
                        case -13:
                            TicketStatus = "MessageID306";// Application.Current.FindResource("MessageID306") as string;
                            break;
                        case -14:
                            TicketStatus = "MessageID312";// Application.Current.FindResource("MessageID312") as string;
                            break;
                        case -98:
                            CheckTicket(TicketDetail);
                            TicketStatus = "MessageID214";// Application.Current.FindResource("MessageID214") as string;
                            break;
                        default:
                            TicketStatus = "MessageID224";// Application.Current.FindResource("MessageID224") as string; 
                            break;
                    }
                }
                TicketDetail.TicketStatus = TicketStatus;

                if (isValidTicket || Return == -4)
                {
                    TicketDetail.ValidTicket = true;

                    GetTicketDetails(ref TicketDetail);

                    //if (HFXVHTicket.GetTicketDetails(ref TicketString))
                    //{
                    //    TicketDetail.RedeemedMachine = HFXVHTicket.PrintedMachine;
                    //    TicketDetail.RedeemedAmount = CommonUtilities.GetCurrency((Convert.ToDouble(HFXVHTicket.Value) / 100));
                    //}
                    //else
                    //{
                    //    TicketDetail.RedeemedMachine = "";
                    //    TicketDetail.RedeemedAmount = "";
                    //}

                    // Check laundering limits, if amount wagered is not enough of credits in, show warning
                    if (Settings.EnableLaundering)
                    {
                        double Wagered = 0;
                        double Drop = 0;
                        WageredDropDetail.WageredAmount = 0;
                        WageredDropDetail.DropAmount = 0;
                        WageredDropDetail.TicketString = TicketString;

                        bool isSuccess = GetWageredAndDrop(ref WageredDropDetail);

                        if (isSuccess)
                        {
                            Wagered = WageredDropDetail.WageredAmount;
                            Drop = WageredDropDetail.DropAmount;
                        }

                        if (Drop > 0)
                        {
                            if ((100 - (((Drop - Wagered) * 100) / Drop)) <= GetAmberCreditsWageredtoCashIn())
                                TicketDetail.TicketWarning = "Suspect Voucher..";
                        }
                    }

                    if (CheckTicketValidateVoucherEnabled() && isValidTicket)
                    {
                        //Check for Offline
                        if (OfflineTicket(ref TicketDetail))
                            OfflineTicketRedemption = true;


                        BMC.Common.LogManagement.LogManager.WriteLog("Started RTOnlineReceiptDetail", BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);
                        RTOnlineReceiptDetail ReceiptDetail = new RTOnlineReceiptDetail();
                        TicketRedemptionReceiptCreate((TicketDetail.TicketValue / 100), "", TicketString, 0, ref ReceiptDetail);//HFXVHTicket.CurrentPayoutID);                        
                        CommonUtilities oCommonUtilities = new CommonUtilities();
                        if (OfflineTicketRedemption)
                            oCommonUtilities.GetCommonValues(TicketDetail, ReceiptDetail, "OFFLINE VOUCHER REDEMPTION");
                        else
                            oCommonUtilities.GetCommonValues(TicketDetail, ReceiptDetail);
                        BMC.Common.LogManagement.LogManager.WriteLog("Done RTOnlineReceiptDetail", BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);
                    }

                }
                return TicketDetail;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return TicketDetail;
            }
        }