public bool CheckCRC(string sBarcode, long lValue, string SiteCode, string Datapak)
        {
            try
            {
                if (sBarcode.Length == 8)
                {
                    Datapak  = string.Concat(Datapak, "0000");
                    sBarcode = "1" + SiteCode.Substring(SiteCode.Length - 3, 3) + Datapak.Substring(0, 5) + "0" + sBarcode.Substring(0, 4) + sBarcode.Substring(sBarcode.Length - 4, 4);
                }

                SDGTicketGenLib.SDGTicketGenClass oticketGen = new SDGTicketGenLib.SDGTicketGenClass();
                string sCRCTicket = oticketGen.stdBarcode(sBarcode.Substring(0, 14), (int)lValue);
                LogManager.WriteLog("CheckCRC Voucher:" + sCRCTicket, LogManager.enumLogLevel.Error);
                if (sCRCTicket == sBarcode)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("CheckCRC Message:" + ex.Message, LogManager.enumLogLevel.Error);
                return(false);
            }
        }
        /// <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;

        }
Example #3
0
        public PrintTicketErrorCodes TicketCreateRequestCage(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);
                        //SDGTicketGen.cSDGTicketGenClass ticketGen = new SDGTicketGen.cSDGTicketGenClass();
                        //retBarCode = ticketGen.StdBarcode(ref retBarCode, ref Amount);
                        SDGTicketGenLib.SDGTicketGenClass ticketGen = new SDGTicketGenLib.SDGTicketGenClass();
                        retBarCode = ticketGen.stdBarcode(retBarCode, Amount);

                        if (LogTitoTicketPrintCage(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);
        }
        public bool CheckCRC(string sBarcode, long lValue, string SiteCode, string Datapak)
        {
            try
            {
                if (sBarcode.Length == 8)
                {
                    Datapak = string.Concat(Datapak, "0000");
                    sBarcode = "1" + SiteCode.Substring(SiteCode.Length - 3, 3) + Datapak.Substring(0, 5) + "0" + sBarcode.Substring(0, 4) + sBarcode.Substring(sBarcode.Length - 4, 4);
                }

                SDGTicketGenLib.SDGTicketGenClass oticketGen = new SDGTicketGenLib.SDGTicketGenClass();
                string sCRCTicket = oticketGen.stdBarcode(sBarcode.Substring(0, 14), (int)lValue);
                LogManager.WriteLog("CheckCRC Voucher:" + sCRCTicket, LogManager.enumLogLevel.Error);
                if (sCRCTicket == sBarcode)
                    return true;
                else
                    return false;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("CheckCRC Message:" + ex.Message, LogManager.enumLogLevel.Error);
                return false;
            }
        }