Exemple #1
0
        public async Task <int> CreateTransaction(int user, int account, DateTime date, string description, int category, int subCategory, int type, double amount)
        {
            var result = 0;

            var entity = new Entity.Transaction()
            {
                User        = user,
                Account     = account,
                Date        = date,
                Description = description,
                Category    = category,
                SubCategory = subCategory,
                Type        = type,
                Amount      = amount
            };

            Context.Transactions.Add(entity);

            if (await Context.SaveChangesAsync() > 0)
            {
                result = entity.ID;
            }

            return(result);
        }
Exemple #2
0
        //public int Edit(Entity.Offer offer)
        //{
        //    string query = "UPDATE Offer SET OfferName='" + offer.OfferName + "', Description='" + offer.Description + "', DiscountPercentage='" + offer.DiscountPercentage + "', OfferGiven='" + offer.OfferGiven + "', OfferValid='" + offer.OfferValid + "', ItemCode='" + offer.ItemCode + "', CategoryID='" + offer.CategoryID + "', MemberTypeID='" + offer.MemberTypeID + "' WHERE OfferID=" + offer.OfferID;
        //    return DataAccess.ExecuteQuery(query);
        //}
        public List <Entity.Transaction> GetAll()
        {
            string        query  = "SELECT SaleTransaction, TransactionDateTime, ItemCode, AccountID, MembershipID, OfferID FROM Transaction";
            SqlDataReader reader = DataAccess.GetData(query);

            Entity.Transaction        transaction     = null;
            List <Entity.Transaction> transactionList = new List <Entity.Transaction>();

            while (reader.Read())
            {
                transaction              = new Entity.Transaction(reader["TransactionID"].ToString(), Convert.ToDateTime(reader["TransactionDateTime"]));
                transaction.ItemCode     = reader["ItemCode"].ToString();
                transaction.AccountId    = reader["AccountID"].ToString();
                transaction.MembershipID = reader["MembershipID"].ToString();
                transaction.OfferID      = reader["OfferID"].ToString();

                transactionList.Add(transaction);
            }
            return(transactionList);
        }
Exemple #3
0
 public int AddWithoutOfferID(Entity.Transaction transaction)
 {
     return(TransactionService.transactionDataAccess.AddWithoutOfferID(transaction));
 }
Exemple #4
0
 public int Add(Entity.Transaction transaction)
 {
     return(TransactionService.transactionDataAccess.Add(transaction));
 }
Exemple #5
0
        public int AddWithoutMemberID(Entity.Transaction transaction)
        {
            string query = string.Format("INSERT INTO SaleTransaction(TransactionID, TransactionDateTime, ItemCode, AccountID, Quantity) VALUES('{0}', '{1}', '{2}', '{3}', '{4})", transaction.TransactionID, transaction.TransactionDateTime, transaction.ItemCode, transaction.AccountId, transaction.Quantity);

            return(DataAccess.ExecuteQuery(query));
        }