Ejemplo n.º 1
0
 /// <summary>
 /// Convert this instance to a CSV file
 /// </summary>
 /// <returns>string as CSV</returns>
 public string ToCsv()
 {
     return(string.Join(",",
                        EndTime.ToStringInvariant("yyyyMMdd HH:mm:ss"),
                        LastUpdate.ToStringInvariant("yyyyMMdd HH:mm:ss"),
                        Ticker,
                        Actual.ToStringInvariant(),
                        CalendarId,
                        Category,
                        Country,
                        (int)DataType,
                        DateSpan,
                        $"\"{EventRaw}\"",
                        Forecast.ToStringInvariant(),
                        (int)Importance,
                        IsPercentage.ToStringInvariant().ToLowerInvariant(),
                        OCategory,
                        OCountry,
                        Previous.ToStringInvariant(),
                        $"\"{Reference}\"",
                        Revised.ToStringInvariant(),
                        $"\"{Source}\"",
                        TESymbol,
                        TradingEconomicsForecast.ToStringInvariant()
                        ));
 }
Ejemplo n.º 2
0
        public static LastUpdate MapFromResponseItem(Dictionary <string, AttributeValue> item)
        {
            if (item.Any())
            {
                var dbLastUpdateItem = new LastUpdate();
                foreach (var propertyValue in item)
                {
                    switch (propertyValue.Key)
                    {
                    case "devicename":
                        dbLastUpdateItem.DeviceName = propertyValue.Value.S;
                        break;

                    case "topic":
                        dbLastUpdateItem.Topic = propertyValue.Value.S;
                        break;

                    case "tstamp":
                        dbLastUpdateItem.Tstamp = propertyValue.Value.S;
                        break;
                    }
                }

                return(dbLastUpdateItem);
            }

            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);
                UpdateLaunchFile();
                
                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate && AutomaticUpdates)
                {
                    CheckForUpdate();
                }

                // Open VS Code automatically when project is loaded
                if (AutoOpenEnabled)
                {
                    CheckForAutoOpen();
                }
                
            }
            
            // Event for when script is reloaded 
            System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     return(LinkSourceKind.GetHashCode()
            ^ Uri.GetHashCode()
            ^ Status.GetHashCode()
            ^ LastUpdate.GetHashCode());
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);

                // Handle Moving To New Folder
                if (MoveToFolderAutomatically)
                {
                    if (CheckFileLocation())
                    {
                        return;
                    }
                }

                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate)
                {
                    CheckForUpdate();
                }
            }



            //System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Ejemplo n.º 6
0
        public override string Xml(EtpVersion version, string indentation = "", bool embedded = false) =>
        $@"{indentation}<ChannelSet{Namespaces(embedded)} schemaVersion=""2.0"" uuid=""{Uuid}""{DefaultNamespace(embedded)}>
{indentation}  <Citation xmlns=""http://www.energistics.org/energyml/data/commonv2"">
{indentation}    <Title>{Title}</Title>
{indentation}    <Originator>ETP DevKit</Originator>
{indentation}    <Creation>{Creation.ToUniversalTime():O}</Creation>
{indentation}    <Format>Energistics:ETP DevKit {typeof(IEtpSession).Assembly.GetName().Version}</Format>
{indentation}    <LastUpdate>{LastUpdate.ToUniversalTime():O}</LastUpdate>
{indentation}  </Citation>
{indentation}  <Index>
{indentation}    <IndexType>{(IsTime ? "date time" : "measured depth")}</IndexType>
{indentation}    <Uom>{(IsTime ? "s" : "m")}</Uom>
{indentation}    <Direction>increasing</Direction>
{indentation}    <Mnemonic>{(IsTime ? "Time" : "Depth")}</Mnemonic>
{indentation}  </Index>
{string.Concat(Channels.Select(c => c.Xml(version, indentation = "  ", embedded = true)))}
{indentation}  <TimeDepth>{(IsTime ? "time" : "depth")}</TimeDepth>
{indentation}  <StartIndex xsi:type=""{(IsTime ? "TimeIndexValue" : "DepthIndexValue")}"">
{indentation}    <{(IsTime ? "Time" : "Depth")}>{(IsTime ? TimeStartIndex?.ToString("O", CultureInfo.InvariantCulture) : DepthStartIndex?.ToString(CultureInfo.InvariantCulture))}</{(IsTime ? "Time" : "Depth")}>
{indentation}  </StartIndex>
{indentation}  <EndIndex xsi:type=""{(IsTime ? "TimeIndexValue" : "DepthIndexValue")}"">
{indentation}    <{(IsTime ? "Time" : "Depth")}>{(IsTime ? TimeEndIndex?.ToString("O", CultureInfo.InvariantCulture) : DepthEndIndex?.ToString(CultureInfo.InvariantCulture))}</{(IsTime ? "Time" : "Depth")}>
{indentation}  </EndIndex>
{indentation}  <LoggingCompanyName>ETP DevKit</LoggingCompanyName>
{indentation}  <Wellbore>
{indentation}    <ContentType xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.ContentType}</ContentType>
{indentation}    <Title xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Title}</Title>
{indentation}    <Uuid xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Uuid}</Uuid>
{indentation}    <Uri xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Uri(version)}</Uri>
{indentation}  </Wellbore>
{indentation}</ChannelSet>";
        public override void Execute()
        {
            SafeReader sr = DB.GetFirst(
                "GetNonLimitedDataForCreditBureau",
                CommandSpecies.StoredProcedure,
                new QueryParameter("RefNumber", this.refNumber)
                );

            if (!sr.IsEmpty)
            {
                LastUpdate = sr["Created"];
                Score      = sr["RiskScore"];
                Errors     = sr["Errors"];

                Log.Debug(
                    "GetNonLimitedDataForCreditBureau {0} results: last update = '{1}', Score = {2}, Errors = '{3}'.",
                    this.refNumber,
                    LastUpdate.MomentStr(),
                    Score,
                    Errors
                    );
            }
            else
            {
                Log.Debug(
                    "GetNonLimitedDataForCreditBureau {0} results: no data found.",
                    this.refNumber
                    );
            }     // if
        }         // Execute
        private Rule GetUpdateRule()
        {
            // Once a node is reached during pathfinding, start traveling to the next node.

            //   If the distance between the player and the current node is less than 0.4 meters away (1)
            // OR
            //   the number of nodes is 2 or greater (2), the player is between the current node and the next node (3), and the player is in line of sight of the next node (4),
            // start traveling to the next node. (5)

            Element position = Element.Part <V_PositionOf>(new V_EventPlayer());

            Rule rule = new Rule(Constants.INTERNAL_ELEMENT + "Pathfinder: Update", RuleEvent.OngoingPlayer);

            rule.Conditions = new Condition[] {
                new Condition(
                    Element.Part <V_CountOf>(Path.GetVariable()),
                    Operators.GreaterThan,
                    0
                    ),
                new Condition(
                    Element.Part <V_Or>(
                        // (1)
                        new V_Compare(
                            Element.Part <V_DistanceBetween>(
                                NextPosition(new V_EventPlayer()),
                                position
                                ),
                            Operators.LessThan,
                            new V_Number(MoveToNext)
                            ),
                        Element.Part <V_And>(
                            // (2)
                            new V_Compare(
                                Element.Part <V_CountOf>(Path.GetVariable()),
                                Operators.Equal,
                                new V_Number(2)
                                ),
                            Element.Part <V_And>(
                                // (3)
                                IsBetween(position, PositionAt(new V_EventPlayer(), 0), PositionAt(new V_EventPlayer(), 1)),
                                // (4)
                                Element.Part <V_IsInLineOfSight>(position + new V_Vector(0, 1.5, 0), PositionAt(new V_EventPlayer(), 1) + new V_Vector(0, 1.5, 0))
                                )
                            )
                        )
                    )
            };

            rule.Actions = ArrayBuilder <Element> .Build(
                LastUpdate.SetVariable(new V_TotalTimeElapsed()),

                Next(), // (5)

                DistanceToNext.SetVariable(Element.Part <V_DistanceBetween>(Element.Part <V_PositionOf>(new V_EventPlayer()), NextPosition(new V_EventPlayer()))),
                A_Wait.MinimumWait,
                new A_LoopIfConditionIsTrue()
                );

            return(rule);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Returns true if LightingZoneStatus instances are equal
        /// </summary>
        /// <param name="other">Instance of LightingZoneStatus to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LightingZoneStatus other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     LastUpdate == other.LastUpdate ||
                     LastUpdate != null &&
                     LastUpdate.Equals(other.LastUpdate)
                 ) &&
                 (
                     Level == other.Level ||
                     Level != null &&
                     Level.Equals(other.Level)
                 ));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);

                // disable vs code and reset vs community as the default external editor
                EditorPrefs.SetString("kScriptsDefaultApp", EditorPrefs.GetString("VSCode_PreviousApp"));

                // sync will now successfully create or update the solution and project files
                SyncSolution();

                UpdateLaunchFile();

                // Re enable vscode
                EditorPrefs.SetString("kScriptsDefaultApp", CodePath);

                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate && AutomaticUpdates)
                {
                    CheckForUpdate();
                }
            }

            // Event for when script is reloaded
            System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (LastUpdate != null)
         {
             hashCode = hashCode * 59 + LastUpdate.GetHashCode();
         }
         if (Level != null)
         {
             hashCode = hashCode * 59 + Level.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 12
0
        public bool ExistsChanges(Guid guid)
        {
            bool exist = LastUpdate.IsChanged(guid);

            //Logger.info(String.Format("Проверка изменений {0}, {1} : {2}",lastUpdate,guid,exist));
            return(exist);
        }
        /// <summary>
        /// Update a LastUpdate
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="lockID"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public void DeleteLastUpdate(string currentUser, string user, string appID, string overrideID, string code, string lockID, IRepository <LastUpdate> dataRepository, IUnitOfWork uow)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (string.IsNullOrEmpty(code))
                {
                    throw new ArgumentOutOfRangeException("code");
                }
                if (string.IsNullOrEmpty(lockID))
                {
                    throw new ArgumentOutOfRangeException("lockID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }

                #endregion

                using (uow)
                {
                    // Convert string to guid
                    Guid codeGuid = Guid.Parse(code);

                    // Find item based on ID
                    LastUpdate dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                    // Delete the item
                    dataRepository.Delete(dataEntity);

                    // Commit unit of work
                    uow.Commit();
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                ExceptionManager.ShieldException(e);
            }
        }
Ejemplo n.º 14
0
 public IQueryable <Order> GetFilteredOrdersFromFilter(OrderFilter Filter, Guid guid)
 {
     Filter.SelectedUsersStr   = Filter.getSelectedUsersJoinStr();
     Filter.SelectedObjectsStr = Filter.getSelectedObjectsJoinStr();
     Logger.info("Получение списка заказов (GetFilteredOrdersFromXML)", Logger.LoggerSource.service);
     LastUpdate.saveUpdate(guid);
     return(context.getOrders(Filter));
 }
Ejemplo n.º 15
0
        private Rule GetStartRule(DeltinScript deltinScript)
        {
            var condition = new Condition(
                Element.Part <V_CountOf>(Path.GetVariable()),
                Operators.GreaterThan,
                0
                );

            Element eventPlayer    = new V_EventPlayer();
            Element eventPlayerPos = Element.Part <V_PositionOf>(eventPlayer);

            TranslateRule rule = new TranslateRule(deltinScript, Constants.INTERNAL_ELEMENT + "Pathfinder: Move", RuleEvent.OngoingPlayer);

            IfBuilder isBetween = new IfBuilder(rule.ActionSet,
                                                Element.Part <V_And>(
                                                    Element.Part <V_CountOf>(Path.GetVariable()) >= 2,
                                                    IsBetween(eventPlayerPos, NextPosition(eventPlayer), PositionAt(eventPlayer, 1))
                                                    )
                                                );

            isBetween.Setup();
            rule.ActionSet.AddAction(Next());
            isBetween.Finish();

            rule.ActionSet.AddAction(ArrayBuilder <Element> .Build
                                     (
                                         LastUpdate.SetVariable(new V_TotalTimeElapsed()),
                                         DistanceToNext.SetVariable(Element.Part <V_DistanceBetween>(Element.Part <V_PositionOf>(new V_EventPlayer()), NextPosition(new V_EventPlayer()))),
                                         // Element.Part<A_StartFacing>(
                                         //     new V_EventPlayer(),
                                         //     Element.Part<V_DirectionTowards>(
                                         //         new V_EyePosition(),
                                         //         NextPosition()
                                         //     ),
                                         //     new V_Number(700),
                                         //     EnumData.GetEnumValue(Relative.ToWorld),
                                         //     EnumData.GetEnumValue(FacingRev.DirectionAndTurnRate)
                                         // ),

                                         // Move to the next node.
                                         Element.Part <A_StartThrottleInDirection>(
                                             new V_EventPlayer(),
                                             Element.Part <V_DirectionTowards>(
                                                 new V_EyePosition(),
                                                 NextPosition(new V_EventPlayer()) // Because of ThrottleRev this will be reevaluated so 'Start Throttle In Direction' only needs to run once.
                                                 ),
                                             new V_Number(1),
                                             EnumData.GetEnumValue(Relative.ToWorld),
                                             EnumData.GetEnumValue(ThrottleBehavior.ReplaceExistingThrottle),
                                             EnumData.GetEnumValue(ThrottleRev.DirectionAndMagnitude)
                                             )
                                     ));

            var result = rule.GetRule();

            result.Conditions = new Condition[] { condition };
            return(result);
        }
Ejemplo n.º 16
0
        public override int GetHashCode()
        {
            var hashCode = -741907486;

            hashCode = hashCode * -1521134295 + LastUpdate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <ImmutableArray <Change> > .Default.GetHashCode(Changes);

            return(hashCode);
        }
Ejemplo n.º 17
0
        protected void Weekly()
        {
            TimeSpan threadWait = LastUpdate.Add(Duration) - LastUpdate;

            Thread.Sleep((int)threadWait.TotalMilliseconds);

            Duration   = new TimeSpan(7, 0, 0, 0, 0); // Add Seven Days, reached target day.
            LastUpdate = DateTime.Now;
        }
        public void Thief_WhatDidYouSteal_IsCorrect()
        {
            _layer[0, 0].Put(_upFacingValuable);

            PerformRobbery();

            Assert.AreEqual(1, UpdateCount);
            Assert.AreEqual(_upFacingValuable, LastUpdate.First());
        }
Ejemplo n.º 19
0
 public override string ToString()
 {
     return(string.Format("{0:S}[{1:S0}, TaskID={2:N0}, ServerID={3:N0}, ScheduleID={4:S}, Inserted={5:S}, LastUpdate={6:S}]",
                          this.GetType().FullName,
                          base.ToString(),
                          TaskID, ServerID,
                          ScheduleID.HasValue ? ScheduleID.Value.ToString() : "<null>",
                          Inserted.ToString(),
                          LastUpdate.ToString()));
 }
Ejemplo n.º 20
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CreationDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (LastUpdate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Status?.GetHashCode() ?? 0);
            return(hashCode);
        }
Ejemplo n.º 21
0
        public override string Xml(EtpVersion version, string indentation = "", bool embedded = false) =>
        $@"{indentation}<Well{Namespaces(embedded)} schemaVersion=""2.0"" uuid=""{Uuid}""{DefaultNamespace(embedded)}>
{indentation}  <Citation xmlns=""http://www.energistics.org/energyml/data/commonv2"">
{indentation}    <Title>{Title}</Title>
{indentation}    <Originator>ETP DevKit</Originator>
{indentation}    <Creation>{Creation.ToUniversalTime():O}</Creation>
{indentation}    <Format>Energistics:ETP DevKit {typeof(IEtpSession).Assembly.GetName().Version}</Format>
{indentation}    <LastUpdate>{LastUpdate.ToUniversalTime():O}</LastUpdate>
{indentation}  </Citation>
{indentation}</Well>";
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = (int)BloodType;
                hashCode = (hashCode * 397) ^ Id.GetHashCode();
                hashCode = (hashCode * 397) ^ LastUpdate.GetHashCode();

                return(hashCode);
            }
        }
Ejemplo n.º 23
0
 public override string ToString()
 {
     if (this.Types != null)
     {
         return($"Types:{Types.Select(m => m.ClassifType().ToString() + " (" + m.ClassifProbability.ToString("P2") + ")").Aggregate((f, s) => f + "; " + s)}"
                + $" updated:{LastUpdate.ToString()}");
     }
     else
     {
         return($"Types:snull updated:{LastUpdate.ToString()}");
     }
     //return base.ToString();
 }
        public override void Update(IDatabase db, Court court, IEnumerable <JudgeModel> judges)
        {
            base.Update(db, court, judges);
            court.Name         = Name.Sanatize();
            court.BoardName    = BoardName.Sanatize();
            court.Mail         = Mail.Sanatize();
            court.BoardMail    = BoardMail.Sanatize();
            court.ReminderMode = ReminderMode.TryParseEnum(Model.ReminderMode.Standard);

            if (CourtKey.IsNullOrEmpty())
            {
                court.CourtKey = Rng.Get(16).ToHexString();
            }
            else
            {
                court.CourtKey = CourtKey.Sanatize();
            }

            if (BoardKey.IsNullOrEmpty())
            {
                court.BoardKey = Rng.Get(16).ToHexString();
            }
            else
            {
                court.BoardKey = BoardKey.Sanatize();
            }

            court.LastUpdate    = LastUpdate.ParseTimestamp();
            court.LastReminder  = LastReminder.ParseTimestamp();
            court.ReminderLevel = ReminderLevel.TryParseInt(0, 0, 9);

            if (Substitute == NullOption)
            {
                court.Substitute = null;
            }
            else
            {
                Guid substituteId = Guid.Empty;
                if (Guid.TryParse(Substitute, out substituteId))
                {
                    if (substituteId.Equals(Guid.Empty))
                    {
                        court.Substitute = null;
                    }
                    else
                    {
                        court.Substitute = db.Query <Court>(substituteId);
                    }
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// For saving settings (NOT cache)
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public XmlNode toXML(ref XmlDocument doc)
        {
            XmlElement repo = doc.CreateElement("repo");

            repo.SetAttribute("type", "remote");
            repo.SetAttribute("name", Name);
            repo.SetAttribute("website", Website);
            repo.SetAttribute("maintainer", Maintainer);
            repo.SetAttribute("lastUpdate", LastUpdate.ToString());

            repo.SetAttribute("url", URL);

            return(repo);
        }
Ejemplo n.º 26
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ Title?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ Status.GetHashCode();
         hashCode = (hashCode * 397) ^ Description?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ Creation.GetHashCode();
         hashCode = (hashCode * 397) ^ LastUpdate?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ Exclusion?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ Conclusion?.GetHashCode() ?? 0;
         return(hashCode);
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Autogenerated by Visual Studio
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            int hashCode = 1640209775;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FolderPath);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FileName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PreviewInfo);

            hashCode = hashCode * -1521134295 + LastUpdate.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Converts the data to TSV
 /// </summary>
 /// <returns>String of TSV</returns>
 /// <remarks>Parsable by the constructor should you need to recreate the object from TSV</remarks>
 public override string ToLine()
 {
     return(string.Join("\t",
                        TimeProcessedUtc?.ToStringInvariant("yyyyMMdd HH:mm:ss"),
                        TransactionID,
                        EventType == null ? null : JsonConvert.SerializeObject(EventType).Replace("\"", ""),
                        LastUpdate.ToStringInvariant("yyyyMMdd"),
                        LastIDsUpdate?.ToStringInvariant("yyyyMMdd"),
                        ISIN,
                        USDMarketCap,
                        CompanyID,
                        ICBIndustry,
                        ICBSuperSector,
                        ICBSector,
                        ICBSubSector,
                        ICBCode,
                        CompanyName,
                        PreviousResultsAnnouncementDate?.ToStringInvariant("yyyyMMdd"),
                        NextResultsAnnouncementsDate?.ToStringInvariant("yyyyMMdd"),
                        NextCloseBegin?.ToStringInvariant("yyyyMMdd"),
                        LastCloseEnded?.ToStringInvariant("yyyyMMdd"),
                        SecurityDescription,
                        TickerCountry,
                        TickerSymbol,
                        AnnouncementDate?.ToStringInvariant("yyyyMMdd"),
                        TimeReleased?.ToStringInvariant("yyyyMMdd HH:mm:ss"),
                        TimeProcessed?.ToStringInvariant("yyyyMMdd HH:mm:ss"),
                        TimeReleasedUtc?.ToStringInvariant("yyyyMMdd HH:mm:ss"),
                        AnnouncedIn,
                        BuybackDate?.ToStringInvariant("yyyyMMdd"),
                        Execution == null ? null : JsonConvert.SerializeObject(Execution).Replace("\"", ""),
                        ExecutionEntity == null ? null : JsonConvert.SerializeObject(ExecutionEntity).Replace("\"", ""),
                        ExecutionHolding == null ? null : JsonConvert.SerializeObject(ExecutionHolding).Replace("\"", ""),
                        Currency,
                        ExecutionPrice,
                        Amount,
                        GBPValue,
                        EURValue,
                        USDValue,
                        NoteText,
                        BuybackPercentage,
                        VolumePercentage,
                        ConversionRate,
                        AmountAdjustedFactor,
                        PriceAdjustedFactor,
                        TreasuryHolding));
 }
Ejemplo n.º 29
0
        private LastUpdate GetLastUpdate(AmazonDynamoDBClient client, string deviceId)
        {
            var request = new QueryRequest
            {
                TableName     = "lastupdate",
                KeyConditions = new Dictionary <string, Condition>
                {
                    { "devicename", new Condition()
                      {
                          ComparisonOperator = ComparisonOperator.EQ,
                          AttributeValueList = new List <AttributeValue>
                          {
                              new AttributeValue {
                                  S = deviceId
                              }
                          }
                      } }
                }
            };
            var response = client.Query(request);

            if (response != null && response.Items.Any())
            {
                var lastUpdate = new LastUpdate();

                var item = response.Items.First();
                foreach (var propertyValue in item)
                {
                    switch (propertyValue.Key)
                    {
                    case "devicename":
                        lastUpdate.DeviceName = propertyValue.Value.S;
                        break;

                    case "topic":
                        lastUpdate.Topic = propertyValue.Value.S;
                        break;

                    case "tstamp":
                        lastUpdate.Tstamp = propertyValue.Value.S;
                        break;
                    }
                }
                return(lastUpdate);
            }
            return(null);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Converts the data to CSV
 /// </summary>
 /// <returns>String of CSV</returns>
 /// <remarks>Parsable by the constructor should you need to recreate the object from CSV</remarks>
 public override string ToLine()
 {
     return(string.Join("\t",
                        TransactionID,
                        BuybackType,
                        LastUpdate.ToString("yyyyMMdd"),
                        LastIDsUpdate?.ToString("yyyyMMdd"),
                        ISIN,
                        USDMarketCap,
                        CompanyID,
                        ICBIndustry,
                        ICBSuperSector,
                        ICBSector,
                        ICBSubSector,
                        ICBCode,
                        CompanyName,
                        PreviousResultsAnnouncementDate?.ToString("yyyyMMdd"),
                        NextResultsAnnouncementsDate?.ToString("yyyyMMdd"),
                        NextCloseBegin?.ToString("yyyyMMdd"),
                        LastCloseEnded?.ToString("yyyyMMdd"),
                        SecurityDescription,
                        TickerCountry,
                        TickerSymbol,
                        AnnouncementDate?.ToString("yyyyMMdd"),
                        TimeReleased?.ToString("yyyyMMdd HH:mm:ss"),
                        TimeProcessed?.ToString("yyyyMMdd HH:mm:ss"),
                        TimeReleasedUtc?.ToString("yyyyMMdd HH:mm:ss"),
                        TimeProcessedUtc?.ToString("yyyyMMdd HH:mm:ss"),
                        AnnouncedIn,
                        BuybackDate?.ToString("yyyyMMdd"),
                        BuybackVia,
                        BuybackBy,
                        HoldingType,
                        Currency,
                        Price,
                        TransactionAmount,
                        GBPValue,
                        EURValue,
                        USDValue,
                        NoteText,
                        BuybackPercentage,
                        VolumePercentage,
                        ConversionRate,
                        AmountAdjustedFactor,
                        PriceAdjustedFactor,
                        TreasuryHolding));
 }