Exemplo n.º 1
0
        public void DeleteWallet(WalletModel wallet, string userId)
        {
            SqlDataAccess sql = new SqlDataAccess(_config);
            var           p   = new { WalletName = wallet.WalletName, UserId = userId };

            sql.Execute("spWallets_RemoweWallet", p, "FinAppData");
        }
Exemplo n.º 2
0
        public int Get(Customer customer)
        {
            var sqlDataAccess = new SqlDataAccess();
            var result        = sqlDataAccess.Execute("SELECT * FROM CUSTOMERS");

            return(0);
        }
Exemplo n.º 3
0
 public void AddWallet(WalletModel wallet, string userId)
 {
     if (WalletDoesNotExist(wallet.WalletName, userId))
     {
         SqlDataAccess sql = new SqlDataAccess(_config);
         var           p   = new { UserId = userId, WalletName = wallet.WalletName, CurrentAmount = wallet.CurrentAmount };
         sql.Execute("spWallets_AddWallet", p, "FinAppData");
     }
 }
Exemplo n.º 4
0
 public bool AddArticle(ArticleModel article)
 {
     if (ArticleDoesNotExist(article.ArticleName))
     {
         _sql.Execute("spArticles_AddAritcle", article, "FinAppData");
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 5
0
        public void MakeTransition(TransitionModel transition, string userId)
        {
            SqlDataAccess sql = new SqlDataAccess(_config);
            var           p   = new
            {
                UserId           = userId,
                WalletId         = transition.Wallet.Id,
                TransitionAmount = transition.Amount,
                TransitionDate   = transition.TransitionDate,
                TransitionType   = transition.TransitionType,
                ArticleId        = transition.Article.Id
            };

            sql.Execute("spTransitions_MakeTransitions", p, "FinAppData");
        }
Exemplo n.º 6
0
        private bool WalletDoesNotExist(string nameToCheck, string userId)
        {
            SqlDataAccess dataAccess = new SqlDataAccess(_config);
            var           p          = new DynamicParameters();

            p.Add("@WalletName", nameToCheck);
            p.Add("@UserId", userId);
            p.Add("@Out", DbType.Int32, direction: ParameterDirection.Output);
            dataAccess.Execute("spWallets_WalletsLookUp", p, "FinAppData");
            var retval = p.Get <int>("@Out");

            if (retval == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }