public voucherDTO IssueTicketToCage(IssueTicketEntity IssueTicketEntity, voucherDTO ovoucherDTO)
        {
            PrintTicketErrorCodes ErrorCode = PrintTicketErrorCodes.Failure;
            CageVoucher voucher = new CageVoucher();

            try
            {
                if ((ErrorCode = issueTicket.CreateTicketForCage(IssueTicketEntity, ref voucher)) == PrintTicketErrorCodes.Success)
                {
                    ovoucherDTO.barcode = IssueTicketEntity.BarCode;
                    ovoucherDTO.amountType = amountTypeEnum.CASHABLE;
                    ovoucherDTO.errorCodeId = voucher.ErrorCode;
                    ovoucherDTO.tktStatus = voucher.tktStatus;
                    ovoucherDTO.tktStatusId = voucher.tktStatusID;
                    ovoucherDTO.expiryDays = voucher.expiryDays;
                    ovoucherDTO.expireDate = voucher.expireDate;
                    ovoucherDTO.effectiveDate = voucher.DatePrinted;
                    //ovoucherDTO.expireDateSpecified = true;
                    //ovoucherDTO.effectiveDateSpecified = true; 

                    //SMSResponseInfo.ExpiryDate = (BDateTime)voucherDToObj.expireDate;
                    //SMSResponseInfo.ValidDays = voucherDToObj.expiryDays;
                    //SMSResponseInfo.TicketStatus = voucherDToObj.tktStatus;
                    //SMSResponseInfo.ErrorCode = voucherDToObj.errorCodeId;
                    //listResponseInfo.Add(SMSResponseInfo);
                    //TenderInfo tempTenderInfo = new TenderInfo();
                    //item.Copy(tempTenderInfo);
                    //(oCommonUtilities.CreateInstance()).PrintCommonReceipt(voucher);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            return ovoucherDTO;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generate bar code number for the ticket number entered.
        /// </summary>
        /// <param name="_ObjCDOEntity"></param>
        /// <returns></returns>

        private PrintTicketErrorCodes Generate(IssueTicketEntity IssueTicketEntity)
        {
            PrintTicketErrorCodes ErrorCode;
            try
            {
                if ((ErrorCode = issueTicketDB.TicketCreateRequest(IssueTicketEntity)) == PrintTicketErrorCodes.Success)
                    if ((ErrorCode = PrintTicket(IssueTicketEntity)) == PrintTicketErrorCodes.Success)
                        return issueTicketDB.TicketPrintConfirmed(IssueTicketEntity);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return PrintTicketErrorCodes.Exception;
            }
            return ErrorCode;
        }
Ejemplo n.º 3
0
        public PrintTicketErrorCodes CreateTicket(IssueTicketEntity CDOEntity, ref Voucher voucher)
        {
            PrintTicketErrorCodes ErrorCode = PrintTicketErrorCodes.Failure;
            try
            {
                if ((ErrorCode = Generate(CDOEntity)) == PrintTicketErrorCodes.Success)
                {
                    if ((ErrorCode = issueTicketDB.SaveTicketIssueDetails(CDOEntity)) == PrintTicketErrorCodes.Success)
                        TicketIssueCreate(CDOEntity, ref voucher);

                    return PrintTicketErrorCodes.Success;
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return ErrorCode;
        }
        public bool GetTicketInfoForCage(IssueTicketEntity issueTicketEntity, ref CageVoucher voucher)
        {
            bool IsTicketInfoRetrieved = false;
            DataSet GetTicketInfo = new DataSet();

            try
            {
                SqlParameter[] sqlparams = new SqlParameter[5];
                sqlparams[0] = new SqlParameter(DBConstants.CONST_SP_PARAM_STARTDATE, DateTime.Now.AddDays(-5));//.GetUniversalDateTimeFormat()
                sqlparams[1] = new SqlParameter(DBConstants.CONST_SP_PARAM_ENDDATE, DateTime.Now.AddDays(5));//.GetUniversalDateTimeFormat()
                sqlparams[2] = new SqlParameter(DBConstants.CONST_SP_PARAM_TYPE, "A");
                sqlparams[3] = new SqlParameter(DBConstants.CONST_SP_PARAM_BARCODE, issueTicketEntity.BarCode);
                sqlparams[4] = new SqlParameter(DBConstants.CONST_SP_PARAM_ISLIABILITY, 0);

                if (OpenConnection() == true)
                {
                    GetTicketInfo = SqlHelper.ExecuteDataset(CommonDataAccess.TicketingConnectionString, "rsp_BGS_VoucherInformation_CAGE", sqlparams);
                    if (GetTicketInfo.Tables[0].Rows.Count > 0)
                    {
                        voucher.PrintDevice = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_PRINTDEVICE].ToString();
                        voucher.PayDevice = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_PAYDEVICE].ToString();
                        voucher.SBarCode = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_BARCODE].ToString();
                        voucher.Amount = int.Parse((GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_AMOUNT]).ToString());
                        voucher.tktStatus = GetTicketInfo.Tables[0].Rows[0]["strVoucherStatus"].ToString();
                        voucher.tktStatusID = short.Parse(GetTicketInfo.Tables[0].Rows[0]["VoucherStatusID"].ToString());
                        voucher.Datepaid = (GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_DATEPAID]).ToString().ReadDate();
                        voucher.DatePrinted = (GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_DATEPRINTED]).ToString().ReadDate();
                        voucher.DeviceType = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_DEVICETYPE].ToString();
                        voucher.expireDate = GetTicketInfo.Tables[0].Rows[0]["dtExpire"].ToString().ReadDate();
                        voucher.expiryDays = int.Parse(GetTicketInfo.Tables[0].Rows[0]["expiryDays"].ToString());
                        IsTicketInfoRetrieved = true;
                        voucher.ErrorCode = 0;
                    }
                }

            }
            catch (Exception ex)
            {
                voucher.ErrorCode = -1001;
                ExceptionManager.Publish(ex);
            }
            return IsTicketInfoRetrieved;
        }
        /// <summary>
        /// To create new ticket for the amount entered
        /// </summary>
        /// <param name="_objCDOEntity"></param>
        /// <returns type=boolean>bTicketCreateReq</returns>
        public PrintTicketErrorCodes TicketCreateRequest(IssueTicketEntity issueTicketEntity)
        {
            string retBarCode = string.Empty;
            int Amount;
            
          //  bool IsTicketCreated = false;
            try
            {
                if (OpenConnection() == true)
                {

                    SqlParameter[] sqlparams = GetSpParametersCreateTicketStart(issueTicketEntity);

                    SqlHelper.ExecuteNonQuery(CommonDataAccess.ExchangeConnectionString, System.Data.CommandType.StoredProcedure, DBConstants.CONST_SP_CREATETICKETSTART, sqlparams);

                    if (sqlparams[2].Value.ToString() != string.Empty)
                    {
                        retBarCode = sqlparams[2].Value.ToString();
                        Amount = Convert.ToInt32(issueTicketEntity.lnglValue);
                        //SDGTicketGenLib.cSDGTicketGenClass ticketGen = new SDGTicketGen.cSDGTicketGenClass();
                        //retBarCode = ticketGen.StdBarcode(ref retBarCode, ref Amount);
                        SDGTicketGenLib.SDGTicketGenClass ticketGen = new SDGTicketGenLib.SDGTicketGenClass();
                        retBarCode = ticketGen.stdBarcode(retBarCode, Amount);

                        if (LogTitoTicketPrint(retBarCode, Amount) > 0)
                        {
                            issueTicketEntity.BarCode = retBarCode;// Convert.ToString(sqlparams[4].Value);
                           // IsTicketCreated = true;   
                        return PrintTicketErrorCodes.Success;
                    }
                }
            }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            //return IsTicketCreated;
            return PrintTicketErrorCodes.TicketCreateRequestFailure;

        }
Ejemplo n.º 6
0
        public PrintTicketErrorCodes IssueTicket(IssueTicketEntity IssueTicketEntity)
        {
            PrintTicketErrorCodes ErrorCode=PrintTicketErrorCodes.Failure;
            Voucher voucher = new Voucher();

            try
            {
                if ((ErrorCode = issueTicket.CreateTicket(IssueTicketEntity, ref voucher)) == PrintTicketErrorCodes.Success)
                {
                    voucher.Value = IssueTicketEntity.dblValue;
                    voucher.SBarCode = IssueTicketEntity.BarCode;
                    voucher.Header = IssueTicketEntity.TicketHeader;
                  
                    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(voucher);
                }                
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            return ErrorCode;
        }
        /// <summary>
        /// To set parameters for completing the create ticket procedure
        /// </summary>
        /// <param name="objCDOEntity"></param>
        /// <returns type=objectarray >sp_parames</returns>
        public SqlParameter[] GetSpParametersSaveTicketIssueDetails(IssueTicketEntity issueTicketEntity)
        {
            SqlParameter[] sp_parames = null;
         
            try
            {
                if (issueTicketEntity != null)
                {
                    sp_parames = new SqlParameter[9];
                    sp_parames[0] = new SqlParameter(DBConstants.CONST_SP_PARAM_TICKETNUMBER, issueTicketEntity.BarCode);
                    sp_parames[1] = new SqlParameter(DBConstants.CONST_SP_PARAM_DATEPRINTED, issueTicketEntity.Date);
                    sp_parames[2] = new SqlParameter(DBConstants.CONST_SP_PARAM_WINDOWUSER, System.Environment.UserName.ToString());
                    sp_parames[3] = new SqlParameter(DBConstants.CONST_SP_PARAM_USERID, "userstring");
                    sp_parames[4] = new SqlParameter(DBConstants.CONST_SP_PARAM_MACHINENAME, Environment.MachineName);
                    sp_parames[5] = new SqlParameter(DBConstants.CONST_SP_PARAM_TOTALVALUE, issueTicketEntity.dblValue);
                    sp_parames[6] = new SqlParameter(DBConstants.CONST_SP_PARAM_CASHTOTAL, issueTicketEntity.dblValue);
                    sp_parames[7] = new SqlParameter(DBConstants.CONST_SP_PARAM_CASHABLE, false);

                    SqlParameter ReturnValue = new SqlParameter();
                    ReturnValue.ParameterName = DBConstants.CONST_SP_PARAM_RETURNVALUE;
                    ReturnValue.Direction = ParameterDirection.ReturnValue;
                    sp_parames[8] = ReturnValue;
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            return sp_parames;
        }
        /// <summary>
        /// Save the ticket details 
        /// </summary>
        /// <param name="ObjCDOEntity"></param>
        /// <returns></returns>
        public PrintTicketErrorCodes SaveTicketIssueDetails(IssueTicketEntity issueTicketEntity)
        {
           // bool IsTicketIssueDetailsSaved = false;

            try
            {
                SqlParameter[] sqlparams = GetSpParametersSaveTicketIssueDetails(issueTicketEntity);
                SqlHelper.ExecuteNonQuery(CommonDataAccess.ExchangeConnectionString, System.Data.CommandType.StoredProcedure, DBConstants.CONST_SP_INSERTTICKETISSUE, sqlparams);
                if (sqlparams[8].Value != DBNull.Value && Convert.ToString(sqlparams[8].Value) != string.Empty && sqlparams[8].Value != null)
                {
                    if (int.Parse(sqlparams[8].Value.ToString()) == 0)
                        //IsTicketIssueDetailsSaved = true;
                        return PrintTicketErrorCodes.Success;
                }
            }

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

           // return IsTicketIssueDetailsSaved;
            return PrintTicketErrorCodes.SaveTicketIssueDetailsFailure;

        }
        /// <summary>
        /// To set parameters for completing the create ticket procedure
        /// </summary>
        /// <param name="objCDOEntity"></param>
        /// <returns type=objectarray >sp_parames</returns>
        public SqlParameter[] GetSpParametersCreateTicketComplete(IssueTicketEntity issueTicketEntity)
        {
            SqlParameter[] sp_parames = null;

            try
            {

                if (issueTicketEntity != null)
                {
                    sp_parames = new SqlParameter[5];
                    sp_parames[0] = new SqlParameter(DBConstants.CONST_SP_PARAM_BARCODE, issueTicketEntity.BarCode);

                    sp_parames[1] = new SqlParameter("@IssuedUser", Security.SecurityHelper.CurrentUser.UserName);
                    sp_parames[2] = new SqlParameter("@RedeemedUser", string.Empty);

                    sp_parames[3] = new SqlParameter();
                    sp_parames[3].ParameterName = DBConstants.CONST_SP_PARAM_RETRESULT;
                    sp_parames[3].Direction = ParameterDirection.Output;
                    sp_parames[3].Value = 0;
                    sp_parames[3].SqlDbType = SqlDbType.Int;

                    SqlParameter ReturnValue = new SqlParameter();
                    ReturnValue.ParameterName = DBConstants.CONST_SP_PARAM_RETURNVALUE;
                    ReturnValue.Direction = ParameterDirection.ReturnValue;
                    sp_parames[4] = ReturnValue;
                }
            }

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

            return sp_parames;
        }
        /// <summary>
        /// To Get Voucher Settings from Setting table in Exchange DB
        /// </summary>
        /// <param name=""></param>
        /// <returns type=string >strVoucherSite</returns>
        public PrintTicketErrorCodes TicketPrintConfirmed(IssueTicketEntity issueTicketEntity)
        {
           // bool IsTicketPrinted = false;

            try
            {
                SqlParameter[] sqlparams = GetSpParametersCreateTicketComplete(issueTicketEntity);
                SqlHelper.ExecuteNonQuery(CommonDataAccess.ExchangeConnectionString, System.Data.CommandType.StoredProcedure, DBConstants.CONST_SP_CREATETICKETCOMPLETE, sqlparams);
                if (sqlparams[4].Value != DBNull.Value && Convert.ToString(sqlparams[4].Value) != string.Empty && sqlparams[4].Value != null)
                {
                    if (Convert.ToInt16(sqlparams[4].Value) == 0)
                        //  IsTicketPrinted = true;
                        return PrintTicketErrorCodes.Success;
                }
            }

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

            //return IsTicketPrinted;
            return PrintTicketErrorCodes.TicketPrintConfirmationFailure;

        }
        /// <summary>
        /// To set parameters for ticket creation algorithm
        /// </summary>
        /// <param name="objCDOEntity"></param>
        /// <returns type=objectarray >sp_parames</returns>
        public SqlParameter[] GetSpParametersCreateTicketStart(IssueTicketEntity issueTicketEntity)
        {
            SqlParameter[] sp_parames = null;

            try
            {
                //BGSGeneral.cGeneral objBGSGeneral = new BGSGeneral.cGeneral();
                if (issueTicketEntity != null)
                {
                    sp_parames = new SqlParameter[5];

                    SqlParameter param0 = new SqlParameter();
                    param0.ParameterName = DBConstants.CONST_SP_PARAM_INSTALLATIONID;
                    param0.Direction = ParameterDirection.Input;
                    param0.Value = 0;
                    sp_parames[0] = param0;

                    //SqlParameter param1 = new SqlParameter();
                    //param1.ParameterName = DBConstants.CONST_SP_PARAM_DATAPAKSERIALNUMBER;
                    //param1.Direction = ParameterDirection.Input;
                    //param1.Value = 0;
                    //sp_parames[1] = param1;

                    SqlParameter param2 = new SqlParameter();
                    param2.ParameterName = DBConstants.CONST_SP_PARAM_TICKETVALUE;
                    param2.Direction = ParameterDirection.Input;
                    param2.Value = issueTicketEntity.lnglValue;
                    sp_parames[1] = param2;

                    //SqlParameter param3 = new SqlParameter();
                    //param3.ParameterName = DBConstants.CONST_SP_PARAM_SERVERNAME;
                    //param3.Direction = ParameterDirection.Input;
                    //param3.Value = objBGSGeneral.GetMachineName();
                    //sp_parames[3] = param3;

                    sp_parames[2] = new SqlParameter();
                    sp_parames[2].ParameterName = DBConstants.CONST_SP_PARAM_RETURNTICKETNUMBER;
                    sp_parames[2].Direction = ParameterDirection.Output;
                    sp_parames[2].Value = string.Empty;
                    sp_parames[2].SqlDbType = SqlDbType.VarChar;
                    sp_parames[2].Size = 18;

                    SqlParameter param5 = new SqlParameter();
                    param5.ParameterName = DBConstants.CONST_SP_PARAM_TICKETTYPE;
                    param5.Direction = ParameterDirection.Input;
                    param5.Value = issueTicketEntity.Type;
                    sp_parames[3] = param5;

                    SqlParameter ReturnValue = new SqlParameter();
                    ReturnValue.ParameterName = DBConstants.CONST_SP_PARAM_RETURNVALUE;
                    ReturnValue.Direction = ParameterDirection.ReturnValue;
                    sp_parames[4] = ReturnValue;
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return sp_parames;

        }
Ejemplo n.º 12
0
        /// <summary>
        /// To set parameters for completing the create ticket procedure
        /// </summary>
        /// <param name="objCDOEntity"></param>
        /// <returns type=objectarray >sp_parames</returns>
        public SqlParameter[] GetSpParametersGetTicketInfo(IssueTicketEntity issueTicketEntity)
        {
            SqlParameter[] sp_parames = null;

            try
            {
                if (issueTicketEntity != null)
                {
                    sp_parames = new SqlParameter[4];
                    sp_parames[0] = new SqlParameter(DBConstants.CONST_SP_PARAM_STARTDATE, DateTime.Now.AddDays(-5).ToString("dd mmm yyyy hh:nn:ss"));
                    sp_parames[1] = new SqlParameter(DBConstants.CONST_SP_PARAM_ENDDATE, DateTime.Now.AddDays(5).ToString("dd mmm yyyy hh:nn:ss"));
                    sp_parames[2] = new SqlParameter(DBConstants.CONST_SP_PARAM_TYPE, "A");
                    sp_parames[3] = new SqlParameter(DBConstants.CONST_SP_PARAM_BARCODE, issueTicketEntity.BarCode);

                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return sp_parames;
        }
 public void PrintValues(int iPromotionID, double dblPromoTicketAmount, DateTime dtPromoTickExp, int PromoTicketType, int TicketCount)
 {
     IssueTicketEntity issueTicketEntity = new IssueTicketEntity();
     this.PromotionID = iPromotionID;
     this.PromotionTicketAmount = dblPromoTicketAmount;
     this.ExpiryDate = dtPromoTickExp;
     this.PromoTicketType = PromoTicketType;
     this.PromCount = TicketCount;
     _mreShutdown.Reset();
     this.DisplayTicketPrintedSuccessMsg = Common.ConfigurationManagement.ConfigManager.Read("DisplayPromoTicketPrintMessage").ToString();
     LoadPromotionDetails(iPromotionID);
 }
        /// <summary>
        /// To set parameters for completing the create ticket procedure
        /// </summary>
        /// <param name="objCDOEntity"></param>
        /// <returns type=objectarray >sp_parames</returns>
        public SqlParameter[] GetSpParametersGetTicketInfo(IssueTicketEntity issueTicketEntity)
        {
            SqlParameter[] sp_parames = null;

            try
            {
                if (issueTicketEntity != null)
                {
                    sp_parames = new SqlParameter[6];
                    sp_parames[0] = new SqlParameter(DBConstants.CONST_SP_PARAM_STARTDATE, DateTime.Now.AddDays(-5));//.GetUniversalDateTimeFormat()
                    sp_parames[1] = new SqlParameter(DBConstants.CONST_SP_PARAM_ENDDATE, DateTime.Now.AddDays(5));//.GetUniversalDateTimeFormat()
                    sp_parames[2] = new SqlParameter(DBConstants.CONST_SP_PARAM_TYPE, "A");
                    sp_parames[3] = new SqlParameter(DBConstants.CONST_SP_PARAM_BARCODE, issueTicketEntity.BarCode);
                    sp_parames[4] = new SqlParameter(DBConstants.CONST_SP_PARAM_ISLIABILITY, 0);
                    sp_parames[5] = new SqlParameter("@User", 0);

                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return sp_parames;
        }
Ejemplo n.º 15
0
        public void Epson_TicketIssueReceipt(IssueTicketEntity IssueTicketEntity)
        {
            try
            {
                TicketNumber = IssueTicketEntity.FullTicketNumber;
                //Voucher.FullTicketNumber = IssueTicketEntity.FullTicketNumber;
                //Voucher.Value = IssueTicketEntity.dblValue;
                Amount = int.Parse(IssueTicketEntity.dblValue.ToString());
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

        }
Ejemplo n.º 16
0
        public bool GetTITOTicketInformation(IssueTicketEntity issueTicketEntity, ref Voucher VoucherEntity)
        {
            bool HasGotTITOTicketInformation = false;

            try
            {
                if (issueTicketEntity.BarCode.Length == 18)
                {

                    if (issueTicketDB.GetTicketInfo(issueTicketEntity, ref VoucherEntity) == true)
                        if (issueTicketDB.GetMachineDetailsFromAsset(ref VoucherEntity) == true)
                            HasGotTITOTicketInformation = true;

                    HasGotTITOTicketInformation = true;
                }
                else
                    HasGotTITOTicketInformation = false;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return HasGotTITOTicketInformation;
        }
Ejemplo n.º 17
0
 public void TicketIssueCreate(IssueTicketEntity issueTicketEntity, ref Voucher voucherEntity)
 {
     try
     {
         if (GetTITOTicketInformation(issueTicketEntity, ref voucherEntity) == true)
         {
             TicketNumber = issueTicketEntity.FullTicketNumber;
             Amount = Convert.ToInt32(issueTicketEntity.dblValue);
             voucherEntity.FullTicketNumber = issueTicketEntity.BarCode;
             voucherEntity.Value = issueTicketEntity.dblValue;
         }
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        public void PrintTickets()
        {
            try
            {
                App application = App.Current as App;
                Thread.CurrentThread.CurrentUICulture = application.CurrentUICulture;
                Thread.CurrentThread.CurrentCulture = application.CurrentCulture;

                this.Dispatcher.Invoke(new Action(() =>
                {
                    pbPrint.Value = _NoOfPrintedTickets;
                    this.lblErrorMsg.Content = string.Empty;
                    this.lblPrintedTicket.Content = _NoOfPrintedTickets;
                    this.lblTotalTicket.Content = _NoOfTickets;
                    pbPrint.Minimum = _NoOfPrintedTickets;
                    pbPrint.Maximum = _NoOfTickets;
                }), System.Windows.Threading.DispatcherPriority.Normal);


                long lValue = 0;
                if (strValue != null && strValue != string.Empty)
                    lValue = Convert.ToInt64(strValue.GetSingleFromString() * 100);
                else
                    lValue = 0;

                this.Dispatcher.Invoke(new Action(() =>
                {
                    pbPrint.Value = _NoOfPrintedTickets;
                }), System.Windows.Threading.DispatcherPriority.Normal);

                Promotional objPromotional = new Promotional();

                try
                {
                    while ((_NoOfPrintedTickets < _NoOfTickets) && !_mreShutdown.WaitOne(1))
                    {
                        if (_mreResume.WaitOne())
                        {
                            if (_mreShutdown.WaitOne(10))
                            {
                                LogManager.WriteLog("Print screen was closed. So exiting now.", LogManager.enumLogLevel.Info);
                                return;
                            }
                        }

                        this.Dispatcher.Invoke(new Action(() =>
                        {

                            lblPrintedTicket.Content = _NoOfPrintedTickets.ToString();
                            lblTotalTicket.Content = _NoOfTickets.ToString();
                        }), System.Windows.Threading.DispatcherPriority.Normal);


                        if (true)
                        {

                            string strBarcode;
                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                pbPrint.Value = _NoOfPrintedTickets;
                            }), System.Windows.Threading.DispatcherPriority.Normal);
                            
                            IssueTicketEntity issueTicketEntity = new IssueTicketEntity();
                            issueTicketEntity.Type = UIIssueTicketConstants.STANDARDTICKET;
                            if (PromoTicketType == 1)
                                issueTicketEntity.TicketHeader = "PLAYABLE VOUCHER";
                            else if (PromoTicketType == 0)
                                issueTicketEntity.TicketHeader = "CASHABLE PROMO VOUCHER";
                            else
                                issueTicketEntity.TicketHeader = "CASH DESK VOUCHER";

                            LogManager.WriteLog("Ticket Header : " + issueTicketEntity.TicketHeader, LogManager.enumLogLevel.Info);

                         //   issueTicketEntity.VoidDate = DateTime.Now.ToString();// (Convert.ToDateTime(this.ExpiryDate, new CultureInfo(ExtensionMethods.CurrentDateCulture))).ToString();
                            issueTicketEntity.VoidDate = (Convert.ToDateTime(this.ExpiryDate, new CultureInfo(ExtensionMethods.CurrentDateCulture))).ToString();
                            issueTicketEntity.dblValue = Convert.ToDouble(this.PromotionTicketAmount, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture)); ;
                            issueTicketEntity.lnglValue = long.Parse((this.PromotionTicketAmount * 100).ToString());
                            System.TimeSpan ts = (ExpiryDate).Subtract(DateTime.Now);
                            issueTicketEntity.NumberOfDays = ts.Days;
                            // issueTicketEntity.Date = DateTime.Now;

                            string PrintedDateTime = string.Empty;
                            //PrintedDateTime = (Convert.ToDateTime(System.DateTime.Now, new CultureInfo(ExtensionMethods.CurrentDateCulture))).ToString();

                            issueTicketEntity.Date = DateTime.Now;//Convert.ToDateTime(PrintedDateTime);
                            PrintTicketErrorCodes PrintResult = objCashDeskOperator.IssueTicket(issueTicketEntity);
                            strBarcode = issueTicketEntity.BarCode;
                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                this.lblErrorMsg.Visibility = Visibility.Visible;
                                this.pbPrint.Visibility = Visibility.Visible;
                                this.lblPrintedTicket.Visibility = Visibility.Visible;
                                this.lblTotalTicket.Visibility = Visibility.Visible;
                                this.btnCancel.Visibility = Visibility.Visible;
                                this.btnPause.Visibility = Visibility.Visible;


                                switch (PrintResult)
                                {
                                    case PrintTicketErrorCodes.OpenCOMPortFailure:
                                        {
                                            _FailureTickets++;
                                            //    MessageBox.ShowBox("MessageID295", BMC_Icon.Warning); //Unable to open COM Port. Please check connectivity.
                                            lblErrorMsg.Content = "Unable to open COM Port. Please check connectivity";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.OutofPaper:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MessageID294", BMC_Icon.Warning); //out of Paper
                                            lblErrorMsg.Content = "Out of Paper";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.Success:
                                        {

                                            lblErrorMsg.Content = string.Empty;
                                            _SucceededTickets++;
                                            pbPrint.Value = _NoOfPrintedTickets;


                                            if (!String.IsNullOrEmpty(DisplayTicketPrintedSuccessMsg))
                                            {
                                                if (DisplayTicketPrintedSuccessMsg.ToUpper().Trim() == "TRUE")
                                                {
                                                    lblErrorMsg.Content = " Voucher printed successfully";
                                                }
                                            }
                                            _NoOfPrintedTickets += 1;


                                            pbPrint.Value = _NoOfPrintedTickets;
                                            lblPrintedTicket.Content = _NoOfPrintedTickets.ToString();
                                            int UpdateVoucherPromotionID = objPromotional.BUpdateVoucherPromotion(this.PromotionID, strBarcode);//Update PromotionalID in Voucher Table

                                            break;
                                        }
                                    case PrintTicketErrorCodes.eVoltErr:
                                        {
                                            _FailureTickets++;
                                            // MessageBox.ShowBox("MsgPromErr1", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Voltage Error";

                                            return;
                                        }
                                    case PrintTicketErrorCodes.eHeadErr:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr2", BMC_Icon.Error);
                                            lblErrorMsg.Content = " Printer Head Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePaperOut:
                                        {
                                            _FailureTickets++;
                                            // MessageBox.ShowBox("MsgPromErr3", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Out of Paper";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePlatenUP:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr4", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Platen Up";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eSysErr:
                                        {
                                            _FailureTickets++;
                                            // MessageBox.ShowBox("MsgPromErr5", BMC_Icon.Error);
                                            lblErrorMsg.Content = "System Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eBusy:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr6", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Printer is Busy";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eJobMemOF:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr7", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Job Memory off";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eBufOF:
                                        {
                                            _FailureTickets++;
                                            // MessageBox.ShowBox("MsgPromErr8", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Buffer off";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eLibLoadErr:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr9", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Library Load Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePRDataErr:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr10", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Printer Data Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eLibRefErr:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr11", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Library Reference Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eTempErr:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr12", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Temp Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eMissingSupplyIndex:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr13", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Supply Index is Missing";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eFlashProgErr:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr14", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Flash Program Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePaperInChute:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr15", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Paper in Chute";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePrintLibCorr:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr16", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Print library is corrupted.";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eCmdErr:
                                        {
                                            _FailureTickets++;
                                            // MessageBox.ShowBox("MsgPromErr17", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Command Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePaperLow:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr18", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Paper low.";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.ePaperJam:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MsgPromErr19", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Paper jammed.";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eCurrentErr:
                                        {
                                            _FailureTickets++;
                                            // MessageBox.ShowBox("MsgPromErr20", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Current Error";
                                            return;
                                        }
                                    case PrintTicketErrorCodes.eJournalPrint:
                                        {
                                            _FailureTickets++;
                                            //  MessageBox.ShowBox("MsgPromErr21", BMC_Icon.Error);
                                            lblErrorMsg.Content = "Journal Print Error";
                                            return;
                                        }
                                    default:
                                        {
                                            _FailureTickets++;
                                            //   MessageBox.ShowBox("MessageID102", BMC_Icon.Warning);
                                            lblErrorMsg.Content = "Unable to Print Voucher";
                                            return;
                                        }
                                }



                            }), System.Windows.Threading.DispatcherPriority.Normal);


                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                this.lblPrintedTicket.Content = _NoOfPrintedTickets.ToString();
                                this.lblTotalTicket.Content = _NoOfTickets.ToString();
                                UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(pbPrint.SetValue);
                            }), System.Windows.Threading.DispatcherPriority.Normal);


                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                btnCancel.IsEnabled = true;

                            }), System.Windows.Threading.DispatcherPriority.Normal);
                            System.Threading.Thread.Sleep(1000);
                        }
                        PromoTickAmt = Convert.ToDouble(_PromotionTicketAmount);
                        PromCount = Convert.ToInt32(_NoOfTickets);

                        double TotalAmoount = PromCount * PromoTickAmt;
                        if (_NoOfPrintedTickets == _NoOfTickets)
                        {
                            int UpdateVoucherPrintSuccess = objPromotional.MarkPromotionalTicketsAsValid(this.PromotionID, 1);
                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                this.lblErrorMsg.Content = string.Empty;
                                pbPrint.Value = _NoOfPrintedTickets;
                                MessageBox.ShowBox("MessageID435", BMC_Icon.Information);

                            }), System.Windows.Threading.DispatcherPriority.Normal);

                            AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                            {
                                AuditModuleName = ModuleName.Promotion,
                                Audit_Screen_Name = "Promo Print",
                                Audit_Desc = "Promo Name: " + PromoName + "; TicketAmount: " + _PromotionTicketAmount.ToString() + "; Number of Tickets: " + PromCount.ToString() + "; Total Promotion Amount: " + TotalAmoount.ToString() + "; Expiry Date: " + ExpiryDate,
                                AuditOperationType = OperationType.ADD,
                                Audit_New_Vl = PromoName
                            });


                            this.Dispatcher.Invoke(new Action(() =>
                                                   {
                                                       IsPrintedCompleted = true;
                                                   }), System.Windows.Threading.DispatcherPriority.Normal);
                        }

                    }

                }
                catch (Exception ex)
                {
                    ExceptionManager.Publish(ex);
                    LogManager.WriteLog("Promotional Print Tickets : " + ex.Message, LogManager.enumLogLevel.Error);

                }
                finally
                {

                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        /// <summary>
        /// To Get the ticket information, to display on receipt.
        /// </summary>
        /// <param name=""></param>
        /// <returns type=boolean >GetTicketInfo</returns>
        public bool GetTicketInfo(IssueTicketEntity issueTicketEntity, ref Voucher voucher)
        {
            bool IsTicketInfoRetrieved = false;
            DataSet GetTicketInfo = new DataSet();

            try
            {
                SqlParameter[] sqlparams = GetSpParametersGetTicketInfo(issueTicketEntity);

                if (OpenConnection() == true)
                {
                    GetTicketInfo = SqlHelper.ExecuteDataset(CommonDataAccess.TicketingConnectionString, DBConstants.CONST_SP_BGSVOUCHERINFORMATION, sqlparams);
                    if (GetTicketInfo.Tables[0].Rows.Count > 0)
                    {
                        voucher.PrintDevice = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_PRINTDEVICE].ToString();
                        voucher.PayDevice = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_PAYDEVICE].ToString();
                        voucher.SBarCode = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_BARCODE].ToString();
                        voucher.Amount = int.Parse((GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_AMOUNT]).ToString());
                        voucher.VoucherStatus = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_VOUCHERSTATUS].ToString();
                        voucher.Datepaid = (GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_DATEPAID]).ToString().ReadDate();
                        voucher.DatePrinted = (GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_DATEPRINTED]).ToString().ReadDate();
                        voucher.DeviceType = GetTicketInfo.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_DEVICETYPE].ToString();
                        IsTicketInfoRetrieved = true;
                    }
                }

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

            return IsTicketInfoRetrieved;

        }
Ejemplo n.º 20
0
        private PrintTicketErrorCodes PrintTicket(IssueTicketEntity IssueTicketEntity)
        {
            //bool ShouldPrintTicket = false;

            ValuetoWords ValueToWord = new ValuetoWords();


            string ValueAsWords;

            XmlNode XMLNode;

            try
            {
                XMLDocument = new XmlDocument();
                XMLDocument.LoadXml("<Ticket><Doc></Doc></Ticket>");
                XMLNode = (XmlNode)XMLDocument.SelectSingleNode("Ticket/Doc");
                //ValueAsWords = ValueToWord.ConvertValueToWords(IssueTicketEntity.dblValue, Settings.Region); //IssueTicketDBAccess.Region().ToString());
                if (IssueTicketEntity.TicketHeader == null)
                    IssueTicketEntity.TicketHeader = "CASH DESK VOUCHER";
                XMLNode.AppendChild(AddNode("TicketHeader", IssueTicketEntity.TicketHeader));
                ValueAsWords = ValueToWord.ConvertValueToWords(IssueTicketEntity.dblValue, ExtensionMethods.CurrentSiteCulture);
                LogManager.WriteLog("ValueasWords:" + ValueAsWords, LogManager.enumLogLevel.Debug);

                XMLNode.AppendChild(AddNode("BarcodeID", IssueTicketEntity.BarCode));

                string sCon = Convert.ToInt64(IssueTicketEntity.BarCode).ToString("#-##-###-##-######-###-#");
                if (Settings.PrintTicket_EncryptDigits)
                {
                    string sEnc = sCon.Substring(0, 18) + "-***-" + sCon.Substring(23, 1);
                    LogManager.WriteLog("BarcodeID:" + sEnc, LogManager.enumLogLevel.Debug);
                    XMLNode.AppendChild(AddNode("FormattedID", sEnc));
                }
                else
                {
                    //XMLNode.AppendChild(AddNode("BarcodeID", IssueTicketEntity.BarCode));
                    LogManager.WriteLog("BarcodeID:" + sCon, LogManager.enumLogLevel.Debug);
                    XMLNode.AppendChild(AddNode("FormattedID", sCon));
                }

                XMLNode.AppendChild(AddNode("PrintLocation", Settings.PrintHeaderFormat)); //IssueTicketDBAccess.VoucherSite().ToString()));


                string sCurrency = Convert.ToDecimal(IssueTicketEntity.dblValue).GetUniversalCurrencyFormatWithSymbol();

                if (sCurrency.StartsWith("€") && Settings.VoucherPrinterName == "ITHACA950")
                {
                    sCurrency = sCurrency.Replace("€", Convert.ToChar(164).ToString());
                }
                else if (sCurrency.StartsWith("€") && Settings.VoucherPrinterName == "COUPONEXPRESS")
                {
                    sCurrency = sCurrency.Replace("€", "GBP");
                }
                //CR 85479 Fix
                else if (sCurrency.StartsWith("£") && (Settings.VoucherPrinterName == "COUPONEXPRESS" || Settings.VoucherPrinterName == "ITHACA850"))
                {
                    sCurrency = sCurrency.Replace("£", "GBP");
                }
                else if ((sCurrency.StartsWith("£") || sCurrency.StartsWith("€")) && Settings.VoucherPrinterName == "ITHACA850")
                {
                    sCurrency = Convert.ToDecimal(IssueTicketEntity.dblValue).GetUniversalCurrencyFormat();
                }
                else
                {
                    sCurrency = sCurrency.Replace("€", "EUR");
                }


                XMLNode.AppendChild(AddNode("FormattedAmount", sCurrency));

                LogManager.WriteLog("FormattedAmount:" + sCurrency, LogManager.enumLogLevel.Debug);
                // CommonUtilities.GetCurrency(IssueTicketEntity.dblValue).ToString()
                XMLNode.AppendChild(AddNode("WordAmount", ValueAsWords));
                //XMLNode.AppendChild(AddNode("Date", IssueTicketEntity.Date.GetUniversalDateFormat()));
                //LogManager.WriteLog("Date:" + IssueTicketEntity.Date.GetUniversalDateTimeFormat(), LogManager.enumLogLevel.Debug);
                Settings.TimeZoneID = Settings.TimeZoneID.Replace("_", " ");
                XMLNode.AppendChild(AddNode("Date", (Convert.ToDateTime(IssueTicketEntity.Date,new CultureInfo(ExtensionMethods.CurrentDateCulture))).ToString()));
                //  XMLNode.AppendChild(AddNode("Date", Settings.TimeZoneID.GetZoneDateinUTCFormat()));
                LogManager.WriteLog("Date:" + Settings.TimeZoneID.GetZoneDateinUTCFormat(), LogManager.enumLogLevel.Debug);
                //XMLNode.AppendChild(AddNode("Time", DateTime.Now.ToString("HH:mm:ss")));
                //LogManager.WriteLog("Time:" + DateTime.Now.ToString("HH:mm:ss"), LogManager.enumLogLevel.Debug);
                XMLNode.AppendChild(AddNode("VoucherID", Convert.ToString(IssueTicketEntity.TicketID)));
                LogManager.WriteLog("VoucherID:" + Convert.ToString(IssueTicketEntity.TicketID), LogManager.enumLogLevel.Debug);

                string sVoidString = string.Empty;
                //if (Settings.VoucherPrinterName.ToUpper() == "ITHACA950")
                //{
                //    sVoidString = Settings.Ticket_Expire + " " + Application.Current.FindResource("Days") as string;
                //}
                //else
                //{

                //}

                if (IssueTicketEntity.TicketHeader == "CASH DESK VOUCHER")
                {

                    sVoidString = Application.Current.FindResource("VoucherVoid") as string + " "
                                            + Settings.Ticket_Expire + " " + Application.Current.FindResource("Days") as string;
                }
                else if (IssueTicketEntity.TicketHeader == "PLAYABLE VOUCHER" || IssueTicketEntity.TicketHeader == "CASHABLE PROMO VOUCHER")
                {

                    sVoidString = Application.Current.FindResource("VoucherVoid") as string + " " + (Convert.ToDateTime(IssueTicketEntity.VoidDate,new CultureInfo(ExtensionMethods.CurrentDateCulture))).ToString();
                }
                LogManager.WriteLog("Ticket Header in Issue Ticket : " + IssueTicketEntity.TicketHeader, LogManager.enumLogLevel.Info);
                LogManager.WriteLog("Void String : " + sVoidString,LogManager.enumLogLevel.Info);

                XMLNode.AppendChild(AddNode("VoucherVoid", sVoidString));
                XMLDocument.ChildNodes[0].AppendChild(XMLNode);



                LogManager.WriteLog("XMLDoc:" + XMLDocument.OuterXml.ToString(), LogManager.enumLogLevel.Debug);


                switch (Settings.VoucherPrinterName.ToUpper())
                {
                    case "ITHACA850":
                        {
                            ITCKPrint iTicketInfo = new CIth850(Settings.PrinterPort);

                            TicketInfo structTicketInfo;
                            structTicketInfo.XMLLayout = "BallyIssueTicket";
                            structTicketInfo.XMLData = XMLDocument.OuterXml;

                            string ErrorMsg = "";
                            if (!iTicketInfo.Connect(ref ErrorMsg))
                            {
                                LogManager.WriteLog(ErrorMsg, LogManager.enumLogLevel.Info);
                                return PrintTicketErrorCodes.OpenCOMPortFailure;
                            }
                            if (iTicketInfo.Pinfo.Valid)
                            {
                                iTicketInfo.PrintTicket(structTicketInfo);
                                //ShouldPrintTicket = true;
                                LogManager.WriteLog("PrintTicket:" + "Completed with Success", LogManager.enumLogLevel.Info);
                                return PrintTicketErrorCodes.Success;
                            }
                            else
                            {
                                if (iTicketInfo.OutOfPaper)
                                {
                                    //ShouldPrintTicket = false;
                                    LogManager.WriteLog("PrintTicket : Printer Status - OutOfPaper", LogManager.enumLogLevel.Debug);
                                    LogManager.WriteLog("PrintTicket:" + "Completed with Failure", LogManager.enumLogLevel.Info);
                                    return PrintTicketErrorCodes.OutofPaper;

                                }
                            }
                            break;
                        }
                    case "ITHACA950":
                        {
                            LogManager.WriteLog("ITHACA950 Printer", LogManager.enumLogLevel.Debug);

                            //new Printer
                            //PrinterCommLib.PrinterCommIntClass oPrinterCommIntClass = new PrinterCommLib.PrinterCommIntClass();

                            PrinterCommLib.IPrinterCommInt oPrinterCommIntClass = new PrinterCommLib.PrinterCommInt();

                            LogManager.WriteLog("OpenSerialCom", LogManager.enumLogLevel.Debug);

                            LogManager.WriteLog("Printer Port = " + Settings.PrinterPort, LogManager.enumLogLevel.Info);

                            int iRetValue = oPrinterCommIntClass.OpenSerialCom(Settings.PrinterPort);//oPrinterCommIntClass.OpenSerialCom("COM1"); 
                            if (iRetValue != 0)
                            {
                                oPrinterCommIntClass.CloseSerialCom();
                                LogManager.WriteLog("PrintVoucher Failed. Unable to Open COM Port ", LogManager.enumLogLevel.Debug);
                                return PrintTicketErrorCodes.OpenCOMPortFailure;
                            }

                            int iPrintRetValue = oPrinterCommIntClass.PrintTicket(XMLDocument.OuterXml);

                            if (iPrintRetValue != 0)
                            {
                                oPrinterCommIntClass.CloseSerialCom();
                                LogManager.WriteLog("PrintVoucher Failed. Print Ticket Function Failed", LogManager.enumLogLevel.Debug);
                                return PrintTicketErrorCodes.PrintTicketFailure;
                            }

                            oPrinterCommIntClass.CloseSerialCom();

                            //ShouldPrintTicket = true;
                            LogManager.WriteLog("PrintVoucher:" + "Completed with Success", LogManager.enumLogLevel.Info);
                            return PrintTicketErrorCodes.Success;
                        }
                    case "COUPONEXPRESS":
                        {
                            LogManager.WriteLog("COUPONEXPRESS Printer", LogManager.enumLogLevel.Debug);
                            //Gen2PrinterIntClass oGen2PrinterIntClass = new Gen2PrinterIntClass();
                            Gen2PrinterLib.Gen2PrinterInt oGen2PrinterIntClass = new Gen2PrinterLib.Gen2PrinterInt();
                            LogManager.WriteLog("Printer Port = " + Settings.PrinterPort, LogManager.enumLogLevel.Info);

                            int PrinterDelayTime = Convert.ToInt32(BMC.Common.ConfigurationManagement.ConfigManager.Read("PrinterDelayTime"));
                            int LoopCount = Convert.ToInt32(BMC.Common.ConfigurationManagement.ConfigManager.Read("PrinterDelayloopCount"));

                            int iRetValue = oGen2PrinterIntClass.OpenSerialCom(Settings.PrinterPort);//oPrinterCommIntClass.OpenSerialCom("COM1"); 



                            if (iRetValue != 0)
                            {
                                oGen2PrinterIntClass.CloseSerialCom();
                                int i = 0;
                                bool bSuccess = false;
                                while (i++ < LoopCount) /*Variable Parameter*/
                                {
                                    if ((iRetValue = oGen2PrinterIntClass.OpenSerialCom(Settings.PrinterPort)) != 0)
                                    {
                                        System.Threading.Thread.Sleep(PrinterDelayTime);
                                        oGen2PrinterIntClass.CloseSerialCom();
                                        System.Threading.Thread.Sleep(10); /*grace sleep before opening the port*/
                                    }
                                    else
                                    {
                                        bSuccess = true;
                                        break;
                                    }
                                }
                                if (bSuccess == false)
                                {
                                    oGen2PrinterIntClass.CloseSerialCom();
                                    switch (iRetValue)
                                    {
                                        case 257:
                                            {
                                                LogManager.WriteLog("eVoltErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eVoltErr;
                                            }
                                        case 258:
                                            {
                                                LogManager.WriteLog("eHeadErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eHeadErr;
                                            }
                                        case 260:
                                            {
                                                LogManager.WriteLog("ePaperOut", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePaperOut;
                                            }
                                        case 264:
                                            {
                                                LogManager.WriteLog("ePlatenUP", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePlatenUP;
                                            }
                                        case 272:
                                            {
                                                LogManager.WriteLog("eSysErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eSysErr;
                                            }
                                        case 288:
                                            {
                                                LogManager.WriteLog("eBusy", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eBusy;
                                            }
                                        case 513:
                                            {
                                                LogManager.WriteLog("eJobMemOF", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eJobMemOF;
                                            }
                                        case 514:
                                            {
                                                LogManager.WriteLog("eBufOF", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eBufOF;
                                            }
                                        case 516:
                                            {
                                                LogManager.WriteLog("eLibLoadErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eLibLoadErr;
                                            }
                                        case 520:
                                            {
                                                LogManager.WriteLog("ePRDataErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePRDataErr;
                                            }
                                        case 528:
                                            {
                                                LogManager.WriteLog("eLibRefErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eLibRefErr;
                                            }
                                        case 544:
                                            {
                                                LogManager.WriteLog("eTempErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eTempErr;
                                            }
                                        case 1025:
                                            {
                                                LogManager.WriteLog("eMissingSupplyIndex", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eMissingSupplyIndex;
                                            }
                                        case 1026:
                                            {
                                                LogManager.WriteLog("ePrinterOffline", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePrinterOffline;
                                            }
                                        case 1028:
                                            {
                                                LogManager.WriteLog("eFlashProgErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eFlashProgErr;
                                            }
                                        case 1032:
                                            {
                                                LogManager.WriteLog("ePaperInChute", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePaperInChute;
                                            }
                                        case 1040:
                                            {
                                                LogManager.WriteLog("ePrintLibCorr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePrintLibCorr;
                                            }
                                        case 1056:
                                            {
                                                LogManager.WriteLog("eCmdErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eCmdErr;
                                            }
                                        case 2049:
                                            {
                                                LogManager.WriteLog("ePaperLow", LogManager.enumLogLevel.Debug);
                                                //return PrintTicketErrorCodes.ePaperLow;
                                                break;
                                            }
                                        case 2050:
                                            {
                                                LogManager.WriteLog("ePaperJam", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.ePaperJam;
                                            }
                                        case 2052:
                                            {
                                                LogManager.WriteLog("eCurrentErr", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eCurrentErr;
                                            }
                                        case 2056:
                                            {
                                                LogManager.WriteLog("eJournalPrint", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eJournalPrint;
                                            }
                                        case 2064:
                                            {
                                                LogManager.WriteLog("eNone1", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eNone1;
                                            }
                                        case 2080:
                                            {
                                                LogManager.WriteLog("eNone2", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.eNone2;
                                            }
                                        default:
                                            {
                                                LogManager.WriteLog("General Failure", LogManager.enumLogLevel.Debug);
                                                return PrintTicketErrorCodes.Failure;
                                            }
                                    }

                                }
                            }

                            int iPrintRetValue = oGen2PrinterIntClass.PrintTicket(XMLDocument.OuterXml);

                            if (iPrintRetValue != 0)
                            {
                                oGen2PrinterIntClass.CloseSerialCom();
                                LogManager.WriteLog("PrintVoucher Failed. Print Ticket Function Failed", LogManager.enumLogLevel.Debug);
                                return PrintTicketErrorCodes.PrintTicketFailure;
                            }



                            oGen2PrinterIntClass.CloseSerialCom();

                            //ShouldPrintTicket = true;
                            LogManager.WriteLog("PrintVoucher:" + "Completed with Success", LogManager.enumLogLevel.Info);
                            return PrintTicketErrorCodes.Success;

                        }
                    default:
                        {
                            return PrintTicketErrorCodes.InvalidPrinterName;
                        }

                }

            }
            catch (Exception ex)
            {
                //ShouldPrintTicket = false;
                LogManager.WriteLog("PrintVoucher:" + "Completed with Failure", LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return PrintTicketErrorCodes.Exception;
            }
            return PrintTicketErrorCodes.Success;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// To create new ticket for the amount entered
        /// </summary>
        /// <param name="_objCDOEntity"></param>
        /// <returns type=boolean>bTicketCreateReq</returns>
        public bool TicketCreateRequest(IssueTicketEntity issueTicketEntity)
        {

            bool IsTicketCreated = false;
            try
            {
                if (OpenConnection() == true)
                {

                    SqlParameter[] sqlparams = GetSpParametersCreateTicketStart(issueTicketEntity);
                                        
                    SqlHelper.ExecuteNonQuery(GetExchangeConnectionString(), System.Data.CommandType.StoredProcedure, DBConstants.CONST_SP_CREATETICKETSTART, sqlparams);

                    if (sqlparams[4].Value.ToString() != string.Empty)
                    {
                        issueTicketEntity.BarCode = Convert.ToString(sqlparams[4].Value);
                        IsTicketCreated = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return IsTicketCreated;

        }
 public void TicketIssueCreateForCage(IssueTicketEntity issueTicketEntity, ref CageVoucher voucherEntity)
 {
     try
     {
         if (GetTITOTicketInformationForCage(issueTicketEntity, ref voucherEntity) == true)
         {
             TicketNumber = issueTicketEntity.FullTicketNumber;
             Amount = int.Parse(issueTicketEntity.dblValue.ToString());
             voucherEntity.FullTicketNumber = issueTicketEntity.BarCode;
             voucherEntity.Value = issueTicketEntity.dblValue;
         }
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }