Fin_CommissionService.cs 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using Models;
  2. using OASystem.Domain.Entities.Groups;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Data.SqlClient;
  7. using System.Linq;
  8. using System.Reflection;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace DAL
  12. {
  13. /// <summary>
  14. /// 新提成表DAL
  15. /// </summary>
  16. public class Fin_CommissionService
  17. {
  18. SqlHelperOA2023 DB=new SqlHelperOA2023();
  19. /// <summary>
  20. /// 查找所有数据
  21. /// </summary>
  22. /// <param name="Personnel"></param>
  23. /// <param name="startDate"></param>
  24. /// <param name="EndDate"></param>
  25. /// <returns></returns>
  26. public DataTable GetAll(int Personnel, string startDate, string EndDate)
  27. {
  28. string sqlwhere = "select * from Fin_Commission where IsDel = 0 and Personnel = " + Personnel + " and(GroupDate Between '" + startDate + "' and '" + EndDate + "')";
  29. return SqlHelperOA2023.QueryAll(sqlwhere);
  30. }
  31. /// <summary>
  32. /// 增
  33. /// </summary>
  34. /// <param name="com"></param>
  35. /// <returns></returns>
  36. public bool add(Fin_Commission com)
  37. {
  38. string sql = "insert into Fin_Commission values(@Personnel,@Diid,@GroupDate,@GroupLvl,@Detail,@Money,@WageYearMonth,@IsMakeLoss,@IsLoss,@CreateUserId," +
  39. "@CreateTime,@DeleteUserId,@DeleteTime,@Remark,@IsDel);SELECT @@IDENTITY";
  40. SqlParameter[] parameter = new SqlParameter[]{
  41. new SqlParameter("Personnel",com.Personnel),
  42. new SqlParameter("Diid",com.Diid),
  43. new SqlParameter("GroupDate",com.GroupDate),
  44. new SqlParameter("GroupLvl",com.GroupLvl),
  45. new SqlParameter("Detail",com.Detail),
  46. new SqlParameter("Money",com.Money),
  47. new SqlParameter("WageYearMonth",com.WageYearMonth),
  48. new SqlParameter("IsMakeLoss",com.IsMakeLoss),
  49. new SqlParameter("IsLoss",com.IsLoss),
  50. new SqlParameter("CreateUserId",com.CreateUserId),
  51. new SqlParameter("CreateTime",com.CreateTime),
  52. new SqlParameter("DeleteUserId",com.DeleteUserId),
  53. new SqlParameter("DeleteTime",com.DeleteTime),
  54. new SqlParameter("Remark",com.Remark),
  55. new SqlParameter("IsDel",com.IsDel)
  56. };
  57. if (SqlHelperOA2023.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  58. return true;
  59. return false;
  60. }
  61. public bool del(int id)
  62. {
  63. if (SqlHelperOA2023.ExecuteNonQuery("update Fin_Commission set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  64. return true;
  65. return false;
  66. }
  67. /// <summary>
  68. /// 查找所有数据
  69. /// </summary>
  70. /// <param name="Personnel"></param>
  71. /// <param name="startDate"></param>
  72. /// <param name="EndDate"></param>
  73. /// <returns></returns>
  74. public DataTable GetByYear(int Personnel, string startDate, string EndDate,string YearMonth)
  75. {
  76. string sqlWhere = "";
  77. if (YearMonth!="全部")
  78. {
  79. sqlWhere += "and WageYearMonth = '" + YearMonth + "' ";
  80. }
  81. if (!string.IsNullOrWhiteSpace(startDate) && !string.IsNullOrWhiteSpace(EndDate))
  82. {
  83. sqlWhere+= "and(GroupDate Between '" + startDate + "' and '" + EndDate + "')";
  84. }
  85. string sqlwhere = "select * from Fin_Commission where IsDel = 0 "+ sqlWhere + " and Personnel = " + Personnel;
  86. return SqlHelperOA2023.QueryAll(sqlwhere);
  87. }
  88. }
  89. }