Exemplo n.º 1
0
        /// <summary>
        /// Creates a new macro given the name
        /// </summary>
        /// <param name="Name">Userfriendly name</param>
        /// <returns>The newly macro</returns>
        public static Macro MakeNew(string Name)
        {
            var macro = new Umbraco.Core.Models.Macro
            {
                Name  = Name,
                Alias = Name.Replace(" ", String.Empty)
            };

            ApplicationContext.Current.Services.MacroService.Save(macro);

            var newMacro = new Macro(macro);

            //fire new event
            var e = new NewEventArgs();

            newMacro.OnNew(e);

            return(newMacro);
        }
Exemplo n.º 2
0
        public static Macro MakeNew(string Name)
        {
            int macroId = 0;

            // The method is synchronized
            SqlHelper.ExecuteNonQuery("INSERT INTO cmsMacro (macroAlias, macroName) values (@macroAlias, @macroName)",
                                      SqlHelper.CreateParameter("@macroAlias", Name.Replace(" ", String.Empty)),
                                      SqlHelper.CreateParameter("@macroName", Name));
            macroId = SqlHelper.ExecuteScalar <int>("SELECT MAX(id) FROM cmsMacro");

            Macro newMacro = new Macro(macroId);

            //fire new event
            NewEventArgs e = new NewEventArgs();

            newMacro.OnNew(e);

            return(newMacro);
        }
Exemplo n.º 3
0
		public static Macro MakeNew(string Name) 
		{
            int macroId = 0;
            // The method is synchronized
            SqlHelper.ExecuteNonQuery("INSERT INTO cmsMacro (macroAlias, macroName) values (@macroAlias, @macroName)",
                SqlHelper.CreateParameter("@macroAlias", Name.Replace(" ", String.Empty)),
                SqlHelper.CreateParameter("@macroName", Name));
            macroId = SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM cmsMacro");

            Macro newMacro = new Macro(macroId);
           
            //fire new event
            NewEventArgs e = new NewEventArgs();
            newMacro.OnNew(e);
            
            return newMacro;
		}
Exemplo n.º 4
0
		public static Macro MakeNew(string Name) 
		{
		    var macro = new Umbraco.Core.Models.Macro
		        {
                    Name = Name,
                    Alias = Name.Replace(" ", String.Empty)
		        };

		    ApplicationContext.Current.Services.MacroService.Save(macro);

            var newMacro = new Macro(macro);
           
            //fire new event
            var e = new NewEventArgs();
            newMacro.OnNew(e);
            
            return newMacro;
		}