// 2011.06.13 - moving the initialization of these to App_Start
// Session["current_user"] = "guest";
// Session["current_db"] = "today's featured";
// need class with set and get methods
// 2011.06.27
// i] user has NO ACCOUNT , RETURNS db(todaysfeatured)
// ] user has account and NO db(firt time),RETURN new blank sospep db
// i] user has account and HAS 1 db, RETURNS db(users)
// ] user has account and HAS mult db, RETURNS selectdb dlg
// var DatabaseExists=false;
// REPLACING WORKING
// var currentDbNameShort =@MyHelper.getCurrentDbNameShort(@WebSecurity.CurrentUserName);
// Session["current_db"]=@WebSecurity.CurrentUserName; WORKS
// REV - change to short db name using helper function to create/extract the "default" short db name(DbNameShort) which is just the user email address prefix part(before @ symbol)
// GET the userID for the authenticated user
// var id =@WebSecurity.GetUserId(@WebSecurity.CurrentUserName);
// REV - GET the name of "the db" OR "THE DBS" that the user has access to
// var db=Database.Open("StarterSite");
@*
var sqlQ="SELECT db,dbExists from webpages_Membership WHERE UserId=@0";
var rec =db.QuerySingle(sqlQ,id);
// var exists=rec.dbExists;
// bool DatabaseExists=exists.AsBool()
*@
@*
// GETS the dbName ( 1 only )
var sqlQ2="SELECT sName from UserProfile WHERE UserId=@0";
// REV WA - now using dbs table, ( again 1 name only)
var sqlQ2="SELECT sName from db_owner WHERE ownersUserId=@0";
var name =db.QueryValue(sqlQ2,id);
*@
// OLD var freindlyname=rec.db;
// if (rec.dbExists)