示例#1
0
        protected override DxfObject PostParse()
        {
            foreach (var a in _objectIdsA)
            {
                ObjectIds.Add(a);
            }

            foreach (var b in _objectIdsB)
            {
                ObjectIds.Add(b);
            }

            foreach (var c in _objectIdsC)
            {
                ObjectIds.Add(c);
            }

            foreach (var d in _objectIdsD)
            {
                ObjectIds.Add(d);
            }

            _objectIdsA.Clear();
            _objectIdsB.Clear();
            _objectIdsC.Clear();
            _objectIdsD.Clear();

            ObjectData = BinaryHelpers.CombineBytes(_binaryObjectBytes);
            _binaryObjectBytes.Clear();

            return(this);
        }
示例#2
0
        protected override DxfObject PostParse()
        {
            foreach (var a in _objectIdsA)
            {
                ObjectIds.Add(a);
            }

            foreach (var b in _objectIdsB)
            {
                ObjectIds.Add(b);
            }

            foreach (var c in _objectIdsC)
            {
                ObjectIds.Add(c);
            }

            foreach (var d in _objectIdsD)
            {
                ObjectIds.Add(d);
            }

            _objectIdsA.Clear();
            _objectIdsB.Clear();
            _objectIdsC.Clear();
            _objectIdsD.Clear();

            return(this);
        }
 public MembersSearchCriteria ToSearchCriteria()
 {
     return(new MembersSearchCriteria
     {
         Keyword = ObjectIds.IsNullOrEmpty() ? Keyword : null,//if concrete members selected there is no index searching
         ObjectIds = ObjectIds,
         MemberId = OrganizationId,
         MemberTypes = new[] { nameof(Contact), nameof(Organization) },
         DeepSearch = true
     });
 }
示例#4
0
        protected override DxfObject PostParse()
        {
            ObjectIds.AddRange(_objectIdsA);
            ObjectIds.AddRange(_objectIdsB);
            ObjectIds.AddRange(_objectIdsC);
            ObjectIds.AddRange(_objectIdsD);
            _objectIdsA.Clear();
            _objectIdsB.Clear();
            _objectIdsC.Clear();
            _objectIdsD.Clear();

            return(this);
        }
        protected override bool Execute(CodeActivityContext context)
        {
            if (string.IsNullOrEmpty(ObjectIds))
            {
                Errors.Set(context, "Не определены объекты для которых будет сформирован баланс");
                return(false);
            }

            MultiPsSelectedArgs args;

            try
            {
                args = ObjectIds.DeserializeFromString <MultiPsSelectedArgs>();
            }
            catch (Exception ex)
            {
                Errors.Set(context, "Ошибка преобразования параметров " + ex.Message);
                return(false);
            }

            try
            {
                var res = ARM_Service.BL_GetFreeHierarchyBalanceByObjects(args.PSList,
                                                                          StartDateTime.Get(context),
                                                                          EndDateTime.Get(context), TimeZoneId,
                                                                          DiscreteType, UnitDigit);

                if (res != null && res.CalculatedValues != null)
                {
                    Balances.Set(context, res.CalculatedValues.Values.ToList());

                    if (res.Errors != null && res.Errors.Length > 0)
                    {
                        Errors.Set(context, res.Errors.ToString());
                    }
                }
            }

            catch (Exception ex)
            {
                Errors.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Errors.Get(context)));
        }
示例#6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is BatchRetrieveCatalogObjectsRequest other &&
                   ((ObjectIds == null && other.ObjectIds == null) || (ObjectIds?.Equals(other.ObjectIds) == true)) &&
                   ((IncludeRelatedObjects == null && other.IncludeRelatedObjects == null) || (IncludeRelatedObjects?.Equals(other.IncludeRelatedObjects) == true)) &&
                   ((CatalogVersion == null && other.CatalogVersion == null) || (CatalogVersion?.Equals(other.CatalogVersion) == true)));
        }
示例#7
0
        private AvoidObjectInfo BuildAvoidObjectInfo <T>() where T : WoWObject
        {
            var includeId        = ObjectIds.Any();
            var includeAvoidWhen = AvoidWhen != null;
            Predicate <WoWObject> pred;

            if (includeId)
            {
                if (includeAvoidWhen)
                {
                    pred = o => ObjectIds.Contains((int)o.Entry) && o is T && ((DelayCompiledExpression <Func <T, bool> >)AvoidWhen).CallableExpression((T)o);
                }
                else
                {
                    pred = o => ObjectIds.Contains((int)o.Entry) && o is T;
                }
            }
            else
            {
                pred = o => o is T && ((DelayCompiledExpression <Func <T, bool> >)AvoidWhen).CallableExpression((T)o);
            }

            Func <WoWObject, Vector3> locationProducer;

            if (AvoidLocationProducer != null)
            {
                locationProducer = o => ((DelayCompiledExpression <Func <T, Vector3> >)AvoidLocationProducer).CallableExpression((T)o);
            }
            else
            {
                locationProducer = null;
            }

            return(new AvoidObjectInfo(
                       () => true,
                       pred,
                       o => Radius,
                       ignoreIfBlocking: IgnoreIfBlocking,
                       locationProducer: locationProducer,
                       leashPointSelector: LeashPoint.HasValue ? new Func <Vector3>(() => LeashPoint.Value) : null,
                       leashRadius: LeashRadius));
        }
示例#8
0
        public override int GetHashCode()
        {
            int hashCode = 664426275;

            if (ObjectIds != null)
            {
                hashCode += ObjectIds.GetHashCode();
            }

            if (IncludeRelatedObjects != null)
            {
                hashCode += IncludeRelatedObjects.GetHashCode();
            }

            if (CatalogVersion != null)
            {
                hashCode += CatalogVersion.GetHashCode();
            }

            return(hashCode);
        }
示例#9
0
        private AvoidLocationInfo BuildAvoidMissileImpact()
        {
            var includeAvoidWhen = AvoidWhen != null;
            Func <IEnumerable <object> > collectionProducer;

            if (includeAvoidWhen)
            {
                collectionProducer = () => WoWMissile.InFlightMissiles
                                     .Where(m => (m.SpellId != 0 ? ObjectIds.Contains(m.SpellId) : ObjectIds.Contains(m.SpellVisualId)) &&
                                            ((DelayCompiledExpression <Func <WoWMissile, bool> >)AvoidWhen).CallableExpression(m));
            }
            else
            {
                collectionProducer = () => WoWMissile.InFlightMissiles
                                     .Where(m => m.SpellId != 0 ? ObjectIds.Contains(m.SpellId) : ObjectIds.Contains(m.SpellVisualId));
            }

            Func <object, Vector3> locationProducer;

            if (AvoidLocationProducer != null)
            {
                locationProducer = o => ((DelayCompiledExpression <Func <WoWMissile, Vector3> >)AvoidLocationProducer).CallableExpression((WoWMissile)o);
            }
            else
            {
                locationProducer = o => ((WoWMissile)o).ImpactPosition;
            }

            return(new AvoidLocationInfo(
                       () => true,
                       locationProducer,
                       o => Radius,
                       collectionProducer,
                       LeashPoint.HasValue ? new Func <Vector3>(() => LeashPoint.Value) : null,
                       LeashRadius,
                       ignoreIfBlocking: IgnoreIfBlocking));
        }
示例#10
0
        protected override void EvaluateUsage_SemanticCoherency(XElement xElement)
        {
            UsageCheck_SemanticCoherency(
                xElement,
                Command == CommandType.Add && s_avoidDictionary.ContainsKey(AvoidName),
                context => string.Format("An avoid with name {0} has already been added", AvoidName));

            UsageCheck_SemanticCoherency(
                xElement,
                Command == CommandType.Add && string.IsNullOrEmpty(AvoidWhenExpression) && !ObjectIds.Any(),
                context => "At least a ObjectId or AvoidWhen must be specified");

            UsageCheck_SemanticCoherency(
                xElement,
                Command == CommandType.Add && LeashPoint.HasValue && LeashRadius - Radius < 5,
                context => "LeashRadius MUST be at least 5 more than Radius when X/Y/Z is specified ");
        }