📄 reciveboxmake.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
namespace Com.SMS.Dal
{
/// <summary>
/// ReciveBoxMake 的摘要说明。
/// </summary>
public class ReciveBoxMake
{
/// <summary>
/// 添加收信箱记录
/// </summary>
/// <param name="rb"></param>
/// <returns></returns>
public bool Insert(Entity.ReciveBox rb)
{
SqlParameter[] parms=
{
new SqlParameter("@ReciveuserId",rb.ReciveId),
new SqlParameter("@conId",rb.ConId),
new SqlParameter("@senduserId",rb.SenduserId),
new SqlParameter("@isDel",rb.IsDel),
new SqlParameter("@isRead",rb.IsRead),
new SqlParameter("@reciveTime",DateTime.Now),
};
int i=SqlBasic.ExecuteNonQuery(SqlBasic.CONN_STRING,CommandType.Text,SqlCollections.SQL_RECIVEBOX_INSERT,parms);
if(i==1)
{
return true;
}
else
return false;
}
/// <summary>
/// 删除收信箱记录
/// </summary>
/// <param name="rId"></param>
/// <returns></returns>
public void Delete(int rId,int conId)
{
SqlConnection scon=new SqlConnection(SqlBasic.CONN_STRING);
scon.Open();
SqlTransaction trans=scon.BeginTransaction();
try
{
SqlBasic.ExecuteNonQuery(
trans,
CommandType.Text,
SqlCollections.SQL_RECIVEBOX_DELETE,
new SqlParameter("@ReciveId",rId)
);
int reader=Convert.ToInt32(
SqlBasic.ExecuteScalar(
trans,
CommandType.Text,
SqlCollections.SQL_CONTENTS_ISHAVEINSEND,
new SqlParameter("@conId",conId)
)
);
if(reader==0)
{
SqlBasic.ExecuteNonQuery(
trans,
CommandType.Text,
SqlCollections.SQL_CONTENTS_DELETE,
new SqlParameter("@conId",conId)
);
}
trans.Commit();
}
catch(Exception)
{
trans.Rollback();
}
finally
{
scon.Close();
}
}
/// <summary>
/// 根据收信人查询收到信笺
/// </summary>
/// <param name="senderId"></param>
/// <returns></returns>
public DataTable FindByReciver(int ReciveuserId)
{
DataTable dt=new DataTable();
SqlBasic.FillDatatable(SqlBasic.CONN_STRING,CommandType.Text,SqlCollections.SQL_RECIVEBOX_SELECTBYSENDER,dt,new SqlParameter("@ReciveuserId",ReciveuserId));
return dt;
}
/// <summary>
/// 根据收信人查询未读信笺
/// </summary>
/// <param name="senderId"></param>
/// <returns></returns>
public DataTable FindByReciverNotRead(int ReciveuserId)
{
DataTable dt=new DataTable();
SqlBasic.FillDatatable(SqlBasic.CONN_STRING,CommandType.Text,SqlCollections.SQL_RECIVEBOX_SELECTNOREAD,dt,new SqlParameter("@ReciveuserId",ReciveuserId));
return dt;
}
/// <summary>
/// 将信息放入回收站
/// </summary>
/// <param name="reciveId"></param>
/// <returns></returns>
public bool InsertRecycleBin(int reciveId)
{
int i=SqlBasic.ExecuteNonQuery(
SqlBasic.CONN_STRING,
CommandType.Text,
SqlCollections.SQL_RECIVEBOX_USERISDEL,
new SqlParameter("@ReciveId",reciveId)
);
if(i==1)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 读取未读信息
/// </summary>
/// <param name="reciveId"></param>
/// <returns></returns>
public bool ReadMessage(int reciveId)
{
int i=SqlBasic.ExecuteNonQuery(
SqlBasic.CONN_STRING,
CommandType.Text,
SqlCollections.SQL_RECIVEBOX_READMESSAGE,
new SqlParameter("@ReciveId",reciveId)
);
if(i==1)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 查询回收站的信息
/// </summary>
/// <param name="reciverId"></param>
/// <returns></returns>
public DataTable FindRecycleBin(int reciverId)
{
DataTable dt=new DataTable();
SqlBasic.FillDatatable(
SqlBasic.CONN_STRING,
CommandType.Text,
SqlCollections.SQL_RECIVEBOX_SELECTUSERALLNOTDEL,
dt,
new SqlParameter("@ReciveuserId",reciverId)
);
return dt;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -