示例#1
0
 public virtual bool DeepSave(TransactionManager mgr, Entity entity, DeepSaveType deepSaveType, params Type[] childTypes)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity", "The argument entity, can not be null.");
     }
     if (!Enum.IsDefined(typeof(DeepSaveType), deepSaveType))
     {
         throw new ArgumentNullException("A valid DeepSaveType option is not present.", "deepSaveType");
     }
     if (childTypes == null)
     {
         throw new ArgumentNullException("childTypes", "A valid Type[] array is not present.");
     }
     if (deepSaveType != DeepSaveType.Ignore)
     {
         ChildEntityTypesList innerList = new ChildEntityTypesList();
         for (int i = 0; i < childTypes.Length; i++)
         {
             if (childTypes[i] != null)
             {
                 if (!childTypes[i].IsGenericType)
                 {
                     innerList.Add(childTypes[i].Name);
                 }
                 else
                 {
                     innerList.Add(string.Format("List<{0}>", childTypes[i].GetGenericArguments()[0].Name));
                 }
             }
         }
         this.DeepSave(mgr, entity, deepSaveType, childTypes, innerList);
     }
     return(true);
 }
示例#2
0
        internal virtual bool DeepSave(TransactionManager mgr, TList <Entity> entities, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
        {
            if (entities == null)
            {
                throw new ArgumentNullException("entityCollection", "A valid non-null, TList<Entity> object is not present.");
            }
            if (!Enum.IsDefined(typeof(DeepSaveType), deepSaveType))
            {
                throw new ArgumentException("A valid DeepSaveType option is not present.", "deepSaveType");
            }
            if (childTypes == null)
            {
                throw new ArgumentNullException("childTypes", "A valid Type[] array is not present.");
            }
            if (deepSaveType == DeepSaveType.Ignore)
            {
                return(true);
            }
            bool flag = true;

            if (innerList == null)
            {
                innerList = new ChildEntityTypesList();
                for (int i = 0; i < childTypes.Length; i++)
                {
                    if (childTypes[i] != null)
                    {
                        if (!childTypes[i].IsGenericType)
                        {
                            innerList.Add(childTypes[i].Name);
                        }
                        else
                        {
                            innerList.Add(string.Format("List<{0}>", childTypes[i].GetGenericArguments()[0].Name));
                        }
                    }
                }
            }
            foreach (Entity local in entities)
            {
                if (!this.DeepSave(mgr, local, deepSaveType, childTypes, innerList))
                {
                    flag = false;
                }
            }
            foreach (Entity local in entities.DeletedItems)
            {
                if (!this.DeepSave(mgr, local, deepSaveType, childTypes, innerList))
                {
                    flag = false;
                }
            }
            entities.DeletedItems.Clear();
            return(flag);
        }
示例#3
0
 internal override bool DeepSave(TransactionManager transactionManager, Trouble entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "InspectSituation", "InspectSituationIDSource", deepSaveType, innerList) && (entity.InspectSituationIDSource != null))
     {
         DataRepository.InspectSituationProvider.Save(transactionManager, entity.InspectSituationIDSource);
         entity.InspectSituationID = entity.InspectSituationIDSource.InspectSituationID;
     }
     this.Save(transactionManager, entity);
     return(true);
 }
示例#4
0
 internal override void DeepLoad(TransactionManager transactionManager, Material entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if ((entity != null) && base.CanDeepLoad(entity, "List<ContractMaterial>", "ContractMaterialCollection", deepLoadType, innerList))
     {
         entity.ContractMaterialCollection = DataRepository.ContractMaterialProvider.GetByMaterialCode(transactionManager, new int?(entity.MaterialCode));
         if (deep && (entity.ContractMaterialCollection.Count > 0))
         {
             DataRepository.ContractMaterialProvider.DeepLoad(transactionManager, entity.ContractMaterialCollection, deep, deepLoadType, childTypes, innerList);
         }
     }
 }
 internal override void DeepLoad(TransactionManager transactionManager, PaymentItem entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity != null)
     {
         object[] pkItems;
         if (base.CanDeepLoad(entity, "ContractCost", "ContractCostCodeSource", deepLoadType, innerList) && (entity.ContractCostCodeSource == null))
         {
             pkItems = new object[] { entity.ContractCostCode ?? string.Empty };
             ContractCost cost = EntityManager.LocateEntity <ContractCost>(EntityLocator.ConstructKeyFromPkItems(typeof(ContractCost), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (cost != null)
             {
                 entity.ContractCostCodeSource = cost;
             }
             else
             {
                 entity.ContractCostCodeSource = DataRepository.ContractCostProvider.GetByContractCostCode(entity.ContractCostCode ?? string.Empty);
             }
             if (deep && (entity.ContractCostCodeSource != null))
             {
                 DataRepository.ContractCostProvider.DeepLoad(transactionManager, entity.ContractCostCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "Payment", "PaymentCodeSource", deepLoadType, innerList) && (entity.PaymentCodeSource == null))
         {
             pkItems = new object[] { entity.PaymentCode ?? string.Empty };
             Payment payment = EntityManager.LocateEntity <Payment>(EntityLocator.ConstructKeyFromPkItems(typeof(Payment), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (payment != null)
             {
                 entity.PaymentCodeSource = payment;
             }
             else
             {
                 entity.PaymentCodeSource = DataRepository.PaymentProvider.GetByPaymentCode(entity.PaymentCode ?? string.Empty);
             }
             if (deep && (entity.PaymentCodeSource != null))
             {
                 DataRepository.PaymentProvider.DeepLoad(transactionManager, entity.PaymentCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<PayoutItem>", "PayoutItemCollection", deepLoadType, innerList))
         {
             entity.PayoutItemCollection = DataRepository.PayoutItemProvider.GetByPaymentItemCode(transactionManager, entity.PaymentItemCode);
             if (deep && (entity.PayoutItemCollection.Count > 0))
             {
                 DataRepository.PayoutItemProvider.DeepLoad(transactionManager, entity.PayoutItemCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
     }
 }
示例#6
0
 internal override bool DeepSave(TransactionManager transactionManager, PayoutItem entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "Payout", "PayoutCodeSource", deepSaveType, innerList) && (entity.PayoutCodeSource != null))
     {
         DataRepository.PayoutProvider.Save(transactionManager, entity.PayoutCodeSource);
         entity.PayoutCode = entity.PayoutCodeSource.PayoutCode;
     }
     if (base.CanDeepSave(entity, "PaymentItem", "PaymentItemCodeSource", deepSaveType, innerList) && (entity.PaymentItemCodeSource != null))
     {
         DataRepository.PaymentItemProvider.Save(transactionManager, entity.PaymentItemCodeSource);
         entity.PaymentItemCode = entity.PaymentItemCodeSource.PaymentItemCode;
     }
     this.Save(transactionManager, entity);
     return(true);
 }
 internal override bool DeepSave(TransactionManager transactionManager, MaterialPurchas entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "Project", "ProjectCodeSource", deepSaveType, innerList) && (entity.ProjectCodeSource != null))
     {
         DataRepository.ProjectProvider.Save(transactionManager, entity.ProjectCodeSource);
         entity.ProjectCode = entity.ProjectCodeSource.ProjectCode;
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<MaterialPurchasDtl>", "MaterialPurchasDtlCollection", deepSaveType, innerList))
     {
         foreach (MaterialPurchasDtl dtl in entity.MaterialPurchasDtlCollection)
         {
             dtl.MaterialPurchasID = new int?(entity.MaterialPurchasID);
         }
         if ((entity.MaterialPurchasDtlCollection.Count > 0) || (entity.MaterialPurchasDtlCollection.DeletedItems.Count > 0))
         {
             DataRepository.MaterialPurchasDtlProvider.DeepSave(transactionManager, entity.MaterialPurchasDtlCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
示例#8
0
 internal override bool DeepSave(TransactionManager transactionManager, Project entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<MaterialPurchas>", "MaterialPurchasCollection", deepSaveType, innerList))
     {
         foreach (MaterialPurchas purchas in entity.MaterialPurchasCollection)
         {
             purchas.ProjectCode = entity.ProjectCode;
         }
         if ((entity.MaterialPurchasCollection.Count > 0) || (entity.MaterialPurchasCollection.DeletedItems.Count > 0))
         {
             DataRepository.MaterialPurchasProvider.DeepSave(transactionManager, entity.MaterialPurchasCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<Payout>", "PayoutCollection", deepSaveType, innerList))
     {
         foreach (Payout payout in entity.PayoutCollection)
         {
             payout.ProjectCode = entity.ProjectCode;
         }
         if ((entity.PayoutCollection.Count > 0) || (entity.PayoutCollection.DeletedItems.Count > 0))
         {
             DataRepository.PayoutProvider.DeepSave(transactionManager, entity.PayoutCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<Contract>", "ContractCollection", deepSaveType, innerList))
     {
         foreach (Contract contract in entity.ContractCollection)
         {
             contract.ProjectCode = entity.ProjectCode;
         }
         if ((entity.ContractCollection.Count > 0) || (entity.ContractCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractProvider.DeepSave(transactionManager, entity.ContractCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<InspectSituation>", "InspectSituationCollection", deepSaveType, innerList))
     {
         foreach (InspectSituation situation in entity.InspectSituationCollection)
         {
             situation.ProjectCode = entity.ProjectCode;
         }
         if ((entity.InspectSituationCollection.Count > 0) || (entity.InspectSituationCollection.DeletedItems.Count > 0))
         {
             DataRepository.InspectSituationProvider.DeepSave(transactionManager, entity.InspectSituationCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<Payment>", "PaymentCollection", deepSaveType, innerList))
     {
         foreach (Payment payment in entity.PaymentCollection)
         {
             payment.ProjectCode = entity.ProjectCode;
         }
         if ((entity.PaymentCollection.Count > 0) || (entity.PaymentCollection.DeletedItems.Count > 0))
         {
             DataRepository.PaymentProvider.DeepSave(transactionManager, entity.PaymentCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
 internal override void DeepLoad(TransactionManager transactionManager, ContractBill entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if ((entity != null) && (base.CanDeepLoad(entity, "Contract", "ContractCodeSource", deepLoadType, innerList) && (entity.ContractCodeSource == null)))
     {
         object[] pkItems  = new object[] { entity.ContractCode ?? string.Empty };
         Contract contract = EntityManager.LocateEntity <Contract>(EntityLocator.ConstructKeyFromPkItems(typeof(Contract), pkItems), DataRepository.Provider.EnableEntityTracking);
         if (contract != null)
         {
             entity.ContractCodeSource = contract;
         }
         else
         {
             entity.ContractCodeSource = DataRepository.ContractProvider.GetByContractCode(entity.ContractCode ?? string.Empty);
         }
         if (deep && (entity.ContractCodeSource != null))
         {
             DataRepository.ContractProvider.DeepLoad(transactionManager, entity.ContractCodeSource, deep, deepLoadType, childTypes, innerList);
         }
     }
 }
示例#10
0
 internal abstract bool DeepSave(TransactionManager mgr, Entity entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList);
示例#11
0
 internal void DeepLoad(TransactionManager mgr, TList <Entity> entities, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entities == null)
     {
         throw new ArgumentNullException("entities", "A valid non-null, TList<Entity> object is not present.");
     }
     if (!Enum.IsDefined(typeof(DeepLoadType), deepLoadType))
     {
         throw new ArgumentException("A valid DeepLoadType option is not present.", deepLoadType.ToString());
     }
     if (childTypes == null)
     {
         throw new ArgumentNullException("childTypes", "A valid Type[] array is not present.");
     }
     if (deepLoadType != DeepLoadType.Ignore)
     {
         foreach (Entity local in entities)
         {
             this.DeepLoad(mgr, local, deep, deepLoadType, childTypes, innerList);
             innerList.Keys.Remove(local.EntityTrackingKey);
         }
     }
 }
示例#12
0
 internal abstract void DeepLoad(TransactionManager mgr, Entity entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList);
示例#13
0
 internal override bool DeepSave(TransactionManager transactionManager, Contract entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "Project", "ProjectCodeSource", deepSaveType, innerList) && (entity.ProjectCodeSource != null))
     {
         DataRepository.ProjectProvider.Save(transactionManager, entity.ProjectCodeSource);
         entity.ProjectCode = entity.ProjectCodeSource.ProjectCode;
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<ContractCost>", "ContractCostCollection", deepSaveType, innerList))
     {
         foreach (ContractCost cost in entity.ContractCostCollection)
         {
             cost.ContractCode = entity.ContractCode;
         }
         if ((entity.ContractCostCollection.Count > 0) || (entity.ContractCostCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractCostProvider.DeepSave(transactionManager, entity.ContractCostCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<Payment>", "PaymentCollection", deepSaveType, innerList))
     {
         foreach (Payment payment in entity.PaymentCollection)
         {
             payment.ContractCode = entity.ContractCode;
         }
         if ((entity.PaymentCollection.Count > 0) || (entity.PaymentCollection.DeletedItems.Count > 0))
         {
             DataRepository.PaymentProvider.DeepSave(transactionManager, entity.PaymentCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<ContractChange>", "ContractChangeCollection", deepSaveType, innerList))
     {
         foreach (ContractChange change in entity.ContractChangeCollection)
         {
             change.ContractCode = entity.ContractCode;
         }
         if ((entity.ContractChangeCollection.Count > 0) || (entity.ContractChangeCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractChangeProvider.DeepSave(transactionManager, entity.ContractChangeCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<ContractCostPlan>", "ContractCostPlanCollection", deepSaveType, innerList))
     {
         foreach (ContractCostPlan plan in entity.ContractCostPlanCollection)
         {
             plan.ContractCode = entity.ContractCode;
         }
         if ((entity.ContractCostPlanCollection.Count > 0) || (entity.ContractCostPlanCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractCostPlanProvider.DeepSave(transactionManager, entity.ContractCostPlanCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<ContractBill>", "ContractBillCollection", deepSaveType, innerList))
     {
         foreach (ContractBill bill in entity.ContractBillCollection)
         {
             bill.ContractCode = entity.ContractCode;
         }
         if ((entity.ContractBillCollection.Count > 0) || (entity.ContractBillCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractBillProvider.DeepSave(transactionManager, entity.ContractBillCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<ContractAccount>", "ContractAccountCollection", deepSaveType, innerList))
     {
         foreach (ContractAccount account in entity.ContractAccountCollection)
         {
             account.ContractCode = entity.ContractCode;
         }
         if ((entity.ContractAccountCollection.Count > 0) || (entity.ContractAccountCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractAccountProvider.DeepSave(transactionManager, entity.ContractAccountCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<ContractMaterial>", "ContractMaterialCollection", deepSaveType, innerList))
     {
         foreach (ContractMaterial material in entity.ContractMaterialCollection)
         {
             material.ContractCode = entity.ContractCode;
         }
         if ((entity.ContractMaterialCollection.Count > 0) || (entity.ContractMaterialCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractMaterialProvider.DeepSave(transactionManager, entity.ContractMaterialCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
示例#14
0
 internal override void DeepLoad(TransactionManager transactionManager, Contract entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity != null)
     {
         if (base.CanDeepLoad(entity, "Project", "ProjectCodeSource", deepLoadType, innerList) && (entity.ProjectCodeSource == null))
         {
             object[] pkItems = new object[] { entity.ProjectCode ?? string.Empty };
             Project  project = EntityManager.LocateEntity <Project>(EntityLocator.ConstructKeyFromPkItems(typeof(Project), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (project != null)
             {
                 entity.ProjectCodeSource = project;
             }
             else
             {
                 entity.ProjectCodeSource = DataRepository.ProjectProvider.GetByProjectCode(entity.ProjectCode ?? string.Empty);
             }
             if (deep && (entity.ProjectCodeSource != null))
             {
                 DataRepository.ProjectProvider.DeepLoad(transactionManager, entity.ProjectCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<ContractCost>", "ContractCostCollection", deepLoadType, innerList))
         {
             entity.ContractCostCollection = DataRepository.ContractCostProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.ContractCostCollection.Count > 0))
             {
                 DataRepository.ContractCostProvider.DeepLoad(transactionManager, entity.ContractCostCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<Payment>", "PaymentCollection", deepLoadType, innerList))
         {
             entity.PaymentCollection = DataRepository.PaymentProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.PaymentCollection.Count > 0))
             {
                 DataRepository.PaymentProvider.DeepLoad(transactionManager, entity.PaymentCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<ContractChange>", "ContractChangeCollection", deepLoadType, innerList))
         {
             entity.ContractChangeCollection = DataRepository.ContractChangeProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.ContractChangeCollection.Count > 0))
             {
                 DataRepository.ContractChangeProvider.DeepLoad(transactionManager, entity.ContractChangeCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<ContractCostPlan>", "ContractCostPlanCollection", deepLoadType, innerList))
         {
             entity.ContractCostPlanCollection = DataRepository.ContractCostPlanProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.ContractCostPlanCollection.Count > 0))
             {
                 DataRepository.ContractCostPlanProvider.DeepLoad(transactionManager, entity.ContractCostPlanCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<ContractBill>", "ContractBillCollection", deepLoadType, innerList))
         {
             entity.ContractBillCollection = DataRepository.ContractBillProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.ContractBillCollection.Count > 0))
             {
                 DataRepository.ContractBillProvider.DeepLoad(transactionManager, entity.ContractBillCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<ContractAccount>", "ContractAccountCollection", deepLoadType, innerList))
         {
             entity.ContractAccountCollection = DataRepository.ContractAccountProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.ContractAccountCollection.Count > 0))
             {
                 DataRepository.ContractAccountProvider.DeepLoad(transactionManager, entity.ContractAccountCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<ContractMaterial>", "ContractMaterialCollection", deepLoadType, innerList))
         {
             entity.ContractMaterialCollection = DataRepository.ContractMaterialProvider.GetByContractCode(transactionManager, entity.ContractCode);
             if (deep && (entity.ContractMaterialCollection.Count > 0))
             {
                 DataRepository.ContractMaterialProvider.DeepLoad(transactionManager, entity.ContractMaterialCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
     }
 }
 internal override bool DeepSave(TransactionManager transactionManager, DictionaryName entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<DictionaryItem>", "DictionaryItemCollection", deepSaveType, innerList))
     {
         foreach (DictionaryItem item in entity.DictionaryItemCollection)
         {
             item.DictionaryNameCode = entity.DictionaryNameCode;
         }
         if ((entity.DictionaryItemCollection.Count > 0) || (entity.DictionaryItemCollection.DeletedItems.Count > 0))
         {
             DataRepository.DictionaryItemProvider.DeepSave(transactionManager, entity.DictionaryItemCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
示例#16
0
 protected bool CanDeepSave(IEntity entity, string key, string property, DeepSaveType deepSaveType, ChildEntityTypesList innerList)
 {
     if (innerList != null)
     {
         if (deepSaveType == DeepSaveType.ExcludeChildren)
         {
             if (!(innerList.Contains(key) || innerList.HasProperty(entity, key, property)))
             {
                 innerList.AddProperty(entity, key, property);
                 return(true);
             }
         }
         else if ((deepSaveType == DeepSaveType.IncludeChildren) && (innerList.Contains(key) && innerList.HasProperty(entity, key, property)))
         {
             innerList.AddProperty(entity, key, property);
             return(true);
         }
     }
     return(false);
 }
示例#17
0
 internal override bool DeepSave(TransactionManager transactionManager, ContractNexus entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "ContractChange", "ContractChangeCodeSource", deepSaveType, innerList) && (entity.ContractChangeCodeSource != null))
     {
         DataRepository.ContractChangeProvider.Save(transactionManager, entity.ContractChangeCodeSource);
         entity.ContractChangeCode = entity.ContractChangeCodeSource.ContractChangeCode;
     }
     this.Save(transactionManager, entity);
     return(true);
 }
 internal override void DeepLoad(TransactionManager transactionManager, DictionaryItem entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if ((entity != null) && (base.CanDeepLoad(entity, "DictionaryName", "DictionaryNameCodeSource", deepLoadType, innerList) && (entity.DictionaryNameCodeSource == null)))
     {
         object[]       pkItems = new object[] { entity.DictionaryNameCode ?? string.Empty };
         DictionaryName name    = EntityManager.LocateEntity <DictionaryName>(EntityLocator.ConstructKeyFromPkItems(typeof(DictionaryName), pkItems), DataRepository.Provider.EnableEntityTracking);
         if (name != null)
         {
             entity.DictionaryNameCodeSource = name;
         }
         else
         {
             entity.DictionaryNameCodeSource = DataRepository.DictionaryNameProvider.GetByDictionaryNameCode(entity.DictionaryNameCode ?? string.Empty);
         }
         if (deep && (entity.DictionaryNameCodeSource != null))
         {
             DataRepository.DictionaryNameProvider.DeepLoad(transactionManager, entity.DictionaryNameCodeSource, deep, deepLoadType, childTypes, innerList);
         }
     }
 }
示例#19
0
 internal override void DeepLoad(TransactionManager transactionManager, Project entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity != null)
     {
         if (base.CanDeepLoad(entity, "List<MaterialPurchas>", "MaterialPurchasCollection", deepLoadType, innerList))
         {
             entity.MaterialPurchasCollection = DataRepository.MaterialPurchasProvider.GetByProjectCode(transactionManager, entity.ProjectCode);
             if (deep && (entity.MaterialPurchasCollection.Count > 0))
             {
                 DataRepository.MaterialPurchasProvider.DeepLoad(transactionManager, entity.MaterialPurchasCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<Payout>", "PayoutCollection", deepLoadType, innerList))
         {
             entity.PayoutCollection = DataRepository.PayoutProvider.GetByProjectCode(transactionManager, entity.ProjectCode);
             if (deep && (entity.PayoutCollection.Count > 0))
             {
                 DataRepository.PayoutProvider.DeepLoad(transactionManager, entity.PayoutCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<Contract>", "ContractCollection", deepLoadType, innerList))
         {
             entity.ContractCollection = DataRepository.ContractProvider.GetByProjectCode(transactionManager, entity.ProjectCode);
             if (deep && (entity.ContractCollection.Count > 0))
             {
                 DataRepository.ContractProvider.DeepLoad(transactionManager, entity.ContractCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<InspectSituation>", "InspectSituationCollection", deepLoadType, innerList))
         {
             entity.InspectSituationCollection = DataRepository.InspectSituationProvider.GetByProjectCode(transactionManager, entity.ProjectCode);
             if (deep && (entity.InspectSituationCollection.Count > 0))
             {
                 DataRepository.InspectSituationProvider.DeepLoad(transactionManager, entity.InspectSituationCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<Payment>", "PaymentCollection", deepLoadType, innerList))
         {
             entity.PaymentCollection = DataRepository.PaymentProvider.GetByProjectCode(transactionManager, entity.ProjectCode);
             if (deep && (entity.PaymentCollection.Count > 0))
             {
                 DataRepository.PaymentProvider.DeepLoad(transactionManager, entity.PaymentCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
     }
 }
 internal override void DeepLoad(TransactionManager transactionManager, MaterialPurchasDtl entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if ((entity != null) && (base.CanDeepLoad(entity, "MaterialPurchas", "MaterialPurchasIDSource", deepLoadType, innerList) && (entity.MaterialPurchasIDSource == null)))
     {
         object[] pkItems           = new object[1];
         int?     materialPurchasID = entity.MaterialPurchasID;
         pkItems[0] = materialPurchasID.HasValue ? materialPurchasID.GetValueOrDefault() : 0;
         MaterialPurchas purchas = EntityManager.LocateEntity <MaterialPurchas>(EntityLocator.ConstructKeyFromPkItems(typeof(MaterialPurchas), pkItems), DataRepository.Provider.EnableEntityTracking);
         if (purchas != null)
         {
             entity.MaterialPurchasIDSource = purchas;
         }
         else
         {
             materialPurchasID = entity.MaterialPurchasID;
             entity.MaterialPurchasIDSource = DataRepository.MaterialPurchasProvider.GetByMaterialPurchasID(materialPurchasID.HasValue ? materialPurchasID.GetValueOrDefault() : 0);
         }
         if (deep && (entity.MaterialPurchasIDSource != null))
         {
             DataRepository.MaterialPurchasProvider.DeepLoad(transactionManager, entity.MaterialPurchasIDSource, deep, deepLoadType, childTypes, innerList);
         }
     }
 }
 internal override void DeepLoad(TransactionManager transactionManager, MaterialPurchas entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity != null)
     {
         if (base.CanDeepLoad(entity, "Project", "ProjectCodeSource", deepLoadType, innerList) && (entity.ProjectCodeSource == null))
         {
             object[] pkItems = new object[] { entity.ProjectCode ?? string.Empty };
             Project  project = EntityManager.LocateEntity <Project>(EntityLocator.ConstructKeyFromPkItems(typeof(Project), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (project != null)
             {
                 entity.ProjectCodeSource = project;
             }
             else
             {
                 entity.ProjectCodeSource = DataRepository.ProjectProvider.GetByProjectCode(entity.ProjectCode ?? string.Empty);
             }
             if (deep && (entity.ProjectCodeSource != null))
             {
                 DataRepository.ProjectProvider.DeepLoad(transactionManager, entity.ProjectCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<MaterialPurchasDtl>", "MaterialPurchasDtlCollection", deepLoadType, innerList))
         {
             entity.MaterialPurchasDtlCollection = DataRepository.MaterialPurchasDtlProvider.GetByMaterialPurchasID(transactionManager, new int?(entity.MaterialPurchasID));
             if (deep && (entity.MaterialPurchasDtlCollection.Count > 0))
             {
                 DataRepository.MaterialPurchasDtlProvider.DeepLoad(transactionManager, entity.MaterialPurchasDtlCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
     }
 }
 internal override bool DeepSave(TransactionManager transactionManager, MaterialPurchasDtl entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "MaterialPurchas", "MaterialPurchasIDSource", deepSaveType, innerList) && (entity.MaterialPurchasIDSource != null))
     {
         DataRepository.MaterialPurchasProvider.Save(transactionManager, entity.MaterialPurchasIDSource);
         entity.MaterialPurchasID = new int?(entity.MaterialPurchasIDSource.MaterialPurchasID);
     }
     this.Save(transactionManager, entity);
     return(true);
 }
示例#23
0
 internal override void DeepLoad(TransactionManager transactionManager, PayoutItem entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity != null)
     {
         object[] pkItems;
         if (base.CanDeepLoad(entity, "Payout", "PayoutCodeSource", deepLoadType, innerList) && (entity.PayoutCodeSource == null))
         {
             pkItems = new object[] { entity.PayoutCode ?? string.Empty };
             Payout payout = EntityManager.LocateEntity <Payout>(EntityLocator.ConstructKeyFromPkItems(typeof(Payout), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (payout != null)
             {
                 entity.PayoutCodeSource = payout;
             }
             else
             {
                 entity.PayoutCodeSource = DataRepository.PayoutProvider.GetByPayoutCode(entity.PayoutCode ?? string.Empty);
             }
             if (deep && (entity.PayoutCodeSource != null))
             {
                 DataRepository.PayoutProvider.DeepLoad(transactionManager, entity.PayoutCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "PaymentItem", "PaymentItemCodeSource", deepLoadType, innerList) && (entity.PaymentItemCodeSource == null))
         {
             pkItems = new object[] { entity.PaymentItemCode ?? string.Empty };
             PaymentItem item = EntityManager.LocateEntity <PaymentItem>(EntityLocator.ConstructKeyFromPkItems(typeof(PaymentItem), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (item != null)
             {
                 entity.PaymentItemCodeSource = item;
             }
             else
             {
                 entity.PaymentItemCodeSource = DataRepository.PaymentItemProvider.GetByPaymentItemCode(entity.PaymentItemCode ?? string.Empty);
             }
             if (deep && (entity.PaymentItemCodeSource != null))
             {
                 DataRepository.PaymentItemProvider.DeepLoad(transactionManager, entity.PaymentItemCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
     }
 }
 internal override void DeepLoad(TransactionManager transactionManager, InspectSituation entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity != null)
     {
         object[] pkItems;
         if (base.CanDeepLoad(entity, "Project", "ProjectCodeSource", deepLoadType, innerList) && (entity.ProjectCodeSource == null))
         {
             pkItems = new object[] { entity.ProjectCode ?? string.Empty };
             Project project = EntityManager.LocateEntity <Project>(EntityLocator.ConstructKeyFromPkItems(typeof(Project), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (project != null)
             {
                 entity.ProjectCodeSource = project;
             }
             else
             {
                 entity.ProjectCodeSource = DataRepository.ProjectProvider.GetByProjectCode(entity.ProjectCode ?? string.Empty);
             }
             if (deep && (entity.ProjectCodeSource != null))
             {
                 DataRepository.ProjectProvider.DeepLoad(transactionManager, entity.ProjectCodeSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "SystemUser", "InspectUserSource", deepLoadType, innerList) && (entity.InspectUserSource == null))
         {
             pkItems = new object[] { entity.InspectUser ?? string.Empty };
             SystemUser user = EntityManager.LocateEntity <SystemUser>(EntityLocator.ConstructKeyFromPkItems(typeof(SystemUser), pkItems), DataRepository.Provider.EnableEntityTracking);
             if (user != null)
             {
                 entity.InspectUserSource = user;
             }
             else
             {
                 entity.InspectUserSource = DataRepository.SystemUserProvider.GetByUserCode(entity.InspectUser ?? string.Empty);
             }
             if (deep && (entity.InspectUserSource != null))
             {
                 DataRepository.SystemUserProvider.DeepLoad(transactionManager, entity.InspectUserSource, deep, deepLoadType, childTypes, innerList);
             }
         }
         if (base.CanDeepLoad(entity, "List<Trouble>", "TroubleCollection", deepLoadType, innerList))
         {
             entity.TroubleCollection = DataRepository.TroubleProvider.GetByInspectSituationID(transactionManager, entity.InspectSituationID);
             if (deep && (entity.TroubleCollection.Count > 0))
             {
                 DataRepository.TroubleProvider.DeepLoad(transactionManager, entity.TroubleCollection, deep, deepLoadType, childTypes, innerList);
             }
         }
     }
 }
 internal override bool DeepSave(TransactionManager transactionManager, ContractChange entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "Contract", "ContractCodeSource", deepSaveType, innerList) && (entity.ContractCodeSource != null))
     {
         DataRepository.ContractProvider.Save(transactionManager, entity.ContractCodeSource);
         entity.ContractCode = entity.ContractCodeSource.ContractCode;
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<ContractCostChange>", "ContractCostChangeCollection", deepSaveType, innerList))
     {
         foreach (ContractCostChange change in entity.ContractCostChangeCollection)
         {
             change.ContractChangeCode = entity.ContractChangeCode;
         }
         if ((entity.ContractCostChangeCollection.Count > 0) || (entity.ContractCostChangeCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractCostChangeProvider.DeepSave(transactionManager, entity.ContractCostChangeCollection, deepSaveType, childTypes, innerList);
         }
     }
     if (base.CanDeepSave(entity, "List<ContractNexus>", "ContractNexusCollection", deepSaveType, innerList))
     {
         foreach (ContractNexus nexus in entity.ContractNexusCollection)
         {
             nexus.ContractChangeCode = entity.ContractChangeCode;
         }
         if ((entity.ContractNexusCollection.Count > 0) || (entity.ContractNexusCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractNexusProvider.DeepSave(transactionManager, entity.ContractNexusCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
 internal override bool DeepSave(TransactionManager transactionManager, InspectSituation entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "Project", "ProjectCodeSource", deepSaveType, innerList) && (entity.ProjectCodeSource != null))
     {
         DataRepository.ProjectProvider.Save(transactionManager, entity.ProjectCodeSource);
         entity.ProjectCode = entity.ProjectCodeSource.ProjectCode;
     }
     if (base.CanDeepSave(entity, "SystemUser", "InspectUserSource", deepSaveType, innerList) && (entity.InspectUserSource != null))
     {
         DataRepository.SystemUserProvider.Save(transactionManager, entity.InspectUserSource);
         entity.InspectUser = entity.InspectUserSource.UserCode;
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<Trouble>", "TroubleCollection", deepSaveType, innerList))
     {
         foreach (Trouble trouble in entity.TroubleCollection)
         {
             trouble.InspectSituationID = entity.InspectSituationID;
         }
         if ((entity.TroubleCollection.Count > 0) || (entity.TroubleCollection.DeletedItems.Count > 0))
         {
             DataRepository.TroubleProvider.DeepSave(transactionManager, entity.TroubleCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
 internal override bool DeepSave(TransactionManager transactionManager, PaymentItem entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     if (base.CanDeepSave(entity, "ContractCost", "ContractCostCodeSource", deepSaveType, innerList) && (entity.ContractCostCodeSource != null))
     {
         DataRepository.ContractCostProvider.Save(transactionManager, entity.ContractCostCodeSource);
         entity.ContractCostCode = entity.ContractCostCodeSource.ContractCostCode;
     }
     if (base.CanDeepSave(entity, "Payment", "PaymentCodeSource", deepSaveType, innerList) && (entity.PaymentCodeSource != null))
     {
         DataRepository.PaymentProvider.Save(transactionManager, entity.PaymentCodeSource);
         entity.PaymentCode = entity.PaymentCodeSource.PaymentCode;
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<PayoutItem>", "PayoutItemCollection", deepSaveType, innerList))
     {
         foreach (PayoutItem item in entity.PayoutItemCollection)
         {
             item.PaymentItemCode = entity.PaymentItemCode;
         }
         if ((entity.PayoutItemCollection.Count > 0) || (entity.PayoutItemCollection.DeletedItems.Count > 0))
         {
             DataRepository.PayoutItemProvider.DeepSave(transactionManager, entity.PayoutItemCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
 internal override void DeepLoad(TransactionManager transactionManager, DictionaryName entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if ((entity != null) && base.CanDeepLoad(entity, "List<DictionaryItem>", "DictionaryItemCollection", deepLoadType, innerList))
     {
         entity.DictionaryItemCollection = DataRepository.DictionaryItemProvider.GetByDictionaryNameCode(transactionManager, entity.DictionaryNameCode);
         if (deep && (entity.DictionaryItemCollection.Count > 0))
         {
             DataRepository.DictionaryItemProvider.DeepLoad(transactionManager, entity.DictionaryItemCollection, deep, deepLoadType, childTypes, innerList);
         }
     }
 }
示例#29
0
 internal override bool DeepSave(TransactionManager transactionManager, Material entity, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if (entity == null)
     {
         return(false);
     }
     this.Save(transactionManager, entity);
     if (base.CanDeepSave(entity, "List<ContractMaterial>", "ContractMaterialCollection", deepSaveType, innerList))
     {
         foreach (ContractMaterial material in entity.ContractMaterialCollection)
         {
             material.MaterialCode = new int?(entity.MaterialCode);
         }
         if ((entity.ContractMaterialCollection.Count > 0) || (entity.ContractMaterialCollection.DeletedItems.Count > 0))
         {
             DataRepository.ContractMaterialProvider.DeepSave(transactionManager, entity.ContractMaterialCollection, deepSaveType, childTypes, innerList);
         }
     }
     return(true);
 }
示例#30
0
 internal override void DeepLoad(TransactionManager transactionManager, Trouble entity, bool deep, DeepLoadType deepLoadType, Type[] childTypes, ChildEntityTypesList innerList)
 {
     if ((entity != null) && (base.CanDeepLoad(entity, "InspectSituation", "InspectSituationIDSource", deepLoadType, innerList) && (entity.InspectSituationIDSource == null)))
     {
         object[]         pkItems   = new object[] { entity.InspectSituationID };
         InspectSituation situation = EntityManager.LocateEntity <InspectSituation>(EntityLocator.ConstructKeyFromPkItems(typeof(InspectSituation), pkItems), DataRepository.Provider.EnableEntityTracking);
         if (situation != null)
         {
             entity.InspectSituationIDSource = situation;
         }
         else
         {
             entity.InspectSituationIDSource = DataRepository.InspectSituationProvider.GetByInspectSituationID(entity.InspectSituationID);
         }
         if (deep && (entity.InspectSituationIDSource != null))
         {
             DataRepository.InspectSituationProvider.DeepLoad(transactionManager, entity.InspectSituationIDSource, deep, deepLoadType, childTypes, innerList);
         }
     }
 }