|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Security;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using WebSqlHelper;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.EntityDA
|
|
|
|
|
{
|
|
|
|
|
public class SysAnnounceSetDA
|
|
|
|
|
{
|
|
|
|
|
private const string PARM_sys_announce_set_GID = "@gid";
|
|
|
|
|
private const string PARM_sys_announce_set_CLIENTGID = "@CLIENTGID";
|
|
|
|
|
private const string PARM_sys_announce_set_CREATE_TIME = "@create_time";
|
|
|
|
|
private const string PARM_sys_announce_set_MODIFIED_TIME = "@modified_time";
|
|
|
|
|
|
|
|
|
|
private const string SQL_SELECT_sys_announce_set_BY_CLIENTGID = "SELECT GID, CLIENTGID, CREATETIME, MODIFIEDTIME, INTERVAL ,ANNOUNCEGID,ISDELETE,DELETETIME,DELETEUSER,ISCLOSE FROM sys_announce_set WHERE CLIENTGID = @CLIENTGID and ANNOUNCEGID=@ANNOUNCEGID ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_INSERT_sys_announce_set = " INSERT sys_announce_set(GID,CLIENTGID,CREATETIME,INTERVAL,ANNOUNCEGID,ISDELETE,DELETETIME,DELETEUSER,ISCLOSE) VALUES(@gid,@CLIENTGID,GETDATE(),@INTERVAL,@ANNOUNCEGID,0,getdate(),@CLIENTGID,@ISCLOSE) ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_UPDATE_sys_announce_set = " UPDATE sys_announce_set SET MODIFIEDTIME = GETDATE(),INTERVAL = @INTERVAL WHERE CLIENTGID = @CLIENTGID ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_UPDATE_sys_announce_ISCLOSE = " UPDATE sys_announce_set SET MODIFIEDTIME = GETDATE(),ISCLOSE = @ISCLOSE WHERE GID = @GID ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_DELETE_sys_announce_set = " DELETE FROM sys_announce_set WHERE CLIENTGID = @CLIENTGID ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取SQL语句查询数据集
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取SQL语句查询数据集
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strSql"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataSet GetExcuteSql(string strSql)
|
|
|
|
|
{
|
|
|
|
|
DataSet tempSet = new DataSet();
|
|
|
|
|
|
|
|
|
|
tempSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
|
|
|
|
|
return tempSet;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 返回公告类型条数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 返回公告类型条数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strUserID">用户GID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public String GetTYPENUM(string strUserID)
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string inum = "0";
|
|
|
|
|
inum = T_ALL_DA.GetStrSQL("inum", "SELECT count(*) as inum FROM sys_announce_set WHERE CLIENTGID ='" + strUserID + "'");
|
|
|
|
|
return inum;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除客户消息设置信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempCLIENTGID">客户GID</param>
|
|
|
|
|
/// <returns>值1表示删除成功 值不等于1表示删除失败</returns>
|
|
|
|
|
public int DeleteUserMsgSetting(string tempCLIENTGID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_sys_announce_set_CLIENTGID, SqlDbType.VarChar, 36);
|
|
|
|
|
parm.Value = tempCLIENTGID;
|
|
|
|
|
|
|
|
|
|
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, SQL_DELETE_sys_announce_set, parm);
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常失败
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除客户消息设置信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempCLIENTGID">客户GID</param>
|
|
|
|
|
/// <returns>值1表示删除成功 值不等于1表示删除失败</returns>
|
|
|
|
|
public int DeleteGID(string strSQLDEL)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, strSQLDEL, null);
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常失败
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 通过客户GID获取客户设置参数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过客户GID获取客户设置参数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempCLIENTGID">客户GID</param>
|
|
|
|
|
/// <returns>返回实体类客户消息参数</returns>
|
|
|
|
|
public SysAnnounceSetEntity GetUserMsgSettingByCLIENTGID(string tempCLIENTGID, string strANNOUNCEGID)
|
|
|
|
|
{
|
|
|
|
|
SysAnnounceSetEntity userMsgSettingEntity = null;
|
|
|
|
|
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_sys_announce_set_CLIENTGID, SqlDbType.VarChar, 36);
|
|
|
|
|
parm.Value = tempCLIENTGID;
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter("@CLIENTGID", SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter("@ANNOUNCEGID", SqlDbType.VarChar, 36)
|
|
|
|
|
};
|
|
|
|
|
parms[0].Value = tempCLIENTGID;
|
|
|
|
|
parms[1].Value = strANNOUNCEGID;
|
|
|
|
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_sys_announce_set_BY_CLIENTGID, parms))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (sqlRead.Read())
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity = new SysAnnounceSetEntity();
|
|
|
|
|
if (!sqlRead.IsDBNull(0))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.GID = sqlRead.GetString(0);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(1))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.CLIENTGID = sqlRead.GetString(1);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(2))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.CreateTime = sqlRead.GetDateTime(2);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(3))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.ModifiedTime = sqlRead.GetDateTime(3);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(4))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.InterVal = sqlRead.GetInt32(4);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(5))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.ANNOUNCEGID = sqlRead.GetString(5);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(6))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.ISDELETE = sqlRead.GetBoolean(6);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.DELETETIME = sqlRead.GetDateTime(7);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(8))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.DELETEUSER = sqlRead.GetString(8);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
userMsgSettingEntity.ISCLOSE = sqlRead.GetBoolean(7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return userMsgSettingEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 插入客户消息设置信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 插入客户消息设置信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempUserMsgSettingEntity">客户信息设置实体类</param>
|
|
|
|
|
/// <returns>值1表示插入成功 值不等于1表示插入失败</returns>
|
|
|
|
|
public int InsertUserMsgSetting(SysAnnounceSetEntity tempUserMsgSettingEntity)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter(PARM_sys_announce_set_GID, SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter(PARM_sys_announce_set_CLIENTGID, SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter("@INTERVAL",SqlDbType.Int),
|
|
|
|
|
new SqlParameter("@ANNOUNCEGID", SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter("@DELETEUSER", SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter("@ISCLOSE", SqlDbType.Bit)
|
|
|
|
|
};
|
|
|
|
|
parms[0].Value = tempUserMsgSettingEntity.GID;
|
|
|
|
|
parms[1].Value = tempUserMsgSettingEntity.CLIENTGID;
|
|
|
|
|
parms[2].Value = tempUserMsgSettingEntity.InterVal;
|
|
|
|
|
parms[3].Value = tempUserMsgSettingEntity.ANNOUNCEGID;
|
|
|
|
|
parms[4].Value = tempUserMsgSettingEntity.DELETEUSER;
|
|
|
|
|
parms[5].Value = tempUserMsgSettingEntity.ISCLOSE;
|
|
|
|
|
|
|
|
|
|
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, SQL_INSERT_sys_announce_set, parms);
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exceError)
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常失败
|
|
|
|
|
//抛出异常
|
|
|
|
|
throw exceError;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
sqlConnection.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 更新客户已读设置
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新客户消息设置信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempUserMsgSettingEntity">客户信息设置实体类</param>
|
|
|
|
|
/// <returns>值1表示更新成功 值不等于1表示更新失败</returns>
|
|
|
|
|
public int UpdateUserMsgISCLOSE(SysAnnounceSetEntity tempUserMsgSettingEntity)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter("@GID", SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter("@ISCLOSE",SqlDbType.Bit)
|
|
|
|
|
};
|
|
|
|
|
parms[0].Value = tempUserMsgSettingEntity.GID;
|
|
|
|
|
parms[1].Value = tempUserMsgSettingEntity.ISCLOSE;
|
|
|
|
|
|
|
|
|
|
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, SQL_UPDATE_sys_announce_ISCLOSE, parms);
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exceError)
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常失败
|
|
|
|
|
//抛出异常
|
|
|
|
|
throw exceError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 更新客户消息设置信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新客户消息设置信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempUserMsgSettingEntity">客户信息设置实体类</param>
|
|
|
|
|
/// <returns>值1表示更新成功 值不等于1表示更新失败</returns>
|
|
|
|
|
public int UpdateUserMsgSetting(SysAnnounceSetEntity tempUserMsgSettingEntity)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter(PARM_sys_announce_set_CLIENTGID, SqlDbType.VarChar, 36),
|
|
|
|
|
new SqlParameter("@INTERVAL",SqlDbType.Int)
|
|
|
|
|
};
|
|
|
|
|
parms[0].Value = tempUserMsgSettingEntity.CLIENTGID;
|
|
|
|
|
parms[1].Value = tempUserMsgSettingEntity.InterVal;
|
|
|
|
|
|
|
|
|
|
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, SQL_UPDATE_sys_announce_set, parms);
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常失败
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|