public static string ExtendedScripts(
            Context context,
            int deptId,
            List <int> groups,
            int userId,
            bool siteTop,
            long siteId,
            long id,
            string controller,
            string action)
        {
            var scripts = (siteTop && !context.TopScript.IsNullOrEmpty()
                ? context.TopScript + '\n'
                : string.Empty)
                          + ExtensionUtilities.ExtensionWhere <ExtendedScript>(
                extensions: Parameters.ExtendedScripts,
                name: null,
                deptId: deptId,
                groups: groups,
                userId: userId,
                siteId: siteId,
                id: id,
                controller: controller,
                action: action)
                          .Select(o => o.Script)
                          .Join("\n");

            return(scripts);
        }
 public static string ExtendedHtmls(
     Context context,
     string id,
     string columnName = null)
 {
     return(ExtensionUtilities.ExtensionWhere <ExtendedHtml>(
                context: context,
                extensions: Parameters.ExtendedHtmls,
                columnName: columnName)
            .Select(o => o.Html.Display(
                        context: context,
                        id: id))
            .Join("\n"));
 }
Beispiel #3
0
 public static string ExtendedScripts(
     int deptId,
     int userId,
     long siteId,
     long id,
     string controller,
     string action)
 {
     return(ExtensionUtilities.ExtensionWhere <ExtendedScript>(
                extensions: Parameters.ExtendedScripts,
                deptId: deptId,
                userId: userId,
                siteId: siteId,
                id: id,
                controller: controller,
                action: action)
            .Select(o => o.Script)
            .Join("\n"));
 }
Beispiel #4
0
 public static HtmlBuilder ExtendedSql(
     this HtmlBuilder hb,
     Context context)
 {
     ExtensionUtilities.ExtensionWhere <ExtendedSql>(
         context: context,
         extensions: Parameters.ExtendedSqls
         ?.Where(o => o.Html)
         .Where(o => !o.CommandText.IsNullOrEmpty()))
     .ForEach(extendedSql =>
     {
         var dataSet = DataSources.Repository.ExecuteDataSet(
             context: context,
             statements: new SqlStatement(commandText: extendedSql.CommandText
                                          .Replace("{{SiteId}}", context.SiteId.ToString())
                                          .Replace("{{Id}}", context.Id.ToString())));
         foreach (DataTable dataTable in dataSet.Tables)
         {
             var table = new List <Dictionary <string, object> >();
             foreach (DataRow dataRow in dataTable.Rows)
             {
                 var row = new Dictionary <string, object>();
                 foreach (DataColumn dataColumn in dataTable.Columns)
                 {
                     row.AddIfNotConainsKey(
                         dataColumn.ColumnName,
                         dataRow[dataColumn.ColumnName]);
                 }
                 table.Add(row);
             }
             hb.Hidden(
                 controlId: dataSet.Tables.Count > 1
                         ? $"{extendedSql.Name}_{dataTable.TableName}"
                         : $"{extendedSql.Name}",
                 value: table.ToJson());
         }
     });
     return(hb);
 }
        private static List <ParameterAccessor.Parts.ExtendedNavigationMenu> ExtendedNavigationMenu(
            int deptId,
            List <int> groups,
            int userId,
            long siteId,
            long id,
            string controller,
            string action)
        {
            var extendedNavigationMenus = ExtensionUtilities.ExtensionWhere <ParameterAccessor.Parts.ExtendedNavigationMenu>(
                extensions: Parameters.ExtendedNavigationMenus,
                name: null,
                deptId: deptId,
                groups: groups,
                userId: userId,
                siteId: siteId,
                id: id,
                controller: controller,
                action: action);

            return(extendedNavigationMenus.ToList());
        }