public ActionResult DeleteJournalEntryLine(AddJournalEntry model)
        {
            var request     = HttpContext.Request;
            var deletedItem = request.Form["DeletedLineItem"];

            return(View(model));
        }
Exemplo n.º 2
0
        public void Handle(AddJournalEntry message)
        {
            var item = _session.Get <Book>(message.Id);

            item.AddTransaction(message.Id, message.UserId, message.JournalEntry);
            _session.Commit();
        }
        public ActionResult UpdateJournalEntryLine(AddJournalEntry model)
        {
            var request     = HttpContext.Request;
            var deletedItem = request.Form["DeletedLineItem"];

            //model.AddJournalEntryLines.Remove(model.AddJournalEntryLines.Where(i => i.RowId.ToString() == deletedItem.ToString()).FirstOrDefault());
            return(View(model));
        }
Exemplo n.º 4
0
            private int CompareAddJournalEntry(AddJournalEntry <T> x, AddJournalEntry <T> y)
            {
                int result = _sort(x.Item, y.Item);

                if (result != 0)
                {
                    return(result);
                }
                return(x.Order - y.Order);
            }
Exemplo n.º 5
0
        /// <summary>
        /// Compares the add journal entry.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <returns></returns>
        private int CompareAddJournalEntry(AddJournalEntry x, AddJournalEntry y)
        {
            var result = this._sort(x.Item, y.Item);

            if (result != 0)
            {
                return(result);
            }

            return(x.Order - y.Order);
        }
        public ActionResult SaveJournalEntry(AddJournalEntry model)
        {
            if (model.AddJournalEntryLines.Count < 2)
            {
                return(View(model));
            }
            var journalEntry = new JournalEntryLine()
            {
                Date        = model.Date,
                Memo        = model.Memo,
                ReferenceNo = model.ReferenceNo,
            };

            _financialService.AddJournalEntry(journalEntry);
            return(RedirectToAction("JournalEntries"));
        }
        public ActionResult EditJournalEntry(AddJournalEntry model)
        {
            if (model.AddJournalEntryLines.Count < 2)
            {
                return(View(model));
            }

            var journalEntry = _financialService.GetJournalEntry(model.Id);

            journalEntry.Date        = model.Date;
            journalEntry.Memo        = model.Memo;
            journalEntry.ReferenceNo = model.ReferenceNo;

            _financialService.UpdateJournalEntry(journalEntry);

            return(RedirectToAction("JournalEntries"));
        }
        //public ActionResult AddJournalEntryLine(AddJournalEntry model)
        //{
        //    //if(model.AccountId != -1 && model.Amount > 0)
        //    if(model.Amount > 0)
        //    {
        //        //var rowId = Guid.NewGuid().ToString();
        //        model.AddJournalEntryLines.Add(new AddJournalEntryLine()
        //        {
        //            AccountId = model.AccountId,
        //            AccountName = _financialService.GetAccounts().Where(a => a.Id == model.AccountId).FirstOrDefault().AccountName,
        //            DrCr = model.DrCr,
        //            Amount = model.Amount,
        //            Memo = model.MemoLine
        //        });
        //    }
        //    return View(model);
        //}

        public ActionResult EditJournalEntry(int id)
        {
            // for now, use the same view model as add journal entry. nothing different
            var je = _financialService.GetJournalEntry(id);

            var model = new AddJournalEntry();

            model.Date        = je.Date;
            model.Memo        = je.Memo;
            model.ReferenceNo = je.ReferenceNo;
            model.Id          = je.Id;
            //model.JournalEntryId = je.Id;
            // model.Posted = je.Posted.HasValue ? je.Posted.Value : false;


            return(View(model));
        }
        public ActionResult AddJournalEntry(AddJournalEntry model)
        {
            JournalEntryLine journal = new JournalEntryLine()
            {
                AccountId     = model.AccountId,
                ReferenceNo   = model.ReferenceNo,
                DrCr          = model.DrCr,
                Date          = model.Date,
                Amount        = model.Amount,
                Memo          = model.Memo,
                SubCategoryId = model.SubCategoryId
            };

            _financialService.AddJournalEntry(journal);

            return(RedirectToAction("JournalEntries"));
        }
Exemplo n.º 10
0
            public bool Remove(T item)
            {
                if (_addJournal.Remove(AddJournalEntry <T> .CreateKey(item)))
                {
                    return(true);
                }

                var index = _items.IndexOf(item);

                if (index >= 0)
                {
                    UnsubscribeFromItemEvents(item);
                    _removeJournal.Add(index);
                    InvalidateCache();
                    return(true);
                }
                return(false);
            }
Exemplo n.º 11
0
        /// <summary>
        /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </summary>
        /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
        /// <returns>
        /// true if <paramref name="item"/> was successfully removed from the <see
        /// cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also
        /// returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </returns>
        public bool Remove(T item)
        {
            if (this._addJournal.Remove(AddJournalEntry.CreateKey(item)))
            {
                this.CollectionChanged.SafeInvoke(this, new CollectionChangedEventArgs <T>(false, item));
                return(true);
            }

            var index = this._items.IndexOf(item);

            if (index >= 0)
            {
                this.UnsubscribeFromItemEvents(item);
                this._removeJournal.Add(index);
                this.InvalidateCache();
                this.CollectionChanged.SafeInvoke(this, new CollectionChangedEventArgs <T>(false, item));
                return(true);
            }

            return(false);
        }
 public bool Equals(AddJournalEntry <T> other)
 {
     return(Item is IEquatable <T> equatable
         ? equatable.Equals(other.Item)
         : Equals(Item, other.Item));
 }
Exemplo n.º 13
0
        public ActionResult AddJournalEntry()
        {
            var model = new AddJournalEntry();

            return(View(model));
        }