public EditTransactionPageViewModel() { EditTransactionCommand = new DelegateCommand(EditAsync); CancelCommand = new DelegateCommand(Cancel); TransactionTypes.Add("Income"); TransactionTypes.Add("Expense"); }
public List <Models.Accounting.LedgerLine> GetByTransactionType(TransactionTypes transactionType) { return(erpNodeDBContext.Ledgers .Where(journal => journal.TransactionType == transactionType) .OrderBy(journal => journal.accountItem.No) .ToList()); }
public TransactionTypes GetTransactionType(long ID) { try { DataSet data = new DataSet(); SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@ID", ID); data = new ADODataFunction().ExecuteDataset(Constants.Procedures.GetTransactionTypeByID, param, CommandType.StoredProcedure); TransactionTypes model = data.Tables[0].AsEnumerable().Select(a => new TransactionTypes { ID = a.Field <long>("ID") , Type = a.Field <string>("TransactionType") , Nature = a.Field <string>("TransactionNature") , IsActive = a.Field <bool>("IsActive") , CreatedBy = a.Field <long>("CreatedBy") , CreatedOn = a.Field <DateTime>("CreatedOn") }).FirstOrDefault(); return(model); } catch (Exception ex) { return(null); } }
public Transaction(decimal value, DateTimeOffset date, TransactionTypes transactionType, Guid accountId) { this.AccountId = accountId; this.Date = date; this.Value = value; this.TransactionType = transactionType; }
public ResponseToTransferToAccountsOfSameClient TransferToAccountOfSameClient(RequestTransferToAccountsOfSameClient requestTransfer) { ResponseToTransferToAccountsOfSameClient objReturn = new ResponseToTransferToAccountsOfSameClient(); decimal transfer_amount; //1: ORIGEN (AL QUE SE LE RESTA) 2: DESTINO(EL QUE RECIBE) string identification1, name1, identification2, name2, description; identification1 = requestTransfer.Identifier; identification2 = requestTransfer.Identifier; name1 = requestTransfer.Main_Account; name2 = requestTransfer.Secondary_Account; transfer_amount = requestTransfer.Balance_To_Transfer; description = TransactionTypes.Transfer(identification1, identification2, name1, name2, transfer_amount, false); try { entities.bankTransfer(transfer_amount, identification1, name1, identification2, name2, description); objReturn.Success = true; objReturn.Message = "La transferencia se hizo con exito!"; } catch { objReturn.Success = false; objReturn.Message = "La transferencia no se hizo con exito, intentelo mas tarde"; } return(objReturn); }
protected string GetTransactionTextForProcedure <T>(TransactionTypes transactionType, bool doAlter) where T : Cope <T>, IManageable, new() { Logger.Info(string.Format("Getting {0} transaction for type {1}. DoAlter = {2}", transactionType.ToString(), typeof(T), doAlter)); switch (transactionType) { case TransactionTypes.Delete: return(_creator.CreateDeleteStoredProcedure <T>(doAlter)); case TransactionTypes.DeleteMassive: return(_creator.CreateMassiveOperationStoredProcedure <T>(doAlter)); case TransactionTypes.Insert: return(_creator.CreateInsertStoredProcedure <T>(doAlter)); case TransactionTypes.InsertMassive: return(_creator.CreateMassiveOperationStoredProcedure <T>(doAlter)); case TransactionTypes.Update: return(_creator.CreateUpdateStoredProcedure <T>(doAlter)); case TransactionTypes.UpdateMassive: return(_creator.CreateMassiveOperationStoredProcedure <T>(doAlter)); default: ArgumentException argumentException = new ArgumentException("El tipo de transaccion no es valido para generar un nuevo procedimiento almacenado."); Logger.Error(argumentException); throw argumentException; } }
protected void PerformStoredProcedureValidation <T>(TransactionTypes transactionType, QueryOptions queryOptions) where T : Cope <T>, IManageable, new() { TransactionTypes singleTransactionType; switch (transactionType) { case TransactionTypes.InsertMassive: singleTransactionType = TransactionTypes.Insert; break; case TransactionTypes.UpdateMassive: singleTransactionType = TransactionTypes.Update; break; case TransactionTypes.DeleteMassive: singleTransactionType = TransactionTypes.Delete; break; default: throw new NotSupportedException($"El tipo de transaccion {transactionType.ToString()} no puede ser utilizado con esta funcion."); } string schema = Manager.ConnectionType == ConnectionTypes.MSSQL ? Cope <T> .ModelComposition.Schema : ConsolidationTools.GetInitialCatalog(queryOptions.ConnectionToUse, true); if (!DoStoredProcedureExist(ConsolidationTools.GetInitialCatalog(queryOptions.ConnectionToUse), schema, $"{Manager.StoredProcedurePrefix}massive_operation", queryOptions.ConnectionToUse)) { ExecuteScalar(GetTransactionTextForProcedure <T>(transactionType, false), queryOptions.ConnectionToUse, false); } if (!DoStoredProcedureExist(ConsolidationTools.GetInitialCatalog(queryOptions.ConnectionToUse), schema, $"{Manager.StoredProcedurePrefix}{Cope<T>.ModelComposition.TableName}{GetFriendlyTransactionSuffix(singleTransactionType)}", queryOptions.ConnectionToUse)) { ExecuteScalar(GetTransactionTextForProcedure <T>(singleTransactionType, false), queryOptions.ConnectionToUse, false); } }
public double GetBalance() { double total = 0.0; for (int i = 0; i < Transactions.Count; i++) { TransactionTypes type = Transactions[i].TransactionType; double amount = Transactions[i].Amount; switch (type) { case TransactionTypes.Deposit: total += amount; break; case TransactionTypes.Withdraw: total -= amount; break; case TransactionTypes.Send: total -= amount; break; case TransactionTypes.Receive: total += amount; break; case TransactionTypes.Interest: total += amount; break; } } return(Math.Round(total, 2)); }
public async Task Log(TransactionTypes transactionType, string message) { Transaction transaction = await transactionService.GetNewTransaction(transactionType); transaction.Message = message; await transactionService.UpdateTransactionCompleted(transaction); }
protected TransactionType CreateType(TransactionTypes type) { var app = _fixture.Container.Resolve <ApplicationViewModel>(); app.SelectViewModelCommand.Execute(ViewModel.TypesManager); var vm = (TransactionTypesViewModel)app.SelectedViewModel; vm.AddTransactionTypeCommand.Execute(null); var transactionType = vm.TransactionTypes.Last(); switch (type) { case TransactionTypes.Income: transactionType.Income = true; transactionType.Outcome = false; transactionType.Name = "income"; break; case TransactionTypes.Outcome: transactionType.Outcome = true; transactionType.Income = false; transactionType.Name = "outcome"; break; } return(transactionType); }
public AccountLedgerEntry(TransactionTypes transactionType, decimal transactionAmmount, decimal balance) { this.transactionType = transactionType; this.transactionAmount = transactionAmount; this.balance = balance; }
public TransactionItemsList(TransactionTypes transactionType, ItemDTO itemDto) { InitializeComponent(); Messenger.Default.Send <TransactionTypes>(transactionType); Messenger.Default.Send <ItemDTO>(itemDto); Messenger.Reset(); }
public async void addTransaction(string CustomerID, TransactionTypes transactionType, DateTime transactionTime, float amount, Currency currency, string sourceAccountNumber, string destnationAccountNumber = null) { AccountTransactionRepository transactionRepository = new AccountTransactionRepository(this._context); CustomerRepository customerRepository = new CustomerRepository(this._context); BankAccountRepository accountRepository = new BankAccountRepository(this._context); var customer = customerRepository.getByCustomerID(CustomerID); if (customer == null) { throw new Exception(string.Format("there's no customer with that customerID'{0}'", CustomerID)); } var sourceAccount = accountRepository.getByAccountNumber(sourceAccountNumber); if (customer == null) { throw new Exception(string.Format("Source Bank Account Error:there's no BankAccount with that AccountNumber'{0}'", sourceAccountNumber)); } DAL.Entities.BankAccount destnationAccount = null; if (transactionType == TransactionTypes.transfer) { destnationAccount = accountRepository.getByAccountNumber(destnationAccountNumber); if (destnationAccount == null) { throw new Exception(string.Format("Destnation Bank Account Error:there's no BankAccount with that AccountNumber'{0}'", destnationAccountNumber)); } } await transactionRepository.addTransaction(customer, transactionType, transactionTime, amount, currency, sourceAccount, destnationAccount); }
private decimal getBalance(decimal amount, TransactionTypes transactionType) { var updatedBalance = transactionType == TransactionTypes.Deposit ? runningTotal + amount : runningTotal - amount; runningTotal = updatedBalance; return(updatedBalance); }
public ReceiveStock(TransactionTypes type) { ReceiveStockViewModel.Errors = 0; InitializeComponent(); Messenger.Default.Send <TransactionTypes>(type); Messenger.Reset(); }
private void Export() { AllowInput = false; try { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "JSON|*.json"; sfd.DefaultExt = "json"; if (sfd.ShowDialog() == true) { FileExporter.FileExporter.ExportTransactionType(sfd.FileName, TransactionTypes.Where(c => TransactionTypesView.Filter(c)).ToList()); } } catch (IOException e) { MessageBox.Show("Unexpected error occurred while loading JSON file. Details:/n" + e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception) { MessageBox.Show("Unexpected error occurred while importing", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { AllowInput = true; } }
public bool CreateTransaction(TransactionTypes transactionType, double amount, int receiverAccountId = -1) { if (transactionType == TransactionTypes.Withdraw || transactionType == TransactionTypes.Send) { if (amount > GetBalance()) { Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine("Insufficient balance"); Console.ResetColor(); return(false); } } Transaction transaction = new Transaction(this, transactionType, amount); transaction.Save(); // If there is a receiverAccountId then we will create an transacion on the other account if (receiverAccountId > 0) { Transaction receiverTransaction = new Transaction(Registry.GetAccount(receiverAccountId), TransactionTypes.Receive, amount); receiverTransaction.Save(); } return(true); }
public void ReadLine(string line) { string[] cols = line.Split(','); if (cols.Length < 8 || cols.Length > 9) { throw new ArgumentException("Invalid line length"); } Account = cols[0]; TransDate = DateTime.Parse(cols[1]); Amount = StringToDecimal(cols[2]); Balance = StringToDecimal(cols[3]); Category = cols[4]; Description = cols[5]; Memo = cols[6]; Notes = cols[7]; TransType = cols.Length == 9 ? (TransactionTypes)Enum.Parse(typeof(TransactionTypes), cols[8]) : TransactionTypes.Unselected; if (TransType == TransactionTypes.Unselected) { TransType = CategoryMatch.GetType(this.ToString()); } if (TransType == TransactionTypes.Unselected && Description.Contains("Check Withdrawal") && Amount < 0) { TransType = TransactionTypes.Bill; } }
public HttpResponseMessage Get(TransactionTypes transactionType, int transactionID, decimal? amount) { string htmlContent = @" <html> <head> <title></title> <script src='/scripts/jquery-2.1.0.min.js' type='text/javascript'></script> </head> <body> <script type='text/javascript'> $(function () { window.location.href = 'http://www.yahoo.com'; }); </script> </body> "; return new HttpResponseMessage { Content = new StringContent( htmlContent, Encoding.UTF8, "text/html") }; }
public TransactionType AddTransactionType(string name, bool hasMaximumPrecission) { TransactionType transactionType = new TransactionType(name, hasMaximumPrecission); TransactionTypes.Add(transactionType); return(transactionType); }
public override bool CreateTransaction(TransactionTypes transactionType, double amount, ref Account sender, ref Account receiver) { if (transactionType == TransactionTypes.Send) { if (amount > GetBalance()) { Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine("Insufficient balance"); Console.ResetColor(); return(false); } if ((GetBalance() + amount) < this.MinBalance) { return(false); } if (amount < this.MinDeposit) { return(false); } this.Transactions.Add(new Transaction(TransactionTypes.Send, amount, sender, receiver)); receiver.Transactions.Add(new Transaction(TransactionTypes.Receive, amount, sender, receiver)); return(true); } return(false); }
public override bool CreateTransaction(TransactionTypes transactionType, double amount) { if (transactionType == TransactionTypes.Withdraw) { if (amount > GetBalance()) { Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine("Insufficient balance"); Console.ResetColor(); return(false); } } else if (transactionType == TransactionTypes.Deposit) { if ((GetBalance() + amount) < this.MinBalance) { return(false); } if (amount < this.MinDeposit) { return(false); } } this.Transactions.Add(new Transaction(transactionType, amount)); return(true); }
public Transaction(Account account, TransactionTypes transactionType, double amount) { this.Account = account; this.TransactionType = transactionType; this.Date = DateTime.Now; this.Amount = amount; }
public ResponseToWithdrawal ToWithdrawal(RequestWithdrawal requestWithdrawal) { ResponseToWithdrawal objToWithdrawal = new ResponseToWithdrawal(); decimal withdraw_amount; string identification, name, description; withdraw_amount = requestWithdrawal.Balance_To_Withdraw; identification = requestWithdrawal.Identifier; name = requestWithdrawal.Account_Name; description = TransactionTypes.Withdrawal(identification, name, withdraw_amount); try { entities.bankWithdraw(withdraw_amount, identification, name, description); objToWithdrawal.Success = true; objToWithdrawal.Message = "Se ha retirado dinero con exito!"; } catch { objToWithdrawal.Success = false; objToWithdrawal.Message = "Error, revise sus datos"; } return(objToWithdrawal); }
public NewTransactionPageViewModel() { CreateTransactionCommand = new DelegateCommand(CreateAsync); CancelCommand = new DelegateCommand(Cancel); TranDate = System.DateTime.Now; TransactionTypes.Add("Income"); TransactionTypes.Add("Expense"); }
public PaymentList(TransactionTypes transaction, BusinessPartnerDTO businessPartner, PaymentListTypes listType) { InitializeComponent(); Messenger.Default.Send <BusinessPartnerDTO>(businessPartner); Messenger.Default.Send <PaymentListTypes>(listType); Messenger.Default.Send <TransactionTypes>(transaction); Messenger.Reset(); }
public Transaction(TransactionTypes transactionType, double amount) { this.Date = DateTime.Now; this.TransactionType = transactionType; this.Amount = amount; // Create the transaction job }
internal Guid GetTransactionTypeIdByEnum(TransactionTypes transactionType) { if (_transactionTypes == null) { _transactionTypes = ExecuteCommand(new GetAllTransactionTypes()); } return(_transactionTypes.Single(t => t.Name == transactionType.ToString()).Id); }
public SellItemEntry(TransactionTypes type) { SellItemEntryViewModel.Errors = 0; InitializeComponent(); LstItemsAutoCompleteBox.Focus(); Messenger.Default.Send <TransactionTypes>(type); Messenger.Reset(); }
public Transaction(decimal amount) { if(amount == 0) throw new ArgumentException("amount cannot be zero"); this.amount = amount; this.transactionDate = DateTime.Now; this.transactionType = amount < 0 ? TransactionTypes.Withdrawal : TransactionTypes.Deposit; }
public Transaction(TransactionTypes type, decimal amount, decimal balanceBefore) { TypeOfTransaction = type; Amount = amount; TimeInitiated = System.DateTime.Now; GUID = Guid.NewGuid(); Success = true; BalanceBefore = balanceBefore; }
public Transaction(DateTime date, string code, TransactionTypes type, int units, decimal fees, decimal total) { Date = date; Code = code; Type = type; Units = units; Fees = fees; Total = total; }
public static string GetNumber(DateTime date, TransactionTypes Type) { FrContext DB = new FrContext(); if (Type == TransactionTypes.In || Type == TransactionTypes.Out) { var num = DB.Transfers.Where(p => p.Date.Year == date.Year && p.Date.Month == date.Month && p.Type == Type); return num.Count() != 0 ? (num.Max(p => p.Number) + 1).ToString() : string.Format("{0}001", date.ToString("yyMM")); } else if (Type == TransactionTypes.Buy || Type == TransactionTypes.ReBuy) { var num = DB.Transactions.Where(p => p.Date.Year == date.Year && p.Date.Month == date.Month && (p.Type == TransactionTypes.Buy || p.Type == TransactionTypes.ReBuy)); return num.Count() != 0 ? (num.Max(p => p.Number) + 1).ToString() : string.Format("{0}001", date.ToString("yyMM")); } else { var num = DB.Transactions.Where(p => p.Date.Year == date.Year && p.Date.Month == date.Month && (p.Type != TransactionTypes.Buy && p.Type != TransactionTypes.ReBuy)); return num.Count() != 0 ? (num.Max(p => p.Number) + 1).ToString() : string.Format("{0}001", date.ToString("yyMM")); } }
private decimal GetDebitCreditBalance(TransactionTypes side) { decimal balance = 0; if (side == TransactionTypes.Dr) { var dr = from d in GeneralLedgerLines where d.DrCr == TransactionTypes.Dr select d; balance = dr.Sum(d => d.Amount); } else { var cr = from d in GeneralLedgerLines where d.DrCr == TransactionTypes.Cr select d; balance = cr.Sum(d => d.Amount); } return balance; }
public static void CreateNotas(BatchExecutionResults results, int managementCompanyId, int accountId) { checkCompanyAndAccount(managementCompanyId, accountId); CreateNotasFromOrders(results, managementCompanyId, accountId); // Which transaction types should be processed, and in what order TransactionTypes[] transactionTypes = new TransactionTypes[] { TransactionTypes.NTM, // NotaTransfer TransactionTypes.InstrumentConversion // NotaCorporateAction }; foreach (TransactionTypes transactionType in transactionTypes) CreateNotasFromTransactions(results, transactionType, managementCompanyId, accountId); // Which booking types should be processed, and in what order GeneralOperationsBookingReturnClass[] bookingTypes = new GeneralOperationsBookingReturnClass[] { GeneralOperationsBookingReturnClass.ManagementFee, // NotaFees GeneralOperationsBookingReturnClass.CashDividend, // NotaDividend GeneralOperationsBookingReturnClass.CashTransfer // NotaDeposit }; foreach (GeneralOperationsBookingReturnClass bookingType in bookingTypes) CreateNotasFromBookings(results, bookingType, managementCompanyId, accountId); }
/// <summary> /// Log all transaction into rekurant DB /// </summary> /// <param name="userId">the user id</param> /// <param name="request"> request sent to spreedly</param> /// <param name="response">response from spreedly</param> /// <param name="transactionType">type of transaction</param> public void LogToDb(string userId, string request, string response, TransactionTypes transactionType) { if (!string.IsNullOrEmpty(userId)) { var logsDto = new SpreedlyLogsDto { UserId = userId, Request = request, Response = response, ModifiedBy = userId, TransactionType = (int)transactionType }; bool result = this.spreedlyLogsService.SaveSpreedlyLogs(logsDto); } }
/// <summary> /// The call. /// </summary> /// <param name="innerCall">The inner call.</param> /// <param name="userId">The user Id.</param> /// <param name="request">The request.</param> /// <param name="transactionType">The transaction Type.</param> /// <returns> /// The <see cref="XDocument" />. /// </returns> private AsyncCallResult<XDocument> Call(Func<IAsyncClient, CancellationToken, Task<HttpResponseMessage>> innerCall, string userId = "", string request = "", TransactionTypes transactionType = TransactionTypes.UnKnown) { var source = new CancellationTokenSource(); CancellationToken token = source.Token; string response = "Connection Timeout"; using (var client = new AsyncClient()) { client.Init(this.securityKeys.Credentials); using (Task<HttpResponseMessage> task = innerCall(client, token)) { try { if (task.Wait(20000, token) == false) { if (token.CanBeCanceled) { source.Cancel(); } this.LogToDb(userId, request, response, transactionType); return new AsyncCallResult<XDocument>(AsyncCallFailureReason.TimeOut); } } catch (Exception ex) { response = "Connection failure ,error :- " + ex; this.LogToDb(userId, request, response, transactionType); return new AsyncCallResult<XDocument>(AsyncCallFailureReason.FailedConnection); } Task<Stream> content = task.Result.Content.ReadAsStreamAsync(); if (content.Wait(20000, token) == false) { if (token.CanBeCanceled) { source.Cancel(); } this.LogToDb(userId, request, response, transactionType); return new AsyncCallResult<XDocument>(AsyncCallFailureReason.TimeOut); } using (var streamReader = new StreamReader(content.Result)) { XDocument doc = XDocument.Load(streamReader, LoadOptions.SetLineInfo); response = doc.ToString(); if (task.Result.IsSuccessStatusCode == false) { this.LogToDb(userId, request, response, transactionType); return new AsyncCallResult<XDocument>(AsyncCallFailureReason.FailedStatusCode, doc); } this.LogToDb(userId, request, response, transactionType); return new AsyncCallResult<XDocument>(AsyncCallFailureReason.None, doc); } } } }
private void AddTransactionItem( TransactionTypes ttype, int playerid ) { SqlHelper.ExecuteNonQuery( System.Configuration.ConfigurationSettings.AppSettings[ "ConnectionString" ], "spAddTransactionItem", Session[ "TransactionId" ], ttype, playerid ); }
public Command(string description, TransactionTypes inquiry) { Description = description; Inquiry = inquiry; }
public Purchases(TransactionTypes type) { InitializeComponent(); Type = type; Title = type == TransactionTypes.Buy ? "المشتريات" : "مرتجعات المشتريات"; }
public Transfers(TransactionTypes type) { InitializeComponent(); Type = type; Title = type == TransactionTypes.Out ? "سحب أصناف" : "تخزين أصناف"; }
public static int Add(String refCode, TransactionTypes TransactionType, Decimal amount, String Comment, int ShowID, int UserID, DateTime TransactionDate, Decimal cheque) { String moduleSettings = ModuleConfig.GetSettings(); Fpp.Data.Transaction t = new Fpp.Data.Transaction(moduleSettings); return t.Add(refCode, (int)TransactionType, amount, Comment, ShowID, UserID, TransactionDate, cheque); }
public static void CreateNotasFromTransactions(BatchExecutionResults results, TransactionTypes transactionType, int managementCompanyId, int accountId) { IDalSession session = NHSessionFactory.CreateSession(); int[] notarizableTxIds = null; try { notarizableTxIds = TransactionMapper.GetNotarizableTransactionIds(session, transactionType, managementCompanyId, accountId); } catch (Exception ex) { results.MarkError( new ApplicationException(string.Format("Error retrieving notarizable transactions ({0}s).", transactionType), ex)); } finally { session.Close(); } foreach (int transactionId in notarizableTxIds) createNotaFromTransaction(results, transactionId, transactionType); }
private static void createNotaFromTransaction(BatchExecutionResults results, int transactionId, TransactionTypes transactionType) { IDalSession session = NHSessionFactory.CreateSession(); try { ITransaction transaction = TransactionMapper.GetTransaction(session, transactionId); if (transaction != null) { INota nota = transaction.CreateNota(); if (nota != null) { NotaMapper.Update(session, nota); results.MarkSuccess(); } else // in case NotaMigrated was set to 'true' (e.g. for a storno of a Monetary Order transaction) TransactionMapper.Update(session, transaction); } else results.MarkError(new ApplicationException(string.Format("Transaction {0} not found.", transactionId))); } catch (Exception ex) { results.MarkError(new ApplicationException(string.Format("Error creating nota for transaction {0} ({1}).", transactionId, transactionType), ex)); } finally { session.Close(); } }
public GeneralLedgerLine CreateGeneralLedgerLine(TransactionTypes DrCr, int accountId, decimal amount) { var line = new GeneralLedgerLine() { DrCr = DrCr, AccountId = accountId, Amount = amount, CreatedBy = Thread.CurrentPrincipal.Identity.Name, CreatedOn = DateTime.Now, ModifiedBy = Thread.CurrentPrincipal.Identity.Name, ModifiedOn = DateTime.Now }; return line; }
public void GivenTheTransactionTypeIs(TransactionTypes transactionType) { _transactionType = transactionType; }