天津投入产出系统后端
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.
 
 
 
 
 
 

917 lines
32 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QMFrameWork.Data;
using QMAPP.Entity.Sys;
namespace QMAPP.DAL.Sys
{
/// <summary>
/// 通知管理
/// 创建者:王丹丹
/// 创建日期:2015.03.09
/// </summary>
public class NoticeManageDAL : BaseDAL
{
#region 通知信息操作
#region 获取通知信息
/// <summary>
/// 获取通知信息
/// </summary>
/// <param name="user">条件</param>
/// <returns>通知信息</returns>
public NoticeInfo Get(NoticeInfo notice)
{
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//获取通知信息
notice = session.Get<NoticeInfo>(notice);
}
return notice;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 获取通知信息列表
/// <summary>
/// 获取通知信息列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetList(NoticeInfo condition, DataPage page)
{
string sql = "";
List<DataParameter> parameters = new List<DataParameter>();
try
{
//分页关键字段及排序
page.KeyName = "NOTICEID";
if (string.IsNullOrEmpty(page.SortExpression))
{
page.SortExpression = "CREATEDATE DESC";
}
sql = GetListSQL(condition, ref parameters);
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
page = session.GetDataPage<NoticeInfo>(sql, parameters.ToArray(), page);
}
return page;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 获取通知信息列表SQL
/// <summary>
/// 获取通知信息列表
/// </summary>
/// <param name="condition">查询条件</param>
/// <param name="parameters"></param>
/// <returns>sql语句</returns>
public string GetListSQL(NoticeInfo condition, ref List<DataParameter> parameters)
{
StringBuilder sqlBuilder = new StringBuilder();
StringBuilder whereBuilder = new StringBuilder();
try
{
//构成查询语句
sqlBuilder.Append(" SELECT N.NOTICEID,N.NOTICETITLE,CASE N.NOTICETYPE WHEN '1' THEN '即时通知' else '普通通知' end as NOTICETYPE, ");
sqlBuilder.Append(" N.NOTICECONTEXT,N.USETIME,N.OUTTIME, ");
sqlBuilder.Append(" N.USETIME AS USETIMETXT, ");
sqlBuilder.Append(" N.OUTTIME AS OUTTIMETXT, ");
sqlBuilder.Append(" N.ATTACHFILE,CASE N.CANREPLY WHEN '1' THEN '是' else '否' end as CANREPLY,N.SENDFLG, ");
sqlBuilder.Append(" N.SENDAIM,N.SENDTIME,N.CREATEDATE ,N.UPDATEDATE,T_QM_USER.USERNAME AS CREATEUSER, ");
sqlBuilder.Append(" U.USERNAME AS UPDATEUSER,C.REPLYCOUNT ");
sqlBuilder.Append(" FROM T_QM_NOTICE N LEFT JOIN T_QM_USER ON N.CREATEUSER = T_QM_USER.USERID ");
sqlBuilder.Append(" LEFT JOIN T_QM_USER U ON N.UPDATEUSER = U.USERID ");
sqlBuilder.Append(" LEFT JOIN ( SELECT COUNT(*) AS REPLYCOUNT,NOTICEID FROM T_QM_NOTICEBROWSE ");
sqlBuilder.Append(" WHERE REPLYCONTENT IS NOT NULL GROUP BY NOTICEID ) C ");
sqlBuilder.Append(" ON C.NOTICEID=N.NOTICEID ");
//查询条件
if (condition.UserName.ToLower() != "admin")
{
sqlBuilder.Append(" LEFT JOIN T_QM_NOTICEBROWSE NB ON NB.NOTICEID=N.NOTICEID ");
//浏览用户ID
if (!string.IsNullOrEmpty(condition.UserID))
{
whereBuilder.Append(" AND NB.USERID=@USERID");
parameters.Add(new DataParameter { ParameterName = "USERID", DataType = DbType.String, Value = condition.UserID });
}
}
//通知标题
if (string.IsNullOrEmpty(condition.NOTICETITLE) == false)
{
whereBuilder.Append(" AND NOTICETITLE LIKE @NOTICETITLE");
parameters.Add(new DataParameter { ParameterName = "NOTICETITLE", DataType = DbType.String, Value = "%"+condition.NOTICETITLE+"%" });
}
//通知开始时间
if (!string.IsNullOrEmpty(condition.USETIMESTART))
{
whereBuilder.Append(" AND N.USETIME >= @USETIMESTART");
parameters.Add(new DataParameter { ParameterName = "USETIMESTART", DataType = DbType.DateTime, Value = DateTime.Parse(condition.USETIMESTART) });
}
//通知结束时间
if (!string.IsNullOrEmpty(condition.USETIMEEND))
{
whereBuilder.Append(" AND N.USETIME < @USETIMEEND");
parameters.Add(new DataParameter { ParameterName = "USETIMEEND", DataType = DbType.DateTime, Value = Convert.ToDateTime(condition.USETIMEEND).AddDays(1) });
}
if (whereBuilder.Length > 0)
{
sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
}
return sqlBuilder.ToString();
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 判断通知标题是否存在
/// <summary>
/// 判断通知标题是否存在
/// </summary>
/// <param name="info">信息</param>
/// <returns>true@已存在;fasel@不存在。</returns>
public bool ExistsNotice(NoticeInfo notice)
{
string noticeID = "";
int count = 0;
string sql = null;
try
{
if (string.IsNullOrEmpty(notice.NOTICEID) == false)
{
noticeID = notice.NOTICEID;
}
sql = "SELECT COUNT(*) FROM T_QM_NOTICE WHERE NOTICEID <> @NOTICEID AND NOTICETITLE=@NOTICETITLE";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
count = Convert.ToInt32(session.ExecuteSqlScalar(sql, new DataParameter("NOTICEID", noticeID), new DataParameter { ParameterName = "NOTICETITLE", Value = notice.NOTICETITLE }));
}
if (count > 0)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 插入通知
/// <summary>
/// 插入通知
/// </summary>
/// <param name="user">通知信息</param>
/// <returns>插入数</returns>
public int Insert(NoticeInfo user)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//插入基本信息
count = session.Insert<NoticeInfo>(user);
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 删除通知
/// <summary>
/// 删除通知信息
/// </summary>
/// <param name="user">通知信息</param>
/// <returns>删除个数</returns>
public int Delete(NoticeInfo notice)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//删除基本信息
count = session.Delete<NoticeInfo>(notice);
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 更新通知
/// <summary>
/// 更新通知
/// </summary>
/// <param name="user">通知信息</param>
/// <returns>更新个数</returns>
public int Update(NoticeInfo notice)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//更新基本信息
count = session.Update<NoticeInfo>(notice);
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#endregion
#region 获取未读有通知信息
/// <summary>
/// 获取未读通知信息
/// </summary>
/// <returns></returns>
public List<NoticeInfo> GetNotReadNotice(NoticeInfo model)
{
StringBuilder sqlBuilder = new StringBuilder();
List<DataParameter> parameters = new List<DataParameter>();
List<NoticeInfo> resultList = new List<NoticeInfo>();
string sql = "";
DataPage page = new DataPage();
try
{
//构成查询语句
sqlBuilder.Append(" SELECT N.NOTICEID,N.NOTICETITLE,N.USETIME,N.CREATEDATE,N.OUTTIME,NB.ISREAD ");
sqlBuilder.Append(" FROM T_QM_NOTICE N ");
sqlBuilder.Append(" LEFT JOIN T_QM_NOTICEBROWSE NB ON NB.NOTICEID=N.NOTICEID ");
sqlBuilder.Append(" WHERE N.USETIME <= @NOWDATE ");
sqlBuilder.Append(" AND N.OUTTIME >= @NOWDATE ");
sqlBuilder.Append(" AND NB.USERID=@USERID ");
sqlBuilder.Append(" AND NB.ISREAD='0' ");
parameters.Add(new DataParameter { ParameterName = "USERID", DataType = DbType.String, Value = model.UserID });
parameters.Add(new DataParameter { ParameterName = "NOWDATE", DataType = DbType.DateTime, Value = DateTime.Now });
page.KeyName = "NOTICEID";
if (string.IsNullOrEmpty(page.SortExpression))
{
page.SortExpression = "CREATEDATE DESC";
}
page.PageIndex=1;
page.PageSize=5;
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sqlBuilder.ToString(), session);
resultList = session.GetDataPage<NoticeInfo>(sql, parameters.ToArray(), page).Result as List<NoticeInfo>;
}
return resultList;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 获取未读即时通知信息
/// <summary>
/// 获取未读有通知信息
/// </summary>
/// <returns></returns>
public List<NoticeInfo> GetNotReadInstantNotice(NoticeInfo model)
{
StringBuilder sqlBuilder = new StringBuilder();
List<DataParameter> parameters = new List<DataParameter>();
List<NoticeInfo> resultList = new List<NoticeInfo>();
string sql = "";
DataPage page = new DataPage();
try
{
//构成查询语句
sqlBuilder.Append(" SELECT N.NOTICEID,N.NOTICETITLE,N.USETIME,N.CREATEDATE,N.OUTTIME,NB.ISREAD ");
sqlBuilder.Append(" FROM T_QM_NOTICE N ");
sqlBuilder.Append(" LEFT JOIN T_QM_NOTICEBROWSE NB ON NB.NOTICEID=N.NOTICEID ");
sqlBuilder.Append(" WHERE N.USETIME <= @NOWDATE");
sqlBuilder.Append(" AND N.OUTTIME >=@NOWDATE ");
sqlBuilder.Append(" AND NB.USERID=@USERID ");
sqlBuilder.Append(" AND NB.ISREAD='0' ");
sqlBuilder.Append(" AND N.NOTICETYPE='1' ");
parameters.Add(new DataParameter { ParameterName = "USERID", DataType = DbType.String, Value = model.UserID });
parameters.Add(new DataParameter { ParameterName = "NOWDATE", DataType = DbType.DateTime, Value = DateTime.Now });
page.KeyName = "NOTICEID";
if (string.IsNullOrEmpty(page.SortExpression))
{
page.SortExpression = "CREATEDATE DESC";
}
page.PageIndex = 1;
page.PageSize = 5;
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sqlBuilder.ToString(), session);
resultList = session.GetDataPage<NoticeInfo>(sql, parameters.ToArray(), page).Result as List<NoticeInfo>;
}
return resultList;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 通知浏览记录操作
#region 根据通知ID,从通知浏览记录表中,获取发送目标
/// <summary>
/// 根据通知ID,从通知浏览记录表中,获取发送目标
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public IList<NoticeBrowse> GetSendaimIdList(string noticeID)
{
List<DataParameter> parameters = new List<DataParameter>();
IList<NoticeBrowse> listModel = new List<NoticeBrowse>();
NoticeBrowse condition = new NoticeBrowse();
try
{
condition.NOTICEID = noticeID;
string sql = GetBrowseSql(condition, ref parameters);
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
listModel = session.GetList<NoticeBrowse>(sql, parameters.ToArray());
}
return listModel;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取通知浏览记录列表
#region 获取通知浏览记录列表
/// <summary>
/// 获取通知浏览记录列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetBrowseList(NoticeBrowse condition,DataPage page)
{
IList<NoticeBrowse> list = new List<NoticeBrowse>();
string sql = null;
List<DataParameter> parameters = new List<DataParameter>();
try
{
//分页关键字段及排序
page.KeyName = "PID";
//获取执行语句
sql = GetBrowseListSql(condition, ref parameters).ToString();
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
page = session.GetDataPage<NoticeBrowse>(sql, parameters.ToArray(), page);
}
return page;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 构造通知公告浏览记录查询语句(用于管理员查看通知浏览记录)
/// <summary>
/// 构造通知公告浏览记录查询语句
/// </summary>
/// <param name="condition">查询条件</param>
/// <returns>sql语句</returns>
public string GetBrowseListSql(NoticeBrowse condition, ref List<DataParameter> parameters)
{
StringBuilder sqlBuilder = new StringBuilder();
StringBuilder whereBuilder = new StringBuilder();
try
{
//构成查询语句
sqlBuilder.Append("SELECT PID,NOTICEID,ISREAD,READTIME,ISAFFIRM,AFFIRMTIME,REPLYCONTENT,REPLYTIME,N.USERID,T_QM_USER.USERNAME AS UserName ");
sqlBuilder.Append("FROM T_QM_NOTICEBROWSE N INNER JOIN T_QM_USER ON N.USERID = T_QM_USER.USERID ");
//通知主键
if (!string.IsNullOrEmpty(condition.NOTICEID))
{
whereBuilder.Append(" AND N.NOTICEID=@NOTICEID ");
parameters.Add(new DataParameter { ParameterName = "NOTICEID", DataType = DbType.String, Value = condition.NOTICEID });
}
//查询条件
if (condition.UserName != null)
{
if (condition.UserName.ToLower() != "admin")
{
//浏览用户主键
if (!string.IsNullOrEmpty(condition.USERID))
{
whereBuilder.Append(" AND N.USERID=@USERID ");
parameters.Add(new DataParameter { ParameterName = "USERID", DataType = DbType.String, Value = condition.USERID });
}
}
}
if (whereBuilder.Length > 0)
{
sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
}
return sqlBuilder.ToString();
}
catch (Exception ex)
{
throw;
}
}
#endregion
#endregion
#region 获取通知浏览记录
#region 获取通知浏览记录
/// <summary>
/// 获取通知浏览记录
/// </summary>
/// <param name="condition">查询条件</param>
/// <returns>通知浏览记录信息</returns>
public NoticeBrowse GetBrowse(NoticeBrowse condition)
{
string sql = null;
List<DataParameter> parameters = new List<DataParameter>();
try
{
//获取执行语句
sql = GetBrowseListSql(condition, ref parameters).ToString();
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
condition = session.Get<NoticeBrowse>(sql, parameters.ToArray());
}
return condition;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 获取通知浏览记录(普通员工查看浏览记录)
/// <summary>
/// 获取通知浏览记录
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public NoticeBrowse GetBrowseModel(NoticeBrowse condition)
{
string sql = null;
List<DataParameter> parameters = new List<DataParameter>();
try
{
//获取执行语句
sql = GetBrowseSql(condition, ref parameters).ToString();
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
condition = session.Get<NoticeBrowse>(sql, parameters.ToArray());
}
return condition;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 构造通知公告浏览记录查询语句(用于普通员工查看通知浏览记录)
/// <summary>
/// 构造通知公告浏览记录查询语句
/// </summary>
/// <param name="condition">查询条件</param>
/// <returns>sql语句</returns>
public string GetBrowseSql(NoticeBrowse condition, ref List<DataParameter> parameters)
{
StringBuilder sqlBuilder = new StringBuilder();
StringBuilder whereBuilder = new StringBuilder();
try
{
//构成查询语句
sqlBuilder.Append("SELECT PID,NOTICEID,ISREAD,READTIME,ISAFFIRM,AFFIRMTIME,REPLYCONTENT,REPLYTIME,N.USERID,T_QM_USER.USERNAME AS UserName ");
sqlBuilder.Append("FROM T_QM_NOTICEBROWSE N INNER JOIN T_QM_USER ON N.USERID = T_QM_USER.USERID ");
//通知主键
if (!string.IsNullOrEmpty(condition.NOTICEID))
{
whereBuilder.Append(" AND N.NOTICEID=@NOTICEID ");
parameters.Add(new DataParameter { ParameterName = "NOTICEID", DataType = DbType.String, Value = condition.NOTICEID });
}
//浏览用户主键
if (!string.IsNullOrEmpty(condition.USERID))
{
whereBuilder.Append(" AND N.USERID=@USERID ");
parameters.Add(new DataParameter { ParameterName = "USERID", DataType = DbType.String, Value = condition.USERID });
}
if (whereBuilder.Length > 0)
{
sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
}
return sqlBuilder.ToString();
}
catch (Exception ex)
{
throw;
}
}
#endregion
#endregion
#region 插入通知浏览记录
/// <summary>
/// 插入通知浏览记录
/// </summary>
/// <param name="user">通知浏览记录信息</param>
/// <returns>插入数</returns>
public int Insert(NoticeBrowse model)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//插入基本信息
count = session.Insert<NoticeBrowse>(model);
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 更新通知浏览记录
/// <summary>
/// 更新通知浏览记录
/// </summary>
/// <param name="user">通知浏览记录信息</param>
/// <returns>更新数</returns>
public int Update(NoticeBrowse model)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//更新基本信息
count = session.Update<NoticeBrowse>(model);
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 删除通知浏览记录
/// <summary>
/// 删除通知浏览记录
/// </summary>
/// <param name="user">通知浏览记录信息</param>
/// <returns>删除个数</returns>
public int Delete(NoticeBrowse notice)
{
StringBuilder sqlBuilder = new StringBuilder();
List<DataParameter> parameters = new List<DataParameter>();
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.OpenTs();
//删除基本信息
sqlBuilder.Append(" DELETE FROM T_QM_NOTICEBROWSE WHERE NOTICEID='" + notice.NOTICEID + "'");
if (string.IsNullOrEmpty(notice.USERID))
{
sqlBuilder.Append(" AND USERID='" + notice.USERID + "'");
}
count = session.ExecuteSql(sqlBuilder.ToString());
session.CommitTs();
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 定时删除超过六个月的通知浏览记录
/// <summary>
/// 定时删除超过六个月的通知浏览记录
/// </summary>
/// <returns>删除个数</returns>
public int DeleteNoticeBrowse()
{
StringBuilder sqlBuilder = new StringBuilder();
List<DataParameter> parameters = new List<DataParameter>();
int count = 0;
DateTime deleteDate = DateTime.Now.AddMonths(-6);
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.OpenTs();
//删除信息
sqlBuilder.Append(" DELETE FROM T_QM_NOTICEBROWSE ");
sqlBuilder.Append(" WHERE NOTICEID IN( ");
sqlBuilder.Append(" SELECT NOTICEID FROM T_QM_NOTICE WHERE ");
sqlBuilder.Append(" USETIME <= to_date('" + deleteDate + "','YYYY-mm-dd hh24:mi:ss')) ");
count = session.ExecuteSql(sqlBuilder.ToString());
session.CommitTs();
}
return count;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#endregion
#region 获取用户信息
/// <summary>
/// 获取用户信息信息
/// </summary>
/// <param name="user">条件</param>
/// <returns>用户信息信息</returns>
public User Get(User user)
{
StringBuilder sqlBuilder = new StringBuilder();
List<DataParameter> parameters = new List<DataParameter>();
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//获取用户信息
sqlBuilder.Append(" SELECT *");
sqlBuilder.Append(" FROM T_QM_USER A WHERE USERID = '" + user.UserID + "'");
user = session.Get<User>(sqlBuilder.ToString());
}
return user;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取导出通知信息
/// <summary>
/// 获取导出通知信息
/// </summary>
/// <param name="model">查询条件</param>
/// <returns>数据</returns>
public DataTable GetExportData(NoticeInfo model)
{
DataTable dt = null;
string sql = null;
List<DataParameter> parameters = new List<DataParameter>();
try
{
//构成查询语句
sql = GetListSQL(model, ref parameters);
sql += " ORDER BY CREATEDATE DESC";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
dt = session.GetTable(sql, parameters.ToArray());
}
dt.TableName = "NoticeInfo";
return dt;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 获取组织机构下人员列表
/// <summary>
/// 获取组织机构下人员列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>同级别菜单列表</returns>
public DataPage GetNoticeUserList(string orgaID, DataPage page)
{
List<DataParameter> parameters = new List<DataParameter>();
string sql = "";
StringBuilder sqlBuilder = new StringBuilder();
try
{
//分页关键字段及排序
page.KeyName = "USERID";
if (string.IsNullOrEmpty(page.SortExpression))
{
page.SortExpression = "UPDATEDATE DESC";
}
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sqlBuilder.Append(" SELECT A.USERID, ");
sqlBuilder.Append(" A.LOGINUSERID,A.EMPLOYEENO,A.USERNAME,A.PASSWORD,A.TEL,B.ORGADESC ");
sqlBuilder.Append(" ,A.MOBILETEL,A.EMAIL,A.CREATEUSER,A.CREATEDATE,A.UPDATEUSER,A.UPDATEDATE,A.USERTYPE ");
sqlBuilder.Append(" ,A.FLGDEL,(CASE WHEN A.ACTIVATEFLG ='0' THEN '否' else '是' end) as ACTIVATEFLG ");
sqlBuilder.Append(" FROM T_QM_USER A LEFT JOIN T_QM_ORGANIZATION B ON B.ORGAID=A.ORGANID WHERE A.FLGDEL ='0' ");
sqlBuilder.Append(" AND A.ACTIVATEFLG = '1' ");
//组织机构
if (!string.IsNullOrEmpty(orgaID))
{
sqlBuilder.Append(" AND A.ORGANID = @ORGANID");
parameters.Add(new DataParameter { ParameterName = "ORGANID", DataType = DbType.String, Value = orgaID });
}
sql =this.ChangeSqlByDB(sqlBuilder.ToString(),session);
page = session.GetDataPage<User>(sql, parameters.ToArray(), page);
}
return page;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织机构树菜单列表
/// <summary>
/// 获取所有组织机构树菜单列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>同级别菜单列表</returns>
public List<Orgaization> GetAllList()
{
List<DataParameter> parameters = new List<DataParameter>();
List<Orgaization> list = null;
string sql = null;
try
{
sql = "SELECT * FROM T_QM_ORGANIZATION WHERE FLGDEL='0'";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
list = session.GetList<Orgaization>(sql, parameters.ToArray()).ToList();
}
return list;
}
catch (Exception ex)
{
throw;
}
}
#endregion
#region 判断当前通知是否存已存在
/// <summary>
/// 判断当前通知是否存已存在
/// </summary>
/// <param name="info">信息</param>
public bool OverTimeRemindNoticeExists(NoticeInfo notice)
{
List<DataParameter> parameters = new List<DataParameter>();
int count = 0;
string sql = null;
try
{
sql = "SELECT COUNT(*) FROM T_QM_NOTICE WHERE NOTICETITLE=@NOTICETITLE AND USETIME = TO_DATE('" + notice.USETIME.ToString("yyyy-MM-dd") + "','YYYY-MM-DD')";
parameters.Add(new DataParameter { ParameterName = "NOTICETITLE", DataType = DbType.String, Value = notice.NOTICETITLE });
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
count = Convert.ToInt32(session.ExecuteSqlScalar(sql, parameters.ToArray()));
}
return count > 0;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}