public string SavePageTemplate(int pageTemplateId, string json)
        {
            SessionService.ClearPageTemplateSessions(pageTemplateId);
            string msg = DataService.UpdateRecordByTable(1, "PageTemplate", json);

            return(msg);
        }
        public string SaveColumnDef(int pageTemplateId, string json)
        {
            SessionService.ClearPageTemplateSessions(pageTemplateId);
            var msg = DataService.UpdateRecordByTable(1, "ColumnDef", json);

            SessionService.ResetPageSession(pageTemplateId);
            return(msg);
        }
        public string GetPageTemplateData(int pageTemplateId)
        {
            SessionService.ClearPageTemplateSessions(pageTemplateId);              // force reload

            var pageTemplate  = SessionService.PageTemplate(pageTemplateId);
            var pageTemplate_ = JsonConvert.SerializeObject(pageTemplate, new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            var json = "{ \"GridColumns\": {} , \"PageTemplate\": " + pageTemplate_ + " }";

            return(json);
        }
        public string SaveLayout(int pageTemplateId, string layout, string columnName)
        {
            SessionService.ClearPageTemplateSessions(pageTemplateId);

            try
            {
                using (SourceControlEntities Db = new SourceControlEntities())
                {
                    Db.Database.ExecuteSqlCommand("UPDATE PageTemplate SET " + columnName + " = @Layout WHERE PageTemplateId = " + pageTemplateId, new SqlParameter("@Layout", layout));
                }

                SessionService.ResetPageSession(pageTemplateId);
                return("");
            }
            catch (Exception ex)
            {
                return("Unable to process UpdateRecord() - " + ex.Message);
            }
        }