| 1234567891011121314151617181920212223242526272829 | 
							- using Comal.Classes;
 
- using InABox.Core;
 
- namespace Comal.Stores;
 
- public class JobScopeStore : BaseStore<JobScope>
 
- {
 
-     protected override void BeforeSave(JobScope entity)
 
-     {
 
-         base.BeforeSave(entity);
 
-         if (entity.ID == Guid.Empty)
 
-         {
 
-             var filter = entity.Type == JobScopeType.Contract
 
-                 ? new Filter<JobScopeStatus>(x => x.ContractDefault).IsEqualTo(true)
 
-                 : entity.Type == JobScopeType.Variation
 
-                     ? new Filter<JobScopeStatus>(x => x.VariationDefault).IsEqualTo(true)
 
-                     : new Filter<JobScopeStatus>(x => x.AdjustmentDefault).IsEqualTo(true);
 
-             var status = Provider.Query(filter,Columns.Required<JobScopeStatus>()).Rows.FirstOrDefault()?.ToObject<JobScopeStatus>();
 
-             if (status != null)
 
-                 entity.Status.CopyFrom(status);
 
-             
 
-             var tax = Provider.Query(
 
-                 new Filter<TaxCode>(x => x.Default).IsEqualTo(true)
 
-             ).Rows.FirstOrDefault()?.ToObject<TaxCode>();
 
-             if (tax != null)
 
-                 entity.TaxCode.CopyFrom(tax);
 
-         }
 
-     }
 
- }
 
 
  |