MachineMaterialMstDal.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Cksoft.Data;
  2. using DllEapEntity.OFILM;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. namespace DllEapDal.OFILM
  8. {
  9. public class MachineMaterialMstDal
  10. {
  11. public IDatabase CurrDb { get; set; }
  12. public MachineMaterialMstDal(IDatabase db)
  13. {
  14. CurrDb = db;
  15. }
  16. public int Insert(MachineMaterialMst mst, ref string errorinfo)
  17. {
  18. var res = CurrDb.InsertFor(mst, string.Empty);
  19. if (res > 0)
  20. {
  21. var sql = "select @@identity;";
  22. return Convert.ToInt32(CurrDb.FindList<string>(sql).FirstOrDefault() ?? "-1");
  23. }
  24. return -1;
  25. }
  26. public IEnumerable<MachineMaterialMst> Get(string filter,ref string errorinfo)
  27. {
  28. return CurrDb.FindListForCondition<MachineMaterialMst>(filter, ref errorinfo);
  29. }
  30. public int Update(MachineMaterialMst mst)
  31. {
  32. return CurrDb.UpdateFor(mst, string.Empty);
  33. }
  34. }
  35. }