public ActionResult Delete(Guid id, ReportDataSetModel model) { using (Muse db = new Muse()) { var record = db.Get <ReportDataSetModel>(x => x.Id == id, null); int flag = db.Del(record, true); if (flag > 0) { return(RedirectToAction("Index")); } else { return(View()); } } }
public ActionResult DeleteOption(Guid id) { using (Muse db = new Muse()) { var record = db.Get <ReportOptionModel>(x => x.Id == id, null); int flag = db.Del(record, true); if (flag > 0) { return(RedirectToAction("Details", new { id = record.ReportPageModelId })); } else { return(View()); } } }
private void BtDelPath_Click(object sender, EventArgs e) { if (DgvPath.CurrentRow != null) { int row = DgvPath.CurrentRow.Index; string path = R.Services.FBS.Paths[row].Path; if (row >= 0) { using (var db = new Muse()) { BackupPaths bp = db.Get <BackupPaths>(x => x.Path == path, null); if (bp != null) { db.Del(bp, true); } R.Services.FBS.Paths.RemoveAt(row); } UIDgvPathDel(row); } } }
/// <summary> /// 删除超过备份最大次数的项 /// </summary> private void DeleteExcess(string path) { using (var db = new Muse()) { int count = db.Do <BackupFiles>().Count(x => x.FullPath == path); if (count >= R.Settings.FileBackup.BACK_UP_COUNT) { var fs = db.Gets <BackupFiles>(x => x.FullPath == path, null).OrderBy(x => x.Id).ToList(); if (ListTool.HasElements(fs)) { for (int i = 0; i <= count - R.Settings.FileBackup.BACK_UP_COUNT; i++) { try { File.Delete(fs[i].BackupFullPath); db.Del(fs[i], true); } catch (Exception e) { } } } } } }