-
Notifications
You must be signed in to change notification settings - Fork 0
/
SurveyQuestion.cs
114 lines (93 loc) · 2.33 KB
/
SurveyQuestion.cs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.Serialization;
using NHibernate;
using NHibernate.Criterion;
using NHibernate.Transform;
using Newtonsoft.Json;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Queries;
namespace TestModel
{
/// <summary>
/// 自定义实体类
/// </summary>
[Serializable]
public partial class SurveyQuestion
{
#region 成员变量
#endregion
#region 成员属性
#endregion
#region 公共方法
/// <summary>
/// 验证操作
/// </summary>
public void DoValidate()
{
// 检查是否存在重复键
/*if (!this.IsPropertyUnique("UniqueKey"))
{
throw new RepeatedKeyException("存在重复的 UniqueKey “" + this.UniqueKey + "”");
}*/
}
/// <summary>
/// 保存
/// </summary>
public void DoSave()
{
if (String.IsNullOrEmpty(Id))
{
this.DoCreate();
}
else
{
this.DoUpdate();
}
}
/// <summary>
/// 创建操作
/// </summary>
public void DoCreate()
{
this.DoValidate();
this.CreateTime = DateTime.Now;
// 事务开始
this.CreateAndFlush();
}
/// <summary>
/// 修改操作
/// </summary>
/// <returns></returns>
public void DoUpdate()
{
this.DoValidate();
this.UpdateAndFlush();
}
/// <summary>
/// 删除操作
/// </summary>
public void DoDelete()
{
this.Delete();
}
#endregion
#region 静态成员
/// <summary>
/// 批量删除操作
/// </summary>
public static void DoBatchDelete(params object[] args)
{
SurveyQuestion[] tents = SurveyQuestion.FindAll(Expression.In("Id", args));
foreach (SurveyQuestion tent in tents)
{
tent.DoDelete();
}
}
#endregion
} // SurveyQuestion
}