<%@ Page language="c#" Debug="true"%><!--#include file="SchoolsWShared.aspx"--><%
//! Support file only, run SchoolsW.html instead !
// This file is used as Page_Url
// Loads and returrns reviews for given record

// --- Database initialization ---
TGSchools TG = new TGSchools(Context);
System.Data.OleDb.OleDbDataReader R;

// --- Returns ratings for the row as server child page --- 
string XML = Request["TGData"];
if (XML == null) XML = "<Grid><Body><B id='jan$Main$1'/></Body></Grid>";  // Just for examples if called directly
System.Xml.XmlDocument X = new System.Xml.XmlDocument();
X.LoadXml(HttpUtility.HtmlDecode(XML));
System.Xml.XmlNodeList Ch = X.GetElementsByTagName("B");
Response.Write ("<Grid><Body>");   

foreach (System.Xml.XmlElement I in Ch)
{
   string[] id = GetIds(I);  // User$Def$Ident
   Response.Write ("<B id=" + ToXml(I.GetAttribute("id")) + ">");
   R = TG.Read("SELECT * FROM Schools_Ratings WHERE Owner=" + ToSql(id[0]) + " AND Id=" + id[2]);
   while(R.Read())
   {
      Response.Write ("<I Def='Review'" + ToXml("CName",R,"ADate") + ToXml("CCountry", R, "Review") + ToXml("CRating", R, "Stars") + "/>");
   }
   Response.Write("</B>");
}
Response.Write ("</Body></Grid>");
TG.Dispose();
// --------------------------------------------------------------------------
%>