protected override void PackRequest() { // Create the streams we will be writing to. MemoryStream requestStream = new MemoryStream(); BinaryWriter requestWriter = new BinaryWriter(requestStream, Encoding.Unicode); // Status Id requestWriter.Write(StatusId); // Operator Id requestWriter.Write(OperatorId); // Status Name requestWriter.Write((ushort)StatusName.Length); requestWriter.Write(StatusName.ToCharArray()); // IsActive flag requestWriter.Write(IsActive); // Alert flag requestWriter.Write(IsAlert); // Set the bytes to be sent. m_requestPayload = requestStream.ToArray(); // Close the streams. requestWriter.Close(); }
public Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { ReceivedMessages[message.DbId].StatusName = state; ReceivedMessages[message.DbId].ExpiresAt = message.ExpiresAt; ReceivedMessages[message.DbId].Content = _serializer.Serialize(message.Origin); return(Task.CompletedTask); }
public Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var msg = ReceivedMessages.FindOne(l => l.Id == message.DbId); msg.StatusName = state; msg.ExpiresAt = message.ExpiresAt; ReceivedMessages.Update(msg); return(Task.CompletedTask); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (StatusName.ToLower() != "confirmed" && StatusName.ToLower() != "pending" && StatusName.ToLower() != "canceled") { yield return(new ValidationResult("Status Name must be 'confirmed', 'pending' or 'canceled'")); } }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var collection = _database.GetCollection <ReceivedMessage>(_options.Value.ReceivedCollection); var updateDef = Builders <ReceivedMessage> .Update .Set(x => x.Retries, message.Retries) .Set(x => x.ExpiresAt, message.ExpiresAt) .Set(x => x.StatusName, state.ToString("G")); await collection.UpdateOneAsync(x => x.Id == long.Parse(message.DbId), updateDef); }
public async Task ChangePublishStateAsync(MediumMessage message, StatusName state) { var collection = _database.GetCollection <PublishedMessage>(_options.Value.PublishedCollection); var updateDef = Builders <PublishedMessage> .Update .Set(x => x.Content, _serializer.Serialize(message.Origin)) .Set(x => x.Retries, message.Retries) .Set(x => x.ExpiresAt, message.ExpiresAt) .Set(x => x.StatusName, state.ToString("G")); await collection.UpdateOneAsync(x => x.Id == long.Parse(message.DbId), updateDef); }
//加算バフとパラメータの合計値 public static int SumParameter(int chara, StatusName sn) { if (chara < 0) { //0:プレイヤー return(playerParameter[(int)sn] + playerStatus[(int)sn]); } else { //1以上:エネミー return(enemyParameterList[chara][(int)sn] + enemyStatusList[chara][(int)sn]); } }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var sql = $"UPDATE {_recName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; var connection = this.DbConnection; await connection.ExecuteAsync(sql, new { Id = message.DbId, message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }, DbTransaction); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var sql = $"UPDATE {_recName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; await this.DbConnection.ExecuteAsync(sql, new { Id = long.Parse(message.DbId), message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }, transaction : DbTransaction); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var connection = this.DbConnection; var sql = $"UPDATE `{_initializer.GetReceivedTableName()}` SET `Retries` = @Retries,`ExpiresAt` = @ExpiresAt,`StatusName`=@StatusName WHERE `Id`=@Id;"; await connection.ExecuteAsync(sql, new { Id = message.DbId, message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }, transaction : DbTransaction); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var sql = $"UPDATE {_recName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; using var connection = new SqlConnection(_options.Value.ConnectionString); await connection.ExecuteAsync(sql, new { Id = message.DbId, message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { await using var connection = new MySqlConnection(_options.Value.ConnectionString); var sql = $"UPDATE `{_initializer.GetReceivedTableName()}` SET `Retries` = @Retries,`ExpiresAt` = @ExpiresAt,`StatusName`=@StatusName WHERE `Id`=@Id;"; await connection.ExecuteAsync(sql, new { Id = message.DbId, message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var sql = $"UPDATE {_recName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; using var connection = new NpgsqlConnection(_options.Value.ConnectionString); await connection.ExecuteAsync(sql, new { Id = long.Parse(message.DbId), message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }); }
public async Task ChangePublishStateAsync(MediumMessage message, StatusName state) { var sql = $"UPDATE {_pubName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; // using var connection = new SqlConnection(_options.Value.ConnectionString); var connection = this.DbConnection; await connection.ExecuteAsync(sql, new { Id = message.DbId, message.Retries, message.ExpiresAt, StatusName = state.ToString("G") }, DbTransaction); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { var sql = $"UPDATE `{_initializer.GetReceivedTableName()}` SET `Retries` = @Retries,`ExpiresAt` = @ExpiresAt,`StatusName` = @StatusName WHERE `Id` = @Id"; var sqlParam = new { Id = message.DbId, Retries = message.Retries, ExpiresAt = message.ExpiresAt, StatusName = state.ToString("G") }; using (var connection = new SqliteConnection(_options.Value.ConnectionString)) { await connection.ExecuteAsync(sql, sqlParam); }; }
bool IsStatusActive(ModifierStateComponent modComp, StatusName name) { foreach (Buff b in modComp.BuffList) { if (b.Name == name && b.IsActive) { return(true); } } foreach (Enabler e in modComp.EnablerList) { if (e.Name == name) { return(true); } } return(false); }
public IList <MessageDto> Messages(MessageQueryDto queryDto) { queryDto.StatusName = StatusName.Standardized(queryDto.StatusName); var name = queryDto.MessageType == MessageType.Publish ? _options.PublishedCollection : _options.ReceivedCollection; var collection = _database.GetCollection <MessageDto>(name); var builder = Builders <MessageDto> .Filter; var filter = builder.Empty; if (!string.IsNullOrEmpty(queryDto.StatusName)) { filter = filter & builder.Eq(x => x.StatusName, queryDto.StatusName); } if (!string.IsNullOrEmpty(queryDto.Name)) { filter = filter & builder.Eq(x => x.Name, queryDto.Name); } if (!string.IsNullOrEmpty(queryDto.Group)) { filter = filter & builder.Eq(x => x.Group, queryDto.Group); } if (!string.IsNullOrEmpty(queryDto.Content)) { filter = filter & builder.Regex(x => x.Content, ".*" + queryDto.Content + ".*"); } var result = collection .Find(filter) .SortByDescending(x => x.Added) .Skip(queryDto.PageSize * queryDto.CurrentPage) .Limit(queryDto.PageSize) .ToList(); return(result); }
decimal TimeLeftOnStatus(ModifierStateComponent modComp, StatusName name, decimal timer) { foreach (Buff b in modComp.BuffList) { if (b.Name == name && b.IsActive) { return(b.Duration - timer + b.Start); } } foreach (Enabler e in modComp.EnablerList) { if (e.Name == name) { return(e.Duration - timer + e.Start); } } // If no buff was found throw new Exception("No buff found."); }
public static GameInfo ToGameInfo(Dictionary <string, AttributeValue> item) { var info = new GameInfo { Code = item["pk"].S.Split("#")[1], OwnerId = item["GSI1-SK"].S, OwnerName = item["ownerName"].S, Status = StatusName.ToStatus(item["GSI1-PK"].S), DateCreated = item["dateCreated"].N, }; // Possibly null if (item.ContainsKey("dateStarted")) { info.DateStarted = item["dateStarted"].N; } if (item.ContainsKey("dateLaunched")) { info.DateLaunched = item["dateLaunched"].N; } if (item.ContainsKey("dateEnded")) { info.DateEnded = item["dateEnded"].N; } if (item.ContainsKey("nextGameCode")) { info.NextGameCode = item["nextGameCode"].S; } if (item.ContainsKey("winningTeam")) { info.WinningTeam = item["winningTeam"].S; } return(info); }
public void GetRunningServices() { string filepath = (@"C:\Users\Operations01\Desktop\Data.csv"); const Int32 bufferSize = 128; int count = 0; string StatusName; //string run = "\"Running\""; bool IsFirstRow = true; using (var fileStream = File.OpenRead(filepath)) { using (var streamReader = new StreamReader(fileStream, Encoding.UTF8, true, bufferSize)) { string line; while ((line = streamReader.ReadLine()) != null) { if (IsFirstRow) { IsFirstRow = false; } else { var data = line.Split(','); if (!string.IsNullOrEmpty(data[0])) { StatusName = data[0]; //Console.WriteLine( StatusName ); if (StatusName.Equals("\"Running\"")) { Console.WriteLine("{0}{1}{2}", data[0], data[1], data[2]); count++; } } } } Console.WriteLine("Total Running Services:{0}", count); } } }
public static Tuple<SolidColorBrush,string,string> getColorAndStatus(StatusName value) { switch (value) { case StatusName.VeryGood: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 0, 138, 0)), "velmi dobré", @"ms-appx:SharedAssets/Smiley7.gif"); case StatusName.Good: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 132, 161, 47)), "dobré", @"ms-appx:SharedAssets/Smiley6.gif"); case StatusName.Satisfying: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 184, 177, 0)), "uspokojivé", @"ms-appx:SharedAssets/Smiley5.gif"); case StatusName.Suitable: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 207, 141, 19)), "vyhovující", @"ms-appx:SharedAssets/Smiley4.gif"); case StatusName.Bad: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 207, 84, 23)), "špatné", @"ms-appx:SharedAssets/Smiley3.gif"); case StatusName.VeryBad: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 207, 51, 27)), "velmi špatné", @"ms-appx:SharedAssets/Smiley2.gif"); case StatusName.NoData: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 143, 143, 143)), "nejsou data", @"ms-appx:SharedAssets/Smiley0.gif"); case StatusName.NoMeasurement: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 138, 137, 156)), "neměří se", @"ms-appx:SharedAssets/Smiley0.gif"); default: return Tuple.Create(new SolidColorBrush(Color.FromArgb(255, 200, 200, 200)), "chyba", @"ms-appx:SharedAssets/Smiley0.gif"); } }
internal override ActionResult SetItemQuantity(int productId, int newQuantity) { return(new ActionResult(isSuccess: false, $"Cannot change item quantities on a {StatusName.ToLower()} sale")); }
public async Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) => await ChangeMessageStateAsync(_recName, message, state);
private async Task ChangeMessageStateAsync(string tableName, MediumMessage message, StatusName state) { var sql = $"UPDATE `{tableName}` SET `Retries`=@Retries,`ExpiresAt`=@ExpiresAt,`StatusName`=@StatusName WHERE `Id`=@Id"; object[] sqlParams = { new SqliteParameter("@Retries", message.Retries), new SqliteParameter("@ExpiresAt", message.ExpiresAt.HasValue?(object)message.ExpiresAt:DBNull.Value), new SqliteParameter("@StatusName", state.ToString("G")), new SqliteParameter("@Id", long.Parse(message.DbId)) }; using var connection = SqliteFactory.Instance.CreateConnection(); connection.ConnectionString = _options.Value.ConnectionString; connection.ExecuteNonQuery(sql, sqlParams: sqlParams); await Task.CompletedTask; }
public Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) { ReceivedMessages[message.DbId].StatusName = state; ReceivedMessages[message.DbId].ExpiresAt = message.ExpiresAt; return(Task.CompletedTask); }
private async Task ChangeMessageStateAsync(string tableName, MediumMessage message, StatusName state) { var sql = $"UPDATE {tableName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; object[] sqlParams = { new SqlParameter("@Id", message.DbId), new SqlParameter("@Retries", message.Retries), new SqlParameter("@ExpiresAt", message.ExpiresAt), new SqlParameter("@StatusName", state.ToString("G")) }; using var connection = new SqlConnection(_options.Value.ConnectionString); connection.ExecuteNonQuery(sql, sqlParams: sqlParams); await Task.CompletedTask; }
private async Task ChangeMessageStateAsync(string tableName, MediumMessage message, StatusName state) { var sql = $@"UPDATE ""{tableName}"" SET ""Retries"" = :P_Retries,""ExpiresAt"" = :P_ExpiresAt,""StatusName"" = :P_StatusName WHERE ""Id"" = :P_Id"; object[] sqlParams = { new OracleParameter(":P_Retries", message.Retries), new OracleParameter(":P_ExpiresAt", message.ExpiresAt), new OracleParameter(":P_StatusName", state.ToString("G")), new OracleParameter(":P_Id", message.DbId) }; using var connection = new OracleConnection(_options.Value.ConnectionString); connection.ExecuteNonQuery(sql, sqlParams: sqlParams); await Task.CompletedTask; }
public static void UpdateStatus(this IDealsContract contract, Int64 dealId, StatusName status) { contract.UpdateStatus(dealId.ToString(), new Status { Name = status }); }
public async Task ChangePublishStateAsync(MediumMessage message, StatusName state) => await ChangeMessageStateAsync(_pubName, message, state);
private async Task ChangeMessageStateAsync(string tableName, MediumMessage message, StatusName state) { var sql = $"UPDATE {tableName} SET \"Content\"=@Content,\"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; object[] sqlParams = { new NpgsqlParameter("@Id", long.Parse(message.DbId)), new NpgsqlParameter("@Content", _serializer.Serialize(message.Origin)), new NpgsqlParameter("@Retries", message.Retries), new NpgsqlParameter("@ExpiresAt", message.ExpiresAt), new NpgsqlParameter("@StatusName", state.ToString("G")) }; await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); connection.ExecuteNonQuery(sql, sqlParams: sqlParams); await Task.CompletedTask; }
private async Task ChangeMessageStateAsync(string tableName, MediumMessage message, StatusName state) { var sql = $"UPDATE `{tableName}` SET `Content`=@Content,`Retries`=@Retries,`ExpiresAt`=@ExpiresAt,`StatusName`=@StatusName WHERE `Id`=@Id;"; object[] sqlParams = { new MySqlParameter("@Id", message.DbId), new MySqlParameter("@Content", _serializer.Serialize(message.Origin)), new MySqlParameter("@Retries", message.Retries), new MySqlParameter("@ExpiresAt", message.ExpiresAt), new MySqlParameter("@StatusName", state.ToString("G")) }; await using var connection = new MySqlConnection(_options.Value.ConnectionString); connection.ExecuteNonQuery(sql, sqlParams: sqlParams); }
internal override ActionResult DeleteItem(int productId) { return(new ActionResult(isSuccess: false, $"Cannot delete items from a {StatusName.ToLower()} sale")); }