示例#1
0
        public List <UserInfo> GetUsers()
        {
            IDataReader dataReader = null;

            try
            {
                List <UserInfo> userList = new List <UserInfo>();
                UserInfo        userInfo = null;

                Database db = DatabaseFactory.CreateDatabase("DbConnection");
                dataReader = BillingDAL.GetUsers(db);
                while (dataReader.Read())
                {
                    userInfo           = new UserInfo();
                    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.Password  = Common.GetString(dataReader, "FPASSWORD");
                    userList.Add(userInfo);
                }
                dataReader.Close();

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