|
@@ -0,0 +1,77 @@
|
|
|
+/*-------------------------------------------------------------------------
|
|
|
+ * 功能描述:SystemCheckReportBll
|
|
|
+ * 作者:xulisong
|
|
|
+ * 创建时间: 2019/3/1 8:45:00
|
|
|
+ * 版本号:v1.0
|
|
|
+ * -------------------------------------------------------------------------*/
|
|
|
+
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Saga.Framework.DB;
|
|
|
+using SAGA.DotNetUtils.Data;
|
|
|
+using SAGA.DotNetUtils.Utilities;
|
|
|
+using SAGA.MBIAssistData.Model;
|
|
|
+
|
|
|
+namespace SAGA.MBIAssistData
|
|
|
+{
|
|
|
+ public class SystemCheckReportBll:Bll<SystemCheckReport>
|
|
|
+ {
|
|
|
+ public SystemCheckReportBll()
|
|
|
+ {
|
|
|
+ Init(this.GetType().FullName, this.GetType().Assembly.FullName);
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool ExistReport(string floorId, string gplotType)
|
|
|
+ {
|
|
|
+ this.CheckDAL();
|
|
|
+ string condion = string.Format("FloorId='{0}' And GplotType='{1}'", floorId, gplotType);
|
|
|
+ return this.m_BaseDal.ExistByCondition(condion);
|
|
|
+ }
|
|
|
+
|
|
|
+ public SystemCheckReport GetCurrentReport(string floorId, string gplotType)
|
|
|
+ {
|
|
|
+ this.CheckDAL();
|
|
|
+ string condion = string.Format("FloorId='{0}' And GplotType='{1}'", floorId, gplotType);
|
|
|
+ string orderBy = string.Format("BuildingTime Desc ");
|
|
|
+ return this.m_BaseDal.FindSingle(condion,orderBy);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 创建报表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="report"></param>
|
|
|
+ /// <param name="results"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public bool CreateReport(SystemCheckReport report, List<SystemCheckResult> results)
|
|
|
+ {
|
|
|
+ this.CheckDAL();
|
|
|
+ var reportId = GuidUtil.GetNString();
|
|
|
+ report.Id = reportId;
|
|
|
+
|
|
|
+ using (var trans = CreateDatabase().CreateTransaction())
|
|
|
+ {
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Insert(report, trans);
|
|
|
+ foreach (var systemCheckResult in results)
|
|
|
+ {
|
|
|
+ systemCheckResult.Id = GuidUtil.GetNString();
|
|
|
+ systemCheckResult.ReportId = reportId;
|
|
|
+ SingleFactory<SystemCheckResultBll>.Instance.Insert(systemCheckResult, trans);
|
|
|
+ }
|
|
|
+ trans.Commit();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ trans.Rollback();
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|