public static void BaiNoiBat_BaiNoiBat_Update(long[] newsIds, int[] thutu, string newsIdNotSelected, string editionType) { using (MainDB db = new MainDB()) { // xóa hết các bài trong bảng BonBaiNoiBat string sql = "Delete From BonBaiNoiBat" + Environment.NewLine; // insert từng bài đã chọn vào bảng BonBaiNoiBat for (int i = 0; i < newsIds.Length; i++) { sql += "Insert Into BonBaiNoiBat (News_Id, isNoiBat, Thutu) Values (" + newsIds.GetValue(i) + ", 0, " + thutu[i] + ")" + Environment.NewLine; } // cập nhật lại những tin không được chọn thành tin bình thường if (!string.IsNullOrEmpty(newsIdNotSelected)) { sql += "Update News Set News_Mode = 0 From News Join Category On News.Cat_ID = Category.Cat_ID " + "Where Category.EditionType_ID = " + editionType + "AND News_ID In (" + newsIdNotSelected + ") AND (News_PublishDate < DATEADD(HOUR,-48,GETDATE())) " + Environment.NewLine; sql += "Update newspublished Set News_Mode = 0 From NewsPublished Join Category On NewsPublished.Cat_ID = Category.Cat_ID" + " Where Category.EditionType_ID = " + editionType + " AND News_ID In (" + newsIdNotSelected + ") AND (News_PublishDate < DATEADD(HOUR,-48,GETDATE())) " + Environment.NewLine; } db.AnotherNonQuery(sql); } }
public static void DeleteFeedback(string ID) { using (MainDB db = new MainDB()) { db.AnotherNonQuery("delete from FeedBack where ID in(" + ID + ")"); } }
public static void AdvDelete(string AdvID) { using (MainDB _db = new MainDB()) { _db.AnotherNonQuery("Delete from Advertisments where AdvId = " + AdvID); } }
public static void Clear4BaiNoiBat() { using (MainDB db = new MainDB()) { db.AnotherNonQuery("DELETE FROM temp_click_comment WHERE [Type]=1"); } }