You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
6.9 KiB
C#
171 lines
6.9 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using DSWeb.Models;
|
|
using WebSqlHelper;
|
|
|
|
namespace DSWeb.EntityDA
|
|
{
|
|
public class ActionDA
|
|
{
|
|
private const string PARM_ACTION_GID = "@gid";
|
|
private const string PARM_ACTION_NAME = "@name";
|
|
private const string PARM_ACTION_DESCRIPTION = "@description";
|
|
private const string PARM_ACTION_MODULE_ID = "@module_id";
|
|
private const string PARM_ACTION_CREATE_USER = "@create_user";
|
|
private const string PARM_ACTION_CREATE_TIME = "@create_time";
|
|
private const string PARM_ACTION_MODIFIED_USER = "@modified_user";
|
|
private const string PARM_ACTION_MODIFIED_TIME = "@modified_time";
|
|
private const string PARM_ACTION_STATE = "@state";
|
|
private const string PARM_ACTION_SORT = "@sort";
|
|
|
|
private const string SQL_SELECT_ACTION_BY_GID = "SELECT GID, NAME, DESCRIPTION, MODULEID, CREATEUSER, CREATETIME, MODIFIEDUSER, MODIFIEDTIME, STATE, SORT FROM [action] WHERE GID = @gid";
|
|
|
|
private const string SQL_SELECT_ACTION_BY_MODULE_ID = "SELECT GID, NAME, DESCRIPTION, MODULEID, CREATEUSER, CREATETIME, MODIFIEDUSER, MODIFIEDTIME, STATE, SORT FROM [action] WHERE MODULEID = @module_id";
|
|
|
|
#region 根据Action表GID获取行为信息
|
|
/// <summary>
|
|
/// 根据Action表GID获取行为信息
|
|
/// </summary>
|
|
/// <param name="tempActionGID">行为表GID</param>
|
|
/// <returns>行为实体类</returns>
|
|
public ActionEntity GetActionByGID(string tempActionGID)
|
|
{
|
|
SqlParameter parm = new SqlParameter(PARM_ACTION_GID,SqlDbType.VarChar,36);
|
|
parm.Value = tempActionGID;
|
|
|
|
ActionEntity actionEntity = null;
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_ACTION_BY_GID, parm))
|
|
{
|
|
try
|
|
{
|
|
//读取字段值
|
|
while (sqlRead.Read())
|
|
{
|
|
actionEntity = new ActionEntity();
|
|
if (!sqlRead.IsDBNull(0))
|
|
{
|
|
actionEntity.GID = sqlRead.GetString(0);
|
|
}
|
|
if (!sqlRead.IsDBNull(1))
|
|
{
|
|
actionEntity.ActionName = sqlRead.GetString(1);
|
|
}
|
|
if (!sqlRead.IsDBNull(2))
|
|
{
|
|
actionEntity.Description = sqlRead.GetString(2);
|
|
}
|
|
if (!sqlRead.IsDBNull(3))
|
|
{
|
|
actionEntity.ModuleID = sqlRead.GetString(3);
|
|
}
|
|
if (!sqlRead.IsDBNull(4))
|
|
{
|
|
actionEntity.CreateUserID = sqlRead.GetString(4);
|
|
}
|
|
if (!sqlRead.IsDBNull(5))
|
|
{
|
|
actionEntity.CreateTime = sqlRead.GetDateTime(5);
|
|
}
|
|
if (!sqlRead.IsDBNull(6))
|
|
{
|
|
actionEntity.ModifiedUserID = sqlRead.GetString(6);
|
|
}
|
|
if (!sqlRead.IsDBNull(7))
|
|
{
|
|
actionEntity.ModifiedTime = sqlRead.GetDateTime(7);
|
|
}
|
|
if (!sqlRead.IsDBNull(8))
|
|
{
|
|
actionEntity.State = sqlRead.GetInt32(8);
|
|
}
|
|
if (!sqlRead.IsDBNull(9))
|
|
{
|
|
actionEntity.Sort = sqlRead.GetInt32(9);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception exceError)
|
|
{
|
|
//抛出异常
|
|
throw exceError;
|
|
}
|
|
}
|
|
return actionEntity;
|
|
}
|
|
#endregion
|
|
|
|
#region 根据模块GID获取行为信息
|
|
/// <summary>
|
|
/// 根据模块GID获取行为信息
|
|
/// </summary>
|
|
/// <param name="tempActionGID">行为表GID</param>
|
|
/// <returns>行为实体类</returns>
|
|
public ActionEntity GetActionByModuleID(string tempModuleID)
|
|
{
|
|
SqlParameter parm = new SqlParameter(PARM_ACTION_MODULE_ID, SqlDbType.VarChar, 36);
|
|
parm.Value = tempModuleID;
|
|
|
|
ActionEntity actionEntity = null;
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_ACTION_BY_MODULE_ID, parm))
|
|
{
|
|
try
|
|
{
|
|
//读取字段值
|
|
while (sqlRead.Read())
|
|
{
|
|
actionEntity = new ActionEntity();
|
|
if (!sqlRead.IsDBNull(0))
|
|
{
|
|
actionEntity.GID = sqlRead.GetString(0);
|
|
}
|
|
if (!sqlRead.IsDBNull(1))
|
|
{
|
|
actionEntity.ActionName = sqlRead.GetString(1);
|
|
}
|
|
if (!sqlRead.IsDBNull(2))
|
|
{
|
|
actionEntity.Description = sqlRead.GetString(2);
|
|
}
|
|
if (!sqlRead.IsDBNull(3))
|
|
{
|
|
actionEntity.ModuleID = sqlRead.GetString(3);
|
|
}
|
|
if (!sqlRead.IsDBNull(4))
|
|
{
|
|
actionEntity.CreateUserID = sqlRead.GetString(4);
|
|
}
|
|
if (!sqlRead.IsDBNull(5))
|
|
{
|
|
actionEntity.CreateTime = sqlRead.GetDateTime(5);
|
|
}
|
|
if (!sqlRead.IsDBNull(6))
|
|
{
|
|
actionEntity.ModifiedUserID = sqlRead.GetString(6);
|
|
}
|
|
if (!sqlRead.IsDBNull(7))
|
|
{
|
|
actionEntity.ModifiedTime = sqlRead.GetDateTime(7);
|
|
}
|
|
if (!sqlRead.IsDBNull(8))
|
|
{
|
|
actionEntity.State = sqlRead.GetInt32(8);
|
|
}
|
|
if (!sqlRead.IsDBNull(9))
|
|
{
|
|
actionEntity.Sort = sqlRead.GetInt32(9);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception exceError)
|
|
{
|
|
//抛出异常
|
|
throw exceError;
|
|
}
|
|
}
|
|
return actionEntity;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|