public User(string user, string pswd) { _username = user; _password = pswd; db.DBError = ""; ExecutionError = ""; DataTable userTable = db.ReadTable("Users", String.Format("SELECT DISTINCT * FROM Users WHERE Username='******' AND Password='******'", _username, AppHandler.Sha1(_password))); if (userTable.Rows.Count > 0) { _id = AppHandler.ToInt(userTable.Rows[0]["UserID"]); _name = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Name"]); _phone = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Phone"]); _email = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Email"]); _username = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Username"]); _usertype = AppHandler.IgnoreDBNullString(userTable.Rows[0]["UserType"]); _status = (short)AppHandler.ToInt(userTable.Rows[0]["Status"]); _logs = AppHandler.ToInt(userTable.Rows[0]["Logs"]); _date_added = AppHandler.ToDateTime(userTable.Rows[0]["DateAdded"].ToString()); _firm_id = AppHandler.ToInt(userTable.Rows[0]["FirmID"]); _role_id = AppHandler.ToInt(userTable.Rows[0]["RoleID"]); _exists = true; } else if (db.DBError.Length > 0) { ExecutionError = db.DBError; } }
public static string NextSession(string session) { string[] newSession = session.Split('/'); newSession[0] = (AppHandler.ToInt(newSession[0]) + 1).ToString(); newSession[1] = (AppHandler.ToInt(newSession[1]) + 1).ToString(); return(newSession[0] + "/" + newSession[1]); }
public User(string user) { _username = user; DataTable userTable = db.ReadTable("Users", String.Format("SELECT * FROM Users WHERE Username='******'", _username)); if (userTable.Rows.Count > 0) { _id = AppHandler.ToInt(userTable.Rows[0]["UserID"]); _name = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Name"]); _phone = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Phone"]); _email = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Email"]); _username = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Username"]); _password = AppHandler.IgnoreDBNullString(userTable.Rows[0]["Password"]); _usertype = AppHandler.IgnoreDBNullString(userTable.Rows[0]["UserType"]); _status = (short)AppHandler.ToInt(userTable.Rows[0]["Status"]); _logs = AppHandler.ToInt(userTable.Rows[0]["Logs"]); _date_added = AppHandler.ToDateTime(userTable.Rows[0]["DateAdded"].ToString()); _firm_id = AppHandler.ToInt(userTable.Rows[0]["FirmID"]); _role_id = AppHandler.ToInt(userTable.Rows[0]["RoleID"]); _exists = true; //if (System.IO.File.Exists("~/Admin/Passports/" + _username + ".jpg")) // _image_url = "~/Admin/Passports/" + _username + ".jpg"; //else // _image_url = "~/images/avater.png"; } }
public static string ToMySqlTime(DateTime dt) { string ampm = dt.ToLongTimeString().Contains("PM") ? "PM" : "AM"; string[] strTime = dt.ToLongTimeString().Split(' ')[0].Split(':'); int hr = AppHandler.ToInt(strTime[0]); if (hr < 10 && ampm == "AM") { return("0" + Implode(strTime, ":")); } else if (hr < 10 && ampm == "PM") { return((12 + hr) + ":" + strTime[1] + ":" + strTime[2]); } else if (hr == 12 && ampm == "PM") { return("00:" + strTime[1] + ":" + strTime[2]); } return(Implode(strTime, ":")); }