public bool EditPassword(string email, string newPassword) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return (dbManager.NonReturnQuery("UPDATE Clients set Client_Password = '******' WHERE Client_Email ='" + email + "';")); }
private void StartSession() { new System.Threading.Thread(() => { Classes.Cryptography crypto = new Classes.Cryptography(); SetLoadingStatus(true); DisplayNotifyBox("Attempting to Sign In", "Please wait while we sign you in"); string passsword = crypto.EncryptString(GetPassword()); Classes.Session session = new Classes.Session(GetUsername(), passsword); if (session.LoginSuccessfull) { DisplayNotifyBox("Signed In", "Welcome " + session.username); OpenAdminWindow(session.username); } else { DisplayNotifyBox("Invalid Username or Password", "Could not sign in"); } SetLoadingStatus(false); }).Start(); }
public bool EditPassword(string username, string newPassword) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return (dbManager.NonReturnQuery("UPDATE Admin set Admin_Password = '******' WHERE Admin_Username ='******';")); }
public bool AddClient(string name, string surname, string phone, string email, string password) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return (dbManager.NonReturnQuery("INSERT INTO Clients (Client_Name , Client_Surname, Client_Phone, Client_Email, Client_Password) VALUES ('" + name + "','" + surname + "','" + phone + "','" + email + "','" + crypto.EncryptString(password) + "');")); }
/// <summary> /// Creates config file with keys and empty values /// </summary> private void CreateConfigFile() { Cryptography crypto = new Cryptography(); if (!Directory.Exists(configDirPath)) { Directory.CreateDirectory(configDirPath); } config.Options.AddOptionsRow(crypto.EncryptString(serverKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(userKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(passwordKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(dbKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(portKey), ""); WriteConfig(); }
public bool AddAdmin(string username, string password) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return (dbManager.NonReturnQuery("INSERT INTO Admin (Admin_Username , Admin_Password) VALUES ('" + username + "','" + crypto.EncryptString(password) + "');")); }
public bool EditPassword(string email, string newPassword) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return(dbManager.NonReturnQuery("UPDATE Agent set Agent_Password = '******' WHERE Agent_Email ='" + email + "';")); }
public bool EditPassword(string username, string newPassword) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return(dbManager.NonReturnQuery("UPDATE Admin set Admin_Password = '******' WHERE Admin_Username ='******';")); }
/// <summary> /// Creates config file with keys and empty values /// </summary> private void CreateConfigFile() { Cryptography crypto = new Cryptography(); if (!Directory.Exists(configDirPath)) { Directory.CreateDirectory(configDirPath); } config.Options.AddOptionsRow(crypto.EncryptString(serverKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(userKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(passwordKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(dbKey), ""); config.Options.AddOptionsRow(crypto.EncryptString(portKey), ""); WriteConfig(); }
public bool SaveFTPConfig(string webdir, string username, string password) { try { Cryptography crypto = new Cryptography(); FtpWebDirectory = webdir; FtpUser = username; FtpPassword = password; r = config.Options.Select("Key = '" + crypto.EncryptString(ftpWebdirKey) + "'")[0]; r[1] = crypto.EncryptString(webdir); r = config.Options.Select("Key = '" + crypto.EncryptString(ftpUserKey) + "'")[0]; r[1] = crypto.EncryptString(FtpUser); r = config.Options.Select("Key = '" + crypto.EncryptString(ftpPasswordKey) + "'")[0]; r[1] = crypto.EncryptString(FtpPassword); WriteConfig(); LoadConfig(); return(true); } catch { return(false); } }
/// <summary> /// Loads values from config XML file /// </summary> private void LoadConfig() { try { config.ReadXml(configFilePath); Cryptography crypto = new Cryptography(); r = config.Options.Select("Key ='" + crypto.EncryptString(serverKey) + "'")[0]; ServerIP = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(userKey) + "'")[0]; ServerUser = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(passwordKey) + "'")[0]; ServerPassword = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(dbKey) + "'")[0]; ServerDB = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(portKey) + "'")[0]; ServerPort = crypto.DecryptString(r[1].ToString()); ConnectionString = "server=" + ServerIP + ";uid=" + ServerUser + ";database=" + ServerDB + ";port=" + ServerPort + ";pwd=" + ServerPassword + ";"; ConfigLoaded = true; } /*catch * { * ConfigLoaded = false; * }*/ catch (Exception e) { Console.WriteLine("LoadConfig Exception " + e.ToString()); ConfigLoaded = false; } }
/// <summary> /// Saves data and writes it encrypted to config XML file /// </summary> /// <param name="server">Server IP address string</param> /// <param name="username">Server username</param> /// <param name="password">Server password</param> /// <param name="database">Server database</param> /// <param name="portno">Server port number</param> /// <returns>Boolean if saved</returns> public bool SaveDBConfig(string server, string username, string password, string database, string portno) { try { Cryptography crypto = new Cryptography(); ServerIP = server; ServerUser = username; ServerPassword = password; ServerDB = database; ServerPort = portno; r = config.Options.Select("Key = '" + crypto.EncryptString(serverKey) + "'")[0]; r[1] = crypto.EncryptString(ServerIP); r = config.Options.Select("Key = '" + crypto.EncryptString(userKey) + "'")[0]; r[1] = crypto.EncryptString(ServerUser); r = config.Options.Select("Key = '" + crypto.EncryptString(passwordKey) + "'")[0]; r[1] = crypto.EncryptString(ServerPassword); r = config.Options.Select("Key = '" + crypto.EncryptString(dbKey) + "'")[0]; r[1] = crypto.EncryptString(ServerDB); r = config.Options.Select("Key = '" + crypto.EncryptString(portKey) + "'")[0]; r[1] = crypto.EncryptString(ServerPort); WriteConfig(); LoadConfig(); return(true); } catch { return(false); } }
/// <summary> /// Saves data and writes it encrypted to config XML file /// </summary> /// <param name="server">Server IP address string</param> /// <param name="username">Server username</param> /// <param name="password">Server password</param> /// <param name="database">Server database</param> /// <param name="portno">Server port number</param> /// <returns>Boolean if saved</returns> public bool SaveConfig(string server, string username, string password, string database, string portno) { try { Cryptography crypto = new Cryptography(); ServerIP = server; ServerUser = username; ServerPassword = password; ServerDB = database; ServerPort = portno; r = config.Options.Select("Key = '" + crypto.EncryptString(serverKey) + "'")[0]; r[1] = crypto.EncryptString(ServerIP); r = config.Options.Select("Key = '" + crypto.EncryptString(userKey) + "'")[0]; r[1] = crypto.EncryptString(ServerUser); r = config.Options.Select("Key = '" + crypto.EncryptString(passwordKey) + "'")[0]; r[1] = crypto.EncryptString(ServerPassword); r = config.Options.Select("Key = '" + crypto.EncryptString(dbKey) + "'")[0]; r[1] = crypto.EncryptString(ServerDB); r = config.Options.Select("Key = '" + crypto.EncryptString(portKey) + "'")[0]; r[1] = crypto.EncryptString(ServerPort); WriteConfig(); LoadConfig(); return true; } catch { return false; } }
public bool AddAdmin(string username, string password) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return(dbManager.NonReturnQuery("INSERT INTO Admin (Admin_Username , Admin_Password) VALUES ('" + username + "','" + crypto.EncryptString(password) + "');")); }
public bool AddAgent(string name, string surname, string phone, string email, string password) { DatabaseManager dbManager = new DatabaseManager(); Cryptography crypto = new Cryptography(); return(dbManager.NonReturnQuery("INSERT INTO Agent (Agent_Name , Agent_Surname, Agent_Phone, Agent_Email, Agent_Password) VALUES ('" + name + "','" + surname + "','" + phone + "','" + email + "','" + crypto.EncryptString(password) + "');")); }
private void StartSession() { new System.Threading.Thread(() => { Classes.Cryptography crypto = new Classes.Cryptography(); SetLoadingStatus(true); DisplayNotifyBox("Attempting to Sign In", "Please wait while we sign you in"); string passsword = crypto.EncryptString(GetPassword()); Classes.Session session = new Classes.Session(GetUsername(), passsword); if (session.LoginSuccessfull) { DisplayNotifyBox("Signed In", "Welcome " + session.username); if( session.IsAdmin ) { OpenAdminWindow(session.username); } else { OpenAgentWindow(session.username); } } else { DisplayNotifyBox("Invalid Username or Password", "Could not sign in"); } SetLoadingStatus(false); }).Start(); }
/// <summary> /// Loads values from config XML file /// </summary> private void LoadConfig() { try { config.ReadXml(configFilePath); Cryptography crypto = new Cryptography(); r = config.Options.Select("Key ='" + crypto.EncryptString(serverKey) + "'")[0]; ServerIP = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(userKey) + "'")[0]; ServerUser = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(passwordKey) + "'")[0]; ServerPassword = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(dbKey) + "'")[0]; ServerDB = crypto.DecryptString(r[1].ToString()); r = config.Options.Select("Key ='" + crypto.EncryptString(portKey) + "'")[0]; ServerPort = crypto.DecryptString(r[1].ToString()); ConnectionString = "server=" + ServerIP + ";uid=" + ServerUser + ";database=" + ServerDB + ";port=" + ServerPort + ";pwd=" + ServerPassword + ";"; ConfigLoaded = true; } /*catch { ConfigLoaded = false; }*/ catch (Exception e) { Console.WriteLine("LoadConfig Exception " + e.ToString()); ConfigLoaded = false; } }
public bool SaveFTPConfig(string webdir, string username, string password) { try { Cryptography crypto = new Cryptography(); FtpWebDirectory = webdir; FtpUser = username; FtpPassword = password; r = config.Options.Select("Key = '" + crypto.EncryptString(ftpWebdirKey) + "'")[0]; r[1] = crypto.EncryptString(webdir); r = config.Options.Select("Key = '" + crypto.EncryptString(ftpUserKey) + "'")[0]; r[1] = crypto.EncryptString(FtpUser); r = config.Options.Select("Key = '" + crypto.EncryptString(ftpPasswordKey) + "'")[0]; r[1] = crypto.EncryptString(FtpPassword); WriteConfig(); LoadConfig(); return true; } catch { return false; } }