Beispiel #1
0
        public UserInfo GetUserInfo(string username, string password)
        {
            IDataReader dataReader = null;

            try
            {
                UserInfo userInfo = new UserInfo();

                Database db = DatabaseFactory.CreateDatabase("DbConnection");
                dataReader = BillingDAL.GetUserInfo(db, username, password);
                if (dataReader.Read())
                {
                    userInfo.UserID      = Common.GetInt32(dataReader, "FUSERID");
                    userInfo.UserName    = Common.GetString(dataReader, "FUSERNAME");
                    userInfo.FirstName   = Common.GetString(dataReader, "FFIRSTNAME");
                    userInfo.LastName    = Common.GetString(dataReader, "FLASTNAME");
                    userInfo.AccessLevel = (AccessLevel)Common.GetInt32(dataReader, "FACCESSLEVEL");
                }
                dataReader.Close();

                return(userInfo);
            }
            catch (Exception ex)
            {
                Common.LogException(ex);
                throw new WebFaultException <string>(ex.Message, HttpStatusCode.InternalServerError);
            }
            finally
            {
                if (dataReader != null && !dataReader.IsClosed)
                {
                    dataReader.Close();
                }
            }
        }