private void cboTicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboName.SelectedIndex > -1) { stock = stocks[cboName.SelectedIndex]; } }
// GET: Crypto/Create public ActionResult Create() { if (Session["user"] != null) { CCrypto crypto = new CCrypto(); return(View(crypto)); } return(RedirectToAction("Login", "Login")); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { CCrypto stock = new CCrypto(); stock.Ticker = txtStock.Text; stock.Insert(); Refresh(); //Close(); }
// GET: Crypto/Edit/5 public ActionResult Edit(Guid id) { if (Session["user"] != null) { CCrypto c = new CCrypto(); c.LoadById(id); return(View()); } return(RedirectToAction("Login", "Login")); }
private void cboStock_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboStock.SelectedIndex > -1) { CCrypto stock = new CCrypto(); CCryptoList stocks = new CCryptoList(); stock = stocks[cboStock.SelectedIndex]; txtStock.Text = stock.Ticker; } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { CCrypto stock = new CCrypto(); stock.Delete(); Refresh(); MainWindow m = new MainWindow(); m.Refresh(); //Close(); }
public ActionResult Edit(Guid id, CCrypto collection) { try { // TODO: Add update logic here collection.Delete(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(CCrypto collection) { try { // TODO: Add insert logic here collection.Insert(); return(RedirectToAction("Index")); } catch { return(View()); } }
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); EncryptionHelper encrypter = new EncryptionHelper(); clearText = encrypter.DecryptTripleDES(CCrypto.IVR_ENCRYPTION_KEY, encryptedText); string encryptValue = ""; CCrypto _crypto = new CCrypto(); int i = _crypto.Encrypt(clearText, out encryptValue); //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; } }
static void Main(String[] args) { var a = new CCrypto(); var b = new CCrypto(); byte[] data = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; for (int i = 0; i < 10; ++i) { a.Encode(data, 0, data.Length, 0x1f3a49b72c8d5ef6); foreach (byte d in data) { Console.Write(String.Format("{0,4}", d)); } Console.WriteLine(); b.Decode(data, 0, data.Length, 0x1f3a49b72c8d5ef6); foreach (byte d in data) { Console.Write(String.Format("{0,4}", d)); } Console.WriteLine(); } }
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; } }