/** * Check Employee Id and Employee Password against database */ public bool verifyIdandPassword(string empid, string emppass) { DeeBee connect = new DeeBee(); int intempid; if (int.TryParse(empid, out intempid)) { if (connect.IsConnect()) { //suppose col0 and col1 are defined as VARCHAR in the DB string query = string.Format("select employeeId, password from employee where employeeId = {0} and password = '******'", empid, emppass); var cmd = new MySqlCommand(query, connect.Connection); var reader = cmd.ExecuteReader(); while (reader.Read()) { string someStringFromColumnZero = reader.GetString(0); string someStringFromColumnOne = reader.GetString(1); if (someStringFromColumnZero != null && someStringFromColumnOne != null) { return(true); } } } } return(false); // Incorrect employee Id and/or password // PSEUDO CODE ISH //return ((checkbase to check employee status == ACTIVE) && (checkdeebee if employee Id and Password == CORRECT)) ? true : false; }
public static DeeBee Instance() { if (_instance == null) { _instance = new DeeBee(); } return(_instance); }