WM_SaleDetailsService.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using LeaRun.Application.Entity.WarehouseManage;
  2. using LeaRun.Data;
  3. using LeaRun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Data.SqlClient;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. //using
  12. namespace LeaRun.Application.Service.WarehouseManage
  13. {
  14. public class WM_SaleDetailsService
  15. {
  16. private SqlHelper sqlHelper = new SqlHelper("InstallDB");
  17. public IEnumerable<WM_SaleDetailsEntity> getDetailList() {
  18. try
  19. {
  20. string sql = "select * from dbo.WM_SaleDetails";
  21. DataTable dt = sqlHelper.ExecuteDataTable(sql,CommandType.Text,null);
  22. return DataHelper.DataTableToT<WM_SaleDetailsEntity>(dt);
  23. }
  24. catch (Exception)
  25. {
  26. throw;
  27. }
  28. }
  29. //TODO 获取登录用户的公共方法
  30. public int InsertSalesDetailsEntity(WM_SaleDetailsEntity entity) {
  31. string sql = @" INSERT INTO WM_SaleDetails(WarehouseId,GoodId,DeliveryNum,PayPrice,CostPrice,OrderAccount,CreateDt,UpdateDt,Operator,OrderNum)VALUES(@WarehouseId,@GoodId,@DeliveryNum,@PayPrice,@CostPrice,@OrderAccount,@CreateDt,@UpdateDt,@Operator,@OrderNum)";
  32. List<SqlParameter> list=new List<SqlParameter>();
  33. list.Add(new SqlParameter("@WarehouseId",entity.WarehouseId));
  34. list.Add(new SqlParameter("@GoodId",entity.GoodId));
  35. list.Add(new SqlParameter("@DeliveryNum", entity.DeliveryNum));
  36. list.Add(new SqlParameter("@PayPrice", entity.PayPrice));
  37. list.Add(new SqlParameter("@CostPrice", entity.CostPrice));
  38. list.Add(new SqlParameter("@OrderAccount", entity.OrderAccount));
  39. list.Add(new SqlParameter("@CreateDt", DateTime.Now));
  40. list.Add(new SqlParameter("@UpdateDt", DateTime.Now));
  41. list.Add(new SqlParameter("@Operator", "System"));
  42. list.Add(new SqlParameter("@OrderNum", entity.OrderNum));
  43. int n = sqlHelper.ExecuteNonQuery(sql,CommandType.Text,list.ToArray());
  44. return n;
  45. }
  46. }
  47. }