Пример #1
0
        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;
            }
        }
Пример #2
0
        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";
            }
        }