Beispiel #1
0
        /// <summary>
        /// Creates a fixed account in the database from the given FixedAccountDataStruct
        /// </summary>
        /// <param name="sQLiteCore"></param>
        /// <param name="fixedAccountDataStruct"></param>
        /// <returns></returns>
        public static bool CreateNewFixedAccount(this ISQLiteCore sQLiteCore, FixedAccountDataStruct fixedAccountDataStruct)
        {
            bool ret = false;

            using (IDbConnection conn = new SQLiteConnection(sQLiteCore._GetConnectionString()))
            {
                conn.Open();
                CommandDefinition commandDefinition = new CommandDefinition($"INSERT INTO bm_fixCore values ({fixedAccountDataStruct.AccNo}, '{fixedAccountDataStruct.FName}'," +
                                                                            $" '{fixedAccountDataStruct.LName}', '{fixedAccountDataStruct.FixedAmount.ToString(System.Globalization.CultureInfo.InvariantCulture)}'," +
                                                                            $" '{fixedAccountDataStruct.MaturityAmount.ToString(System.Globalization.CultureInfo.InvariantCulture)}', '{fixedAccountDataStruct.MaturityDate}', '{fixedAccountDataStruct.InterestRate.ToString(System.Globalization.CultureInfo.InvariantCulture)}', " +
                                                                            $"'{fixedAccountDataStruct.FixedAccountCreationDate}');");
                ret = conn.Execute(commandDefinition) > 0;               // infected cell , first create a new entry in bm_fileCore table
                CommandDefinition commandDefinitionUpdateHasFixed = new CommandDefinition($"UPDATE bm_accCore SET HasFixedAcc='True' WHERE AccNum={fixedAccountDataStruct.AccNo};");
                ret = conn.Execute(commandDefinitionUpdateHasFixed) > 0; // then update the value of HasFixedAcc to ture in bm_accCore table
                conn.Close();
            }
            return(ret);
        }
Beispiel #2
0
 /// <summary>
 /// Returns true if a new fixed deposite account creation is successful
 /// </summary>
 /// <param name="fetchAccountInfo"></param>
 /// <param name="fixedAccountDataStruct"></param>
 /// <returns></returns>
 public static bool CreateNewFixedAccount(this IFetchAccountInfo fetchAccountInfo, FixedAccountDataStruct fixedAccountDataStruct)
 {
     return(_sQLiteCore.CreateNewFixedAccount(fixedAccountDataStruct));
 }