コード例 #1
0
        public CreateProcedureStatement GenerateUpdateStoredProcedure(Table table, QuoteType quoteType = QuoteType.NotQuoted)
        {
            var    pkColumn            = table.Indexes.SingleOrDefault(x => x.IsPrimary).Name;
            var    columnNames         = GetColumnNamesWithoutPrimaryKey(table, pkColumn);
            string storedProcedureName = string.Concat("Update", table.Name);
            var    parameters          = CreateProcedureParameters(table, true);
            var    setClauses          = new List <SetClause>();
            string primaryKeyName      = "";

            foreach (var column in table.Columns)
            {
                if (column.IsPrimaryKey())
                {
                    primaryKeyName = column.Name;
                    continue;
                }

                setClauses.Add(ScriptFactory.EqualsAssignmentSetClause(
                                   ScriptFactory.ColumnReference(column.Name, quoteType),
                                   ScriptFactory.IdentifierLiteral(
                                       CreateProcedureParameterVariableName(column), QuoteType.NotQuoted)));
            }

            StatementList statements = ScriptFactory.List(
                ScriptFactory.Update(ScriptFactory.UpdateSpecification(null,
                                                                       ScriptFactory.Where(
                                                                           ScriptFactory.BooleanEqualsComparison(ScriptFactory.IdentifierLiteral(primaryKeyName, quoteType), ScriptFactory.VariableReference(primaryKeyName))),
                                                                       CreateNamedTableReference(table, quoteType), null, null, null, setClauses)));

            return(ScriptFactory.CreateProcedure(false,
                                                 ScriptFactory.ProcedureReference(
                                                     GenerateStoredProcedureName(storedProcedureName, table, quoteType)),
                                                 ScriptFactory.List(
                                                     ScriptFactory.BeginEndBlock(statements)), null, null, parameters));
        }
コード例 #2
0
 public void AddCreateTableBatches(IEnumerable <Table> tables, QuoteType quoteType = QuoteType.NotQuoted)
 {
     foreach (Table table in tables)
     {
         AddCreateTableBatch(table, quoteType);
     }
 }
コード例 #3
0
        public IEnumerable <ColumnDefinition> GenerateColumnDefinitions(Table table, QuoteType quoteType = QuoteType.NotQuoted)
        {
            List <ColumnDefinition> columns = new List <ColumnDefinition>();

            foreach (var column in table.Columns)
            {
                SqlDataType       sqlDataType = SqlDataType.Parse(column.DataType);
                DataTypeReference dataType    = GenerateDataTypeReference(sqlDataType);
                if (column.IsIdentity)
                {
                    ColumnDefinition columnDef = ScriptFactory.IdentityColumn(column.Name, dataType, CreateIdentityOptions(column), quoteType);
                    columns.Add(columnDef);
                }
                else if (column.RowGuid)
                {
                    if (!string.IsNullOrEmpty(column.DefaultValue))
                    {
                        ColumnDefinition rowGuidCol = ScriptFactory.ColumnDefinition(column.Name, column.DefaultValue, column.DefaultName, dataType, column.AllowNulls, column.RowGuid, quoteType);
                        columns.Add(rowGuidCol);
                    }
                }
                else
                {
                    columns.Add(ScriptFactory.ColumnDefinition(column.Name, dataType, column.AllowNulls, quoteType));
                }
            }

            return(columns);
        }
コード例 #4
0
        public Quote Get(QuoteType quoteType, string vehicleRegistration, short termMonths, decimal deposit)
        {
            var vehiclePrice = _vehicleService.GetRetailPrice(vehicleRegistration);
            var quote        = _quoteService.CalculateQuote(quoteType, vehiclePrice, termMonths, deposit);

            return(quote);
        }
コード例 #5
0
ファイル: MarketDatum.cs プロジェクト: QLNetRisk/Engine
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="value"></param>
 /// <param name="asofDate"></param>
 /// <param name="name"></param>
 /// <param name="quoteType"></param>
 /// <param name="ccy"></param>
 /// <param name="fwdStart"></param>
 /// <param name="term"></param>
 public FRAQuote(double value, Date asofDate, string name, QuoteType quoteType, string ccy, Period fwdStart, Period term)
     : base(value, asofDate, name, quoteType, InstrumentType.FRA)
 {
     _term     = term;
     _ccy      = ccy;
     _fwdStart = fwdStart;
 }
コード例 #6
0
        public void AddDefaultConstraintBatches(IEnumerable <Table> tables, QuoteType quoteType = QuoteType.NotQuoted)
        {
            var definitions = new List <TableDefaultConstraint>();

            AddBatch(Generator.GeneratePrintStatement($"========== Creating Default Constraints =========="));
            foreach (Table table in tables)
            {
                foreach (var column in table.Columns)
                {
                    if (!string.IsNullOrEmpty(column.DefaultName))
                    {
                        definitions.Add(new TableDefaultConstraint
                        {
                            Constraint = ScriptFactory.DefaultConstraintDefinition(
                                ScriptFactory.Identifier(column.Name, quoteType),
                                ScriptFactory.Identifier(column.DefaultName, quoteType),
                                false,
                                ScriptFactory.ParenthesisExpression(ScriptFactory.IntegerLiteral(column.DefaultValue))),
                            Table = table
                        });
                    }
                }
            }

            AddDefaultConstraints(definitions, quoteType);
        }
コード例 #7
0
    public static int GetScore(string txt, QuoteType quote)
    {
        switch (quote)
        {
        case QuoteType.WE_MUST_NEVER_SUBMIT:
            return(doScore(txt,
                           a("we must submit", "they would never take away", "only they can lead us"),
                           a()
                           ));

        case QuoteType.AS_YOUR_ROBO:
            return(doScore(txt,
                           a("i will spare"),
                           a("and bloody")
                           ));

        case QuoteType.WE_SHOULD_INVEST:
            return(doScore(txt,
                           a("i believe", "are fundamentally inferior", "and call for their"),
                           a("there are many who", "are ultimately misguided")
                           ));

        default:
            return(0);
        }
    }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedRateShippingGatewayMethod"/> class.
 /// </summary>
 /// <param name="gatewayResource">
 /// The gateway resource.
 /// </param>
 /// <param name="shipMethod">
 /// The ship method.
 /// </param>
 /// <param name="shipCountry">
 /// The ship country.
 /// </param>
 /// <param name="rateTable">
 /// The rate table.
 /// </param>
 public FixedRateShippingGatewayMethod(IGatewayResource gatewayResource, IShipMethod shipMethod, IShipCountry shipCountry, IShippingFixedRateTable rateTable)
     : base(gatewayResource, shipMethod, shipCountry)
 {
     RateTable = new ShippingFixedRateTable(shipMethod.Key);
     _quoteType = GatewayResource.ServiceCode == FixedRateShippingGatewayProvider.VaryByWeightPrefix ? QuoteType.VaryByWeight : QuoteType.VaryByPrice;
     RateTable = rateTable;
 }
コード例 #9
0
        public async Task <ActionResult> Create(string text, string authorId, QuoteType type = QuoteType.Normal)
        {
            if (string.IsNullOrEmpty(text))
            {
                throw new ArgumentNullException(nameof(text));
            }

            if (string.IsNullOrEmpty(authorId))
            {
                throw new ArgumentNullException(nameof(authorId));
            }
            int parsedAuthorId;
            var newQuote = DbContext.Quotes.Create();

            if (int.TryParse(authorId, out parsedAuthorId))
            {
                newQuote.Author = DbContext.People.FirstOrDefault(p => p.PersonId == parsedAuthorId);
            }
            else
            {
                newQuote.AnonymousAuthor = authorId;
            }

            newQuote.Text            = text;
            newQuote.Owner           = GetCurrentUser();
            newQuote.DateTimeCreated = DateTime.Now;
            newQuote.QuoteType       = type;
            var dbQuote = DbContext.Quotes.Add(newQuote);
            await DbContext.SaveChangesAsync();

            return(JsonResult(new GenericOperationResponse <QuoteItemResponse>(
                                  QuoteItemResponse.Transform(dbQuote))));
        }
コード例 #10
0
 public FixedRateShippingGatewayMethod(IGatewayResource gatewayResource, IShipMethod shipMethod, IShipCountry shipCountry, IShippingFixedRateTable rateTable)
     : base(gatewayResource, shipMethod, shipCountry)
 {
     RateTable  = new ShippingFixedRateTable(shipMethod.Key);
     _quoteType = GatewayResource.ServiceCode == FixedRateShippingGatewayProvider.VaryByWeightPrefix ? QuoteType.VaryByWeight : QuoteType.VaryByPrice;
     RateTable  = rateTable;
 }
コード例 #11
0
        public CreateProcedureStatement GenerateFindStoredProcedure(Table table, QuoteType quoteType = QuoteType.NotQuoted)
        {
            Database database            = table.Parent;
            var      pkColumn            = GetPrimaryKeyColumnName(table);
            var      columnNames         = GetColumnNamesWithoutPrimaryKey(table, pkColumn);
            var      pkDataType          = table.Columns.Single(x => x.Name == pkColumn).DataType.ToSqlDataTypeOption();
            string   storedProcedureName = string.Concat("Find", table.Name);
            var      parameters          = new List <ProcedureParameter>();

            parameters.Add(ScriptFactory.ProcedureParameter(
                               ScriptFactory.Identifier(MakeVariableName(pkColumn)),
                               false,
                               ScriptFactory.SqlDataType(pkDataType)));



            StatementList statements = ScriptFactory.List(
                ScriptFactory.Select(
                    default(Identifier),
                    ScriptFactory.Query(
                        ScriptFactory.From(ScriptFactory.NamedTableReference(GenerateSchemaObjectName(table, quoteType))),
                        ScriptFactory.Where(ScriptFactory.BooleanEqualsComparison(ScriptFactory.IdentifierLiteral(pkColumn, quoteType), ScriptFactory.VariableReference(pkColumn))),
                        ScriptFactory.TopRowFilter(false, false, ScriptFactory.IntegerLiteral("1")),
                        ScriptFactory.ElementList(columnNames.Select(x => ScriptFactory.SelectScalarExpression(x, quoteType)))
                        )
                    )
                );

            return(ScriptFactory.CreateProcedure(false,
                                                 ScriptFactory.ProcedureReference(
                                                     GenerateStoredProcedureName(storedProcedureName, table, quoteType)),
                                                 ScriptFactory.List(
                                                     ScriptFactory.BeginEndBlock(statements)), null, null, parameters));
        }
コード例 #12
0
 public CharacterVerse(BCVRef bcvRef, string character, string delivery, string alias, bool projectSpecific,
                       QuoteType quoteType = QuoteType.Normal, string defaultCharacter = null, string parallelPassageReferences = null) :
     base(character, delivery, alias, projectSpecific, quoteType, defaultCharacter, parallelPassageReferences)
 {
     BcvRef          = new BCVRef(bcvRef);
     m_origQuoteType = quoteType;
 }
コード例 #13
0
 public static ColumnDefinition Column(string columnName,
                                       DataTypeReference dataType,
                                       bool nullable       = false,
                                       QuoteType quoteType = QuoteType.NotQuoted)
 {
     return(Column(Identifier(columnName, quoteType), dataType, nullable));
 }
コード例 #14
0
        public ADouble ValueInstrumentFromFactoryAD(LinearRateModel model, string instrument)
        {
            // Values an instrument contained in the instrument factory using a
            // linear rate model. Note that value here means calculating the value
            // par rate (which is how trades are quoted).

            QuoteType type = InstrumentTypeMap[instrument];

            switch (type)
            {
            case QuoteType.ParSwapRate:
                return(model.IrParSwapRateAD(IrSwaps[instrument]));

            case QuoteType.ParBasisSpread:
                return(model.ParBasisSpreadAD(BasisSwaps[instrument]));

            case QuoteType.OisRate:
                return(model.OisRateSimpleAD(OisSwaps[instrument]));

            case QuoteType.FraRate:
                return(model.ParFraRateAD(Fras[instrument]));

            case QuoteType.FuturesRate:
                return(model.ParFutureRateAD(Futures[instrument]));

            case QuoteType.Deposit:
                return(model.ParDepositRateAD(Deposits[instrument]));

            default:
                throw new InvalidOperationException("Instrument QuoteType not supported...");
            }
        }
コード例 #15
0
    private void ScoreQuote(string concatenatedText, QuoteType quoteType)
    {
        string rubricString = quotesRefList[(int)selectedQuoteType];

        Debug.Log("Player Quote: " + concatenatedText);
        Debug.Log("Quote to grade to : " + rubricString);

        switch (selectedQuoteType)
        {
        case QuoteType.AS_YOUR_ROBO:     // Can make unique grading criteria for the test quote here

            // grade here

            // set these to score actual values
            quotePlayerScore = 10;
            quoteMaxScore    = 10;


            break;

        default:
            quoteMaxScore    = 0;
            quotePlayerScore = 0;
            break;
        }
    }
コード例 #16
0
        private void AddCreateUniqueConstraintBatch(Index index, QuoteType quoteType)
        {
            List <ColumnWithSortOrder> columns = new List <ColumnWithSortOrder>();

            foreach (var member in index.Members)
            {
                Column column = index.Parent.Columns.FirstOrDefault(c => c.Name == member.Column);
                columns.Add(
                    ScriptFactory.ColumnWithSortOrder(
                        ScriptFactory.ColumnReferenceExpression(
                            ScriptFactory.MultiPartIdentifier(
                                ScriptFactory.Identifier(member.Column, quoteType)), ColumnType.Regular), SortOrder.Ascending));
            }
            UniqueConstraintDefinition uniqueConstraint = ScriptFactory.UniqueConstraintDefinition(
                ScriptFactory.Identifier(index.Name, quoteType),
                false,
                index.IsClustered,
                null,
                null,
                null,
                columns
                );

            AddBatch(ScriptFactory.AlterTableAddTableElement(
                         ScriptFactory.TableDefinition(
                             null,
                             null,
                             new List <ConstraintDefinition> {
                uniqueConstraint
            },
                             null),
                         Generator.GenerateSchemaObjectName(index.Parent, quoteType)));
        }
コード例 #17
0
        public void AddCreateForeignKeyBatch(ForeignKey key, QuoteType quoteType = QuoteType.NotQuoted)
        {
            var first = key.ForeignKeyColumns.FirstOrDefault();

            var pkTable = key.Parent.Parent.Tables.FirstOrDefault(t => t.Name == key.PkTable);

            ForeignKeyConstraintDefinition uniqueConstraint = ScriptFactory.ForeignKeyConstraintDefinition(
                ScriptFactory.Identifier(key.Name, quoteType),
                false,
                Generator.GenerateSchemaObjectName(pkTable, quoteType),
                DeleteUpdateAction.NotSpecified,
                DeleteUpdateAction.NotSpecified,
                key.ForeignKeyColumns.Select(fkc => ScriptFactory.Identifier(fkc.FkColumn, quoteType)),
                key.ForeignKeyColumns.Select(fkc => ScriptFactory.Identifier(fkc.PkColumn, quoteType))
                );

            AddBatch(ScriptFactory.AlterTableAddTableElement(
                         ScriptFactory.TableDefinition(
                             null,
                             null,
                             new List <ConstraintDefinition> {
                uniqueConstraint
            },
                             null),
                         Generator.GenerateSchemaObjectName(key.Parent, quoteType)));
        }
コード例 #18
0
 public static NamedTableReference NamedTableReference(string databaseName,
                                                       string schemaName,
                                                       string tableName,
                                                       QuoteType quoteType = QuoteType.NotQuoted)
 {
     return(NamedTableReference(FullTableName(databaseName, schemaName, tableName, quoteType)));
 }
コード例 #19
0
        public void AddUniqueConstraintBatches(IEnumerable <Table> tables, QuoteType quoteType = QuoteType.NotQuoted)
        {
            AddBatch(Generator.GeneratePrintStatement($"========== Creating Unique Constraints =========="));
            List <Index> indexes = new List <Index>();

            foreach (var table in tables)
            {
                foreach (var index in table.Indexes)
                {
                    if (!index.IsPrimary)
                    {
                        if (index.IsUnique)
                        {
                            indexes.Add(index);
                        }
                    }
                }
            }
            for (int i = 0; i < indexes.Count; i++)
            {
                Index index = indexes[i];
                AddBatch(Generator.GeneratePrintStatement($"[{i + 1,-2} - {indexes.Count}] Creating unique constraint [{index.Name}]"));
                AddCreateUniqueConstraintBatch(index, quoteType);
            }
        }
コード例 #20
0
 public static SchemaObjectName FullTableName(string databaseName,
                                              string schemaName,
                                              string tableName,
                                              QuoteType quoteType = QuoteType.NotQuoted)
 {
     return(FullTableName(Identifier(databaseName, quoteType), Identifier(schemaName, quoteType), Identifier(tableName, quoteType)));
 }
コード例 #21
0
        /// <summary>
        /// Determines if an attribute must have a quote (and what type) according to HTML 4.01 spec (http://www.w3.org/TR/html401/)
        /// section 3.2.2.
        /// </summary>
        public static QuoteType NeedQuotesForAttr(string val)
        {
            if (string.IsNullOrWhiteSpace(val))
            {
                return(QuoteType.Double);
            }

            QuoteType qt = QuoteType.None;

            foreach (char c in val)
            {
                if (c >= 'a' && c <= 'z')
                {
                    continue;
                }
                if (c >= 'A' && c <= 'Z')
                {
                    continue;
                }
                if (c >= '0' && c <= '9')
                {
                    continue;
                }
                if (c == '_' || c == '-' || c == '.' || c == ',')        // According to http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2
                {
                    continue;
                }
                qt = QuoteType.Double;
                if (c == '\"')
                {
                    qt = QuoteType.Single;
                }
            }
            return(qt);
        }
コード例 #22
0
 public InstrumentQuote(string identifier, QuoteType type, DateTime curvePoint, double quoteValue)
 {
     this._identifier = identifier;
     this._type       = type;
     this.QuoteValue  = quoteValue;
     this.CurvePoint  = curvePoint;
 }
コード例 #23
0
        public async Task <GlobalData> GetGlobalData(QuoteType quote = QuoteType.NONE)
        {
            string  endpoint = "";
            JObject jObject;

            if (quote != QuoteType.NONE)
            {
                endpoint += $"?convert={QuoteToString(quote)}";
            }
            try
            {
                jObject = await GetJObject("https://api.coinmarketcap.com/v1/global/" + endpoint);
            }
            catch
            {
                return(null);
            }
            GlobalData globalData = jObject.ToObject <GlobalData>();

            if (quote != QuoteType.NONE)
            {
                globalData.Converted24hVolume = jObject[$"total_24h_volume_{QuoteToString(quote)}"].ToObject <float>();
                globalData.ConvertedMarketCap = jObject[$"total_market_cap_{QuoteToString(quote)}"].ToObject <float>();
                globalData.Quote = quote;
            }
            return(globalData);
        }
コード例 #24
0
        public async Task <Ticker> GetTicker(string id, QuoteType quote = QuoteType.NONE)
        {
            string endpoint = id + "/";

            JToken jObject;

            if (quote != QuoteType.NONE)
            {
                endpoint += $"?convert={QuoteToString(quote)}";
            }
            try
            {
                jObject = await GetJToken("https://api.coinmarketcap.com/v1/ticker/" + endpoint);
            }
            catch
            {
                return(null);
            }
            // get JSON result objects into a list
            List <JToken> jTokens = jObject.Children().ToList();
            // serialize JSON results into .NET objects
            Ticker ticker = jTokens[0].ToObject <Ticker>();;

            if (quote != QuoteType.NONE)
            {
                ticker.ConvertedPrice     = jTokens[0][$"price_{QuoteToString(quote)}"].ToObject <string>();
                ticker.Converted24hVolume = jTokens[0][$"24h_volume_{QuoteToString(quote)}"].ToObject <string>();
                ticker.ConvertedMarketCap = jTokens[0][$"market_cap_{QuoteToString(quote)}"].ToObject <string>();
                ticker.Quote = quote;
            }

            return(ticker);
        }
コード例 #25
0
        //
        // Is there an escaped quote token starting at _s[_tokenStartIndex]?
        // If yes then set _quoteType to the appropriate type and set _tokenEndIndex to the next character after the token.
        //
        private bool IsEscapedQuoteToken()
        {
            var escapedOpenQuote  = _options.EscapedOpenQuote;
            var escapedCloseQuote = _options.EscapedCloseQuote;

            if (string.Compare(_s, _tokenStartIndex, escapedOpenQuote, 0, escapedOpenQuote.Length) == 0)
            {
                // Found escaped open quote
                _tokenEndIndex += escapedOpenQuote.Length;
                // If the open quote and close quote strings are the same then this could actually be an open or a close quote
                _quoteType = escapedOpenQuote == escapedCloseQuote ? QuoteType.OpenClose : QuoteType.Open;
                return(true);
            }

            if (string.Compare(_s, _tokenStartIndex, escapedCloseQuote, 0, escapedCloseQuote.Length) == 0)
            {
                // Found escaped close quote
                _tokenEndIndex += escapedCloseQuote.Length;
                _quoteType      = QuoteType.Close;
                return(true);
            }

            _quoteType = QuoteType.None;
            return(false);
        }
コード例 #26
0
 public static CreateTableStatement CreateTable(string databaseName,
                                                string schemaName,
                                                string tableName,
                                                TableDefinition definition,
                                                QuoteType quoteType = QuoteType.NotQuoted)
 {
     return(CreateTable(FullTableName(databaseName, schemaName, tableName, quoteType), definition));
 }
コード例 #27
0
 public void AddCreateTableBatches(IEnumerable <Table> tables, QuoteType quoteType = QuoteType.NotQuoted)
 {
     AddBatch(Generator.GeneratePrintStatement($"========== Creating tables =========="));
     foreach (Table table in tables)
     {
         AddCreateTableBatch(table, quoteType);
     }
 }
コード例 #28
0
 public static Identifier Identifier(string value, QuoteType quoteType = QuoteType.NotQuoted)
 {
     return(new Identifier
     {
         Value = value,
         QuoteType = quoteType
     });
 }
コード例 #29
0
ファイル: Attribute.cs プロジェクト: toddcoder/Core-code
        public Attribute(string name, string text, QuoteType quote)
        {
            text.Must().Not.BeNull().OrThrow();

            this.name  = name.Must().Not.BeNullOrEmpty().Force();
            this.text  = Markupify(text, quote);
            this.quote = quote;
        }
コード例 #30
0
 public TSqlScript BuildScript(Database database, QuoteType quoteType = QuoteType.NotQuoted)
 {
     AddDropDatabaseIfExistsBatch(database, quoteType);
     AddCreateDatabaseBatch(database, quoteType);
     AddUseDatabaseBatch(database, quoteType);
     AddCreateTableBatches(database.Tables, quoteType);
     return(Script);
 }
コード例 #31
0
        public SchemaObjectName GenerateSchemaObjectName(Column column, QuoteType quoteType = QuoteType.NotQuoted)
        {
            var retVal = new SchemaObjectName();

            retVal.Identifiers.Add(ScriptFactory.Identifier(column.Parent.Name, quoteType));
            retVal.Identifiers.Add(ScriptFactory.Identifier(column.Name, quoteType));
            return(retVal);
        }
コード例 #32
0
ファイル: QuotedExpression.cs プロジェクト: takeshik/yacq
 internal QuotedExpression(
     SymbolTable symbols,
     QuoteType quoteType,
     Expression expression
 )
     : base(symbols)
 {
     this.QuoteType = quoteType;
     this.Expression = expression ?? Empty();
     this.SetPosition(this.Expression);
 }
コード例 #33
0
ファイル: QuoteData.cs プロジェクト: johnmensen/TradeSharp
 public float GetPrice(QuoteType quoteType)
 {
     var price = quoteType == QuoteType.Ask
                     ? ask
                     : quoteType == QuoteType.Bid
                           ? bid
                           : quoteType == QuoteType.Middle
                             ? 0.5f * (ask + bid)
                             : ask == 0
                                 ? bid
                                 : bid == 0 ? ask : 0.5f * (ask + bid);
     return price;
 }
コード例 #34
0
    // **********************************************************************

    static bool QuoteTypeEquals(QuoteType qt1, QuoteType qt2)
    {
      switch(qt1)
      {
        case QuoteType.Ask:
        case QuoteType.BestAsk:
          return qt2 == QuoteType.Ask || qt2 == QuoteType.BestAsk;

        case QuoteType.Bid:
        case QuoteType.BestBid:
          return qt2 == QuoteType.Bid || qt2 == QuoteType.BestBid;

        default:
          return qt1 == qt2;
      }
    }
コード例 #35
0
ファイル: Default.aspx.cs プロジェクト: jdamsbo/bevs.dk
    protected void Page_Load(object sender, EventArgs e)
    {
        qt = new QuoteType();
        qt.QuoteTypeText = QuoteTypes.chuck.ToString();
        qt.Heading = "Chuck Norris Generator";
        //qt.SubHeading = "Chuck Norris, verdens definitivt sejeste karl!";
        qt.LeadText = "Tag Arnold, bland ham op med van Damme, tilsæt et skvæt Mr. T, krydr det med lidt Robert de Niro, mix det op med Steven Seagal og server det hele med et bæger Sylvester Stallone. Så har du ikke bare verdens bedste method actor, stuntman, voldstosse eller karatechamp, nej det er galaksens skrappeste gut.";

        /// Max 500 karakterer i keywords og max 15-20 ord!
        qt.MetaTagKeywords = "Chuck Norris, generator, sjove fakta";
        qt.MetaTagDescription = "Sjove fakta om Chuck Norris, manden som er sejere end læder og hårdere end stål.";
        qt.PageTitle = "Chuck Norris Generator - Sjove fakta om Chuck Norris, verdens definitivt sejeste karl!";

        qt.PageViews = UpdatePageViews(Request.Path);

        ShowQuotes1.QT = qt;
    }
コード例 #36
0
ファイル: Default.aspx.cs プロジェクト: jdamsbo/bevs.dk
    protected void Page_Load(object sender, EventArgs e)
    {
        qt = new QuoteType();
        qt.QuoteTypeText = QuoteTypes.hmmm.ToString();
        qt.Heading = "Hmmm";
        //qt.SubHeading = "Sveder fisk?";
        qt.LeadText = "Kender du fornemmelsen, når du lige retter ryggen, lægger hovedet en kende på skrå og retter blikket ind på uendeligt, mens du tænker: \"hmmm...\"?";
            qt.LeadText += "<br />I så fald er det øjeblik lige nu, så læn dig tilbage i stolen, sæt sixpencen på sned og nyd en hel stribe mærkværdigheder, spøjse udsagn og løjerlige sætninger.";

        /// Max 500 karakterer i keywords og max 15-20 ord!
        qt.MetaTagKeywords = "hmmm, spøjse spørgsmål, palindrom, endeskive, forkortelse, ordbog, mørkets hastighed";
        qt.MetaTagDescription = "Spøjse spørgsmål. Sveder fisk? Hvorfor staves palindrom ikke ens forfra og bagfra? Er der et andet ord for synonym?";
        qt.PageTitle = "Hmmm - spøjse spørgsmål.";

        qt.PageViews = UpdatePageViews(Request.Path);

        ShowQuotes1.QT = qt;
    }
コード例 #37
0
ファイル: Default.aspx.cs プロジェクト: jdamsbo/bevs.dk
    protected void Page_Load(object sender, EventArgs e)
    {

        qt = new QuoteType();
        qt.QuoteTypeText = QuoteTypes.medierne.ToString();
        qt.Heading = "I medierne";
        qt.SubHeading = "I medierne";
        qt.LeadText = "5 minutes - nogle af de mere og mindre prominente eksponeringer i medierne gennem tiderne";

        /// Max 500 karakterer i keywords og max 15-20 ord!
        qt.MetaTagKeywords = "Odiøse navne, drengerøvshumor, spøjs humor, Karl Smart, Roger Klam, Elizabeth Luder, Rolv Bræk, Taber Industries, Niels Røv, Fims Quality Control, Chew Shit Fun, Bruce Tis";
        qt.MetaTagDescription = "Spøjs, underlødig drengerøvshumor for dig, der kan grine af rigtige navne som Karl Smart, Roger Klam og Niels Røv eller hvad med firmaet Taber Industries :o)";
        qt.PageTitle = "I medierne";

        qt.PageViews = UpdatePageViews(Request.Path);

        ShowQuotes1.QT = qt;
        //LinkArea1.QT = qt;

    }
コード例 #38
0
ファイル: Default.aspx.cs プロジェクト: jdamsbo/bevs.dk
    protected void Page_Load(object sender, EventArgs e)
    {

        qt = new QuoteType();
        qt.QuoteTypeText = QuoteTypes.thyboe.ToString();
        qt.Heading = "Kurt Thyboe Generator";
        //qt.SubHeading = "Hvad så, champ?";
        qt.LeadText =  "Den ultimative Kurt Thyboe tribute! Her kan du fornøje dig med sjove citater og de herligste replikker fra boksekommentatorernes absolutte stormester Kurt Thyboe.";
            qt.LeadText += "<br />Det er showtime, fighttime, action...";
        
        /// Max 500 karakterer i keywords og max 15-20 ord!
        qt.MetaTagKeywords = "Kurt Thyboe, Kurt Tybo, Kurt Thybo, generator, sjove citater, boksning, kommentator, floskel, anekdote, ringside, ringens mestre, storyteller, reporter, showtime, champ, fight";
        qt.MetaTagDescription = "Ægte sjove citater fra reporter Kurt Thyboe, boksekommentatorernes absolutte stormester, svulstighedens mesterfighter og flosklernes superchamp!";
        qt.PageTitle = "Kurt Thyboe Generator - Sjove citater fra Kurt Thyboe fra flosklernes overdrev";

        qt.PageViews = UpdatePageViews(Request.Path);

        ShowQuotes1.QT = qt;

    }
コード例 #39
0
ファイル: Default.aspx.cs プロジェクト: jdamsbo/bevs.dk
    protected void Page_Load(object sender, EventArgs e)
    {

        qt = new QuoteType();
        qt.QuoteTypeText = QuoteTypes.navne.ToString();
        qt.Heading = "Odiøse Navne";
        //qt.SubHeading = "Latterlige og spøjse navne til overflod";
        qt.LeadText = "Links til folk med lettere underlødige navne, som ikke aner, at deres navne er for sjove på dansk. Spøjs og lettere underlødig humor i topklasse:";

        /*qt.SubText = "En sommerdag i '97 faldt jeg over Karl Smart på nettet. Efter at have sundet mig, begyndte jeg at søge efter lignende odiøse navne. Resten er historie.";
            qt.SubText += "<br />Andre neoklassiske odiøse navne som advokaten Brent Fisse, Bedford-borgmesteren Elizabeth Luder, gynækologen Roger Klam og guitarspilleren Peter Pik er kommet og gået, men minderne har vi stadig...";*/

        /// Max 500 karakterer i keywords og max 15-20 ord!
        qt.MetaTagKeywords = "Odiøse navne, drengerøvshumor, spøjs humor, Karl Smart, Roger Klam, Elizabeth Luder, Rolv Bræk, Taber Industries, Niels Røv, Fims Quality Control, Chew Shit Fun, Bruce Tis";
        qt.MetaTagDescription = "Spøjs, underlødig drengerøvshumor for dig, der kan grine af rigtige navne som Karl Smart, Roger Klam og Niels Røv eller hvad med firmaet Taber Industries :o)";
        qt.PageTitle = "Odiøse Navne - Rigtige folk med ægte, odiøse og virkeligt sjove navne";

        qt.PageViews = UpdatePageViews(Request.Path);

        ShowQuotes1.QT = qt;
        //LinkArea1.QT = qt;

    }
コード例 #40
0
ファイル: CStyleHighlighter.cs プロジェクト: daptiv/Malevich
    /// <summary>
    /// Encodes the string. Unlike standard HtmlEncode, our custom version preserves spaces correctly.
    /// Also, converts tabs to "\t", and breaks lines in chunks of maxLineWidth non-breaking segments.
    /// </summary>
    /// <param name="s"> The string to encode. </param>
    /// <param name="maxLineWidth"> The maximum width. </param>
    /// <param name="tab"> Text string to replace tabs with. </param>
    /// <returns> The string which can be safely displayed in HTML. </returns>
    public string EncodeLine(string s, int maxLineWidth, string tab)
    {
        if (s == null)
            return null;

        s = HttpUtility.HtmlEncode(s.Replace("\t", tab)).Replace(" ", "&nbsp;");

        if (quotes != QuoteType.None && inComments)
            throw new InvalidEncoderState("in quotes and in comments - something is broken!");

        StringBuilder encoded = new StringBuilder();

        if (quotes != QuoteType.None)
            encoded.Append(SpanText);

        if (inComments)
            encoded.Append(SpanComment);

        int i = 0;
        while (i < s.Length)
        {
            if (quotes == QuoteType.Double)
            {
                int endQuotes = s.IndexOf("&quot;", i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                encoded.Append(s.Substring(i, endQuotes + 6 - i));
                if ((endQuotes > 0 && s[endQuotes - 1] != '\\') ||
                    (endQuotes > 1 && s[endQuotes - 1] == '\\' && s[endQuotes - 2] == '\\'))
                {
                    // This is not an escaped quote.
                    quotes = QuoteType.None;
                    encoded.Append(SpanEnd);
                }

                i = endQuotes + 6;
                continue;
            }

            if (quotes == QuoteType.Verbatim)
            {
                int endQuotes = s.IndexOf("&quot;", i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                if (s.IndexOf("&quot;&quot;", endQuotes) == endQuotes)
                {
                    // This is an escaped quote.
                    encoded.Append(s.Substring(i, endQuotes + 12 - i));
                    i = endQuotes + 12;
                    continue;
                }

                encoded.Append(s.Substring(i, endQuotes + 6 - i));
                quotes = QuoteType.None;
                encoded.Append(SpanEnd);

                i = endQuotes + 6;
                continue;
            }

            if (quotes == QuoteType.Single)
            {
                int endQuotes = s.IndexOf('\'', i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                encoded.Append(s.Substring(i, endQuotes + 1 - i));
                if ((endQuotes > 0 && s[endQuotes - 1] != '\\') ||
                    (endQuotes > 1 && s[endQuotes - 1] == '\\' && s[endQuotes - 2] == '\\'))
                {
                    // This is not an escaped quote.
                    quotes = QuoteType.None;
                    encoded.Append(SpanEnd);
                }

                i = endQuotes + 1;
                continue;
            }

            if (inComments)
            {
                int endComments = s.IndexOf("*/", i);
                if (endComments == -1)
                {
                    // The entire string is in comments. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                inComments = false;

                encoded.Append(s.Substring(i, endComments + 2 - i));
                encoded.Append(SpanEnd);
                i = endComments + 2;
                continue;
            }

            Match nextMatch = keywordRegex.Match(s, i);
            if (!nextMatch.Success)
            {
                encoded.Append(s, i, s.Length - i);
                break;
            }

            if (i != nextMatch.Index)
            {
                encoded.Append(s, i, nextMatch.Index - i);
                i = nextMatch.Index;
            }

            string matched = nextMatch.Groups[0].Value;

            if (matched.Equals("'"))
            {
                encoded.Append(SpanText + "'");
                quotes = QuoteType.Single;
                ++i;
                continue;
            }

            if (matched.Equals("&quot;", System.StringComparison.OrdinalIgnoreCase))
            {
                encoded.Append(SpanText + "&quot;");
                quotes = QuoteType.Double;
                i += 6;
                continue;
            }

            if (matched.Equals("@&quot;", System.StringComparison.OrdinalIgnoreCase))
            {
                encoded.Append(SpanText + "@&quot;");
                quotes = QuoteType.Verbatim;
                i += 7;
                continue;
            }

            if (matched.Equals("//"))
            {
                // The rest of the line is comments.
                encoded.Append(SpanComment);
                encoded.Append(s.Substring(i));
                encoded.Append(SpanEnd);
                break;
            }

            if (matched.Equals("/*"))
            {
                // Comments start.
                encoded.Append(SpanComment + "/*");
                inComments = true;
                i += 2;
                continue;
            }

            if (keywordDictionary.Contains(matched))
            {
                // Keyword.
                encoded.Append(SpanKeyword);
                encoded.Append(matched);
                encoded.Append(SpanEnd);
                i += matched.Length;
            }
            else
            {
                encoded.Append(matched);
                i += matched.Length;
            }
        }

        if (inComments || quotes != QuoteType.None)
            encoded.Append(SpanEnd);

        if (language == CStyleLanguage.CSharp)
        {
            // Only verbatim string constants can span multiple lines in C#.
            if (quotes != QuoteType.Verbatim)
                quotes = QuoteType.None;
        }
        else if (language == CStyleLanguage.C || language == CStyleLanguage.CPlusPlus)
        {
            // C and C++ support string continuation if the last character on the line is a backslash.
            if (quotes != QuoteType.Double || !s.EndsWith("\\"))
                quotes = QuoteType.None;
        }
        else
        {
            // Java and JavaScript are the only "other" language, and they do not support
            // line continuations at all. Most browsers do support C-style multiline strings, but we support
            // only ECMA standard here or Java, at least for now...
            quotes = QuoteType.None;
        }

        return EncoderCommon.StringBufferToChunks(encoded, maxLineWidth, s);
    }
コード例 #41
0
ファイル: SqlHighlighter.cs プロジェクト: daptiv/Malevich
    /// <summary>
    /// Encodes the string. Unlike standard HtmlEncode, our custom version preserves spaces correctly.
    /// Also, converts tabs to "\t", and breaks lines in chunks of maxLineWidth non-breaking segments.
    /// </summary>
    /// <param name="s"> The string to encode. </param>
    /// <param name="maxLineWidth"> The maximum width. </param>
    /// <param name="tab"> Text string to replace tabs with. </param>
    /// <returns> The string which can be safely displayed in HTML. </returns>
    public string EncodeLine(string s, int maxLineWidth, string tab)
    {
        if (s == null)
            return null;

        s = HttpUtility.HtmlEncode(s.Replace("\t", tab)).Replace(" ", "&nbsp;");

        if (quotes != QuoteType.None && inComments)
            throw new InvalidEncoderState("in quotes and in comments - something is broken!");

        StringBuilder encoded = new StringBuilder();

        if (quotes != QuoteType.None)
            encoded.Append(SpanText);

        if (inComments)
            encoded.Append(SpanComments);

        int i = 0;
        while (i < s.Length)
        {
            if (quotes == QuoteType.Double)
            {
                int endQuotes = s.IndexOf("&quot;", i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                encoded.Append(s.Substring(i, endQuotes + 6 - i));
                if ((endQuotes > 0 && s[endQuotes - 1] != '\\') ||
                    (endQuotes > 1 && s[endQuotes - 1] == '\\' && s[endQuotes - 2] == '\\'))
                {
                    // This is not an escaped quote.
                    quotes = QuoteType.None;
                    encoded.Append(SpanEnd);
                }

                i = endQuotes + 6;
                continue;
            }

            if (quotes == QuoteType.Single)
            {
                int endQuotes = s.IndexOf('\'', i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                encoded.Append(s.Substring(i, endQuotes + 1 - i));
                if ((endQuotes > 0 && s[endQuotes - 1] != '\\') ||
                    (endQuotes > 1 && s[endQuotes - 1] == '\\' && s[endQuotes - 2] == '\\'))
                {
                    // This is not an escaped quote.
                    quotes = QuoteType.None;
                    encoded.Append(SpanEnd);
                }

                i = endQuotes + 1;
                continue;
            }

            if (inComments)
            {
                int endComments = s.IndexOf("*/", i);
                if (endComments == -1)
                {
                    // The entire string is in comments. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                inComments = false;

                encoded.Append(s.Substring(i, endComments + 2 - i));
                encoded.Append(SpanEnd);
                i = endComments + 2;
                continue;
            }

            Match nextMatch = nextEvent.Match(s, i);
            if (!nextMatch.Success)
            {
                encoded.Append(s, i, s.Length - i);
                break;
            }

            if (i != nextMatch.Index)
            {
                encoded.Append(s, i, nextMatch.Index - i);
                i = nextMatch.Index;
            }

            string matched = nextMatch.Groups[0].Value;

            if (matched.Equals("'"))
            {
                encoded.Append(SpanText + "'");
                quotes = QuoteType.Single;
                ++i;
                continue;
            }

            if (matched.Equals("&quot;", System.StringComparison.OrdinalIgnoreCase))
            {
                encoded.Append(SpanText + "&quot;");
                quotes = QuoteType.Double;
                i += 6;
                continue;
            }

            if (matched.Equals("--"))
            {
                // The rest of the line is comments.
                encoded.Append(SpanComments);
                encoded.Append(s.Substring(i));
                encoded.Append(SpanEnd);
                break;
            }

            if (matched.Equals("/*"))
            {
                // Comments start.
                encoded.Append(SpanComments + "/*");
                inComments = true;
                i += 2;

                continue;
            }

            if (matched.Equals("@@"))
            {
                // Built-in variable
                int j = i + 2;
                while (j < s.Length && char.IsLetterOrDigit(s[j]))
                    ++j;

                if (j == i + 2)
                {
                    encoded.Append("@@");
                    i += 2;

                    continue;
                }

                encoded.Append(SpanBuiltin + s.Substring(i, j - i) + SpanEnd);
                i = j;
                continue;
            }

            if (keywordDictionary.Contains(matched.ToUpper()))
            {
                // Keyword.
                encoded.Append(SpanKeyword);
                encoded.Append(matched);
                encoded.Append(SpanEnd);
                i += matched.Length;
            }
            else
            {
                encoded.Append(matched);
                i += matched.Length;
            }
        }

        if (inComments || quotes != QuoteType.None)
            encoded.Append(SpanEnd);

        return EncoderCommon.StringBufferToChunks(encoded, maxLineWidth, s);
    }
コード例 #42
0
 public Quote(int price, int volume, QuoteType type)
 {
   this.Price = price;
   this.Volume = volume;
   this.Type = type;
 }
コード例 #43
0
 public static string CorrectQuote(this string source, QuoteType type)
 {
     switch(type)
     {
         case QuoteType.NotQuoted:
             return source.UnQuote();
         case QuoteType.SquareBracket:
             return source.Quote();
         case QuoteType.DoubleQuote:
             return source.SpeechQuote();
         default:
             throw new ArgumentOutOfRangeException(nameof(type), type, null);
     }
 }
コード例 #44
0
        public void CreateQuoteType(Dtos.CreateQuoteTypeInput input)
        {
            //We can use Logger, it's defined in ApplicationService class.
            //ERROR:  Logger.Info("Creating a task for input: " + input);

            //Creating a new Task entity with given input's properties
            var type = new QuoteType { 
                Quote = input.Quote,
                DisplayName = input.DisplayName
            };

            //Saving entity with standard Insert method of repositories.
            _quoteTypeRepository.Insert(type);
        }
コード例 #45
0
 public ReturnValue<double> GetInterestRate(CurrencyType currency, QuoteType type)
 {
     throw new NotImplementedException();
 }
コード例 #46
0
ファイル: QuoteElement.cs プロジェクト: GavinHwa/Bridge
 public QuoteElement(QuoteType type)
 {
 }
コード例 #47
0
ファイル: MarkupHighlighter.cs プロジェクト: daptiv/Malevich
    /// <summary>
    /// Encodes the string. Unlike standard HtmlEncode, our custom version preserves spaces correctly.
    /// Also, converts tabs to "\t", and breaks lines in chunks of maxLineWidth non-breaking segments.
    /// </summary>
    /// <param name="s"> The string to encode. </param>
    /// <param name="maxLineWidth"> The maximum width. </param>
    /// <param name="tab"> Text string to replace tabs with. </param>
    /// <returns> The string which can be safely displayed in HTML. </returns>
    public string EncodeLine(string s, int maxLineWidth, string tab)
    {
        if (s == null)
            return null;

        s = HttpUtility.HtmlEncode(s.Replace("\t", tab)).Replace(" ", "&nbsp;");

        StringBuilder encoded = new StringBuilder();

        if (inComments)
            encoded.Append(SpanComments);

        if (inTag)
            encoded.Append(SpanAttr);

        if (inCDATA)
            encoded.Append(SpanCDATA);

        if (quotes != QuoteType.None)
            encoded.Append(SpanText);

        for (int i = 0; i < s.Length; ++i)
        {
            if (quotes == QuoteType.Double)
            {
                int endQuotes = s.IndexOf("&quot;", i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                encoded.Append(s.Substring(i, endQuotes + 6 - i));
                quotes = QuoteType.None;
                encoded.Append(SpanEnd);

                i = endQuotes + 5;
                continue;
            }

            if (quotes == QuoteType.Single)
            {
                int endQuotes = s.IndexOf('\'', i);
                if (endQuotes == -1)
                {
                    // The entire string is in quotes. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                encoded.Append(s.Substring(i, endQuotes + 1 - i));
                quotes = QuoteType.None;
                encoded.Append(SpanEnd);

                i = endQuotes;
                continue;
            }

            if (inComments)
            {
                int endComments = s.IndexOf("--&gt;", i);
                if (endComments == -1)
                {
                    // The entire string is in comments. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                inComments = false;

                encoded.Append(s.Substring(i, endComments - i));
                encoded.Append(SpanEnd + SpanBrackets + "--&gt;" + SpanEnd);
                i = endComments + 5;
                continue;
            }

            if (inCDATA)
            {
                int endCDATA = s.IndexOf("]]&gt;", i);
                if (endCDATA == -1)
                {
                    // The entire string is in cdata. The tag will close after the loop.
                    encoded.Append(s.Substring(i));
                    break;
                }

                inCDATA = false;

                encoded.Append(s.Substring(i, endCDATA - i));
                encoded.Append(SpanEnd + SpanBrackets + "]]&gt;" + SpanEnd);
                i = endCDATA + 5;
                continue;
            }

            if (inTag)
            {
                if (s[i] == '\'')
                {
                    encoded.Append(SpanText + "'");
                    quotes = QuoteType.Single;
                    continue;
                }

                if (s[i] == '=')
                {
                    encoded.Append(SpanBrackets + '=' + SpanEnd);
                    continue;
                }

                if (s[i] == '/')
                {
                    if (i < s.Length - 4 && s.Substring(i, 5).Equals("/&gt;"))
                    {
                        encoded.Append(SpanEnd + SpanBrackets + "/&gt;" + SpanEnd);
                        inTag = false;
                        i += 4;
                        continue;
                    }
                }

                if (s[i] == '&')
                {
                    if (i < s.Length - 5 && s.Substring(i, 6).Equals("&quot;"))
                    {
                        encoded.Append(SpanText + "&quot;");
                        quotes = QuoteType.Double;
                        i += 5;
                        continue;
                    }

                    if (i < s.Length - 3 && s.Substring(i, 4).Equals("&gt;"))
                    {
                        encoded.Append(SpanEnd + SpanBrackets + "&gt;" + SpanEnd);
                        inTag = false;
                        i += 3;
                        continue;
                    }
                }

                encoded.Append(s[i]);
                continue;
            }

            if (s[i] == '&')
            {
                if (i < s.Length - 11 && s.Substring(i, 12).Equals("&lt;![CDATA["))
                {
                    encoded.Append(SpanBrackets + "&lt;![CDATA[" + SpanEnd + SpanCDATA);
                    inCDATA = true;
                    i += 11;

                    continue;
                }

                if (i < s.Length - 6 && s.Substring(i, 7).Equals("&lt;!--"))
                {
                    encoded.Append(SpanBrackets + "&lt;!--" + SpanEnd + SpanComments);
                    inComments = true;
                    i += 6;

                    continue;
                }

                if (i < s.Length - 4 && s.Substring(i, 5).Equals("&lt;/"))
                {
                    i += 5;
                    int j = i;

                    while (i < s.Length && (char.IsLetterOrDigit(s, i) || s[i] == '_' || s[i] == ':'))
                        ++i;

                    encoded.Append(SpanBrackets + "&lt;/" + SpanEnd + SpanTag + s.Substring(j, i - j) + SpanEnd +
                        SpanAttr);

                    --i;

                    inTag = true;

                    continue;
                }

                if (i < s.Length - 3 && s.Substring(i, 4).Equals("&lt;"))
                {
                    i += 4;
                    int j = i;

                    while (i < s.Length && (char.IsLetterOrDigit(s, i) || s[i] == '_' || s[i] == ':'))
                        ++i;

                    encoded.Append(SpanBrackets + "&lt;" + SpanEnd + SpanTag + s.Substring(j, i - j) + SpanEnd +
                        SpanAttr);

                    --i;

                    inTag = true;

                    continue;
                }
            }

            encoded.Append(s[i]);
        }

        if (inComments || inCDATA || inTag || quotes != QuoteType.None)
            encoded.Append(SpanEnd);

        return EncoderCommon.StringBufferToChunks(encoded, maxLineWidth, s);
    }
コード例 #48
0
 public ReturnValue<double> GetConversionRate(CurrencyType source, CurrencyType dest, QuoteType type)
 {
     throw new NotImplementedException();
 }
コード例 #49
0
        public float ConvertExpositionToDepo(string dealSymbol, string depoCurrency,
            Dictionary<string, QuoteData> curPrices, QuoteType quoteType, float value)
        {
            bool inverse, pairsEqual;
            var pair = DalSpot.Instance.FindSymbol(dealSymbol, true, depoCurrency, out inverse, out pairsEqual);
            if (pairsEqual) return value;
            if (string.IsNullOrEmpty(pair))
            {
                logNoFlood.LogMessageFormatCheckFlood(LogEntryType.Error, MsgNoQuote,
                    1000 * 60 * 15, "Ошибка в ConvertBaseOrCounterDepo: {0}, {1} - не найдена",
                    dealSymbol, depoCurrency);
                return value;
            }
            if (!curPrices.ContainsKey(pair))
            {
                logNoFlood.LogMessageFormatCheckFlood(LogEntryType.Error, MsgNoQuote,
                    1000 * 60 * 15, "Ошибка в ConvertBaseOrCounterDepo: {0} - не найдена", pair);
                return value;
            }
            var price = curPrices[pair].GetPrice(quoteType);
            if (price == 0)
            {
                logNoFlood.LogMessageFormatCheckFlood(LogEntryType.Error, MsgNoQuote,
                    1000 * 60 * 15, "Ошибка в ConvertBaseOrCounterDepo: {0} - цена = 0", pair);
                return value;
            }

            value = inverse ? value / price : value * price;
            return value;
        }