/EQT_V2/EQT/EQT.DAL/DaTestRecord.cs

http://sgsoft-las.googlecode.com/ · C# · 57 lines · 42 code · 7 blank · 8 comment · 4 complexity · 0c1cfa83d6161928cc0bb58b715af3f2 MD5 · raw file

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Globalization;
  6. using System.Text;
  7. using System.Xml;
  8. using System.Data.Common;
  9. using Microsoft.Practices.EnterpriseLibrary.Data;
  10. using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
  11. //using Microsoft.Practices.EnterpriseLibrary.Logging;
  12. using EQT.Model;
  13. //using IDataLayer;
  14. namespace EQT.Dal
  15. {
  16. public partial class DaTestRecord
  17. {
  18. /// <summary>
  19. /// ????????.
  20. /// </summary>
  21. /// <param name="motf">??????</param>
  22. /// <param name="motr">??????</param>
  23. /// <returns></returns>
  24. public int AddTestRecordFile(MoTfiles motf, MoTestRecord motr)
  25. {
  26. if (motf == null || motr == null) return 0;
  27. int rc = 0;
  28. using (DbConnection conn = db.CreateConnection())
  29. {
  30. try
  31. {
  32. conn.Open();
  33. using (DbTransaction trans = conn.BeginTransaction())
  34. {
  35. rc+= Add(motr, trans);
  36. DaTfiles da = new DaTfiles(db);
  37. rc+= da.Add(motf, trans);
  38. trans.Commit();
  39. }
  40. conn.Close();
  41. }
  42. catch (DbException ex)
  43. {
  44. HandleDbException(ex);
  45. }
  46. }
  47. return rc;
  48. }
  49. }
  50. }