public int InsertCategory(Term term) { var tagInsertDataSet = _dal.GetData(InsertSql(term)); if (tagInsertDataSet.Tables.Count == 0) { return -1; } if (tagInsertDataSet.Tables[0].Rows.Count == 0) { return -1; } if (tagInsertDataSet.Tables[0].Rows[0].ItemArray.Length == 0) { return -1; } var id = tagInsertDataSet.Tables[0].Rows[0][0].ToString(); return int.Parse(id); }
public string InsertSql(Term term) { var converterFunctions = new ConverterFunctions(); return string.Format( "INSERT INTO wp_terms(name, slug, term_group) VALUES" + "('{0}','{1}',0);" + "SET @l=LAST_INSERT_ID();" + "INSERT INTO wp_term_taxonomy(term_id, taxonomy, description, parent, count) VALUES (@l,'category','{2}',0,0);" + "SELECT @l;", term.Name.EscapeSql(), converterFunctions.SeoUrl(term.Name).EscapeSql(), term.Description.EscapeSql()); }
public void InsertTag(string blogUrl, Term tag) { _tagsPresent[blogUrl].Add(tag); }
public string NewTerm(Term term) { return WordPressService.NewTerm(WordPressSiteConfig.BlogId, WordPressSiteConfig.Username, WordPressSiteConfig.Password, term); }