forked from besley/FormBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityDefManager.cs
More file actions
68 lines (66 loc) · 2.08 KB
/
Copy pathEntityDefManager.cs
File metadata and controls
68 lines (66 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using SlickOne.Data;
using SlickMaster.Builder.Entity;
namespace SlickMaster.Builder.Manager
{
/// <summary>
/// 实体管理器
/// </summary>
internal class EntityDefManager : ManagerBase
{
/// <summary>
/// 更新模板内容
/// </summary>
/// <param name="conn"></param>
/// <param name="entityDef"></param>
/// <param name="trans"></param>
internal void SaveTemplateWithHTMLContent(IDbConnection conn, EntityDefEntity entityDef, IDbTransaction trans)
{
string sql = @"UPDATE EavEntityDef
SET TemplateContent=@templateContent,
HTMLContent=@htmlContent
WHERE ID=@id";
Repository.Execute(conn, sql, new
{
id = entityDef.ID,
templateContent = entityDef.TemplateContent,
htmlContent = entityDef.HTMLContent
}, trans);
}
/// <summary>
/// 保存表单模板内容
/// </summary>
/// <param name="entity"></param>
internal void SaveTemplateContent(EntityDefEntity entity)
{
var session = SessionFactory.CreateSession();
try
{
session.BeginTrans();
string sql = @"UPDATE EavEntityDef
SET TemplateContent=@templateContent
WHERE ID=@id";
Repository.Execute(session.Connection, sql, new
{
id = entity.ID,
templateContent = entity.TemplateContent
}, session.Transaction);
session.Commit();
}
catch (System.Exception ex)
{
session.Rollback();
throw;
}
finally
{
session.Dispose();
}
}
}
}