329 lines
11 KiB
C#
329 lines
11 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class WFSetupDA
|
|
{
|
|
#region WFSetupDA
|
|
|
|
#region Constructor
|
|
|
|
private WFSetupDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert
|
|
|
|
internal static void Insert(TransactionContext tc, WFSetup item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO WFSETUP(WFSETUPID, WFTYPEID, CREATEDBY, CREATEDDATE, SEQUENCENO)"
|
|
+ " VALUES(%n, %n, %n, %d, %n)",
|
|
+item.ID, item.WFTypeId, item.CreatedBy, item.CreatedDate, item.Sequence);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void Update(TransactionContext tc, WFSetup item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE WFSETUP SET WFTYPEID=%n, MODIFIEDBY=%n, MODIFIEDDATE=%d, SEQUENCENO=%n"
|
|
+ " WHERE WFSETUPID=%n ",
|
|
+item.WFTypeId, item.ModifiedBy, item.ModifiedDate, item.Sequence, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete
|
|
|
|
internal static void Delete(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFRULEMANUAL WHERE WFSETUPID=%n", id);
|
|
tc.ExecuteNonQuery("DELETE FROM WFRDDESIGNATION WHERE WFSETUPID=%n", id);
|
|
tc.ExecuteNonQuery("DELETE FROM WFRULEDNODE WHERE WFSETUPID=%n", id);
|
|
tc.ExecuteNonQuery("DELETE FROM WFRDETAILOS WHERE WFSETUPID=%n", id);
|
|
tc.ExecuteNonQuery("DELETE FROM WFSETUPRULE WHERE WFSETUPID=%n", id);
|
|
tc.ExecuteNonQuery("DELETE FROM WFSETUP WHERE WFSETUPID=%n", id);
|
|
}
|
|
|
|
//internal static void DeleteChild(TransactionContext tc, int id)
|
|
//{
|
|
|
|
// tc.ExecuteNonQuery("DELETE FROM WFRULEMANUAL WHERE WFSETUPID=%n", id);
|
|
// tc.ExecuteNonQuery("DELETE FROM WFRDDESIGNATION WHERE WFSETUPID=%n", id);
|
|
// tc.ExecuteNonQuery("DELETE FROM WFRULEDNODE WHERE WFSETUPID=%n", id);
|
|
// tc.ExecuteNonQuery("DELETE FROM WFRDETAILOS WHERE WFSETUPID=%n", id);
|
|
// tc.ExecuteNonQuery("DELETE FROM WFSETUPRULE WHERE WFSETUPID=%n", id);
|
|
// tc.ExecuteNonQuery("DELETE FROM WFSETUP WHERE WFSETUPID=%n", id);
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFSETUP WHERE WFSETUPID=%n", id);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFSETUP");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region WFSetupRule
|
|
|
|
#region Insert
|
|
|
|
internal static void InsertWFSetupRule(TransactionContext tc, WFSetupRule item)
|
|
{
|
|
if (item.FinalDestinationNode != 0)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO WFSETUPRULE(WFSETUPRULEID,WFSETUPID,STAUTHORITYLEVEL,PRIORITY,WFRULETYPE,"
|
|
+ " LEVELDEPTH,REQAPPALL,AUTONOTIFICATIONNODE,FINALDESTINATIONNODE, RAUTHORITY)"
|
|
+ " VALUES(%n,%n,%n,%n,"
|
|
+ " %n,%n,%n,%n,%n,%n)",
|
|
item.ID, item.WFSetupId, item.StAuthorityLevel, item.Priority, item.WFRuleType,
|
|
item.LevelDepth, item.ReqAppAll, item.AutoNotificationNode, item.FinalDestinationNode,
|
|
item.IsRAuthority);
|
|
}
|
|
else
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO WFSETUPRULE(WFSETUPRULEID,WFSETUPID,STAUTHORITYLEVEL,PRIORITY,WFRULETYPE,"
|
|
+ " LEVELDEPTH,REQAPPALL,AUTONOTIFICATIONNODE,FINALDESTINATIONNODE, RAUTHORITY)"
|
|
+ " VALUES(%n,%n,%n,%n,"
|
|
+ " %n,%n,%n,%n,%n,%n)",
|
|
item.ID, item.WFSetupId, item.StAuthorityLevel, item.Priority, item.WFRuleType,
|
|
item.LevelDepth, item.ReqAppAll, item.AutoNotificationNode, item.FinalDestinationNode,
|
|
item.IsRAuthority);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void UpdateWFSetupRule(TransactionContext tc, WFSetupRule item)
|
|
{
|
|
string sSQL = string.Empty;
|
|
sSQL = SQLParser.MakeSQL(
|
|
"UPDATE WFSETUPRULE SET WFSETUPID=%n, STAUTHORITYLEVEL=%n, PRIORITY=%n, WFRULETYPE=%n,"
|
|
+ " LEVELDEPTH=%n, REQAPPALL=%n, FINALDESTINATIONNODE = %n, RAUTHORITY=%n WHERE WFSETUPRULEID=%n",
|
|
item.WFSetupId, item.StAuthorityLevel, item.Priority, item.WFRuleType,
|
|
item.LevelDepth, item.ReqAppAll, DataReader.GetNullValue(item.FinalDestinationNode, 0),
|
|
item.IsRAuthority, item.ID);
|
|
|
|
tc.ExecuteNonQuery(sSQL);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete
|
|
|
|
internal static void DeleteWFSetupRule(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFSETUPRULE WHERE WFSETUPID=%n", iD);
|
|
}
|
|
|
|
internal static void DeleteWFSetupRulebyRuleID(TransactionContext tc, int ruleId)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFSETUPRULE WHERE WFSETUPRULEID=%n", ruleId);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
|
|
internal static IDataReader Get4WFSetupRule(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFSETUPRULE WHERE WFSETUPID=%n", id);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region WFRuleDetailDesignation
|
|
|
|
#region Insert
|
|
|
|
internal static void InsertWFRuleDetailDesignation(TransactionContext tc, WFRuleDetailDesignation item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO WFRDDESIGNATION(WFRULEDETAILID, DESIGNATIONID, WFSETUPID, WFSETUPRULEID, SEQUENCEID)"
|
|
+ " VALUES(%n, %n, %n, %n, %n)",
|
|
item.ID, item.DesignationId, item.WfSetupId, item.WfSetupRuleId, item.SequenceId);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete
|
|
|
|
internal static void DeleteWFRuleDetailDesignation(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFRDDESIGNATION WHERE WFSETUPID=%n", iD);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
|
|
//internal static IDataReader Get4WFRuleDD(TransactionContext tc, int id)
|
|
//{
|
|
// return tc.ExecuteReader("SELECT * FROM WFRDDESIGNATION WHERE WFSETUPID=%n", id);
|
|
//}
|
|
|
|
internal static IDataReader Get4WFRuleDD(TransactionContext tc, int nRuleID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFRDDESIGNATION WHERE WFSETUPRULEID=%n", nRuleID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region WFRuleDetailNode
|
|
|
|
#region Insert
|
|
|
|
internal static void InsertRuleDetailNode(TransactionContext tc, WFRuleDetailNode item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO WFRULEDNODE(WFRULEDNODEID, WFSETUPID, WFSETUPRULEID, NODEID, SEQUENCEID)"
|
|
+ " VALUES(%n, %n, %n, %n, %n)",
|
|
item.ID, item.WfSetupId, item.WfSetupRuleId, item.NodeId, item.SequenceId);
|
|
}
|
|
|
|
internal static void InsertRuleManual(TransactionContext tc, WFRuleDetailManual item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO WFRULEMANUAL(WFRULEDETAILID, WFSETUPID, WFSETUPRULEID, RuleType, SEQUENCEID, ObjectID)"
|
|
+ " VALUES(%n, %n, %n, %n, %n, %n)",
|
|
item.ID, item.WfSetupId, item.WfSetupRuleId, item.RuleType, item.SequenceId, item.ObjectID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void UpdateRuleDetailNode(TransactionContext tc, WFRuleDetailNode item)
|
|
{
|
|
string sSQL = SQLParser.MakeSQL(
|
|
"UPDATE WFRULEDNODE SET NODEID=%n, SEQUENCEID=%n WHERE WFSETUPID=%n AND WFSETUPRULEID=%n AND WFRULEDNODEID=%n",
|
|
item.NodeId, item.SequenceId, item.WfSetupId, item.WfSetupRuleId, item.ID);
|
|
tc.ExecuteNonQuery(sSQL);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete
|
|
|
|
internal static void DeleteWFRuleDetailNode(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFRULEDNODE WHERE WFSETUPID=%n", iD);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
|
|
//internal static IDataReader Get4WFRuleNode(TransactionContext tc, int id)
|
|
//{
|
|
// return tc.ExecuteReader("SELECT * FROM WFRULEDNODE WHERE WFSETUPRULEID=%n", id);
|
|
//}
|
|
|
|
internal static IDataReader Get4WFRuleNode(TransactionContext tc, int nRuleID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFRULEDNODE WHERE WFSetupRuleID=%n", nRuleID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region WFRuleDetailOS
|
|
|
|
#region Insert
|
|
|
|
internal static void InsertRuleDetailOS(TransactionContext tc, WFRuleDetailOS item)
|
|
{
|
|
string sSQL = SQLParser.MakeSQL(
|
|
"INSERT INTO WFRDETAILOS(WFRULEDETAILID, OSID, WFSETUPID, WFSETUPRULEID, SEQUENCEID)"
|
|
+ " VALUES(%n, %n, %n, %n, %n)",
|
|
item.ID, item.OsID, item.WfSetupId, item.WfSetupRuleId, item.SequenceId);
|
|
tc.ExecuteNonQuery(sSQL);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void UpdateRuleDetailOS(TransactionContext tc, WFRuleDetailOS item)
|
|
{
|
|
string sSQL = SQLParser.MakeSQL(
|
|
"UPDATE WFRDETAILOS SET OSID=%n, SEQUENCEID=%n WHERE WFSETUPID=%n AND WFSETUPRULEID=%n AND WFRULEDETAILID=%n",
|
|
item.OsID, item.SequenceId, item.WfSetupId, item.WfSetupRuleId, item.ID);
|
|
tc.ExecuteNonQuery(sSQL);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Delete
|
|
|
|
internal static void DeleteWFRuleDetailOS(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFRDETAILOS WHERE WFSETUPID=%n", iD);
|
|
}
|
|
|
|
internal static void DeleteWFRuleDetailManual(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM WFRULEMANUAL WHERE WFSETUPID=%n", iD);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
|
|
internal static IDataReader Get4WFRuleDetailOS(TransactionContext tc, int ruleid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFRDETAILOS WHERE WFSETUPRULEID=%n", ruleid);
|
|
}
|
|
|
|
internal static IDataReader Get4WFRuleDetailManual(TransactionContext tc, int ruleid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFRULEMANUAL WHERE WFSETUPRULEID=%n", ruleid);
|
|
}
|
|
|
|
internal static IDataReader Get4WFRuleDetailOS(TransactionContext tc, int nWFSetupID, int nSetupRuleID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM WFRDETAILOS WHERE WFSETUPID=%n AND WFSETUPRULEID=%n", nWFSetupID,
|
|
nSetupRuleID);
|
|
}
|
|
|
|
internal static IDataReader Get4WFRuleDetailManual(TransactionContext tc, int nWFSetupID, int nSetupRuleID)
|
|
{
|
|
return tc.ExecuteReader(
|
|
"SELECT * FROM WFRULEMANUAL WHERE WFSETUPID=%n AND WFSETUPRULEID=%n Order by SEQUENCEID", nWFSetupID,
|
|
nSetupRuleID);
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
} |