Esempio n. 1
0
        public void OnEventHandler(ComboValueSelectedAggEvent e)
        {
            Transaction tempTransaction = new Transaction();
            string      catName         = tempTransaction.GetName(() => tempTransaction.Category);
            string      subName         = tempTransaction.GetName(() => tempTransaction.SubCategory);

            TransactionRowModel row = e.EditedObject as TransactionRowModel;


            if (e.PropertyName == catName)
            {
                row.Item.IsEdited = true;


                AggEventCategoriesNeeded eventCategories = new AggEventCategoriesNeeded();
                _eventAggregator.PublishEvent <AggEventCategoriesNeeded>(eventCategories);

                Category category = eventCategories.Categories.GetCategoryByName(e.NewValue);
                row.Item.Color = category.Color;

                SubCategory firstSubCategory = category.SubCategories.FirstOrDefault();
                if (firstSubCategory.IsNotNullObj())
                {
                    row.Item.SubCategory = firstSubCategory.Name;
                }
            }

            if (e.PropertyName == subName)
            {
                row.Item.IsEdited = true;
            }

            _grid.Refresh();
            _grid.Invalidate();
        }
Esempio n. 2
0
        protected override void OnCellFormatting(DataGridViewCellFormattingEventArgs e)
        {
            if (_grid == null)
            {
                return;
            }

            TransactionRowModel transactionRowNModel = _grid.Rows[e.RowIndex].DataBoundItem as TransactionRowModel;

            if (null == transactionRowNModel)
            {
                return;
            }

            if (transactionRowNModel.TransactionColor.HasValue)
            {
                e.CellStyle.BackColor = transactionRowNModel.TransactionColor.Value;
            }
        }
Esempio n. 3
0
        protected override object createRow(Transaction item)
        {
            var rowModel = new TransactionRowModel(item);

            return(rowModel);
        }