Exemple #1
0
        public void AddJoin(ObjectSubQueryJoin joinSpecification, string childAlias, string parentAlias)
        {
            EnsureSubQuery(childAlias, joinSpecification.ChildType);
            EnsureSubQuery(parentAlias, joinSpecification.ParentType);

            string manyToOneForeignKeyColumnName;

            if (joinSpecification.HasChildProperty)
            {
                manyToOneForeignKeyColumnName = _conventionReader.GetManyToOneForeignKeyColumnName(joinSpecification.ChildProperty);
            }
            else
            {
                manyToOneForeignKeyColumnName = _conventionReader.GetColumnName(joinSpecification.ChildToParentForeignKeyProperty);
            }

            var joinSpec = new SqlSubQueryJoin
            {
                ChildTableName             = _conventionReader.GetTableName(joinSpecification.ChildType),
                ParentTableName            = _conventionReader.GetTableName(joinSpecification.ParentType),
                ChildForeignKeyColumnName  = manyToOneForeignKeyColumnName,
                ParentPrimaryKeyColumnName = _conventionReader.GetPrimaryKeyColumnName(joinSpecification.ParentType),
            };

            AddJoin(joinSpec, childAlias, parentAlias);

            ObjectRelations.Add(ObjectRelation.Create(joinSpecification, childAlias, parentAlias));
        }
Exemple #2
0
        private void tsb_select_Click(object sender, EventArgs e)
        {
            if(this.dgv_DocList.RowCount<=0)return;

            int rowIndex = this.dgv_DocList.CurrentCell.RowIndex;
            if (rowIndex < 0)return;

            if (MessageBox.Show("您确认要添加此关联文档?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                DataGridViewRow row = dgv_DocList.Rows[rowIndex];
                ObjectRelation objrl = new ObjectRelation();

                objrl.ORID=Guid.NewGuid().ToString();
                objrl.MASTEROBJECTID = row.Cells["DOCID"].Value.ToString();
                objrl.MASTEROBJECTTYPE="Document";
                objrl.MASTEROBJECTVERSION = row.Cells["DOCVERSION"].Value.ToString();
                objrl.RELATIONOBJECTID = this.m_Product.PRODUCTID;
                objrl.RELATIONOBJECTTYPE="Parts";
                objrl.RELATIONOBJECTVERSION = this.m_Product.VERSION;
                objrl.DEL_FALG = "N";
                try
                {
                    objrl.Save();
                    MessageBox.Show("添加成功");
                    DocList_Init();
                }catch(Exception e1){
                    MessageBox.Show("添加失败:"+ e1.Message);
                }
            }
        }
 public static IEnumerable <ObjectRelation> Parents(this ObjectRelation obj)
 {
     while (obj.Parent != null)
     {
         obj = obj.Parent;
         yield return(obj);
     }
 }
Exemple #4
0
 public void SetUp()
 {
     _row    = new Row();
     _mapper = new EntityMapper(new ConventionReader(new DefaultConvention()));
     _parentChildRelation     = ObjectRelation.CreateTwoWay <Parent, Child>(x => x.Children, x => x.Parent);
     _childParentRelation     = ObjectRelation.CreateTwoWay <Parent, Child>(x => x.Children, x => x.Parent);
     _childGrandChildRelation = ObjectRelation.CreateTwoWay <Child, GrandChild>(x => x.GrandChildren, x => x.Child);
     _idLessRelation          = ObjectRelation.CreateTwoWay <ParentWithoutId, ChildWithoutId>(x => x.Children, x => x.Parent);
 }
 public bool Delete(ObjectRelation relation)
 {
     if (relation.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.DeleteObjectsRelations(relation), true);
     return(true);
 }
Exemple #6
0
 void Start()
 {
     // turn off the glow around the buttons
     shine.SetActive(false);
     // get all the needed components
     movetostage    = item.GetComponent <MoveToStage>();
     rigidbody2d    = item.GetComponent <Rigidbody2D>();
     clamp          = item.GetComponent <Clamp>();
     objectrelation = item.GetComponent <ObjectRelation>();
     particle       = item.GetComponent <Particle>();
 }
Exemple #7
0
        public InjectionConfigurationSet(ObjectDescription description, ObjectRelation admin, InjectionConfigurationGroup defaultGroup)
        {
            if (!defaultGroup.MatchInjectionConfigurationSet(this))
            {
                throw new InvalidOperationException();
            }

            _description  = description;
            _admin        = admin;
            _defaultGroup = defaultGroup;
        }
Exemple #8
0
        public void Insantiates_collection_when_creating_graph_with_parent_having_null_collection()
        {
            _row.Add("Child Id", 1);
            _row.Add("Parent Id", 2);

            var relation = ObjectRelation.CreateTwoWay <NullCollectionParent, ChildWithNullCollectionParent>(x => x.Children, x => x.Parent);

            var parent = _mapper.CreateInstanceGraph <NullCollectionParent>(_row, relation);

            Assert.AreEqual(1, parent.Children.Count);
        }
Exemple #9
0
        /// <summary>
        /// 删除关联
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelRelation_Click(object sender, EventArgs e)
        {
            //tabProduct
            //  MessageBox.Show(this.tabControl2.SelectedTab.Name.ToString());
            if (this.tabControl2.SelectedTab.Name.ToString() == "tabProduct")
            {
                if (this.dGVProduct.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService <ObjectRelationService>();
                    or = _orDocProd.getObjectRelation(DataType.RelationObjectType.Drawing.ToString(), this.document.DOCID, DataType.RelationObjectType.Product.ToString(), this.dGVProduct.CurrentRow.Cells["PRODUCTID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }
                }
            }
            else if (this.tabControl2.SelectedTab.Name.ToString() == "tabMaterial")
            {
                if (this.dgvMaterial.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService <ObjectRelationService>();
                    // or = _orDocProd.getDocMaterialObjectRelation(this.Document.DOCID, this.dgvMaterial.CurrentRow.Cells["MATERIALID"].Value.ToString());
                    or = _orDocProd.getObjectRelation(DataType.RelationObjectType.Drawing.ToString(), this.document.DOCID, DataType.RelationObjectType.Material.ToString(), this.dgvMaterial.CurrentRow.Cells["MATERIALID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }
                }
            }
            else
            {
            }
        }
Exemple #10
0
        public void Foreign_key_value_is_written_to_foreign_key_value_property_even_if_reference_property_for_same_foreign_key_exists_when_creating_graph()
        {
            _row.Add("ChildWithForeignKeyColumn Id", 1);
            _row.Add("ChildWithForeignKeyColumn ParentId", 2);
            _row.Add("ParentToChildWithForeignKeyColumn Id", 3);

            var relation = ObjectRelation.CreateTwoWay <ParentToChildWithForeignKeyColumn, ChildWithForeignKeyColumn>(x => x.Children, x => x.Parent);
            var child    = _mapper.CreateInstanceGraph <ChildWithForeignKeyColumn>(_row, relation);

            Assert.AreEqual(1, child.Id);
            Assert.AreEqual(2, child.ParentId);
            Assert.AreEqual(3, child.Parent.Id);
        }
Exemple #11
0
 private bool ObjectRelationExists(ObjectRelation or, DocStruct parent, IEnumerable <ChildStruct> children)
 {
     if (this.SupportMultiConfig)
     {
         if (parent.Configs.Any(p => p.ConfigId == or.ParentConfigID))//父ID存在时才判断
         {
             return(children.Any((ChildStruct p) => BOMHelp.IsEquals(or.ConfigID, p.ChildNode.ConfigId) &&
                                 BOMHelp.IsEquals(or.ParentConfigID, p.ParentNode.ConfigId)));
         }
         return(true);
     }
     return(children.Any(delegate(ChildStruct p)
     {
         if (p.ChildNode.STD_IsStandardParts)
         {
             return BOMHelp.IsEquals(or.ConfigID, p.ChildNode.ConfigId);
         }
         return BOMHelp.IsEquals(or.ChildObject, p.ChildNode.RealityVerId);
     }));
 }
        public ObjectRelation getObjectRelation(string masterObjectType, string masterObjectId, string relationObjectType, string relationObjectId)
        {
            ObjectRelation oo = null;
            DataEntityQuery <ObjectRelation> query = DataEntityQuery <ObjectRelation> .Create();

            var p = (from item in query
                     where (item.DEL_FALG == "N" && item.MASTEROBJECTID == masterObjectId && item.MASTEROBJECTTYPE == masterObjectType && item.RELATIONOBJECTTYPE == relationObjectType && item.RELATIONOBJECTID == relationObjectId)
                     select item
                     );
            IList <ObjectRelation> list = p.ToList();

            if (list.Count == 0)
            {
                oo = null;
            }
            else
            {
                oo = list[0];
            }
            return(oo);
        }
        public ObjectRelation getDocMaterialObjectRelation(string documentID, string materialID)
        {
            ObjectRelation oo = null;
            DataEntityQuery <ObjectRelation> query = DataEntityQuery <ObjectRelation> .Create();

            var p = (from item in query
                     where (item.DEL_FALG == "N" && item.MASTEROBJECTID == documentID && item.MASTEROBJECTTYPE == "Document" && item.RELATIONOBJECTTYPE == "Material" && item.RELATIONOBJECTID == materialID)
                     select item
                     );
            IList <ObjectRelation> list = p.ToList();

            if (list.Count == 0)
            {
                oo = null;
            }
            else
            {
                oo = list[0];
            }
            return(oo);
        }
Exemple #14
0
        private void tsb_select_Click(object sender, EventArgs e)
        {
            if (this.dgv_DocList.RowCount <= 0)
            {
                return;
            }

            int rowIndex = this.dgv_DocList.CurrentCell.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }

            if (MessageBox.Show("您确认要添加此关联文档?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                DataGridViewRow row   = dgv_DocList.Rows[rowIndex];
                ObjectRelation  objrl = new ObjectRelation();

                objrl.ORID                  = Guid.NewGuid().ToString();
                objrl.MASTEROBJECTID        = row.Cells["DOCID"].Value.ToString();
                objrl.MASTEROBJECTTYPE      = "Drawing";
                objrl.MASTEROBJECTVERSION   = row.Cells["DOCVERSION"].Value.ToString();
                objrl.RELATIONOBJECTID      = this.m_Product.PRODUCTID;
                objrl.RELATIONOBJECTTYPE    = "Product";
                objrl.RELATIONOBJECTVERSION = this.m_Product.VERSION;
                objrl.DEL_FALG              = "N";
                try
                {
                    objrl.Save();
                    MessageBox.Show("添加成功");
                    DocList_Init();
                }catch (Exception e1) {
                    MessageBox.Show("添加失败:" + e1.Message);
                }
            }
        }
Exemple #15
0
 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);
 }
Exemple #16
0
        /// <summary>
        /// 新建关联
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddRelation_Click(object sender, EventArgs e)
        {
            //    List<PDM_ALL_PRODUCT> pdmAllSelectedProduct = null;
            //    List<PDM_MATERAIL> pdmSelectedMaterial = null;
            //     DataType.RelationObjectType relationObjectType;
            ObjectRelation         or  = new ObjectRelation();
            IObjectRelationService orS = ServiceContainer.GetService <ObjectRelationService>();
            IList <ObjectRelation> listObjectRelation = new List <ObjectRelation>();

            HYPDM.WinUI.Document.ConnectForm frmConnect = new ConnectForm();
            frmConnect.Document = this.Document;
            if (frmConnect.ShowDialog() == DialogResult.OK)
            {
                listObjectRelation = frmConnect.ListObjectRelation;

                try
                {
                    foreach (ObjectRelation objRelation in listObjectRelation)
                    {
                        objRelation.MASTEROBJECTID      = this.Document.DOCID;
                        objRelation.MASTEROBJECTTYPE    = DataType.RelationObjectType.Document.ToString();
                        objRelation.MASTEROBJECTVERSION = this.Document.VERSION;
                        objRelation.Save();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    return;
                }
                finally
                {
                    InitialObjectRelation();
                }
            }
        }
Exemple #17
0
 internal Status(System.Data.DataRow aRow, Neo.Core.ObjectContext aContext)
     : base(aRow, aContext)
 {
     Customers = new ObjectRelation<Customer>(this, "Customers");
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            var optionsBuilder = new DbContextOptionsBuilder <LancetContext>();
            var options        = optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=lancet_db;Username=postgres;Password=340571578;Integrated Security=false;").Options;
            var createDate     = DateTime.Now.ToUniversalTime();

            using (LancetContext context = new LancetContext(options))
            {
                //Тестовая страница
                var metaObject = new MetaObject()
                {
                    Id         = Guid.NewGuid(),
                    Title      = "Test Page",
                    Name       = "testpage",
                    MetaTypeId = Types.Page.Id,
                    CreateDate = createDate,
                    Content    = "<h1>Test header</h1>"
                };
                context.MetaObjects.Add(metaObject);

                //Связь страницы с ролью
                var relation = new Relation()
                {
                    Id         = Guid.NewGuid(),
                    CreateDate = createDate
                };
                context.Relations.Add(relation);

                var objectRelation = new ObjectRelation()
                {
                    Id           = Guid.NewGuid(),
                    MetaTypeId   = Types.Role.Id,
                    RelationId   = relation.Id,
                    MetaObjectId = metaObject.Id
                };
                context.ObjectRelations.Add(objectRelation);

                objectRelation = new ObjectRelation()
                {
                    Id           = Guid.NewGuid(),
                    MetaTypeId   = Types.Role.Id,
                    RelationId   = relation.Id,
                    MetaObjectId = Objects.User.Id
                };
                context.ObjectRelations.Add(objectRelation);

                //Связь аккаунта с ролью
                relation = new Relation()
                {
                    Id         = Guid.NewGuid(),
                    CreateDate = createDate
                };
                context.Relations.Add(relation);

                var account = context.MetaObjects.Find(Guid.Parse("b0e56288-e7be-4ceb-a64a-c5a6f1023738"));

                objectRelation = new ObjectRelation()
                {
                    Id           = Guid.NewGuid(),
                    MetaTypeId   = Types.Role.Id,
                    RelationId   = relation.Id,
                    MetaObjectId = account.Id
                };
                context.ObjectRelations.Add(objectRelation);

                objectRelation = new ObjectRelation()
                {
                    Id           = Guid.NewGuid(),
                    MetaTypeId   = Types.Role.Id,
                    RelationId   = relation.Id,
                    MetaObjectId = Objects.User.Id
                };
                context.ObjectRelations.Add(objectRelation);

                context.SaveChanges();
            }
        }
Exemple #19
0
 public static String UpdateObjectsRelations(ObjectRelation relation)
 {
     return(GetCommand(ref updateObjectsRelations, updateObjectsRelationsPath, new string[] { relation.Parent.ToString(), relation.Id.ToString(), relation.ObjRelId.ToString() }));
 }
 internal ObjectBuilderWithCondition(ObjectDescription description, ObjectRelation admin, Lifetime <T> lifetime,
                                     InjectionConfigurationSet configurationSet, IInjectionCondition condition)
     : base(description, admin, lifetime, configurationSet)
 {
     _condition = condition;
 }
Exemple #21
0
 public PartialUnregistrationOperation(ObjectRelation relation)
     : base(relation)
 {
 }
Exemple #22
0
        internal override InjectionConfigurationSet CreateInjectionConfigurationSet(ObjectDescription description, ObjectRelation admin)
        {
            if (_configSet != null)
            {
                return(_configSet);
            }

            var configGroup = new FuncInjectionConfigurationGroup(description, _factory);
            var configSet   = new InjectionConfigurationSet(description, admin, configGroup);
            var interpreter = new FuncInjectionConfigurationInterpreter(configGroup);

            configGroup.InjectionConfigurationInterpreter = interpreter;
            _configSet = configSet;

            return(_configSet);
        }
Exemple #23
0
 internal ObjectRelation CreateRegistrationAdmin()
 {
     _admin = _admin ?? DoCreateRegistrationAdmin();
     return(_admin);
 }
Exemple #24
0
 public RegistrationOperation(ObjectRelation relation)
     : base(relation)
 {
 }
Exemple #25
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            Boolean IsExist = false;
            Boolean hasSelected = false; //判定是否有选择的项目
            switch (this.combQueryType.Text.Trim())
            {
                case "产品":
                    {
                        IsExist = false;
                        hasSelected = false;
                        foreach (DataGridViewRow row in this.dGVProduct.Rows)
                        {
                            string temp = row.Cells["chk"].Value.ToString();
                            bl = Convert.ToBoolean(temp);
                            if (bl == true)
                            {
                                hasSelected = true;
                                string productid = row.Cells["PRODUCTID"].Value.ToString();
                                for (int i = 0; i < listObjectRelation.Count; i++)
                                {
                                    if (listObjectRelation[i].RELATIONOBJECTID == productid && listObjectRelation[i].RELATIONOBJECTTYPE == DataType.RelationObjectType.Product.ToString())
                                    {
                                        IsExist = true;
                                        return;
                                    }
                                }
                                if (!IsExist)
                                {
                                    or = new ObjectRelation();
                                    or.ORID = Guid.NewGuid().ToString();
                                    or.RELATIONOBJECTID = productid;
                                    or.RELATIONOBJECTTYPE = DataType.RelationObjectType.Product.ToString();
                                    or.RELATIONOBJECTVERSION = row.Cells["VERSION1"].Value.ToString();
                                    or.DEL_FALG = "N";
                                    ListObjectRelation.Add(or);
                                }
                            }
                        }
                        if (hasSelected)
                        {
                            MessageBox.Show("选择成功!!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            break;
                        }
                        else
                        {
                            MessageBox.Show("没有选择任何项!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            break;
                        }
                    }
                case "材料":
                    {
                        IsExist = false;
                        hasSelected = false;
                        foreach (DataGridViewRow row in this.dgvMaterial.Rows)
                        {
                            string temp = row.Cells["chk1"].Value.ToString();
                            bl = Convert.ToBoolean(temp);
                            // PDM_MATERAIL material = null;
                            if (bl == true)
                            {
                                hasSelected = true;
                                string materid = row.Cells["MATERIALID"].Value.ToString();
                                for (int i = 0; i < listObjectRelation.Count; i++)
                                {
                                    if (listObjectRelation[i].RELATIONOBJECTID == materid && listObjectRelation[i].RELATIONOBJECTTYPE == DataType.RelationObjectType.Material.ToString())
                                    {
                                        IsExist = true;
                                        return;
                                    }
                                }
                                if (!IsExist)
                                {
                                    or = new ObjectRelation();
                                    or.ORID = Guid.NewGuid().ToString();
                                    or.RELATIONOBJECTID = materid;
                                    or.RELATIONOBJECTTYPE = DataType.RelationObjectType.Material.ToString();
                                    or.RELATIONOBJECTVERSION = row.Cells["VERSION"].Value.ToString();
                                    or.DEL_FALG = "N";
                                    ListObjectRelation.Add(or);
                                }

                            }
                        }
                        if (hasSelected)
                        {
                            MessageBox.Show("选择成功!!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            break;
                        }
                        else
                        {
                            MessageBox.Show("没有选择任何项!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            break;
                        }
                    }
                case "半产品":
                    {
                        IsExist = false;
                        hasSelected = false;
                        foreach (DataGridViewRow row in this.dGVProduct.Rows)
                        {
                            string temp = row.Cells["chk"].Value.ToString();
                            bl = Convert.ToBoolean(temp);
                            if (bl == true)
                            {
                                hasSelected = true;
                                string productid = row.Cells["PRODUCTID"].Value.ToString();
                                for (int i = 0; i < listObjectRelation.Count; i++)
                                {
                                    if (listObjectRelation[i].RELATIONOBJECTID == productid && listObjectRelation[i].RELATIONOBJECTTYPE == DataType.RelationObjectType.SemiProduct.ToString())
                                    {
                                        IsExist = true;
                                        return;
                                    }
                                }
                                if (!IsExist)
                                {
                                    or = new ObjectRelation();
                                    or.ORID = Guid.NewGuid().ToString();
                                    or.RELATIONOBJECTID = productid;
                                    or.RELATIONOBJECTTYPE = DataType.RelationObjectType.SemiProduct.ToString();
                                    or.RELATIONOBJECTVERSION = row.Cells["VERSION1"].Value.ToString();
                                    or.DEL_FALG = "N";
                                    ListObjectRelation.Add(or);
                                }
                            }
                        }
                        if (hasSelected)
                        {
                            MessageBox.Show("选择成功!!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            break;
                        }
                        else
                        {
                            MessageBox.Show("没有选择任何项!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            break;
                        }
                    }
                default:
                    {
                        break;
                    }
            }
        }
Exemple #26
0
 internal Customer(System.Data.DataRow aRow, Neo.Core.ObjectContext aContext)
     : base(aRow, aContext)
 {
     Orders = new ObjectRelation<Order>(this, "Orders");
 }
Exemple #27
0
 /// <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);
 }
Exemple #28
0
 internal Product(System.Data.DataRow aRow, Neo.Core.ObjectContext aContext)
     : base(aRow, aContext)
 {
     Inventory = new ObjectRelation<Inventory>(this, "Inventory");
     OrderItems = new ObjectRelation<OrderItem>(this, "OrderItems");
 }
Exemple #29
0
 public static String DeleteObjectsRelations(ObjectRelation relation)
 {
     return(GetCommand(ref deleteObjectsRelations, deleteObjectsRelationsPath, new string[] { relation.Id.ToString() }));
 }
Exemple #30
0
        /// <summary>
        /// 新建关联
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddRelation_Click(object sender, EventArgs e)
        {
            //    List<PDM_ALL_PRODUCT> pdmAllSelectedProduct = null;
            //    List<PDM_MATERAIL> pdmSelectedMaterial = null;
            //     DataType.RelationObjectType relationObjectType;
            ObjectRelation or = new ObjectRelation();
            IObjectRelationService orS = ServiceContainer.GetService<ObjectRelationService>();
            IList<ObjectRelation> listObjectRelation = new List<ObjectRelation>();
            HYPDM.WinUI.Document.ConnectForm frmConnect = new ConnectForm();
            frmConnect.Document = this.Document;
            if (frmConnect.ShowDialog() == DialogResult.OK)
            {
                listObjectRelation = frmConnect.ListObjectRelation;

                try
                {
                    foreach (ObjectRelation objRelation in listObjectRelation)
                    {
                        objRelation.MASTEROBJECTID = this.Document.DOCID;
                        objRelation.MASTEROBJECTTYPE = DataType.RelationObjectType.Document.ToString();
                        objRelation.MASTEROBJECTVERSION = this.Document.VERSION;
                        objRelation.Save();
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    return;
                }
                finally
                {
                    InitialObjectRelation();

                }
            }
        }
Exemple #31
0
 internal abstract InjectionConfigurationSet CreateInjectionConfigurationSet(ObjectDescription description, ObjectRelation admin);
Exemple #32
0
        /// <summary>
        /// 删除关联
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelRelation_Click(object sender, EventArgs e)
        {
            //tabProduct
            //  MessageBox.Show(this.tabControl2.SelectedTab.Name.ToString());
            if (this.tabControl2.SelectedTab.Name.ToString() == "tabProduct")
            {
                if (this.dGVProduct.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService<ObjectRelationService>();
                    or = _orDocProd.getDocProdObjectRelation(this.Document.DOCID, this.dGVProduct.CurrentRow.Cells["PRODUCTID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }

                }
            }
            else if (this.tabControl2.SelectedTab.Name.ToString() == "tabMaterial")
            {
                if (this.dgvMaterial.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService<ObjectRelationService>();
                    or = _orDocProd.getDocMaterialObjectRelation(this.Document.DOCID, this.dgvMaterial.CurrentRow.Cells["MATERIALID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }
                }
            }
            else
            {

            }
        }
 public void SetUp()
 {
     _row = new Row();
     _mapper = new EntityMapper(new ConventionReader(new DefaultConvention()));
     _parentChildRelation = ObjectRelation.CreateTwoWay<Parent, Child>(x => x.Children, x => x.Parent);
     _childParentRelation = ObjectRelation.CreateTwoWay<Parent, Child>(x => x.Children, x => x.Parent);
     _childGrandChildRelation = ObjectRelation.CreateTwoWay<Child, GrandChild>(x => x.GrandChildren, x => x.Child);
     _idLessRelation = ObjectRelation.CreateTwoWay<ParentWithoutId, ChildWithoutId>(x => x.Children, x => x.Parent);
 }
Exemple #34
0
 protected Operation(ObjectRelation relation)
 {
     MyAdmin = relation;
 }
Exemple #35
0
 internal Address(System.Data.DataRow aRow, Neo.Core.ObjectContext aContext)
     : base(aRow, aContext)
 {
     CustomerMailingAddress = new ObjectRelation<Customer>(this, "CustomerMailingAddress");
     CustomerDeliveryAddress = new ObjectRelation<Customer>(this, "CustomerDeliveryAddress");
 }
Exemple #36
0
 public DeactivationOperation(ObjectRelation relation)
     : base(relation)
 {
 }
 internal ObjectBuilder(ObjectRelation relation)
 {
     _relation = relation;
     relation.SetObjectBuilder(this);
 }
 public bool Insert(ObjectRelation relation)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertObjectsRelations(relation), true);
     return(true);
 }
Exemple #39
0
 public static String InsertObjectsRelations(ObjectRelation relation)
 {
     return(GetCommand(ref insertObjectsRelations, insertObjectsRelationsPath, new string[] { relation.Parent.ToString(), relation.Id.ToString() }));
 }