コード例 #1
0
        public async Task <ActionResult <LedgerType> > PostLedgerType(LedgerType ledgerType)
        {
            _context.LedgerTypes.Add(ledgerType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLedgerType", new { id = ledgerType.LedgerTypeId }, ledgerType));
        }
コード例 #2
0
        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());
        }
コード例 #3
0
 public Ledger(LedgerType ledgerType, string entity, string ApplicationToken, string UserName)
 {
     _ledgerType       = ledgerType;
     _entity           = entity;
     _applicationToken = ApplicationToken;
     apicall           = new RestAPICall(ApplicationToken, UserName, entity);
 }
コード例 #4
0
 public bool DeleteLedgerType(LedgerType entity)
 {
     if (entity == null) return false;
     _unitOfWork.LedgerTypeRepository.Delete(entity);
     _unitOfWork.Save();
     return true;
 }
コード例 #5
0
//-------------------------------------------------------------------------------------------
    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;
            }
        }
    }
コード例 #6
0
        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));
        }
コード例 #7
0
ファイル: LedgerTypeService.cs プロジェクト: ndrmc/cats-hub
 public bool DeleteLedgerType(LedgerType entity)
 {
     if (entity == null)
     {
         return(false);
     }
     _unitOfWork.LedgerTypeRepository.Delete(entity);
     _unitOfWork.Save();
     return(true);
 }
コード例 #8
0
 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));
 }
コード例 #9
0
 //-------------------------------------------------------------------------------------------
 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;
 }
コード例 #10
0
        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));
        }
コード例 #11
0
 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
     });
 }
コード例 #12
0
 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());
 }
コード例 #13
0
        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));
            }
        }
コード例 #14
0
 /// <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;
 }
コード例 #15
0
 /// <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;
 }
コード例 #16
0
 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();
 }
コード例 #17
0
    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();
            }
        }
    }
コード例 #18
0
 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;
 }
コード例 #19
0
ファイル: ImportPayroll.cs プロジェクト: amitdumka/eStore
        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);
            }
        }
コード例 #20
0
ファイル: LedgerDto.cs プロジェクト: opets/ImportApiSample
 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;
 }
コード例 #21
0
 public bool AddLedgerType(LedgerType entity)
 {
     _unitOfWork.LedgerTypeRepository.Add(entity);
     _unitOfWork.Save();
     return true;
 }
コード例 #22
0
 public bool EditLedgerType(LedgerType entity)
 {
     _unitOfWork.LedgerTypeRepository.Edit(entity);
     _unitOfWork.Save();
     return true;
 }
コード例 #23
0
ファイル: BulkPayment.cs プロジェクト: ipduncan/Refactor
 //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())
 {
 }
コード例 #24
0
ファイル: BulkPayment.cs プロジェクト: ipduncan/Refactor
 /// <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())
 {
 }
コード例 #25
0
        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);
                }
            }
        }
コード例 #26
0
 /// <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);
コード例 #27
0
ファイル: BulkPayment.cs プロジェクト: ipduncan/Refactor
 /// <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;
 }
コード例 #28
0
ファイル: LedgerTypeService.cs プロジェクト: ndrmc/cats-hub
 public bool EditLedgerType(LedgerType entity)
 {
     _unitOfWork.LedgerTypeRepository.Edit(entity);
     _unitOfWork.Save();
     return(true);
 }
コード例 #29
0
ファイル: BulkPayment.cs プロジェクト: ipduncan/Refactor
 /// <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);
 }
コード例 #30
0
ファイル: BulkPayment.cs プロジェクト: ipduncan/Refactor
        /// <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"); }
        }