public void PrintCommonReceipt(Voucher voucher)
        {
            CommonUtilities CommonUtilitiesObject = new CommonUtilities();

            try
            {
                CommonUtilitiesObject.GetCommonValues(voucher);
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
            }
        }
        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 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;
        }
        public void GetCommonValues(Voucher voucherData)
        {
            voucher = voucherData;

            Header = voucher.Header;

            if (Settings.EnableIssueReceipt)
            {
                PrintType = "Voucher Issue";
                BMC.Common.LogManagement.LogManager.WriteLog("Inside CommonUtilites Settings.EnableIssueReceipt=: " +
                    Settings.EnableIssueReceipt.ToString() + "object ticketdetail=:" + voucher.ToString()
                    , BMC.Common.LogManagement.LogManager.enumLogLevel.Debug);

                PrintFunction();
            }
        }
        /// <summary>
        /// To Get the ticket information, to display on receipt.
        /// </summary>
        /// <param name=""></param>
        /// <returns type=boolean >GetTicketInfo</returns>
        public bool GetMachineDetailsFromAsset(ref Voucher voucher)
        {
            bool IsMachineDetailsRetrieved = false;
            DataSet dsGetMachineDetailsFromAsset = new DataSet();
            try
            {
                SqlParameter[] sqlparams = new SqlParameter[1];
                sqlparams[0] = new SqlParameter(DBConstants.CONST_SP_PARAM_MACHINENAME, voucher.PrintDevice);

                dsGetMachineDetailsFromAsset = SqlHelper.ExecuteDataset(CommonDataAccess.ExchangeConnectionString, DBConstants.CONST_SP_GETMACHINEDETAILSFROMASSET, sqlparams);

                if (dsGetMachineDetailsFromAsset.Tables[0].Rows.Count > 0)
                {
                    voucher.BarPositionName = dsGetMachineDetailsFromAsset.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_BARPOSITIONNAME].ToString();
                    voucher.InstallationNo = int.Parse((dsGetMachineDetailsFromAsset.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_INSTALLATIONNUMBER]).ToString());
                    voucher.StockNo = dsGetMachineDetailsFromAsset.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_STOCKNUMBER].ToString();
                    voucher.PrintDeviceName = dsGetMachineDetailsFromAsset.Tables[0].Rows[0][DBConstants.CONST_SP_RESULT_MACHINENAME].ToString();
                    voucher.PrintDeviceSerial = voucher.PrintDevice;
                    IsMachineDetailsRetrieved = true;
                }
                else
                {
                    voucher.PrintDeviceName = string.Empty;
                    IsMachineDetailsRetrieved = false;
                }

            }
            catch (Exception ex)
            {
                IsMachineDetailsRetrieved = false;
                ExceptionManager.Publish(ex);
            }
            return IsMachineDetailsRetrieved;

        }
        /// <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;

        }
        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;
        }
 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);
     }
 }