Example #1
0
 public void DeleteMaintainGuarantee(MaintainGuaranteeDTO guarantee)
 {
     if (guarantee == null)
     {
         throw new Exception("保证金不能为空");
     }
     Guarantee persistGuarantee =
         _guaranteeRepository.Get(guarantee.GuaranteeId);
     if (persistGuarantee == null)
     {
         throw new Exception("找不到需要删除的保证金");
     }
     DeleteGuarantee(persistGuarantee);
 }
Example #2
0
 public void ModifyMaintainGuarantee(MaintainGuaranteeDTO guarantee)
 {
     if (guarantee == null)
     {
         throw new Exception("保证金不能为空");
     }
     var persistGuarantee =
         _guaranteeRepository.Get(guarantee.GuaranteeId) as MaintainGuarantee;
     if (persistGuarantee == null)
     {
         throw new Exception("找不到需要更新的保证金");
     }
     if (!(persistGuarantee.StartDate == guarantee.StartDate))
     {
         persistGuarantee.StartDate = guarantee.StartDate;
     }
     if (!(persistGuarantee.EndDate == guarantee.EndDate))
     {
         persistGuarantee.EndDate = guarantee.EndDate;
     }
     if (!(persistGuarantee.SupplierId.Equals(guarantee.SupplierId)))
     {
         persistGuarantee.SetSupplier(guarantee.SupplierId, guarantee.SupplierName);
     }
     if (!(persistGuarantee.Amount.Equals(guarantee.Amount)))
     {
         persistGuarantee.Amount = guarantee.Amount;
     }
     if (persistGuarantee.Reviewer != (guarantee.Reviewer))
     {
         persistGuarantee.Review(guarantee.Reviewer);
     }
     if (persistGuarantee.CurrencyId != guarantee.CurrencyId)
     {
         persistGuarantee.SetCurrency(guarantee.CurrencyId);
     }
     if (persistGuarantee.MaintainContractId != guarantee.MaintainContractId)
     {
         persistGuarantee.SetMaintainContractId(guarantee.MaintainContractId);
     }
     if (persistGuarantee.OperatorName != guarantee.OperatorName)
     {
         persistGuarantee.SetOperator(guarantee.OperatorName);
     }
     if (persistGuarantee.Status != (GuaranteeStatus) guarantee.Status)
     {
         persistGuarantee.SetGuaranteeStatus((GuaranteeStatus) guarantee.Status);
     }
     UpdateGuarantee(persistGuarantee);
 }
Example #3
0
 public void InsertMaintainGuarantee(MaintainGuaranteeDTO guarantee)
 {
     if (guarantee == null)
     {
         throw new Exception("保证金不能为空");
     }
     MaintainGuarantee newGuarantee = GuaranteeFactory.CreateMaintainGuarantee(guarantee.CreateDate,
         guarantee.EndDate,
         guarantee.Amount, guarantee.SupplierName, guarantee.OperatorName,
         guarantee.SupplierId, guarantee.CurrencyId, guarantee.MaintainContractId, guarantee.Status,
         guarantee.Reviewer);
     AddGuarantee(newGuarantee);
 }