示例#1
0
        public async Task <int> InsertTaskAsync(OneTimeTasks task, bool isUserPerformed = false)
        {
            string query = "INSERT INTO `OneTimeTasks`" +
                           "(`Type`,`Comments`,`Duration`,`CreatedUser`,`CreatedDateTime`,`IsDelete`,`Effectivedate`) " +
                           "VALUES (@Type,@Comments,@Duration,@CreatedUser,@CreatedDateTime,@IsDelete,@Effectivedate);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Type", task.Type),
                new KeyValuePair <string, object>("@Comments", task.Comments),
                new KeyValuePair <string, object>("@Duration", task.Duration),
                new KeyValuePair <string, object>("@CreatedUser", task.CreatedUser),
                new KeyValuePair <string, object>("@Effectivedate", TimeConverterMethods.ConvertDateTimeToTimeStamp(task.Effectivedate)),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(task.CreatedDateTime)),
                new KeyValuePair <string, object>("@IsDelete", 0)
            };

            int id = await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true);

            query = "UPDATE `OneTimeTasks` SET `ReferenceNumber`=@ReferenceNumber WHERE `Id`=@Id";

            parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@ReferenceNumber", id.ToString("OTASK000000")),
                new KeyValuePair <string, object>("@Id", id)
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);

            return(id);
        }
示例#2
0
        public async Task <int> InsertTransactionAsync(TransactionEntity transactionEntity, bool isUserPerformed = false)
        {
            string query = "INSERT INTO `Transaction`" +
                           "(`TransactionPartyId`,`Amount`,`IsIncome`,`TransactionDateTime`,`ScheduledTransactionId`,`Remarks`,`CreatedDateTime`,`IsUserPerformed`) " +
                           "VALUES (@TransactionPartyId,@Amount,@IsIncome,@TransactionDateTime,@ScheduledTransactionId,@Remarks,@CreatedDateTime,@IsUserPerformed);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@TransactionPartyId", transactionEntity.TransactionPartyId),
                new KeyValuePair <string, object>("@Amount", transactionEntity.Amount),
                new KeyValuePair <string, object>("@IsIncome", transactionEntity.IsIncome ? 1 : 0),
                new KeyValuePair <string, object>("@TransactionDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.TransactionDateTime)),
                new KeyValuePair <string, object>("@ScheduledTransactionId", transactionEntity.ScheduledTransactionId),
                new KeyValuePair <string, object>("@Remarks", transactionEntity.Remarks),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.CreatedDateTime)),
                new KeyValuePair <string, object>("@IsUserPerformed", isUserPerformed ? 1 : 0)
            };

            int id = await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true);

            query = "UPDATE `Transaction` SET `ReferenceNumber`=@ReferenceNumber WHERE `Id`=@Id";

            parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@ReferenceNumber", id.ToString("TC00000000")),
                new KeyValuePair <string, object>("@Id", id)
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);

            return(id);
        }
示例#3
0
        public async Task <int> InsertTransactionPartyAsync(TransactionPartyEntity transactionPartyEntity)
        {
            string query = "INSERT INTO `TransactionParty`" +
                           "(`Code`,`Description`,`CreatedDateTime`) " +
                           "VALUES (@Code,@Description,@CreatedDateTime);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Code", transactionPartyEntity.Code),
                new KeyValuePair <string, object>("@Description", transactionPartyEntity.Description),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionPartyEntity.CreatedDateTime))
            };

            return(await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true));
        }
示例#4
0
        public async Task <int> InsertUserDetailsAsync(UserEntity userEntity)
        {
            userEntity.CurrentBalance     = userEntity.StartingAmount;
            userEntity.RegisteredDateTime = DateTime.Now;
            userEntity.LastCheckDateTime  = DateTime.Now;

            string query = @"INSERT INTO `User`
                (`FirstName`,`LastName`,`RegisteredDateTime`,`StartingAmount`,`CurrentBalance`,`LastCheckDateTime`) 
                VALUES (@FirstName,@LastName,@RegisteredDateTime,@StartingAmount,@CurrentBalance,@LastCheckDateTime);";

            IList <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@FirstName", userEntity.FirstName),
                new KeyValuePair <string, object>("@LastName", userEntity.LastName),
                new KeyValuePair <string, object>("@RegisteredDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(userEntity.RegisteredDateTime)),
                new KeyValuePair <string, object>("@StartingAmount", userEntity.StartingAmount),
                new KeyValuePair <string, object>("@CurrentBalance", userEntity.CurrentBalance),
                new KeyValuePair <string, object>("@LastCheckDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(userEntity.LastCheckDateTime))
            };

            return(await SqliteConnector.ExecuteInsertQueryAsync(query, parameters : parameters, true));
        }
示例#5
0
        public async Task <int> InsertScheduledTransactionListAsync(SheduledTransactionList transactionEntity)
        {
            string query = "INSERT INTO `ScheduledTransaction`" +
                           "(`TransactionPartyId`,`Amount`,`IsIncome`,`RepeatType`,`StartDateTime`,`Remarks`,`CreatedDateTime`,`EndDateTime`,`NextTransactionDate`,`InfiniteSchedule`,`IsDelete`,`CreatedUser`,`IsActive`) " +
                           "VALUES (@TransactionPartyId,@Amount,@IsIncome,@RepeatType,@StartDateTime,@Remarks,@CreatedDateTime,@EndDateTime,@NextTransactionDate,@InfiniteSchedule,@IsDelete,@CreatedUser,@IsActive);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@TransactionPartyId", transactionEntity.TransactionPartyId),
                new KeyValuePair <string, object>("@Amount", transactionEntity.Amount),
                new KeyValuePair <string, object>("@IsIncome", transactionEntity.IsIncome ? 1 : 0),
                new KeyValuePair <string, object>("@RepeatType", transactionEntity.RepeatType),
                new KeyValuePair <string, object>("@StartDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.StartDateTime)),
                new KeyValuePair <string, object>("@Remarks", transactionEntity.Remarks),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.CreatedDateTime)),
                new KeyValuePair <string, object>("@EndDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.EndDateTime ?? transactionEntity.StartDateTime)),
                new KeyValuePair <string, object>("@NextTransactionDate", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.NextTransactionDate)),
                new KeyValuePair <string, object>("@InfiniteSchedule", transactionEntity.InfiniteSchedule ? 1 : 0),
                new KeyValuePair <string, object>("@IsDelete", 0),
                new KeyValuePair <string, object>("@CreatedUser", transactionEntity.CreatedUser),
                new KeyValuePair <string, object>("@IsActive", 1)
            };

            int id = await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true);

            query = "UPDATE `ScheduledTransaction` SET `ReferenceNumber`=@ReferenceNumber WHERE `Id`=@Id";

            parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@ReferenceNumber", id.ToString("SYSTC00000000")),
                new KeyValuePair <string, object>("@Id", id)
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);

            return(id);
        }
示例#6
0
        public async Task <int> InsertTransactionLogAsync(TransactionLogEntity transactionLogEntity)
        {
            string query = "INSERT INTO `TransactionLog`" +
                           "(`TransactionId`,`ScheduledTransactionId`,`TransactionPartyId`,`IsDeletedTransaction`,`IsIncome`,`TransactionDateTime`,`Amount`,`StartingBalance`,`FinalBalance`,`Remarks`,`CreatedDateTime`,`IsUserPerformed`) " +
                           "VALUES(@TransactionId,@ScheduledTransactionId,@TransactionPartyId,@IsDeletedTransaction,@IsIncome,@TransactionDateTime,@Amount,@StartingBalance,@FinalBalance,@Remarks,@CreatedDateTime,@IsUserPerformed);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@TransactionId", transactionLogEntity.TransactionId),
                new KeyValuePair <string, object>("@ScheduledTransactionId", transactionLogEntity.ScheduledTransactionId),
                new KeyValuePair <string, object>("@TransactionPartyId", transactionLogEntity.TransactionPartyId),
                new KeyValuePair <string, object>("@IsDeletedTransaction", transactionLogEntity.IsDeletedTransaction ? 1 : 0),
                new KeyValuePair <string, object>("@IsIncome", transactionLogEntity.IsIncome ? 1 : 0),
                new KeyValuePair <string, object>("@Amount", transactionLogEntity.Amount),
                new KeyValuePair <string, object>("@StartingBalance", transactionLogEntity.StartingBalance),
                new KeyValuePair <string, object>("@FinalBalance", transactionLogEntity.FinalBalance),
                new KeyValuePair <string, object>("@Remarks", transactionLogEntity.Remarks),
                new KeyValuePair <string, object>("@TransactionDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionLogEntity.TransactionDateTime)),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionLogEntity.CreatedDateTime)),
                new KeyValuePair <string, object>("@IsUserPerformed", transactionLogEntity.IsUserPerformed ? 1 : 0)
            };

            return(await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true));
        }