Example #1
0
        /// <summary>
        /// Print a new ticket
        /// </summary>
        /// <param name="eTicket">pass TicketInfo struct</param>
        /// <returns></returns>
        public bool PrintTicket(TicketInfo eTicket)
        {
            bool retVal = false;

            try
            {
                if (eTicket.XMLLayout.ToUpper() == "BALLYISSUETICKET")
                {
                    CXMLParse parse = new CXMLParse();
                    parse.LoadXml(eTicket.XMLData);
                    LogManager.WriteLog("Start Printing...", LogManager.enumLogLevel.Debug);

                    switch (_CurrentVersion)
                    {
                    case "PP8522":
                        retVal = BallyTicketPP8522(parse);
                        break;

                    case "PP8576":     //New Version
                        retVal = BallyTicketPP8576(parse);
                        break;

                    default:
                        retVal = BallyTicketPP8576(parse);
                        break;
                    }

                    LogManager.WriteLog("End Printing", LogManager.enumLogLevel.Debug);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return(retVal);
        }
Example #2
0
        private bool BallyTicketPP8576(CXMLParse parse)
        {
            bool retVal = false;

            try
            {
                ExecMacro(1, null, false);     // set start

                /* Voucher Name *(i.e. Cash Desk Voucher)*/
                string _sData = parse.GTagData("TicketHeader").Trim();
                _sData += _sData.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _VoucherName = Encoding.ASCII.GetBytes(_sData);

                VoucherName();
                SendSerialdata(_VoucherName);

                /* Site Name */
                string _sLocation = parse.GTagData("PrintLocation").Trim();
                _sLocation += _sLocation.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bLocation = Encoding.ASCII.GetBytes(_sLocation);
                LocationField();
                SendSerialdata(_bLocation);


                /*Datetime field*/
                string _sDatetimeValid = (parse.GTagData("Date") + " " + parse.GTagData("Time") + "  VOUCHER: " + parse.GTagData("VoucherID")).Trim();
                _sDatetimeValid += _sDatetimeValid.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bDatetimeValid = Encoding.ASCII.GetBytes(_sDatetimeValid);
                DateTimeCmd();
                SendSerialdata(_bDatetimeValid);

                /* Validation */
                string _sValidateData = ("VALIDATION:" + parse.GTagData("FormattedID")).Trim();
                _sValidateData += _sValidateData.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bValidateData = Encoding.ASCII.GetBytes(_sValidateData);
                ValidateField();
                SendSerialdata(_bValidateData);

                /* Display FormattedID In Vertical Mode */
                string _sFormattedIDV = parse.GTagData("FormattedID").Trim();
                _sFormattedIDV += _sFormattedIDV.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bFormattedIDV = Encoding.ASCII.GetBytes(_sFormattedIDV);
                FormattedIDVertical();
                SendSerialdata(_bFormattedIDV);

                /*BarCode field*/
                string _sBarCode = parse.GTagData("BarcodeID").Trim();
                _sBarCode += _sBarCode.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bBarCode = Encoding.ASCII.GetBytes(_sBarCode);
                BarCodeCmd();
                SendSerialdata(_bBarCode);

                /*Word Amount(i.e. Twelve Dollars and Fifty Five Cents )*/
                string _sWordAmount = parse.GTagData("WordAmount").Trim();
                _sWordAmount += _sWordAmount.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bWordAmount = Encoding.ASCII.GetBytes(_sWordAmount);
                WordAmount();
                SendSerialdata(_bWordAmount);

                /*FormattedAmount (i.e. $2.55 )*/
                string _sBoldAmount = parse.GTagData("FormattedAmount").Trim();
                _sBoldAmount += _sBoldAmount.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bBoldAmount = Encoding.ASCII.GetBytes(_sBoldAmount);
                BoldAmount();
                SendSerialdata(_bBoldAmount);

                /*VoucherVoid (i.e. Voucher void after 10 days )*/
                string _sVoucherAfter = parse.GTagData("VoucherVoid").Trim();
                _sVoucherAfter += _sVoucherAfter.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bVoucherAfter = Encoding.ASCII.GetBytes(_sVoucherAfter);
                VoucherAfter();
                SendSerialdata(_bVoucherAfter);


                byte[] _bdata = { 12 };
                SendSerialdata(_bdata); /*initiate a Print*/


                retVal = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("ITHACA850 --> Error Occured:" + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
            }
            finally
            {
                if (oPrt.IsOpen)
                {
                    oPrt.ClosePort();
                }
            }
            return(retVal);
        }
Example #3
0
        private bool BallyTicketPP8522(CXMLParse parse)
        {
            bool retVal = false;

            try
            {
                int    nWidth  = 62;
                string stext   = "";
                int    nOffset = 0;

                ExecMacro(1, null, false);     // set start
                stext = parse.GTagData("TicketHeader").ToString();

                // stext = "CASH DESK VOUCHER";
                nOffset = ((nWidth - stext.Length) / 2);

                ExecMacro(320, stext.PadLeft((stext.Length + 5), ' '), false);

                SendCmd(GS + "!" + Convert.ToChar(0));                     // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));                    // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                stext   = parse.GTagData("PrintLocation");
                nOffset = (nWidth - stext.Length) / 2;
                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, false));
                SendCmd(DynamicText("", false));

                //  clear settings
                SendCmd(GS + "!" + Convert.ToChar(0));                     // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));                    // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                stext   = parse.GTagData("Date") + " " + parse.GTagData("Time") + "  VOUCHER: " + parse.GTagData("VoucherID");
                nOffset = ((nWidth - stext.Length) / 2);

                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, false));

                ExecMacro(318, parse.GTagData("BarcodeID"), false);

                SendCmd(GS + "!" + Convert.ToChar(0));                     // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));                    // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                SendCmd(DynamicText("".PadLeft(13, ' ') + "VALIDATION: " + parse.GTagData("FormattedID"), false));
                // SendCmd(DynamicText("", false));
                stext = parse.GTagData("WordAmount"); //"Three Hundred Ten Pounds Twenty One Pence"

                nOffset = (nWidth - stext.Length) / 2;
                nOffset = (nOffset < 0) ? 0 : nOffset;
                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, false));
                SendCmd(DynamicText("", false));
                ExecMacro(320, "".PadLeft(5, ' ') + "Amount .... " + parse.GTagData("FormattedAmount"), false);
                // SendCmd(DynamicText("", false));
                SendCmd(GS + "!" + Convert.ToChar(0));                     // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));                    // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                stext   = parse.GTagData("VoucherVoid");
                nOffset = (nWidth - stext.Length) / 2;
                nOffset = (nOffset < 0) ? 0 : nOffset;
                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, true));

                retVal = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("ITHACA850 --> Error Occured:" + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
            }
            finally
            {
                if (oPrt.IsOpen)
                {
                    oPrt.ClosePort();
                }
            }
            return(retVal);
        }
Example #4
0
        private bool BallyTicketPP8576(CXMLParse parse)
        {
            bool retVal = false;
            try
            {


                ExecMacro(1, null, false);     // set start

                /* Voucher Name *(i.e. Cash Desk Voucher)*/
                string _sData = parse.GTagData("TicketHeader").Trim();
                _sData += _sData.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _VoucherName = Encoding.ASCII.GetBytes(_sData);

                VoucherName();
                SendSerialdata(_VoucherName);

                /* Site Name */
                string _sLocation = parse.GTagData("PrintLocation").Trim();
                _sLocation += _sLocation.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bLocation = Encoding.ASCII.GetBytes(_sLocation);
                LocationField();
                SendSerialdata(_bLocation);


                /*Datetime field*/
                string _sDatetimeValid = (parse.GTagData("Date") + " " + parse.GTagData("Time") + "  VOUCHER: " + parse.GTagData("VoucherID")).Trim();
                _sDatetimeValid += _sDatetimeValid.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bDatetimeValid = Encoding.ASCII.GetBytes(_sDatetimeValid);
                DateTimeCmd();
                SendSerialdata(_bDatetimeValid);

                /* Validation */
                string _sValidateData = ("VALIDATION:" + parse.GTagData("FormattedID")).Trim();
                _sValidateData += _sValidateData.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bValidateData = Encoding.ASCII.GetBytes(_sValidateData);
                ValidateField();
                SendSerialdata(_bValidateData);

                /* Display FormattedID In Vertical Mode */
                string _sFormattedIDV = parse.GTagData("FormattedID").Trim();
                _sFormattedIDV += _sFormattedIDV.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bFormattedIDV = Encoding.ASCII.GetBytes(_sFormattedIDV);
                FormattedIDVertical();
                SendSerialdata(_bFormattedIDV);

                /*BarCode field*/
                string _sBarCode = parse.GTagData("BarcodeID").Trim();
                _sBarCode += _sBarCode.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bBarCode = Encoding.ASCII.GetBytes(_sBarCode);
                BarCodeCmd();
                SendSerialdata(_bBarCode);

                /*Word Amount(i.e. Twelve Dollars and Fifty Five Cents )*/
                string _sWordAmount = parse.GTagData("WordAmount").Trim();
                _sWordAmount += _sWordAmount.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bWordAmount = Encoding.ASCII.GetBytes(_sWordAmount);
                WordAmount();
                SendSerialdata(_bWordAmount);

                /*FormattedAmount (i.e. $2.55 )*/
                string _sBoldAmount = parse.GTagData("FormattedAmount").Trim();
                _sBoldAmount += _sBoldAmount.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString();
                byte[] _bBoldAmount = Encoding.ASCII.GetBytes(_sBoldAmount);
                BoldAmount();
                SendSerialdata(_bBoldAmount);

                /*VoucherVoid (i.e. Voucher void after 10 days )*/
                string _sVoucherAfter = parse.GTagData("VoucherVoid").Trim();
                _sVoucherAfter += _sVoucherAfter.Contains(_CarriageReturn) ? string.Empty : _CarriageReturn.ToString(); 
                byte[] _bVoucherAfter = Encoding.ASCII.GetBytes(_sVoucherAfter);
                VoucherAfter();
                SendSerialdata(_bVoucherAfter);


                byte[] _bdata = { 12 };
                SendSerialdata(_bdata); /*initiate a Print*/


                retVal = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("ITHACA850 --> Error Occured:" + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);

            }
            finally
            {
                if (oPrt.IsOpen)
                {
                    oPrt.ClosePort();
                }

            }
            return retVal;
        }
Example #5
0
        private bool BallyTicketPP8522(CXMLParse parse)
        {
            bool retVal = false;
            try
            {
                int nWidth = 62;
                string stext = "";
                int nOffset = 0;

                ExecMacro(1, null, false);     // set start
                stext = parse.GTagData("TicketHeader").ToString();

                // stext = "CASH DESK VOUCHER";
                nOffset = ((nWidth - stext.Length) / 2);

                ExecMacro(320, stext.PadLeft((stext.Length + 5), ' '), false);

                SendCmd(GS + "!" + Convert.ToChar(0));          // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));       // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                stext = parse.GTagData("PrintLocation");
                nOffset = (nWidth - stext.Length) / 2;
                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, false));
                SendCmd(DynamicText("", false));

                //  clear settings
                SendCmd(GS + "!" + Convert.ToChar(0));          // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));       // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                stext = parse.GTagData("Date") + " " + parse.GTagData("Time") + "  VOUCHER: " + parse.GTagData("VoucherID");
                nOffset = ((nWidth - stext.Length) / 2);

                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, false));

                ExecMacro(318, parse.GTagData("BarcodeID"), false);

                SendCmd(GS + "!" + Convert.ToChar(0));          // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));       // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                SendCmd(DynamicText("".PadLeft(13, ' ') + "VALIDATION: " + parse.GTagData("FormattedID"), false));
                // SendCmd(DynamicText("", false));
                stext = parse.GTagData("WordAmount"); //"Three Hundred Ten Pounds Twenty One Pence"

                nOffset = (nWidth - stext.Length) / 2;
                nOffset = (nOffset < 0) ? 0 : nOffset;
                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, false));
                SendCmd(DynamicText("", false));
                ExecMacro(320, "".PadLeft(5, ' ') + "Amount .... " + parse.GTagData("FormattedAmount"), false);
                // SendCmd(DynamicText("", false));
                SendCmd(GS + "!" + Convert.ToChar(0));          // Select character size = 1W/1H"
                SendCmd(ESC + "G" + Convert.ToChar(1));       // Set emphasized print"
                SendCmd(GS + "$" + Convert.ToChar(0) + Convert.ToChar(0)); // Set absolute vertical position = 0"

                stext = parse.GTagData("VoucherVoid");
                nOffset = (nWidth - stext.Length) / 2;
                nOffset = (nOffset < 0) ? 0 : nOffset;
                SendCmd(DynamicText("".PadLeft(nOffset, ' ') + stext, true));

                retVal = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("ITHACA850 --> Error Occured:" + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);

            }
            finally
            {
                if (oPrt.IsOpen)
                {
                    oPrt.ClosePort();
                }

            }
            return retVal;
        }
Example #6
0
        /// <summary>
        /// Print a new ticket
        /// </summary>
        /// <param name="eTicket">pass TicketInfo struct</param>
        /// <returns></returns>
        public bool PrintTicket(TicketInfo eTicket)
        {
            bool retVal = false;
            try
            {

                if (eTicket.XMLLayout.ToUpper() == "BALLYISSUETICKET")
                {
                    CXMLParse parse = new CXMLParse();
                    parse.LoadXml(eTicket.XMLData);
                    LogManager.WriteLog("Start Printing...", LogManager.enumLogLevel.Debug);

                    switch (_CurrentVersion)
                    {
                        case "PP8522":
                            retVal = BallyTicketPP8522(parse);
                            break;
                        case "PP8576": //New Version
                            retVal = BallyTicketPP8576(parse);
                            break;
                        default:
                            retVal = BallyTicketPP8576(parse);
                            break;

                    }

                    LogManager.WriteLog("End Printing", LogManager.enumLogLevel.Debug);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);

            }
            return retVal;
        }