public ReportModel() { Report = new CIReport(); ReportList = new List <CIReport>(); Pagelist = new ReportPageList(); dtReport = new DataTable(); }
public ActionResult ReportAdd(CIReport report) { ReportModel model = new ReportModel(); model.Report = report; if (string.IsNullOrEmpty(report.ID)) { report.ID = Guid.NewGuid().ToString(); report.AddTime = DateTime.Now; int num = _reportService.InsertReport(report); if (num > 0) { return(Redirect(Url.Action("ReportList", "Report"))); } else { ErrorNotification("添加失败"); return(View(model)); } } else { int num = _reportService.UpdateReport(report); if (num > 0) { return(Redirect(Url.Action("ReportList", "Report"))); } else { ErrorNotification("修改失败"); return(View(model)); } } }
/// <summary> /// 删除报表 /// </summary> /// <param name="checkitem"></param> /// <returns></returns> public int Delete(CIReport report) { const string sql = "DELETE FROM CIReport WHERE ID=@ID "; using (var conn = new DapperHelper().OpenConnection()) { return(conn.Execute(sql, new { ID = report.ID })); } }
/// <summary> /// 添加报表 /// </summary> /// <param name="checkitem"></param> /// <returns></returns> public int Insert(CIReport report) { var sql = @"INSERT INTO CIReport (ID,ReportName,ReportSQL,AddTime) VALUES (@ID,@ReportName,@ReportSQL,@AddTime)"; using (var conn = new DapperHelper().OpenConnection()) { return(conn.Execute(sql, report)); } }
/// <summary> /// 编辑报表 /// </summary> /// <param name="checkitem"></param> /// <returns></returns> public int Update(CIReport report) { const string sql = @"UPDATE CIReport SET ReportName = @ReportName, ReportSQL = @ReportSQL WHERE ID=@ID " ; using (var conn = new DapperHelper().OpenConnection()) { return(conn.Execute(sql, report)); } }
/// <summary> /// 更新报表 /// </summary> /// <param name="report"></param> /// <returns></returns> public int UpdateReport(CIReport report) { return(_reportRepository.Update(report)); }
/// <summary> /// 新增报表 /// </summary> /// <param name="report"></param> /// <returns></returns> public int InsertReport(CIReport report) { return(_reportRepository.Insert(report)); }