public void UpdateDraft(SavedPostContent data) { string tags = SQLUtils.SQLEncode(data.Tags, true, true); string image = SQLUtils.SQLEncode(data.ImagePath, true, true); string cmd = string.Format(UpdateDraftQuery, TableDrafts, data.ID, SQLUtils.SQLEncode(data.Text), image, tags ); ExecuteNonQuery(cmd); }
private SavedPostContent ParsePostContent(DataRow row) { long id = Convert.ToInt64(row["ID"]); string text = row["TextString"].ToString(); object tmp = row["ImagePath"]; string img = SQLUtils.IsNull(tmp) ? null : tmp.ToString(); tmp = row["TagString"]; string tag = SQLUtils.IsNull(tmp) ? null : tmp.ToString(); SavedPostContent pc = new SavedPostContent(text, id, tag, img); return(pc); }
public SavedPostContent GetDraft(long id) { string cmd = "select * FROM {0} WHERE ID = {1}"; cmd = string.Format(cmd, TableDrafts, id); var dt = ExecuteSelect(cmd); if (dt.Rows.Count > 0) { SavedPostContent post = ParsePostContent(dt.Rows[0]); return(post); } else { return(null); } }
public void AddDraft(SavedPostContent pc) { string tags = SQLUtils.SQLEncode(pc.Tags, true, true); string image = SQLUtils.SQLEncode(pc.ImagePath, true, true); string cmd = string.Format(InsertDraftQuery, TableDrafts, SQLUtils.SQLEncode(pc.Text), image, tags ); ExecuteNonQuery(cmd); long id = SQLUtils.GetLastInsertRow(this); pc.SetId(id); }