private void CheckError() { string sql = " Select * From UserMaster where USERID='" + txtUserID.Text + "' and Password='******' "; OleDbCommand com = new OleDbCommand(sql, conn); OleDbDataReader dr = com.ExecuteReader(); int checkCount = 0; while (dr.Read()) { MyGlobal.GlobalUserID = dr[0].ToString(); MyGlobal.GlobalUserName = dr[1].ToString(); MyGlobal.GlobalSection = dr[3].ToString(); MyGlobal.GlobalUserAuthority = dr[4].ToString(); MyGlobal.GlobalPosition = dr[5].ToString(); checkCount = +1; } dr.Close(); if (checkCount == 0) { MessageBox.Show("Invalid User and Password"); } else { this.Hide(); ProgramMenu SApplication = new ProgramMenu(); SApplication.ShowDialog(); Application.Exit(); } }
private static Tuple <string[], string[]> GetDecipherProgramValuesToUse(ProgramMenu menu, DecipherInputAction menuStartingChoice, Tuple <string[], string[]> lastCipherText) { Tuple <string[], string[]> valuesToUse = null; switch (menuStartingChoice) { case DecipherInputAction.LastGeneratedCipherText: { if (lastCipherText != null) { valuesToUse = lastCipherText; } else { menu.NoLastCipherTextWarning(); } break; } case DecipherInputAction.UserInput: { valuesToUse = menu.InputValues(); break; } default: { throw new Exception(SurpriseExceptionMessage); } } return(valuesToUse); }
private static Tuple <string[], string[]> GetCipherProgramValuesToUse(ProgramMenu menu, CipherInputAction menuStartingChoice) { Tuple <string[], string[]> valuesToUse; switch (menuStartingChoice) { case CipherInputAction.Predefined: { valuesToUse = menu.DisplayAndChoosePredefinedValue(); break; } case CipherInputAction.UserInput: { valuesToUse = menu.InputValues(); break; } default: { throw new Exception(SurpriseExceptionMessage); } } return(valuesToUse); }
static void Main(string[] args) { ProgramMenu menu = new ProgramMenu(); Tuple <string[], string[]> lastCipherText = null; while (true) { ProgramAction direction = menu.ChooseCipherAction(); AesCipher cipherProgram = new AesCipher(); Tuple <string[], string[]> valuesToUse = null; while (valuesToUse == null) { switch (direction) { case ProgramAction.Cipher: { CipherInputAction menuStartingChoice = menu.ChooseCipherInputType(); valuesToUse = GetCipherProgramValuesToUse(menu, menuStartingChoice); IEnumerable <RoundWords> roundKeys = GetRoundKeys(valuesToUse); menu.PromptForContinue(); byte[] inputBytes = valuesToUse.Item2.Select(x => CreateByteFromHexadecimal(x)).ToArray(); ByteArray result = cipherProgram.Cipher(inputBytes, roundKeys); lastCipherText = new Tuple <string[], string[]>(valuesToUse.Item1, result.Bytes1dArray.Select(x => CreateHexadecimalFromByte(x)).ToArray()); break; } case ProgramAction.Decipher: { DecipherInputAction menuStartingChoice = menu.ChooseDecipherInputType(); valuesToUse = GetDecipherProgramValuesToUse(menu, menuStartingChoice, lastCipherText); IEnumerable <RoundWords> roundKeys = GetRoundKeys(valuesToUse); menu.PromptForContinue(); byte[] inputBytes = valuesToUse.Item2.Select(x => CreateByteFromHexadecimal(x)).ToArray(); cipherProgram.Decipher(inputBytes, roundKeys); break; } default: { throw new Exception(SurpriseExceptionMessage); } } } menu.PromptForContinue(); } }
public IActionResult FindProgramById(string id) { try { ProgramMenu pm = dbContext.ProgramMenus.Find(id); if (pm != null) { return(Ok(pm)); } else { throw new Exception($"Program menu with id of '{ id }' is not found."); } } catch (Exception ex) { return(BadRequest(GetErrorMessage(ex))); } }
static void Main(string[] args) { ProgramMenu menu = new ProgramMenu(); }
private void UIElement_OnTapped(object sender, TappedRoutedEventArgs e) { ProgramMenu.Open(); }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { ProgramMenu.Open(); }