public bool AddTransactions(TranactionDTO dto)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         try
         {
             dto.User_ID = uow.Accounts.getUserIdBuUserAccountId(dto.Account_ID);
             var EmployeeAdded = uow.Transactions.AddTransaction(dto);
             if (EmployeeAdded != false)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception ex)
         {
             ex.Data.Add("AddTransactions", "An error occurred while trying to create AddEmployee Record - BLL");
             uow.Rollback();
             return(false);
         }
     }
 }
示例#2
0
        public bool AddTransaction(TranactionDTO dto)
        {
            try
            {
                var record = new Tranaction()
                {
                    Account_ID       = dto.Account_ID,
                    Amount           = dto.Amount,
                    Currency         = dto.Currency,
                    DateTime_UTC     = dto.DateTime_UTC,
                    Is_Credit        = dto.Is_Credit,
                    Server_Date_Time = dto.Server_Date_Time,
                    User_ID          = dto.User_ID,
                };

                Create(record);
                _uow.Save();
                return(true);
            }
            catch (Exception ex)
            {
                ex.Data.Add("AddTransaction", "An error occurred while trying to  AddTransaction Record - DAL");

                _uow.Rollback();
                return(false);
            }
        }
示例#3
0
        public List <TranactionDTO> ConvertTransactionToBLL(List <TranactionViewModel> model)
        {
            List <TranactionDTO> TransactionsList = new List <TranactionDTO>();

            if (model == null)
            {
                return(TransactionsList);
            }
            foreach (var Transaction in model)
            {
                var newTransaction = new TranactionDTO()
                {
                    Account_ID       = Transaction.Account_ID,
                    Amount           = Transaction.Amount,
                    User_ID          = Transaction.User_ID,
                    Currency         = Transaction.Currency,
                    DateTime_UTC     = Transaction.DateTime_UTC,
                    ID               = Transaction.ID,
                    Is_Credit        = Transaction.Is_Credit,
                    Server_Date_Time = Transaction.Server_Date_Time,
                };
                TransactionsList.Add(newTransaction);
            }
            return(TransactionsList);
        }
示例#4
0
        public TranactionDTO ConvertTransactionToBLL(TranactionViewModel model)
        {
            TranactionDTO Transactions = new TranactionDTO();

            if (model == null)
            {
                return(Transactions);
            }
            Transactions = new TranactionDTO()
            {
                Account_ID       = model.Account_ID,
                Amount           = model.Amount,
                User_ID          = model.User_ID,
                Currency         = model.Currency,
                DateTime_UTC     = model.DateTime_UTC,
                ID               = model.ID,
                Is_Credit        = model.Is_Credit,
                Server_Date_Time = model.Server_Date_Time,
            };
            return(Transactions);
        }
示例#5
0
        public TranactionViewModel ConvertTransactionToWeb(TranactionDTO Transaction)
        {
            TranactionViewModel Transactions = new TranactionViewModel();

            if (Transaction == null)
            {
                return(Transactions);
            }
            Transactions = new TranactionViewModel()
            {
                Account_ID       = Transaction.Account_ID,
                Amount           = Transaction.Amount,
                User_ID          = Transaction.User_ID,
                Currency         = Transaction.Currency,
                DateTime_UTC     = Transaction.DateTime_UTC,
                ID               = Transaction.ID,
                Is_Credit        = Transaction.Is_Credit,
                Server_Date_Time = Transaction.Server_Date_Time,
            };

            return(Transactions);
        }
 public bool EditTransactions(TranactionDTO dto)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         try
         {
             var EmployeeUpdated = uow.Transactions.EditTransaction(dto);
             if (EmployeeUpdated != false)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception ex)
         {
             ex.Data.Add("EditTransactions", "An error occurred while trying to create EditEmployee Record - BLL");
             uow.Rollback();
             return(false);
         }
     }
 }
示例#7
0
        public bool EditTransaction(TranactionDTO dto)
        {
            try
            {
                var record = GetQuerable(x => x.ID == dto.ID).FirstOrDefault();
                record.Account_ID       = dto.Account_ID;
                record.Amount           = dto.Amount;
                record.Currency         = dto.Currency;
                record.DateTime_UTC     = dto.DateTime_UTC;
                record.Is_Credit        = dto.Is_Credit;
                record.Server_Date_Time = dto.Server_Date_Time;

                Update(record);
                _uow.Save();
                return(true);
            }
            catch (Exception ex)
            {
                ex.Data.Add("EditTransaction", "An error occurred while trying to Edit Transaction Record - DAL");

                _uow.Rollback();
                return(false);
            }
        }