コード例 #1
0
ファイル: ValidateEmpty.cs プロジェクト: guangxb/learn
 private bool ValidateGeneral(DocStruct doc, Func <ChildStruct, ObjectRelation> getrelation)
 {
     foreach (ChildStruct current in
              from p in doc.ParentRelation
              where p.ParentNode != null
              select p)
     {
         DocStruct      parentNode     = current.ParentNode;
         ObjectRelation objectRelation = this.objrelatda.GetObjectRelation(parentNode.RealityVerId, doc.RealityVerId);
         if (objectRelation == null)
         {
             if (!ValidatorHelp.CheckPCRelation(current))
             {
                 return(false);
             }
         }
         else
         {
             current.RelationId          = objectRelation.RelationId;
             current.RelationOperateType = RelationOperateType.None;
         }
     }
     return(true);
 }
コード例 #2
0
ファイル: ValidateEmpty.cs プロジェクト: guangxb/learn
 /// <summary>
 /// 验证族实例
 /// </summary>
 /// <param name="sourcedoc"></param>
 /// <param name="context"></param>
 /// <param name="std"></param>
 /// <param name="GetRelations"></param>
 /// <returns></returns>
 static bool ValidateConfigParts(DocStruct sourcedoc, ValidateContext context, DocConfig std, Func <ChildStruct, IList> GetRelations)
 {
     if (std != null)
     {
         sourcedoc.ConfigId = std.ConfigID;
         if (!string.IsNullOrEmpty(std.MatVerId))
         {
             sourcedoc.MaterialVerId = std.MatVerId;
         }
         BOMHelp.Write(context.CurScopeProperty, "__STD_OLD_MaterialVerId", std.MatVerId);
         foreach (var current in sourcedoc.ParentRelation.Where(p => p.ParentNode != null))
         {
             DocStruct parent = current.ParentNode;
             IEnumerable <ObjectRelation> source = GetRelations(current).Cast <ObjectRelation>();
             if (!source.Any <ObjectRelation>())
             {
                 if (!ValidatorHelp.CheckPCRelation(current))
                 {
                     bool result = false;
                     return(result);
                 }
                 sourcedoc.IsBorrow          = true;
                 current.RelationOperateType = RelationOperateType.AddRelation;
             }
             else
             {
                 if (parent.IsBorrow)
                 {
                     sourcedoc.IsBorrow = true;
                 }
                 else
                 {
                     ObjectRelation objectRelation = source.FirstOrDefault((ObjectRelation p) => (string.IsNullOrEmpty(p.ParentConfigID) || p.ParentConfigID == parent.ConfigId) && BOMHelp.IsEquals(p.ConfigID, std.ConfigID));
                     if (objectRelation != null)
                     {
                         current.RelationId = objectRelation.RelationId;
                         bool flag = current.Count == current.HiddenCount;
                         if (objectRelation.IsHidden != flag || !BOMHelp.Contains(parent.OperateType, EntityOperateType.NotCheckOut))
                         {
                             current.RelationOperateType = RelationOperateType.ModifyRelation;
                         }
                     }
                     else
                     {
                         current.RelationOperateType = RelationOperateType.AddRelation;
                     }
                 }
             }
         }
     }
     else if (!ValidateCreoConfig.IsZuBiao(sourcedoc)) //没有到如果该配置 同时不是族表实例
     {
         foreach (var item in sourcedoc.ParentRelation.Where(p => p.ParentNode != null))
         {
             if (!ValidatorHelp.CheckPCRelation(item))
             {
                 return(false);
             }
         }
     }
     return(true);
 }