public void DepositMoneyInUserAC(Dictionary<int, List<Money>> moneyDictionary, string userAddressId) { UsersDBTool userDBTool = new UsersDBTool(); int uid; int.TryParse(userDBTool.ValidateUsers(userAddressId), out uid); string spName = "sp_UsersAccounts_Insert"; try { SqlCommand cmd; CON.Open(); foreach (var moneyList in moneyDictionary.Values) { for (var i = 0; i < moneyList.Count; i++) { cmd = new SqlCommand(spName, CON); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", moneyList[i].id); cmd.Parameters.AddWithValue("@Value", moneyList[i].value); cmd.Parameters.AddWithValue("@Hash", moneyList[i].hash); cmd.Parameters.AddWithValue("@OwnerId", moneyList[i].ownerId); cmd.Parameters.AddWithValue("@Dated", moneyList[i].dated); cmd.Parameters.Add("@Signature", SqlDbType.Binary).Value = moneyList[i].signature; cmd.Parameters.AddWithValue("@UserId", uid); cmd.ExecuteNonQuery(); } } } catch (Exception e) { throw new Exception("Error while connecting database", e); } finally { if (CON != null)CON.Close(); } }
public void InsertTestCases() { var dbTool = new UsersDBTool(); List<MadMoney.MoneyBank.Money> oneMoneyList = new List<MadMoney.MoneyBank.Money>(); oneMoneyList.Add(new Money(1)); //dbTool.InsertOne(oneMoneyList, ); }