using framework_business; using framework_library; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Web; namespace framework_business { public class compositeHandler { public compositeHandler() { } public static bool BuildCompositeTemplate(oComposite composite, string sourceTemplateControl, string destinationPath, bool reCreate = false) { bool result = false; try { //check if folder exists utils.validateFolder(HttpContext.Current.Server.MapPath(destinationPath)); string codeFront = utils.ConvertHTMLFiletoString(HttpContext.Current.Server.MapPath(sourceTemplateControl)); //setup Heading codeFront = codeFront.Replace("<%--{Heading}--%>", composite.composite); //build Composite Tabs codeFront = codeFront.Replace("<%--{TabList}--%>", BuildCompositeTabList(composite)); //build Composite Pages codeFront = codeFront.Replace("<%--{TabContent}--%>", BuildCompositeTabContent(composite, false)); //save to new location result = utils.ConvertStringtoHTMLFile(codeFront, HttpContext.Current.Server.MapPath(destinationPath + composite.name + ".ascx")); } catch (Exception ex) { exception.HandleException("handler:", MethodBase.GetCurrentMethod().Name, ex, HttpContext.Current.Session["user"]); } return result; } private static string BuildCompositeTabList(oComposite composite) { string result = String.Empty; StringBuilder tabListBuilder = new StringBuilder(); try { ArrayList tabList = xData.GetTypedByCriteriaSpecific("recId", typeof(oCanvas), "parentId", composite.canvasId.ToString(), "sequence"); bool firstTab = true; foreach (oCanvas canvasTab in tabList) { tabListBuilder.AppendLine("