public void Update(int ID, BidEntity Bid) { var entity = this._DB.Get(ID); entity.SetEntity(Bid); this._DB.Edit(entity); // 创建系统提醒 CreateOrRemoveNotify(Bid); }
public int Add(BidInfo Bid) { var entity = new BidEntity(Bid); entity.IsDelete = false; this._DB.Add(entity); // 创建系统提醒 CreateOrRemoveNotify(entity); return(entity.ID); }
public void SetEntity(BidEntity Entity) { this.Name = Entity.Name; this.Manager = Entity.Manager; this.CustomerID = Entity.CustomerID; this.PersonID = Entity.PersonID; this.Agency = Entity.Agency; this.BidStatus = Entity.BidStatus; this.ServiceFee = Entity.ServiceFee; this.BidFee = Entity.BidFee; this.DepositFee = Entity.DepositFee; this.DepositFeeStatus = Entity.DepositFeeStatus; this.LimitFee = Entity.LimitFee; this.IsTentative = Entity.IsTentative; this.BidDate = Entity.BidDate; this.SuccessfulBidDate = Entity.SuccessfulBidDate; this.Note = Entity.Note; }
/// <summary> /// 创建系统提醒 /// </summary> /// <param name="entity"></param> private void CreateOrRemoveNotify(BidEntity entity) { // 如果有应退的担保金,且担保金状态为未退,则创建一个系统提醒 if (entity.DepositFeeStatus == (int)DepositFeeStatus.未退 && entity.DepositFee - entity.ServiceFee > 0) { var notifys = _INotificationService.Get("Bid", entity.ID, "ReturnFee"); var effectNotifys = notifys.Where(n => !n.InvalidDate.HasValue || n.InvalidDate > DateTime.Now); // 如果该招投标没有提醒或者所有的提醒已经过期 if (notifys.Count == 0 || effectNotifys.Count() == 0) { _INotificationService.Add(new NotificationInfo() { CreateDate = DateTime.Now, EffectDate = DateTime.Now, // 生效日期 Title = string.Format("招投标项目:{0}的应退担保金:¥{1}未退回", entity.Name, entity.DepositFee - entity.ServiceFee), Info = "", ReceiveUser = entity.Manager, SendUser = 0, SourceID = entity.ID, SourceName = "Bid", SourceTag = "ReturnFee", }); } else if (effectNotifys.Count() == 1) { // 如果已经有一个生效的提醒,则更新提醒的接受人和标题 var notify = effectNotifys.First(); notify.Title = string.Format("招投标项目:{0}的应退担保金:¥{1}未退回", entity.Name, entity.DepositFee - entity.ServiceFee); notify.ReceiveUser = entity.Manager; _INotificationService.Update(notify); } } else { // 应退的保证金如果已退 _INotificationService.Delete("Bid", entity.ID, "ReturnFee"); } }
public void Update(int ID, BidEntity Entity) { this._IBidService.Update(ID, Entity); }