/// <summary> /// Adds the macro to the package /// </summary> /// <param Name="MacroToAdd">Macro to add</param> public void AddMacro(Macro MacroToAdd) { _macros.Add(MacroToAdd); }
/// <summary> /// Retrieve all macroes /// </summary> /// <returns>A list of all macroes</returns> public static Macro[] GetAll() { int total = int.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(GlobalSettings.DbDSN, CommandType.Text, "select count(*) from cmsMacro").ToString()); int count = 0; SqlDataReader dr = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(GlobalSettings.DbDSN, CommandType.Text, "select id from cmsMacro order by macroName"); Macro[] retval = new Macro[total]; while (dr.Read()) { retval[count] = new Macro(int.Parse(dr["id"].ToString())); count++; } dr.Close(); return retval; }
/// <summary> /// Creates a new MacroProperty on a macro /// </summary> /// <param Name="M">The macro</param> /// <param Name="show">Will the editor be able to input data</param> /// <param Name="alias">The alias of the property</param> /// <param Name="name">Userfriendly MacroProperty Name</param> /// <param Name="propertyType">The MacroPropertyType of the property</param> /// <returns></returns> public static MacroProperty MakeNew(Macro M, bool show, string alias, string name, MacroPropertyType propertyType) { return(new MacroProperty(int.Parse( Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(GlobalSettings.DbDSN, CommandType.Text, "SET NOCOUNT ON; insert into cmsMacroProperty (macro, macroPropertyHidden, macropropertyAlias, macroPropertyName, macroPropertyType) values (@macro, @show, @alias, @Name, @type) select @@identity as id", new SqlParameter("@macro", M.Id), new SqlParameter("@show", show), new SqlParameter("@alias", alias), new SqlParameter("@Name", name), new SqlParameter("@type", propertyType.Id)).ToString()))); }
/// <summary> /// Creates a new MacroProperty on a macro /// </summary> /// <param Name="M">The macro</param> /// <param Name="show">Will the editor be able to input data</param> /// <param Name="alias">The alias of the property</param> /// <param Name="name">Userfriendly MacroProperty Name</param> /// <param Name="propertyType">The MacroPropertyType of the property</param> /// <returns></returns> public static MacroProperty MakeNew(Macro M, bool show, string alias, string name, MacroPropertyType propertyType) { return new MacroProperty( int.Parse( Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(GlobalSettings.DbDSN, CommandType.Text, "SET NOCOUNT ON; insert into cmsMacroProperty (macro, macroPropertyHidden, macropropertyAlias, macroPropertyName, macroPropertyType) values (@macro, @show, @alias, @Name, @type) select @@identity as id", new SqlParameter("@macro", M.Id), new SqlParameter("@show", show), new SqlParameter("@alias", alias), new SqlParameter("@Name", name), new SqlParameter("@type", propertyType.Id)).ToString())); }