public ContractExpiredFolderNotifier(ContractExpiredNotifiyDataManager contractExpiredNotifiyDataManager, ContractFactory factroy, int advanceDays, string notifyMails, int folderId) { this._contractExpiredNotifiyDataManager = contractExpiredNotifiyDataManager; this._factroy = factroy; this._advanceDays = advanceDays; this._notifyMails = notifyMails; this._folderId = folderId; }
public ContractExpiredNotifyService(ContractFactory factroy, int advanceDays, int notifyMetaTypeId, int contractMetaTypeId, int contractNameAttrTypeId) { this._factroy = factroy; this._advanceDays = advanceDays; _contractExpiredNotifiyDataManager = new ContractExpiredNotifiyDataManager(); this._notifyMetaTypeId = notifyMetaTypeId; this._contractMetaTypeId = contractMetaTypeId; this._contractNameAttrTypeId = contractNameAttrTypeId; }
public void Test() { ContractFactory factroy = new ContractFactory(); Contract contract = factroy.Create(1, DateTime.Now, null); contract.Update(DateTime.Now.AddDays(10)); //ContractExpireDaysCalculativeService expireDaysCalculativeService = new ContractExpireDaysCalculativeService(factroy); //string contractExpiredNodifyEmails = ""; //int advanceDays; //advanceDays = 10; //ContractExpiredNotifyService contractExpiredNotifyService = new ContractExpiredNotifyService(factroy, advanceDays, contractExpiredNodifyEmails); //expireDaysCalculativeService.Start(new Common.Log.ConsoleLog()); //contractExpiredNotifyService.Start(new Common.Log.ConsoleLog()); //Thread.Sleep(1000*5); }
public ContractExpireDaysCalculativeService(ContractFactory factroy) { _factroy = factroy; }
public ContractShujuXiuhuService(ContractFactory contractFactory) { this._contractFactory = contractFactory; }
protected override void OnInitService() { this._serviceName = "ContractExtensionService"; this.LogDirectory = AppDomain.CurrentDomain.BaseDirectory + "Logs\\YCT\\"; // TODO: 编写初始化消息服务的代码。 this._errorLog.Info(string.Format("Init Extension Service: {0}", this._serviceName)); ContractManagerHelper.Logger = this._errorLog; try { string token; ApiManager.Api.OrgnizationManagement.ImpersonateByLoginName("admin", "127.0.0.1", out token); int notifyMetaTypeId = EDoc2MetadataHelper.GetMetaTypeId(token, EDoc2MetadataHelper.CONTRACT_META_NOTIFY_NAME); this._metaTypeId = EDoc2MetadataHelper.GetMetaTypeId(token, EDoc2MetadataHelper.CONTRACT_META_NAME); EDoc2MetadataHelper.ContactMetaTypeId = this._metaTypeId; int contractNameMetaAttrId = EDoc2MetadataHelper.GetMetaAttrId(token, this._metaTypeId, EDoc2MetadataHelper.CONTRACT_META_ATTR_NAME_CONTRACT_NAME); this._expireDateMetaAttrId = EDoc2MetadataHelper.GetMetaAttrId(token, this._metaTypeId, EDoc2MetadataHelper.CONTRACT_META_ATTR_NAME_EXPIRE_DATE); EDoc2MetadataHelper.ExpireDateMetaAttrId = this._expireDateMetaAttrId; this._validMonthMetaAttrId = EDoc2MetadataHelper.GetMetaAttrId(token, this._metaTypeId, EDoc2MetadataHelper.CONTRACT_META_ATTR_NAME_VALID_MONTH); EDoc2MetadataHelper.ValidMonthMetaAttrId = this._validMonthMetaAttrId; if (this._metaTypeId == 0) { throw new Exception("找不到元数据" + EDoc2MetadataHelper.CONTRACT_META_NAME); } if (this._expireDateMetaAttrId == 0) { throw new Exception("找不到元数据属性" + EDoc2MetadataHelper.CONTRACT_META_ATTR_NAME_EXPIRE_DATE); } if (this._validMonthMetaAttrId == 0) { throw new Exception("找不到元数据属性" + EDoc2MetadataHelper.CONTRACT_META_ATTR_NAME_VALID_MONTH); } if (notifyMetaTypeId == 0) { throw new Exception("找不到元数据属性" + EDoc2MetadataHelper.CONTRACT_META_NOTIFY_NAME); } if (contractNameMetaAttrId == 0) { throw new Exception("找不到元数据属性" + EDoc2MetadataHelper.CONTRACT_META_ATTR_NAME_CONTRACT_NAME); } this._contractFactory = new ContractFactory(); this._expireDaysCalculativeService = new ContractExpireDaysCalculativeService(_contractFactory); this._expireDaysCalculativeService.Start(this._errorLog); this._errorLog.Info("Started ContractExpireDaysCalculativeService"); Thread.Sleep(1000 * 3); this._contractExpiredNotifyService = new ContractExpiredNotifyService(_contractFactory, 60, notifyMetaTypeId, this._metaTypeId, contractNameMetaAttrId); this._contractExpiredNotifyService.Start(); this._errorLog.Info("Started ContractExpiredNotifyService"); ContractShujuXiuhuService shujuXiuhuService = new ContractShujuXiuhuService(_contractFactory); shujuXiuhuService.Start(); this._errorLog.Info("Started ContractShujuXiuhuService"); _initSucceed = true; } catch(Exception ex) { _initSucceed = false; this._errorLog.Info(ex.ToString()); throw; } }