/DocSrvQuartz_V2/DocSrv.Core/DaExcelSrvStatus.cs

http://sgsoft-las.googlecode.com/ · C# · 76 lines · 59 code · 9 blank · 8 comment · 1 complexity · 89c97b7fb2adaf57368d5734cf569e02 MD5 · raw file

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Collections.ObjectModel;
  5. using System.Data;
  6. using System.Globalization;
  7. using System.Text;
  8. using System.Data.Common;
  9. using Microsoft.Practices.EnterpriseLibrary.Data;
  10. using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
  11. using DocSrv.Model;
  12. namespace DocSrv.Dal
  13. {
  14. public partial class DaExcelSrvStatus
  15. {
  16. internal const int MAX_DESCRIPTION_LEN = 500;
  17. /// <summary>
  18. /// ???????JOB????????????1.
  19. /// 0???????????1???????2??????????
  20. /// 1000--1999?????Excel????????1001??????
  21. /// </summary>
  22. /// <returns></returns>
  23. public int ClearInterruptedJobStatus()
  24. {
  25. //???????????
  26. try
  27. {
  28. return DeleteByWhereClause(" WHERE RC%10 <>0"); //????0????
  29. }
  30. catch (DbException ex)
  31. {
  32. throw new DalException("??????????????!",ex);
  33. }
  34. }
  35. public int ClearInterruptedJobStatus(int beginStatus, int endStatus)
  36. {
  37. //???????????
  38. try
  39. {
  40. return DeleteByWhereClause(String.Format(" WHERE RC>{0} AND RC<{1} ",beginStatus,endStatus));
  41. }
  42. catch (DbException ex)
  43. {
  44. throw new DalException("??????????????!", ex);
  45. }
  46. }
  47. public int ClearInterruptedExcelJobStatus()
  48. {
  49. return ClearInterruptedJobStatus(1000, 1999);
  50. }
  51. public void SafeUpdate(string file_id, int status_code, string opt_info)
  52. {
  53. try
  54. {
  55. if (opt_info.Length > MAX_DESCRIPTION_LEN)
  56. {
  57. opt_info = opt_info.Substring(0, MAX_DESCRIPTION_LEN);
  58. }
  59. Update(new MoExcelSrvStatus(file_id, status_code, DateTime.Now, opt_info));
  60. }
  61. catch (DalException ex)
  62. {
  63. log.Error(String.Format("????{0}??????.", file_id), ex);
  64. }
  65. }
  66. }
  67. }