using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;
using System.Data.SqlClient;
using System.Data;
namespace DAL
{
///
/// 信用卡账单访问层
///
public class BillInfoService
{
///
/// 新增
///
/// 对象
public bool AddBill(BillInfo b)
{
string sql = "INSERT INTO BillInfo(TransDate,PostDate,Description,Amount,Currency,IsDel)VALUES(@TransDate,@PostDate,@Description,@Amount,@Currency,0)";
SqlParameter[] parameter = new SqlParameter[]{
new SqlParameter("@TransDate",b.TransDate),
new SqlParameter("@PostDate",b.PostDate),
new SqlParameter("@Description",b.Description),
new SqlParameter("@Amount",b.Amount),
new SqlParameter("@Currency",b.Currency)
};
if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
return true;
return false;
}
///
/// 获取全部未付款数据 - 分页
///
///
public List GetAll(int pageIndex, out int sumPage, out int totalRecord)
{
string sqlwhere = "IsDel =0 and Description<>''";
return PageBase.excutePageSql(new BillInfo(), "BillInfo", "BillInfo", "*", "id desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
}
///
/// 删除不处理的信用卡信息
///
///
public void DelBill(int id)
{
SqlHelper.ExecuteNonQuery("delete from billinfo", CommandType.Text, null);
}
}
}