BillInfoService.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Models;
  6. using System.Data.SqlClient;
  7. using System.Data;
  8. namespace DAL
  9. {
  10. /// <summary>
  11. /// 信用卡账单访问层
  12. /// </summary>
  13. public class BillInfoService
  14. {
  15. /// <summary>
  16. /// 新增
  17. /// </summary>
  18. /// <param name="sdt">对象</param>
  19. public bool AddBill(BillInfo b)
  20. {
  21. string sql = "INSERT INTO BillInfo(TransDate,PostDate,Description,Amount,Currency,IsDel)VALUES(@TransDate,@PostDate,@Description,@Amount,@Currency,0)";
  22. SqlParameter[] parameter = new SqlParameter[]{
  23. new SqlParameter("@TransDate",b.TransDate),
  24. new SqlParameter("@PostDate",b.PostDate),
  25. new SqlParameter("@Description",b.Description),
  26. new SqlParameter("@Amount",b.Amount),
  27. new SqlParameter("@Currency",b.Currency)
  28. };
  29. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  30. return true;
  31. return false;
  32. }
  33. /// <summary>
  34. /// 获取全部未付款数据 - 分页
  35. /// </summary>
  36. /// <returns></returns>
  37. public List<BillInfo> GetAll(int pageIndex, out int sumPage, out int totalRecord)
  38. {
  39. string sqlwhere = "IsDel =0 and Description<>''";
  40. return PageBase<BillInfo>.excutePageSql(new BillInfo(), "BillInfo", "BillInfo", "*", "id desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
  41. }
  42. /// <summary>
  43. /// 删除不处理的信用卡信息
  44. /// </summary>
  45. /// <param name="id"></param>
  46. public void DelBill(int id)
  47. {
  48. SqlHelper.ExecuteNonQuery("delete from billinfo", CommandType.Text, null);
  49. }
  50. }
  51. }