public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content)
        {
            if (FileName.IsNullOrWhiteSpace())
            {
                FileName = Text.EnsureEndsWith(".css");
            }

            // validate if node ends with css, if it does we'll remove it as we append it later
            if (Text.ToLowerInvariant().EndsWith(".css"))
            {
                Text = Text.TrimEnd(".css");
            }

            var newSheet = new Stylesheet(FileName)
            {
                Content = Content
            };

            ApplicationContext.Current.Services.FileService.SaveStylesheet(newSheet);

            var newCss = new StyleSheet(newSheet);
            var e      = new NewEventArgs();

            newCss.OnNew(e);

            return(newCss);
        }
示例#2
0
        public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content)
        {
            // Create the umbraco node
            var newNode = CMSNode.MakeNew(-1, ModuleObjectType, user.Id, 1, Text, Guid.NewGuid());

            // Create the stylesheet data
            SqlHelper.ExecuteNonQuery(string.Format("insert into cmsStylesheet (nodeId, filename, content) values ('{0}','{1}',@content)", newNode.Id, FileName), SqlHelper.CreateParameter("@content", Content));

            // save to file to avoid file coherency issues
            var newCss = new StyleSheet(newNode.Id, false, false);
            var e      = new NewEventArgs();

            newCss.OnNew(e);

            return(newCss);
        }
示例#3
0
        public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content)
        {

            // Create the umbraco node
            var newNode = CMSNode.MakeNew(-1, ModuleObjectType, user.Id, 1, Text, Guid.NewGuid());

            // Create the stylesheet data
            SqlHelper.ExecuteNonQuery(string.Format("insert into cmsStylesheet (nodeId, filename, content) values ('{0}','{1}',@content)", newNode.Id, FileName), SqlHelper.CreateParameter("@content", Content));

            // save to file to avoid file coherency issues
            var newCss = new StyleSheet(newNode.Id, false, false);
            var e = new NewEventArgs();
            newCss.OnNew(e);

            return newCss;
        }