ITIN_EmployeeInputService.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Data.SqlClient;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Models;
  9. namespace DAL
  10. {
  11. public class ITIN_EmployeeInputService
  12. {
  13. List<ITIN_EmployeeInputInfo> excuteSql(string sql, params SqlParameter[] param)
  14. {
  15. return ServiceBase<ITIN_EmployeeInputInfo>.excuteSql(new ITIN_EmployeeInputInfo(), "AirTicketBlackCode", sql, CommandType.Text, param);
  16. }
  17. ITIN_EmployeeInputInfo excuteType(string sql, params SqlParameter[] param)
  18. {
  19. //查询结果放入对象集合
  20. List<ITIN_EmployeeInputInfo> hdList = excuteSql(sql, param);
  21. //判断集合是否为空
  22. if (hdList == null || hdList.Count == 0)
  23. //返回null
  24. return null;
  25. //返回单个对象
  26. return hdList[0];
  27. }
  28. #region 数据添加相关函数
  29. public bool Insert_ITINEmployeeInfo(ITIN_EmployeeInputInfo _info)
  30. {
  31. string sql = " Insert Into ITINEmployee Values(@Diid,@Days,@YDate,@Sort,@Content,@Operators,@OperatorsDate,@IsDel) ";
  32. SqlParameter[] parameter = new SqlParameter[]{
  33. new SqlParameter("@Diid",_info.Diid),
  34. new SqlParameter("@Days",_info.Days),
  35. new SqlParameter("@YDate",_info.YDate),
  36. new SqlParameter("@Sort",_info.Sort),
  37. new SqlParameter("@Content",_info.Content),
  38. new SqlParameter("@Operators",_info.Operators),
  39. new SqlParameter("@OperatorsDate",_info.OperatorsDate),
  40. new SqlParameter("@IsDel",_info.IsDel),
  41. };
  42. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  43. return true;
  44. return false;
  45. }
  46. #endregion
  47. #region 数据删除相关函数
  48. public bool Delete_Single_ITIN(int id)
  49. {
  50. if (SqlHelper.ExecuteNonQuery("update ITINEmployee set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  51. return true;
  52. return false;
  53. }
  54. #endregion
  55. #region 数据修改相关函数
  56. public bool Update_Single_ITIN(ITIN_EmployeeInputInfo _info)
  57. {
  58. string sql = "update ITINEmployee Set Diid=@Diid,Days=@Days,Sort=@Sort,YDate=@YDate,Content=@Content,Operators=@Operators,OperatorsDate=@OperatorsDate,IsDel=@IsDel where Id = @Id";
  59. SqlParameter[] parameter = new SqlParameter[]{
  60. new SqlParameter("@Diid",_info.Diid),
  61. new SqlParameter("@Days",_info.Days),
  62. new SqlParameter("@YDate",_info.YDate),
  63. new SqlParameter("@Sort",_info.Sort),
  64. new SqlParameter("@Content",_info.Content),
  65. new SqlParameter("@Operators",_info.Operators),
  66. new SqlParameter("@OperatorsDate",_info.OperatorsDate),
  67. new SqlParameter("@IsDel",_info.IsDel),
  68. new SqlParameter("@Id",_info.Id),
  69. };
  70. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  71. return true;
  72. return false;
  73. }
  74. #endregion
  75. #region 数据查询相关函数
  76. public List<ITIN_EmployeeInputInfo> Select_List_ITIN(int Diid)
  77. {
  78. return excuteSql("select * from ITINEmployee where Isdel=0 and Diid=" + Diid + " order by Days,Sort");
  79. }
  80. public ITIN_EmployeeInputInfo Select_Single_ITIN(int id)
  81. {
  82. return excuteType("select * from ITINEmployee where Isdel=0 and Id=@id", new SqlParameter("@id", id));
  83. }
  84. #endregion
  85. }
  86. }