コード例 #1
0
        public string WriteLog(PayPalLogEntity.NotificationKind kind, string txnId, string logData)
        {
            if (String.IsNullOrEmpty(txnId))
            {
                throw new ArgumentException();
            }

            var rowKey = KeyUtils.GetCurrentTimeKey();

            var entity = new PayPalLogEntity
            {
                PartitionKey = txnId,
                RowKey       = rowKey,
                Kind         = kind.ToString(),
                LogData      = logData,
            };

            AzureStorageUtils.InsertEntity(AzureStorageUtils.TableNames.PaymentLog, entity);

            return(rowKey);
        }
コード例 #2
0
        // Extract text from the HTML page
        private string FindText(string html, string startSnippet, string endSnippet)
        {
            var i1 = html.IndexOf(startSnippet);
            var i2 = html.IndexOf(endSnippet, i1 + 1);

            if ((i1 == -1) || (i2 == -1))
            {
                // Write the poison HTML page to the log.
                var partitionKey = KeyUtils.GetCurrentTimeKey();
                var entity       = new ExternalSessionLogEntity
                {
                    PartitionKey = partitionKey,
                    RowKey       = "Error_FindText",
                    Data         = html,
                };
                AzureStorageUtils.InsertEntity(AzureStorageUtils.TableNames.ExternalSessions, entity);

                throw new FormatException("Parsing the external service data. Snippet not found. " + startSnippet.Length.ToString() + " " + endSnippet.Length.ToString());
            }
            var shift = startSnippet.Length;

            return(html.Substring(i1 + shift, i2 - i1 - shift));
        }