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