/// <summary> Method gets the HOME PAGE html for the appropriate UI settings </summary>
/// <param name="CompAggr"> Complete item aggregation object </param>
/// <param name = "Language"> Current language of the user interface </param>
/// <param name = "Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
/// <returns>Home page HTML</returns>
private static HTML_Based_Content Get_Home_HTML(Complete_Item_Aggregation CompAggr, Web_Language_Enum Language, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Home_HTML", "Reading home text source file");
}
string homeFileSource = "";
// Get the home file source
if(CompAggr.Home_Page_File(Language) != null)
homeFileSource = Path.Combine(Engine_ApplicationCache_Gateway.Settings.Servers.Base_Design_Location, CompAggr.ObjDirectory, CompAggr.Home_Page_File(Language).Source);
// If no home file source even found, return a message to that affect
if (homeFileSource.Length == 0)
{
return new HTML_Based_Content("<div class=\"error_div\">NO HOME PAGE SOURCE FILE FOUND</div>", null, homeFileSource);
}
// Do the rest in a try/catch
try
{
// Does the file exist?
if (!File.Exists(homeFileSource))
{
return new HTML_Based_Content("<div class=\"error_div\">HOME PAGE SOURCE FILE '" + homeFileSource + "' DOES NOT EXIST.</div>", null, homeFileSource);
}
HTML_Based_Content content = HTML_Based_Content_Reader.Read_HTML_File(homeFileSource, true, Tracer);
content.Source = homeFileSource;
return content;
}
catch (Exception ee)
{
return new HTML_Based_Content("<div class=\"error_div\">EXCEPTION CAUGHT WHILE TRYING TO READ THE HOME PAGE SOURCE FILE '" + homeFileSource + "'.<br /><br />ERROR: " + ee.Message + "</div>", null, homeFileSource);
}
}