Ejemplo n.º 1
0
        DataTable GetStylesheetTable(Components.Settings settings, int portalId)
        {
            var returnValue = new DataTable(DataSetTableName.Stylesheets);

            returnValue.Columns.Add(new DataColumn(StylesheetTableColumn.NameOfSetting, typeof(string)));
            returnValue.Columns.Add(new DataColumn(StylesheetTableColumn.LocalFilePath, typeof(string)));
            returnValue.Columns.Add(new DataColumn(StylesheetTableColumn.Stylesheet, typeof(string)));

            var renderMethod = string.Format("UDT_{0}", settings.RenderingMethod);
            var listScript   = renderMethod == SettingName.XslUserDefinedStyleSheet
                                 ? settings.ScriptByRenderingMethod(renderMethod)
                                 : string.Empty;

            if (listScript.Length > 0)
            {
                var row = returnValue.NewRow();
                row[StylesheetTableColumn.NameOfSetting] = SettingName.XslUserDefinedStyleSheet;
                row[StylesheetTableColumn.LocalFilePath] = listScript;
                row[StylesheetTableColumn.Stylesheet]    = Utilities.ReadStringFromFile(listScript, portalId);
                returnValue.Rows.Add(row);
            }

            var trackingSkript = settings.TrackingScript;

            if (trackingSkript.Length > 0 && trackingSkript != "[AUTO]")
            {
                var row = returnValue.NewRow();
                row[StylesheetTableColumn.NameOfSetting] = SettingName.TrackingScript;
                row[StylesheetTableColumn.LocalFilePath] = trackingSkript;
                row[StylesheetTableColumn.Stylesheet]    = Utilities.ReadStringFromFile(trackingSkript, portalId);
                returnValue.Rows.Add(row);
            }

            return(returnValue);
        }
 static bool ActionIsTriggered(Trigger trigger, Settings  settings)
 {
     return 
            ((trigger == Trigger.New && settings.TrackingTriggerOnNew) ||
             ((trigger == Trigger.Update) && settings.TrackingTriggerOnUpdate) ||
             ((trigger == Trigger.Delete) && settings.TrackingTriggerOnDelete));
 }