/// <summary> /// 修改报表格式 /// </summary> /// <param name="entity"></param> /// <param name="list"></param> /// <returns></returns> public int Update(ReportsEntity entity, List<ReportParamsEntity> list) { int line = 0; using (TransactionScope ts = new TransactionScope()) { ReportParamsEntity param = new ReportParamsEntity(); param.Where(a => a.ReportNum == entity.ReportNum); line += this.ReportParams.Delete(param); entity.Include(a => new { a.ReportName, a.ReportType, a.Remark, a.DataSource, a.DsType, a.FileName }); entity.Where(a => a.ReportNum == entity.ReportNum); line += this.Reports.Update(entity); if (!list.IsNullOrEmpty()) { foreach (ReportParamsEntity item in list) { item.ParamNum = item.ParamNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(ReportParamsEntity)) : item.ParamNum; item.ReportNum = entity.ReportNum; item.IncludeAll(); } this.ReportParams.Add(list); } ts.Complete(); } return line; }
/// <summary> /// 根据报表格式编号查询参数信息 /// </summary> /// <param name="reportNum"></param> /// <returns></returns> public List<ReportParamsEntity> GetParams(string reportNum) { ReportParamsEntity entity = new ReportParamsEntity(); entity.IncludeAll(); entity.Where(a => a.ReportNum == reportNum); List<ReportParamsEntity> list = this.ReportParams.GetList(entity); return list; }