天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
7.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Data;
using QMAPP.Entity.Sys;
using System.Data;
namespace QMAPP.DAL.Sys
{
/// <summary>
/// 参数与人员组织接口
/// 创建者:郭佳伟
/// 创建日期:2013.2.7
/// </summary>
public class ParaAuthorityPortManageDAL
{
#region 获取参数与人员组织信息列表
/// <summary>
/// 获取参数与人员组织信息列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetList(ParaAuthorityPort condition, DataPage page)
{
try
{
//StringBuilder sqlBuilder = new StringBuilder();
//StringBuilder whereBuilder = new StringBuilder();
//List<DataParameter> parameters = new List<DataParameter>();
//sqlBuilder.Append(" SELECT USERID,(SELECT USERNAME FROM T_QM_USER WHERE USERID = A.USERID) AS USERNAME");
//sqlBuilder.Append(" ,ORGAID,(SELECT ORGADESC FROM T_QM_ORGANIZATION WHERE ORGAID = A.ORGAID) AS ORGADESC ,PARAID ,PARADESC,PARATYPE, ");
//sqlBuilder.Append(" CREATEUSER,CREATETIME,UPDATEUSER,UPDATETIME ");
//sqlBuilder.Append(" ,DELFLAG ");
//sqlBuilder.Append(" FROM T_QM_PARAAUTHORITYPORT AS A WHERE DELFLAG = '0'");
////查询条件
//if (string.IsNullOrEmpty(condition.OrgaID) == false)
//{
// whereBuilder.Append(" AND ORGAID = @ORGAID");
// parameters.Add(new DataParameter { ParameterName = "ORGAID", DataType = DbType.String, Value = condition.OrgaID });
//}
////查询条件
//if (string.IsNullOrEmpty(condition.ParaID) == false)
//{
// whereBuilder.Append(" AND PARAID = @PARAID");
// parameters.Add(new DataParameter { ParameterName = "PARAID", DataType = DbType.String, Value = condition.ParaID });
//}
////查询条件
//if (string.IsNullOrEmpty(condition.UserID) == false)
//{
// whereBuilder.Append(" AND USERID = @USERID");
// parameters.Add(new DataParameter { ParameterName = "USERID", DataType = DbType.String, Value = condition.UserID });
//}
//if (whereBuilder.Length > 0)
//{
// sqlBuilder.Append(whereBuilder.ToString());
//}
////分页关键字段及排序
//page.KeyName = "PARAID";
//page.SortExpression = "UPDATETIME DESC";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//page = session.GetDataPage<ParaAuthorityPort>(sqlBuilder.ToString(), parameters.ToArray(), page);
}
return page;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 获取参数信息
/// <summary>
/// 获取参数信息
/// </summary>
/// <param name="user">条件</param>
/// <returns>参数信息</returns>
public ParaAuthorityPort Get(ParaAuthorityPort user)
{
StringBuilder sqlBuilder = new StringBuilder();
StringBuilder whereBuilder = new StringBuilder();
List<DataParameter> parameters = new List<DataParameter>();
ParaAuthorityPort tmpPara = new ParaAuthorityPort();
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
////获取用户信息
//sqlBuilder.Append(" SELECT USERID,(SELECT USERNAME FROM T_QM_USER WHERE USERID = A.USERID) AS USERNAME");
//sqlBuilder.Append(" ,ORGAID,(SELECT ORGADESC FROM T_QM_ORGANIZATION WHERE ORGAID = A.ORGAID) AS ORGADESC ,PARAID ,PARADESC ,PARATYPE, ");
//sqlBuilder.Append(" CREATEUSER,CREATETIME,UPDATEUSER,UPDATETIME ");
//sqlBuilder.Append(" ,DELFLAG ");
//sqlBuilder.Append(" FROM T_QM_PARAAUTHORITYPORT AS A WHERE DELFLAG = '0' AND PARAID = @PARAID");
//parameters.Add(new DataParameter { ParameterName = "PARAID", DataType = DbType.String, Value = user.ParaID });
//tmpPara = session.Get<ParaAuthorityPort>(sqlBuilder.ToString(), parameters.ToArray());
}
return tmpPara;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 插入参数信息
/// <summary>
/// 插入参数信息
/// </summary>
/// <param name="ParaAuthorityPort">参数基本信息</param>
/// <returns>插入数</returns>
public int Insert(ParaAuthorityPort pap)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.OpenTs();
//插入基本信息
session.Insert<ParaAuthorityPort>(pap);
session.CommitTs();
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 删除参数信息
/// <summary>
/// 删除参数信息
/// </summary>
/// <param name="ParaAuthorityPort">参数基本信息</param>
/// <returns>删除个数</returns>
public int Delete(ParaAuthorityPort pap)
{
int count = 0;
string sql = null;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.OpenTs();
////删除参数信息
//sql = "UPDATE T_QM_PARAAUTHORITYPORT SET DELFLAG = '1' WHERE PARAID=@PARAID";
//count = session.ExecuteSql(sql, new DataParameter { ParameterName = "PARAID", DataType = DbType.String, Value = pap.ParaID });
session.CommitTs();
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 更新参数信息
/// <summary>
/// 更新参数信息
/// </summary>
/// <param name="ParaAuthorityPort">参数信息</param>
/// <returns>更新个数</returns>
public int Update(ParaAuthorityPort pap)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.OpenTs();
//更新基本信息
count = session.Update<ParaAuthorityPort>(pap);
session.CommitTs();
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
}
}