Exemple #1
0
        public void OnProcessComplete(BallyCEAProcessComplete e)
        {
            try
            {
                _LastComm = DateTime.Now;
                _OP_TYPE opType = e.OpType;
                switch (opType)
                {
                case _OP_TYPE.Cashout: doProcCashoutResponse(e); break;

                default: break;
                }

                if (_evtProcessComplete != null)
                {
                    _evtProcessComplete(this, e);
                }
            }
            catch (Exception x)
            {
                LogManager.WriteLog(DispenserType + "OnProcessComplete :" + x.ToString(), LogManager.enumLogLevel.Error);
            }
        }
        private void doProcCashoutResponse(BallyCEAProcessComplete e)
        {

        }
        public void OnProcessComplete(BallyCEAProcessComplete e)
        {
            try
            {
                _LastComm = DateTime.Now;
                _OP_TYPE opType = e.OpType;
                switch (opType)
                {
                    case _OP_TYPE.Cashout: doProcCashoutResponse(e); break;
                    default: break;
                }

                if (_evtProcessComplete != null)
                    _evtProcessComplete(this, e);
            }
            catch (Exception x)
            {
                LogManager.WriteLog(DispenserType + "OnProcessComplete :" + x.ToString(), LogManager.enumLogLevel.Error);
            }
        }
        private void evtProcessCompleteCashout(object sender, EventArgs e)
        {
            int    totalPiecesDispensed = 0;
            double totalAmountDispensed = 0;
            Result _result = new Result();

            _result.IsSuccess         = true;
            _result.error             = new Error();
            _result.error.MessageType = MessageType.Information.ToString();
            try
            {
                if (((BallyCEAProcessComplete)e).OpType != _OP_TYPE.Cashout)
                {
                    return;
                }
                GloryDeviceHelper.Instance._evtProcessComplete -= new EventHandler(evtProcessCompleteCashout);


                BallyCEAProcessComplete ea  = (BallyCEAProcessComplete)e;
                BallyCCashoutResponse   res = (BallyCCashoutResponse)ea.ResponseInfo;

                if (res != null)
                {
                    #region Cashout
                    LogManager.WriteLog(DispenserType + "Cashout result:" + res.Result, LogManager.enumLogLevel.Info);
                    if (res.Result == _SYS_CODE.SYS_SUCCESS)
                    {
                        String        msg          = String.Format("Cashout result: {0}", res.Result);
                        StringBuilder strPieceFace = new StringBuilder();
                        strPieceFace.Append("FaceValue*Piece==> ");
                        foreach (CGDBSCDenomination denom in res.CashoutDetail)
                        {
                            msg = String.Format("{0}\n{1:c2} : {2}", msg, denom.FaceValue / 100, denom.Piece);

                            #region Update the total
                            {
                                totalPiecesDispensed += denom.Piece;
                                totalAmountDispensed += ((double)denom.Piece * denom.FaceValue / 100);
                                strPieceFace.Append(" " + denom.FaceValue + "F" + "*" + denom.Piece + "Piece;");
                                LogManager.WriteLog(DispenserType + " Piece :" + denom.Piece + " * FaceValue :" + denom.FaceValue + "==> AmountDispensed= " + (denom.Piece * denom.FaceValue), LogManager.enumLogLevel.Info);
                            }
                            #endregion
                        }
                        strPieceFace.Append("TotalAmountDispensed==>" + (totalAmountDispensed * 100));
                        LogManager.WriteLog(DispenserType + "Total Piece Dispensed :" + totalPiecesDispensed + " Total AmountDispensed= " + (totalAmountDispensed * 100), LogManager.enumLogLevel.Info);

                        LogManager.WriteLog(DispenserType + "RequestAmount:" + _RequestAmount + " ResponseAmount:" + (totalAmountDispensed * 100), LogManager.enumLogLevel.Info);
                        if (_RequestAmount == (totalAmountDispensed * 100))
                        {
                            AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                            {
                                AuditModuleName    = _cType,
                                Audit_Screen_Name  = _cType + "|Cashout Session",
                                Audit_Desc         = "Cashout Session Succeed ; Session ID:" + UserInformation.SessionID + "; TicketNo:" + _TicketNo + ";RequestAmount:" + _RequestAmount + " ResponseAmount:" + (totalAmountDispensed * 100) + ";",
                                AuditOperationType = OperationType.ADD,
                                Audit_Field        = "Amount",
                                Audit_New_Vl       = strPieceFace.ToString()
                            });
                        }
                        else
                        {
                            AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                            {
                                AuditModuleName    = _cType,
                                Audit_Screen_Name  = _cType + "|Cashout Session",
                                Audit_Desc         = "Cashout Session InComplete ; Session ID:" + UserInformation.SessionID + "; TicketNo:" + _TicketNo + ";RequestAmount:" + _RequestAmount + " ResponseAmount:" + (totalAmountDispensed * 100) + ";",
                                AuditOperationType = OperationType.ADD,
                                Audit_Field        = "Amount",
                                Audit_New_Vl       = strPieceFace.ToString()
                            });
                        }
                        OnStatusChanged("Cash Dispensed Successfully");
                    }
                    else
                    {
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = _cType,
                            Audit_Screen_Name  = _cType + "|Cashout Session",
                            Audit_Desc         = "Cashout Failed ; Session ID:" + UserInformation.SessionID + "; TicketNo:" + _TicketNo + "; Amount:" + totalAmountDispensed + ";",
                            AuditOperationType = OperationType.ADD,
                            Audit_Field        = "Session ID"
                        });
                        _result.IsSuccess         = false;
                        _result.error.Message     = Application.Current.FindResource("MessageID442") as string;
                        _result.error.Code        = (int)res.Result;
                        _result.error.MessageType = MessageType.Error.ToString();
                        LogManager.WriteLog(DispenserType + "Error:" + res.Result + res.Desc, LogManager.enumLogLevel.Error);
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(DispenserType + "evtProcessCompleteCashout::" + ex.Message, LogManager.enumLogLevel.Error);
                _result.IsSuccess     = false;
                _result.error.Message = ex.Message;
            }
            finally
            {
                try
                {
                    #region Release
                    _SYS_CODE syRel = doRelease();
                    if (syRel != _SYS_CODE.SYS_SUCCESS)
                    {
                        LogManager.WriteLog(DispenserType + "Releasing Device Failed: Msg:-" + syRel.ToString() + "Error Code:-" + (int)syRel, LogManager.enumLogLevel.Info);
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = _cType,
                            Audit_Screen_Name  = _cType + "|Release Session",
                            Audit_Desc         = "Failed to Release ; Device Name:" + UserInformation.Device,
                            AuditOperationType = OperationType.ADD,
                            Audit_Field        = "Device"
                        });
                        OnStatusChanged("Failed to Release ; Device Name:" + UserInformation.Device);
                        //_result.IsSuccess = false;
                        //_result.error.Message = "Failed to Release ; Device Name:" + UserInformation.Device + " " + syRel.ToString();
                        //_result.error.Code = (int)syRel;
                        //_result.error.MessageType = MessageType.Error.ToString();
                    }
                    else
                    {
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = _cType,
                            Audit_Screen_Name  = _cType + "|Release Session",
                            Audit_Desc         = "Release Succeed ; Device Name:" + UserInformation.Device,
                            AuditOperationType = OperationType.ADD,
                            Audit_Field        = "Device"
                        });
                        OnStatusChanged("Device Name:" + UserInformation.Device + " released succeesfully");
                        LogManager.WriteLog(DispenserType + "Device Name:" + UserInformation.Device + " released succeesfully", LogManager.enumLogLevel.Info);
                    }
                    #endregion

                    #region Close Session
                    _SYS_CODE syObj = doCloseSession();
                    if (syObj != _SYS_CODE.SYS_SUCCESS)
                    {
                        LogManager.WriteLog(DispenserType + "CloseSession Failed: Msg:-" + syObj.ToString() + "Error Code:-" + (int)syObj, LogManager.enumLogLevel.Info);
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = _cType,
                            Audit_Screen_Name  = _cType + "|Close Session",
                            Audit_Desc         = "Close Session Failed ; Session ID:" + UserInformation.SessionID + "; EndTime:" + DateTime.Now.GetUniversalDateTimeFormat(),
                            AuditOperationType = OperationType.ADD,
                            Audit_Field        = "Session ID"
                        });
                        OnStatusChanged("Close Session Failed");
                        //_result.IsSuccess = false;
                        //_result.error.Message = "Close Session Failed" + syObj.ToString();
                        //_result.error.Code = (int)syObj;
                        //_result.error.MessageType = MessageType.Error.ToString();
                        _result.error.Message = Application.Current.FindResource("MessageID441") as string;
                    }
                    else
                    {
                        AuditCloseSessionGloryDetails(true, string.Empty);
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = _cType,
                            Audit_Screen_Name  = _cType + "|Close Session",
                            Audit_Desc         = "Close Session Succeed ; Session ID:" + UserInformation.SessionID + "; EndTime:" + DateTime.Now.GetUniversalDateTimeFormat(),
                            AuditOperationType = OperationType.ADD,
                            Audit_Field        = "Session ID"
                        });
                        OnStatusChanged("Close Session Succeed");
                        if (_result.IsSuccess)
                        {
                            _result.error.Message = Application.Current.FindResource("MessageID441") as string;
                        }
                        LogManager.WriteLog(DispenserType + "Close Session Succeed", LogManager.enumLogLevel.Info);
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(DispenserType + "Exception Occured in Release module" + ex.Message, LogManager.enumLogLevel.Info);
                }

                #endregion

                this.OnFinished(_result);
            }
        }
Exemple #5
0
 private void doProcCashoutResponse(BallyCEAProcessComplete e)
 {
 }