예제 #1
0
        private string translatePIN(string encryptedText)
        {
            string MethodName = MethodBase.GetCurrentMethod().Name;

            Logger.logDebug(ModuleName, MethodName, "**********Entered Method**********", Logger.LOGLEVEL.ERROR);


            try
            {
                string clearText = "";

                Logger.logDebug(ModuleName, MethodName, "Decreypting Existing PIN", Logger.LOGLEVEL.INFO);

                CCrypto _crypto = new CCrypto();
                int     i       = _crypto.Decrypt(encryptedText, out clearText);

                EncryptionHelper encrypter    = new EncryptionHelper();
                string           encryptValue = encrypter.EncryptTripleDES(CCrypto.IVR_ENCRYPTION_KEY, clearText);
                //Logger.logDebug(ModuleName, MethodName, "Clear PIN: [" + clearText + "]", Logger.LOGLEVEL.INFO);
                Logger.logDebug(ModuleName, MethodName, "Source PIN: [" + encryptedText + "] Dest PIN: [" + encryptValue + "]", Logger.LOGLEVEL.INFO);

                if (encryptValue == "")
                {
                    throw new Exception("Unable to Translate");
                }
                return(encryptValue);
            }
            catch (Exception ex)
            {
                Logger.logDebug(ModuleName, MethodName, "Exception: " + ex.Message, Logger.LOGLEVEL.ERROR);
                if (ex.InnerException != null)
                {
                    Logger.logDebug(ModuleName, MethodName, "Inner Exception: " + ex.InnerException, Logger.LOGLEVEL.ERROR);
                }

                throw ex;
            }
        }
예제 #2
0
        private bool getPINLengthCount()
        {
            string          MethodName    = MethodBase.GetCurrentMethod().Name;
            OleDbDataReader _dataReader   = null;
            bool            customerFound = false;
            string          ModuleName    = "TPINMigrationUtility";

            try
            {
                Logger.logDebug(ModuleName, MethodName, "**********Entered Method**********", Logger.LOGLEVEL.INFO);

                OledbSqlHelper _dbHelper = new OledbSqlHelper(VisionConnString, bVisionConnEncrypted);

                Logger.logDebug(ModuleName, MethodName, "Fetching Records", Logger.LOGLEVEL.INFO);
                gstatus        = "Fetching Records";
                lblStatus.Text = gstatus;

                string sqlQuery = ConfigurationManager.AppSettings["RETREIVE_RECORDS_LIST"];
                Logger.logDebug(ModuleName, MethodName, "Executing Query : " + sqlQuery, Logger.LOGLEVEL.INFO);

                _dataReader = _dbHelper.ExecuteReader(sqlQuery);

                Logger.logDebug(ModuleName, MethodName, "Query executed. Retrieving Values", Logger.LOGLEVEL.INFO);

                gstatus        = "Parsing Records";
                lblStatus.Text = gstatus;

                CCrypto _crypto = new CCrypto();

                if (_dataReader != null)
                {
                    if (_dataReader.HasRows)
                    {
                        while (_dataReader.Read())
                        {
                            customerFound = true;
                            //string Status = _dataReader["STATUS"].ToString();
                            int    RetryAvailable = Convert.ToInt16(_dataReader["RETRY_AVAILABLE"]);
                            int    MaxRetryCount  = Convert.ToInt16(_dataReader["MAX_RETRY_COUNT"]);
                            string TPIN           = _dataReader["PIN_CODE"].ToString();
                            string customerID     = _dataReader["CUSTOMER_ID"].ToString();

                            Logger.logDebug(ModuleName, MethodName, "CIF : " + customerID, Logger.LOGLEVEL.WARNING);
                            //Logger.logDebug(ModuleName, MethodName, "STATUS          : " + Status, Logger.LOGLEVEL.WARNING);
                            Logger.logDebug(ModuleName, MethodName, "RETRY AVAILABLE : " + RetryAvailable, Logger.LOGLEVEL.WARNING);
                            Logger.logDebug(ModuleName, MethodName, "MAX RETRY       : " + MaxRetryCount, Logger.LOGLEVEL.WARNING);
                            Logger.logDebug(ModuleName, MethodName, "RETRY AVAILABLE : " + RetryAvailable, Logger.LOGLEVEL.WARNING);
                            //Logger.logDebug(ModuleName, MethodName, "ENCRYPTED PIN   : " + EncryptedTPIN, Logger.LOGLEVEL.DEBUG);



                            //translate the PIN
                            try
                            {
                                string clearPIN = "";
                                if (TPIN != null && TPIN != "")
                                {
                                    int i = _crypto.Decrypt(TPIN, out clearPIN);

                                    if (clearPIN != "")
                                    {
                                        if (clearPIN.Length == 4)
                                        {
                                            fourDigitCount += 1;
                                        }
                                        else if (clearPIN.Length == 5)
                                        {
                                            fiveDigitCount += 1;
                                        }
                                        else if (clearPIN.Length == 6)
                                        {
                                            SixDigitCount += 1;
                                        }
                                        else
                                        {
                                            otherDigitCount += 1;
                                        }
                                    }
                                    else
                                    {
                                        writeFailedCustomerstoFile(customerID);
                                        throw new Exception("Translated PIN is empty");
                                    }
                                }
                                else
                                {
                                    writeFailedCustomerstoFile(customerID);
                                    throw new Exception("TPIN is empty or NULL");
                                }
                            }
                            catch (Exception ex)
                            {
                                iFailed       += 1;
                                lblFailed.Text = iFailed.ToString();
                                Logger.logDebug(ModuleName, MethodName, "Exception      : " + ex.Message, Logger.LOGLEVEL.INFO);
                                //log query in a separate file

                                //
                            }
                            iProcessed       += 1;
                            lblProcessed.Text = iProcessed.ToString();
                        }
                    }
                    else
                    {
                        Logger.logDebug(ModuleName, MethodName, "No record found", Logger.LOGLEVEL.INFO);
                        customerFound = false;
                    }

                    _dataReader.Close();
                    //btnMigrate.Enabled = true;
                    gstatus        = "Finished";
                    lblStatus.Text = gstatus;
                }
                else
                {
                    Logger.logDebug(ModuleName, MethodName, "No Records Founds", Logger.LOGLEVEL.INFO);
                    customerFound      = false;
                    btnMigrate.Enabled = true;
                    gstatus            = "Finished";
                    lblStatus.Text     = gstatus;
                }
                Logger.logDebug(ModuleName, MethodName, "**********Exiting Method**********", Logger.LOGLEVEL.INFO);
                return(customerFound);
            }
            catch (Exception ex)
            {
                if (_dataReader != null)
                {
                    _dataReader.Close();
                }

                Logger.logDebug(ModuleName, MethodName, "Exception      : " + ex.Message, Logger.LOGLEVEL.INFO);
                if (ex.InnerException != null)
                {
                    Logger.logDebug(ModuleName, MethodName, "Inner Exception: " + ex.InnerException.Message, Logger.LOGLEVEL.INFO);
                }
                Logger.logDebug(ModuleName, MethodName, "**********Exiting Method**********", Logger.LOGLEVEL.INFO);

                MessageBox.Show(ex.Message);
                throw ex;
            }
            finally
            {
                btnMigrate.Enabled = true;
            }
        }