public void Write(modelTopic topic, bool reload = true) { db.Update("tblTopic", "ID", topic); if (reload) { LoadTopics(); } }
public void Update(modelTopic topic, bool reload = true) { if (topic.CreatedDate.Year < 2000) { topic.CreatedDate = new DateTime(2000, 1, 1); } topic.UpdatedDate = DateTime.Now; db.Update("tblTopic", "ID", topic); if (reload) { LoadTopics(); } }
public void Insert(modelTopic topic, bool reload = true) { if (topic.ID == 0) { topic.ID = Program.GData.LongID(); topic.CreatedDate = DateTime.Now; topic.UpdatedDate = DateTime.Now; } db.Insert("tblTopic", "ID", false, topic); if (reload) { LoadTopics(); } }