public async Task <ActionResult <LedgerType> > PostLedgerType(LedgerType ledgerType) { _context.LedgerTypes.Add(ledgerType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLedgerType", new { id = ledgerType.LedgerTypeId }, ledgerType)); }
public async Task <IActionResult> PutLedgerType(int id, LedgerType ledgerType) { if (id != ledgerType.LedgerTypeId) { return(BadRequest()); } _context.Entry(ledgerType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LedgerTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Ledger(LedgerType ledgerType, string entity, string ApplicationToken, string UserName) { _ledgerType = ledgerType; _entity = entity; _applicationToken = ApplicationToken; apicall = new RestAPICall(ApplicationToken, UserName, entity); }
public bool DeleteLedgerType(LedgerType entity) { if (entity == null) return false; _unitOfWork.LedgerTypeRepository.Delete(entity); _unitOfWork.Save(); return true; }
//------------------------------------------------------------------------------------------- protected void LedgerItemAdd_Click(object sender, EventArgs e) { //List.ShowFooter = true; //List.EditItemIndex = List.Items.Count; LedgerType ledgerType = (LedgerType)Enum.Parse(typeof(LedgerType), Request["ledgertype"], true); using (WeavverEntityContainer data = new WeavverEntityContainer()) { Accounting_LedgerItems item = new Accounting_LedgerItems(); item.Id = Guid.NewGuid(); item.OrganizationId = BasePage.SelectedOrganization.Id; item.LedgerType = ledgerType.ToString(); item.Code = ((CodeType)Enum.Parse(typeof(CodeType), CodeTypeList.SelectedValue, true)).ToString(); item.PostAt = DateTime.Parse(LedgerItemPostAt.Text).ToUniversalTime(); item.AccountId = new Guid(Request["AccountId"]); item.Memo = LedgerItemName.Text; item.Amount = Decimal.Parse(LedgerItemAmount.Text); data.Accounting_LedgerItems.AddObject(item); try { data.SaveChanges(); ErrorMsg.Text = ""; OnDataSaved(this, EventArgs.Empty); } catch (IValidatorException ex) { ErrorMsg.Text = ex.Message; } } }
public async Task <IActionResult> Edit(int id, [Bind("LedgerTypeId,LedgerNameType,Category,Remark")] LedgerType ledgerType) { if (id != ledgerType.LedgerTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ledgerType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LedgerTypeExists(ledgerType.LedgerTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(PartialView(ledgerType)); }
public bool DeleteLedgerType(LedgerType entity) { if (entity == null) { return(false); } _unitOfWork.LedgerTypeRepository.Delete(entity); _unitOfWork.Save(); return(true); }
public ActionResult Edit(LedgerType ledgerType) { if (ModelState.IsValid) { ledgerRepository.SaveLedgerType(ledgerType); TempData["message"] = string.Format("{0} saved successfully", ledgerType.LedgerTypeName); CacheRepository.RefreshLedgerTypes(); return(RedirectToAction("Index")); } return(View(ledgerType)); }
//------------------------------------------------------------------------------------------- public static AccountTypes ConvertWeavverLedgerTypeToEbankingAccountType(LedgerType accountType) { switch (accountType) { case LedgerType.Checking: return AccountTypes.atChecking; case LedgerType.CreditLine: return AccountTypes.atLineOfCredit; case LedgerType.MoneyMarket: return AccountTypes.atMoneyMarket; case LedgerType.Savings: return AccountTypes.atSavings; } return AccountTypes.atChecking; }
public async Task <IActionResult> Create([Bind("LedgerTypeId,LedgerNameType,Category,Remark")] LedgerType ledgerType) { if (ModelState.IsValid) { _context.Add(ledgerType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView(ledgerType)); }
private void AddEntry(Guid playerId, int amount, LedgerType type, Guid?roundid = null) { SaveNewEntity(new LedgerEntry { Id = Guid.NewGuid(), PlayerId = playerId, Amount = amount, Type = type, TransactionTime = _clock.GetCurrentInstant(), RoundId = roundid }); }
public static int AddExpLedgerType(eStoreDbContext db) { string[] lists = { "Electricity", "Postage", "HomeExpenses", "Out of Store", "Assests", "Freight", "Serivces", "Tax & Duties" }; foreach (var item in lists) { LedgerType lt = new LedgerType { LedgerNameType = item, Remark = item, Category = LedgerCategory.Expenses }; db.LedgerTypes.Add(lt); } return(db.SaveChanges()); }
public static string ToApiString(this LedgerType type) { switch (type) { case LedgerType.Deposit: return("deposit"); case LedgerType.Withdrawal: return("withdrawal"); case LedgerType.Trade: return("trade"); case LedgerType.Margin: return("margin"); default: throw new ArgumentOutOfRangeException(nameof(type)); } }
/// <summary> /// Initializer for Deposit or Withdrawal /// </summary> public Ledger(string ledgerId, DateTime dateTime, LedgerType ledgerType, Currency currency, decimal amount, decimal amountInUsd, decimal fee, decimal balance, string withdrawId, string depositId, AccountId accountId) { LedgerId = ledgerId; DateTime = dateTime; LedgerType = ledgerType; Currency = currency; Amount = amount; AmountInUsd = amountInUsd; Fee = fee; Balance = balance; WithdrawId = withdrawId; DepositId = depositId; AccountId = accountId; }
/// <summary> /// Initializer for trade ledgers /// </summary> public Ledger(string ledgerId, DateTime dateTime, LedgerType ledgerType, Currency currency, decimal amount, decimal amountInUsd, decimal fee, decimal balance, string tradeId, string orderId, bool isBaseCurrencyInTrade, AccountId accountId) { LedgerId = ledgerId; DateTime = dateTime; LedgerType = ledgerType; Currency = currency; Amount = amount; AmountInUsd = amountInUsd; Fee = fee; Balance = balance; TradeId = tradeId; OrderId = orderId; IsBaseCurrencyInTrade = isBaseCurrencyInTrade; AccountId = accountId; }
public void SaveLedgerType(LedgerType ledgerType) { if (ledgerType.LedgerTypeId == 0) { context.LedgerTypes.Add(ledgerType); } else { var dbEntry = context.LedgerTypes.Find(ledgerType.LedgerTypeId); if (dbEntry != null) { dbEntry.LedgerTypeName = ledgerType.LedgerTypeName; dbEntry.CanParticipateInPnL = ledgerType.CanParticipateInPnL; } } context.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { ScheduledPayments.ItemDataBound += new DataGridItemEventHandler(ScheduledPayments_ItemDataBound); WeavverMaster.FormTitle = "OFX Bill Pay"; Guid accountId = new Guid(Request["id"]); using (WeavverEntityContainer data = new WeavverEntityContainer()) { Accounting_Accounts financialAccount = (from x in data.Accounting_Accounts where x.Id == accountId select x).FirstOrDefault(); if (financialAccount.OrganizationId == LoggedInUser.OrganizationId) { Accounting_OFXSettings ofxBank = financialAccount.GetOFXSettings(); Logistics_Addresses address = null; billPayment.OFXAppId = "QWIN"; billPayment.OFXAppVersion = "1700"; billPayment.FIUrl = ofxBank.Url; billPayment.FIId = ofxBank.FinancialInstitutionId.ToString(); billPayment.FIOrganization = ofxBank.FinancialInstitutionName; billPayment.OFXUser = ofxBank.Username; billPayment.OFXPassword = ofxBank.Password; billPayment.Payment.FromBankId = ofxBank.BankId; billPayment.Payment.FromAccountId = financialAccount.AccountNumber; LedgerType lType = (LedgerType)Enum.Parse(typeof(LedgerType), financialAccount.LedgerType); billPayment.Payment.FromAccountType = Accounting_OFXSettings.ConvertWeavverLedgerTypeToEbankingAccountType(lType); billPayment.SynchronizePayments("REFRESH"); billPayment.SynchronizePayees("REFRESH"); // do these together so we can poll the info in ItemDataBound var items = from x in billPayment.SyncPayments orderby x.DateDue descending select x; ScheduledPayments.DataSource = items; ScheduledPayments.DataBind(); Payees.DataSource = billPayment.SyncPayees; Payees.DataBind(); } } }
public LedgerEntry( string ledgerId, string refId, DateTimeOffset timestamp, LedgerType type, string assetClass, string asset, decimal amount, decimal fee, decimal balance) { LedgerId = ledgerId; RefId = refId; Timestamp = timestamp; Type = type; AssetClass = assetClass; Asset = asset; Amount = amount; Fee = fee; Balance = balance; }
private int AddOrGetEmployeeLedger() { var ID = db.LedgerTypes.Where(c => c.LedgerNameType == "Salary").Select(c => c.LedgerTypeId).FirstOrDefault(); if (ID <= 0) { LedgerType Lt = new LedgerType { LedgerNameType = "Salary", Remark = "For Employees", Category = LedgerCategory.Expenses }; db.LedgerTypes.Add(Lt); db.SaveChanges(); return(Lt.LedgerTypeId); } else { return(ID); } }
public LedgerDto( int trans, LedgerType type, DateTime date, int num, string name, string memo, string account, double debit, double credit ) { Trans = trans; Type = type; Date = date; Num = num; Name = name; Memo = memo; Account = account; Debit = debit; Credit = credit; }
public bool AddLedgerType(LedgerType entity) { _unitOfWork.LedgerTypeRepository.Add(entity); _unitOfWork.Save(); return true; }
public bool EditLedgerType(LedgerType entity) { _unitOfWork.LedgerTypeRepository.Edit(entity); _unitOfWork.Save(); return true; }
//syntax to call the other constructor /// <summary> /// Constructor /// </summary> /// <param name="ledgerType"></param> /// <param name="id"></param> /// <param name="total"></param> /// <param name="date"></param> /// <param name="user"></param> public BulkPayment(LedgerType ledgerType, string id, double total, DateTime? date , IUser user) : this(ledgerType, id, total, date, user, new Batch()) { }
/// <summary> /// Constructor used for an existing Batch /// </summary> /// <param name="ledgerType"></param> /// <param name="key"></param> public BulkPayment(LedgerType ledgerType, int key) : this(ledgerType, key, new Batch()) { }
IEnumerable <LedgerDto> ILedgerParser.Parse(TextReader reader) { var configuration = new Configuration(CultureInfo.InvariantCulture); configuration.HasHeaderRecord = true; int lineIndex = 0; using (var csv = new CsvReader(reader, configuration)) { csv.Read(); csv.ReadHeader(); while (csv.Read()) { lineIndex++; string transField = csv.GetField("Trans #"); if (!int.TryParse(transField, NumberStyles.Integer | NumberStyles.AllowThousands, NumberFormatInfo.InvariantInfo, out int trans)) { Log.Logger.Write(LogEventLevel.Error, $"CSV error in line: {lineIndex}. Unable to parse Trans #:'{transField}' to number."); } string dateField = csv.GetField("Date"); if (!DateTime.TryParse(dateField, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out DateTime date)) { Log.Logger.Write(LogEventLevel.Error, $"CSV error in line: {lineIndex}. Unable to parse Date:'{dateField}' to date."); } string numField = csv.GetField("Num"); int num = 0; if (!string.IsNullOrEmpty(numField)) { if (!int.TryParse(numField, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out num)) { Log.Logger.Write(LogEventLevel.Error, $"CSV error in line: {lineIndex}. Unable to parse Num:'{numField}' to number."); } } string debitField = csv.GetField("Debit"); if (!double.TryParse(debitField, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out double debit)) { Log.Logger.Write(LogEventLevel.Error, $"CSV error in line: {lineIndex}. Unable to parse Debit:'{debitField}' to decimal."); } string creditField = csv.GetField("Credit"); if (!double.TryParse(creditField, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out double credit)) { Log.Logger.Write(LogEventLevel.Error, $"CSV error in line: {lineIndex}. Unable to parse Credit:'{creditField}' to decimal."); } LedgerType type = LedgerTypeHelper.Parse(csv.GetField("Type")); var dto = new LedgerDto( trans: trans, type: type, date: date, num: num, name: csv.GetField("Name"), memo: csv.GetField("Memo"), account: csv.GetField("Account"), debit: debit, credit: credit ); yield return(dto); } } }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="LedgerType" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LedgerType.CreateFrom(sourceValue);
/// <summary> /// Constructor used for testing /// </summary> /// <param name="ledgerType"></param> /// <param name="id"></param> /// <param name="total"></param> /// <param name="date"></param> /// <param name="user"></param> /// <param name="batch"></param> internal BulkPayment(LedgerType ledgerType, string id, double total, DateTime? date , IUser user, IBatch batch) { _ledgerType = ledgerType; _id = id; _total = total; _date = date; _user = user; _batch = batch; }
public bool EditLedgerType(LedgerType entity) { _unitOfWork.LedgerTypeRepository.Edit(entity); _unitOfWork.Save(); return(true); }
/// <summary> /// Constructor used for testing when the Batch already exists /// </summary> /// <param name="ledgerType"></param> /// <param name="batchHeaderKey"></param> /// <param name="batch"></param> internal BulkPayment(LedgerType ledgerType, int batchHeaderKey, IBatch batch) { _batchHeaderKey = batchHeaderKey; _ledgerType = ledgerType; _batch = batch; GetBatch(ledgerType, batchHeaderKey); }
/// <summary> /// Retrieves an existing batch from the database; brings back only header and summary information /// </summary> /// <param name="ledgerType"></param> /// <param name="key"></param> private void GetBatch(LedgerType ledgerType, int key) { BatchHeaderDTO batchHeaderDTO = null; switch (ledgerType) { case LedgerType.PayerAccountsReceivable: batchHeaderDTO = _batch.GetPayerBatch(key); break; default: break; } if (batchHeaderDTO != null) {UpdateFromBatchHeaderDTO(batchHeaderDTO);} else { throw new BatchNotFoundException("Batch not found"); } }