Ejemplo n.º 1
0
        /// <summary>
        /// 创建绑定项
        /// </summary>
        /// <param name="className"></param>
        /// <param name="mode"></param>
        /// <param name="scene"></param>
        /// <returns></returns>
        private DEBindingOperationCollection CreateDEBindingOprt(string className, string mode, string scene, List <DEBindingOperationCollection> oldCols)
        {
            if (string.IsNullOrEmpty(className))
            {
                return(null);
            }
            DEBindingOperationCollection col = new DEBindingOperationCollection()
            {
                Product = OBCOLLECTION_PRODUCT, Mode = OperModeType.Single.ToString(), ClassName = className, Scene = scene
            };
            var oldCol = oldCols.Find(p => p.Scene == scene && (p.ClassName == ROOT_BI || p.ClassName == className));

            if (oldCol != null && oldCol.OperationInfos != null && oldCol.OperationInfos.Count > 0)
            {
                col.OperationInfos.AddRange(oldCol.OperationInfos);
            }
            var currentCol = col.OperationInfos.Find(p => p.Id == OPERATION_ID);

            if (currentCol == null)
            {
                DEBindingOperationInfo info = new DEBindingOperationInfo()
                {
                    Id = OPERATION_ID, Order = 600
                };
                col.OperationInfos.Add(info);
            }

            return(col);
        }
Ejemplo n.º 2
0
        private List <DEBindingOperationCollection> GetBindingCollections(List <DEBindingOperationCollection> oldCols)
        {
            if (oldCols == null || oldCols.Count == 0)
            {
                return(null);
            }
            List <DEBindingOperationCollection> cols = new List <DEBindingOperationCollection>();

            foreach (DEBindingOperationCollection item in oldCols)
            {
                if (OBCOLLECTION_SENCE.IndexOf(item.Scene) < 0 || OBCOLLECTION_MODE.IndexOf(item.Mode) < 0)
                {
                    cols.Add(item);
                    continue;
                }
                DEBindingOperationInfo info = new DEBindingOperationInfo();
            }
            return(cols);
        }
Ejemplo n.º 3
0
        private void AddOperationBinding()
        {
            var cols = PLOperationDef.Agent.GetAllBindingCollection(new Guid());

            try {
                //DEBindingOperationCollection col = new DEBindingOperationCollection() {
                //    Product = OBCOLLECTION_PRODUCT, Mode = OperModeType.Single.ToString(), ClassName = className, Scene = scene
                //};
                var oldCol = cols.FindAll(p => ModelContext.MetaModel.IsChild(ROOT_BI, p.ClassName));
                if (oldCol == null || oldCol.Count == 0)
                {
                    return;
                }
                foreach (DEBindingOperationCollection curCol in oldCol)
                {
                    if (curCol == null)
                    {
                        continue;
                    }
                    var currentCol = curCol.OperationInfos.Find(p => p.Id == OPERATION_ID);
                    if (currentCol != null)
                    {
                        continue;
                    }
                    DEBindingOperationInfo info = new DEBindingOperationInfo()
                    {
                        Id = OPERATION_ID, Order = 600
                    };
                    curCol.OperationInfos.Add(info);
                    PLOperationDef.Agent.SaveBindingCollection(curCol, Guid.NewGuid());
                }
                //if (oldCol != null && oldCol.OperationInfos != null && oldCol.OperationInfos.Count > 0) {
                //    col.OperationInfos.AddRange(oldCol.OperationInfos);
                //}
            } catch (Exception ex) {
                MessageBoxPLM.Show(ex.Message);
            }
        }