/
CProcessFactory.cs
126 lines (102 loc) · 3.35 KB
/
CProcessFactory.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using LimsProject.BusinessLayer.DataLayer;
namespace LimsProject.BusinessLayer
{
public partial class CProcessFactory
{
#region data Members
CProcessSql _dataObject = null;
#endregion
#region Constructor
public CProcessFactory()
{
_dataObject = new CProcessSql();
}
#endregion
#region Public Methods
/// <summary>
/// Insert new CProcess
/// </summary>
/// <param name="businessObject">CProcess object</param>
/// <returns>true for successfully saved</returns>
public bool Insert(CProcess businessObject)
{
if (!businessObject.IsValid)
{
throw new InvalidBusinessObjectException(businessObject.BrokenRulesList.ToString());
}
return _dataObject.Insert(businessObject);
}
/// <summary>
/// Update existing CProcess
/// </summary>
/// <param name="businessObject">CProcess object</param>
/// <returns>true for successfully saved</returns>
public bool Update(CProcess businessObject)
{
if (!businessObject.IsValid)
{
throw new InvalidBusinessObjectException(businessObject.BrokenRulesList.ToString());
}
return _dataObject.Update(businessObject);
}
/// <summary>
/// get CProcess by primary key.
/// </summary>
/// <param name="keys">primary key</param>
/// <returns>Student</returns>
public CProcess GetByPrimaryKey(CProcessKeys keys)
{
return _dataObject.SelectByPrimaryKey(keys);
}
/// <summary>
/// get list of all CProcesss
/// </summary>
/// <returns>list</returns>
public List<CProcess> GetAll()
{
return _dataObject.SelectAll();
}
/// <summary>
/// get datatable of all CProcesss
/// </summary>
/// <returns>list</returns>
public DataTable GetAllDataTable()
{
return _dataObject.SelectAllDataTable();
}
/// <summary>
/// get list of CProcess by field
/// </summary>
/// <param name="fieldName">field name</param>
/// <param name="value">value</param>
/// <returns>list</returns>
public List<CProcess> GetAllBy(CProcess.CProcessFields fieldName, object value)
{
return _dataObject.SelectByField(fieldName.ToString(), value);
}
/// <summary>
/// delete by primary key
/// </summary>
/// <param name="keys">primary key</param>
/// <returns>true for succesfully deleted</returns>
public bool Delete(CProcessKeys keys)
{
return _dataObject.Delete(keys);
}
/// <summary>
/// delete CProcess by field.
/// </summary>
/// <param name="fieldName">field name</param>
/// <param name="value">value</param>
/// <returns>true for successfully deleted</returns>
public bool Delete(CProcess.CProcessFields fieldName, object value)
{
return _dataObject.DeleteByField(fieldName.ToString(), value);
}
#endregion
}
}