/// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="triggerScript"></param>
        public new ResultModel Update(TriggerScript triggerScript)
        {
            TriggerScript myfield = GetById(triggerScript.Id);

            if (myfield != null)
            {
                //编码不允许修改
                //脚本类型不允许修改

                //如果脚本有改动,则清空脚本缓存
                if (!myfield.Script.Equals(triggerScript.Script))
                {
                    TriggerScriptCache.ClearCache(triggerScript.Script);
                }

                myfield.Script        = triggerScript.Script;
                myfield.FailurePolicy = triggerScript.FailurePolicy;

                myfield.Name        = triggerScript.Name;
                myfield.Group       = triggerScript.Group;
                myfield.SortNumber  = triggerScript.SortNumber;
                myfield.Description = triggerScript.Description;
                myfield.ModifyBy    = -1;
                myfield.ModifyTime  = DateTime.Now;
            }
            base.Update(myfield);
            return(ResultModel.Success());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="interfaceAggregation"></param>
        public new ResultModel Update(InterfaceAggregation interfaceAggregation)
        {
            InterfaceAggregation myEntity = GetById(interfaceAggregation.Id);

            if (myEntity != null)
            {
                if (interfaceAggregation.InterfaceType != (int)InterfaceType.TriggerScriptDataSource)
                {
                    var interfaceField  = interfaceFieldService.GetById(interfaceAggregation.FieldListId);
                    var searchCondition = searchConditionService.GetById(interfaceAggregation.SearchConditionId);

                    myEntity.FieldListId   = interfaceAggregation.FieldListId;
                    myEntity.FieldListName = interfaceField.Name;

                    myEntity.SearchConditionId   = interfaceAggregation.SearchConditionId;
                    myEntity.SearchConditionName = searchCondition.Name;
                }

                myEntity.InterfaceType = interfaceAggregation.InterfaceType;

                //如果脚本有改动,则清空脚本缓存
                if (myEntity.Script != null && !myEntity.Script.Equals(interfaceAggregation.Script))
                {
                    TriggerScriptCache.ClearCache(interfaceAggregation.Script);
                }
                myEntity.Script = interfaceAggregation.Script;

                //编码不允许修改
                myEntity.Name        = interfaceAggregation.Name;
                myEntity.Group       = interfaceAggregation.Group;
                myEntity.SortNumber  = interfaceAggregation.SortNumber;
                myEntity.Description = interfaceAggregation.Description;
                myEntity.ModifyBy    = -1;
                myEntity.ModifyTime  = DateTime.Now;
            }
            base.Update(myEntity);
            return(ResultModel.Success());
        }