Esempio n. 1
0
        /// <summary>
        /// Inserts a category into the database
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override bool InsertCategory(ref CategoryInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString);
            cmd.CommandText = "dbo.mon_elrn_INSERT_CATEGORY";

            cmd.AddInputParam("@Name", DbType.AnsiString, entity.CategoryName);
            cmd.AddInputParam("@Visible", DbType.Boolean, entity.Visible);
            cmd.AddInputParam("@ApplicationName", DbType.String, System.Web.Security.Membership.Provider.ApplicationName);

            int result;

            result = Convert.ToInt32(cmd.ExecuteSelectTable().Rows[0].ItemArray[0].ToString());
            if (result > 0)
                return true;
            else
                return false;



        }
Esempio n. 2
0
 public static bool UpdateCategory(CategoryInfo entity) { return Instance.UpdateCategory(entity); }
Esempio n. 3
0
        /// <summary>
        /// Updates a category into the database
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override bool UpdateCategory(CategoryInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString);
            cmd.CommandText = "dbo.mon_elrn_UPDATE_CATEGORY";

            cmd.AddInputParam("@Id", DbType.Int32, entity.Id);
            cmd.AddInputParam("@Name", DbType.AnsiString, entity.CategoryName);
            cmd.AddInputParam("@Visible", DbType.Boolean, entity.Visible);


            return Convert.ToBoolean(SqlHelpers.ExecuteNonQuery(cmd));

        }
Esempio n. 4
0
 //Category related functions
 public static bool InsertCategory(ref CategoryInfo entity) { return Instance.InsertCategory(ref entity); }