using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.DAL;
using QMAPP.FJC.Entity.Message;
using QMFrameWork.Data;
namespace QMAPP.FJC.DAL.Message
{
public class MessageDAL : BaseDAL
{
///
/// 获取待发送短信信息
///
///
public List GetOutBoxList()
{
List list = new List();
string sql = "select * from OutBox ";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
list = session.GetList(sql, new List().ToArray()).ToList();
}
return list;
}
///
/// 获取发送失败短信信息
///
///
public List GetBadOutBoxList()
{
List list = new List();
string sql = "select * from badoutbox ";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
list = session.GetList(sql, new List().ToArray()).ToList();
}
return list;
}
///
/// 插入发送成功短信信息
///
///
public void InsertSendOutBox(SendOutBox entity)
{
if (BaseSession != null)
{
BaseSession.Insert(entity);
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.Insert(entity);
}
}
}
///
/// 插入发送失败短信信息
///
///
public void InsertBadOutBox(BadOutBox entity)
{
if (BaseSession != null)
{
BaseSession.Insert(entity);
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.Insert(entity);
}
}
}
///
/// 删除待发送短信信息
///
///
public void DeleteBadOutBox(BadOutBox entity)
{
if (BaseSession != null)
{
BaseSession.Delete(entity);
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.Delete(entity);
}
}
}
///
/// 插入待发送短信信息
///
///
public void InsertOutBox(OutBox entity)
{
if (BaseSession != null)
{
BaseSession.Insert(entity);
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.Insert(entity);
}
}
}
///
/// 删除待发送短信信息
///
///
public void DeleteOutBox(OutBox entity)
{
if (BaseSession != null)
{
BaseSession.Delete(entity);
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.Delete(entity);
}
}
}
}
}