public int Add(Category entity)
        {
            try
            {
                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("INSERT INTO tb_category(");
                strSQL.Append("ChannelID,Title,SortID)");
                strSQL.Append(" VALUES (");
                strSQL.Append("@ChannelID,@Title,@SortID);");

                DbCommand dbCommand = DB.DB.Db().GetSqlStringCommand(strSQL.ToString());
                int result = DB.DB.Db().ExecuteNonQuery(dbCommand);

                return result;
            }
            catch (Exception ex)
            {
                Log.Log.logError(ex.Message);
                throw;
            }
        }
 private Category FillEntity(DataRow dr)
 {
     Category entity = new Category
     {
         ID = DataTypeHelper.Convert<Int32>(dr["ID"]),
         ChannelID = DataTypeHelper.Convert<Int32>(dr["ChannelID"]),
         Title = DataTypeHelper.Convert<String>(dr["Title"]),
         SortID = DataTypeHelper.Convert<Int32>(dr["SortID"]),
     };
     return entity;
 }
        public bool Update(Category entity)
        {
            try
            {
                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("UPDATE tb_category SET ");
                strSQL.Append(" ChannelID=@ChannelID,");
                strSQL.Append("Title=@Title,");
                strSQL.Append("SortID=@SortID");
                strSQL.Append(" WHERE ID=@ID;");

                DbCommand dbCommand = DB.DB.Db().GetSqlStringCommand(strSQL.ToString());
                DB.DB.Db().AddInParameter(dbCommand, "@ChannelID", DbType.Int32, entity.ChannelID);
                DB.DB.Db().AddInParameter(dbCommand, "@Title", DbType.String, entity.Title);
                DB.DB.Db().AddInParameter(dbCommand, "@SortID", DbType.Int32, entity.SortID);
                DB.DB.Db().AddInParameter(dbCommand, "@ID", DbType.Int32, entity.ID);

                DB.DB.Db().ExecuteNonQuery(dbCommand);

                return true;
            }
            catch (Exception ex)
            {
                Log.Log.logError(ex.Message);
                throw;
            }
        }
 public bool Update(Category entity)
 {
     return dal.Update(entity);
 }
 public int Add(Category entity)
 {
     return dal.Add(entity);
 }