Exemple #1
0
        public ServiceResult Update(FinanceAccountTransaction fat)
        {
            if (fat == null)
            {
                return(ServiceResponse.Error("Invalid FinanceAccountTransaction sent to server."));
            }

            FinanceAccountTransactionsManager financeManager = new FinanceAccountTransactionsManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            var res = financeManager.Get(fat.UUID);

            if (res.Code != 200)
            {
                return(res);
            }

            var dbS = (FinanceAccountTransaction)res.Result;

            if (dbS.DateCreated == DateTime.MinValue)
            {
                dbS.DateCreated = DateTime.UtcNow;
            }

            dbS.Name = fat.Name;

            dbS.Image     = fat.Image;
            dbS.Deleted   = fat.Deleted;
            dbS.Status    = fat.Status;
            dbS.SortOrder = fat.SortOrder;
            //FinanceAccountUUID
            //PayToAccountUUID
            // PayFromAccountUUID
            // CreationDate
            // CustomerIp
            //LastPaymentStatusCheck
            //    OrderUUID
            //    Amount
            //  TransactionType
            // TransactionDate
            // PaymentTypeUUID
            // AmountTransferred
            // SelectedPaymentTypeSymbol
            //SelectedPaymentTypeTotal
            //        UserUUID
            //        CustomerEmail
            // CurrencyUUID
            return(financeManager.Update(dbS));
        }
Exemple #2
0
        public ServiceResult DeleteFinanceAccountTransactionBy(string uuid)
        {
            if (string.IsNullOrWhiteSpace(uuid))
            {
                return(ServiceResponse.Error("Invalid id."));
            }

            FinanceAccountTransactionsManager fm = new FinanceAccountTransactionsManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            var res = fm.Get(uuid);

            if (res.Code != 200)
            {
                return(res);
            }
            FinanceAccountTransaction c = (FinanceAccountTransaction)res.Result;

            return(fm.Delete(c));
        }
Exemple #3
0
        public ServiceResult GetFinanceAccountTransactionByName(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(ServiceResponse.Error("You must provide a name for the strain."));
            }

            FinanceAccountTransactionsManager financeManager = new FinanceAccountTransactionsManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            FinanceAccountTransaction s = (FinanceAccountTransaction)financeManager.Get(name);

            if (s == null)
            {
                return(ServiceResponse.Error("FinanceAccountTransaction could not be located for the name " + name));
            }

            return(ServiceResponse.OK("", s));
        }