Example #1
0
        public static bool IsVisiableColumn(this CellModel cellModel, TableEditorModel tableEditorModel, int colIndex)
        {
            if (colIndex == CellModel.LatitudeColumnIndex || colIndex == CellModel.LongitudeColumnIndex) // lat, long col always invisible
            {
                return(false);
            }
            switch (colIndex)
            {
            case CellModel.LocationTitleColumnIndex:
                return(tableEditorModel.ShowLocationTitle);

            case CellModel.AddressColumnIndex:
                return(tableEditorModel.ShowAddress);

            case CellModel.PhonenNumberColumnIndex:
                return(tableEditorModel.ShowPhoneNumber);

            case CellModel.EmailColumnIndex:
                return(tableEditorModel.ShowEmail);

            case CellModel.WebsiteColumnIndex:
                return(tableEditorModel.ShowWebsite);
            }
            return(true);
        }
Example #2
0
        private TableEditorModel GetTableModel(IEnumerable <ProfileManagementModel> profiles, ProfileManagementModel profile)
        {
            var entityType = typeof(ProfileManagementModel);

            var tableModel = new TableEditorModel("Profiles", entityType, "Id", profiles, profile);

            _tableEditorService.AddColumn(tableModel, "Id", null);
            _tableEditorService.AddColumn(tableModel, "Name", null, ControlType.Input, null);

            return(tableModel);
        }
Example #3
0
        private TableEditorModel GetTableModel(IEnumerable <StockManagementModel> stocks, StockManagementModel stock)
        {
            var entityType = typeof(StockManagementModel);

            var tableModel = new TableEditorModel("Stocks", entityType, "Id", stocks, stock);

            _tableEditorService.AddColumn(tableModel, "Id", null);
            _tableEditorService.AddColumn(tableModel, "Name", null, ControlType.Input, null);

            return(tableModel);
        }
Example #4
0
        private TableEditorModel GetAccountTableModel(IEnumerable <AccountManagementModel> accounts, AccountManagementModel account)
        {
            var entityType = typeof(AccountManagementModel);

            var tableModel = new TableEditorModel("Accounts", entityType, "Id", accounts, account);
            var profiles   = _profileManagementService.GetProfiles().OrderBy(p => p.Name);

            _tableEditorService.AddColumn(tableModel, "Id", null);
            _tableEditorService.AddColumn(tableModel, "Name", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "ProfileId", null, ControlType.Select, new SelectList(profiles, "Id", "Name"));

            return(tableModel);
        }
        private TableEditorModel GetTableModel(IEnumerable <CurrencyManagementModel> currencies, CurrencyManagementModel currency)
        {
            var entityType = typeof(CurrencyManagementModel);

            var tableModel = new TableEditorModel("Currencies", entityType, "Id", currencies, currency);

            var stocks = _stockManagementService.GetStocks().OrderBy(s => s.Name);

            _tableEditorService.AddColumn(tableModel, "Id", null);
            _tableEditorService.AddColumn(tableModel, "Name", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "StockId", null, ControlType.Select, new SelectList(stocks, "Id", "Name"));

            return(tableModel);
        }
        public TablePanelViewModel Get(TableEditorModel model)
        {
            var table = model.Map <TableEditorViewModel>();

            var rows = CollectRows(model.Cells);

            table.Cells = _tableCellBuilder.Map(rows, model.MakeFirstColumnBold);

            var result = new TablePanelViewModel
            {
                Table = table
            };

            return(result);
        }
        private TableEditorModel GetExchangeTableModel(IEnumerable <CurrencyExchangeRateManagementModel> currencyExchanges, CurrencyExchangeRateManagementModel currencyExchange, string currentCurrencyName)
        {
            var entityType = typeof(CurrencyExchangeRateManagementModel);

            var tableModel = new TableEditorModel(currentCurrencyName, entityType, "CurrencyPairId", currencyExchanges, currencyExchange);

            var currencies = _currencyManagementService.GetCurrencies().Where(c => c.Name != currentCurrencyName).OrderBy(s => s.Name);

            _tableEditorService.AddColumn(tableModel, "CurrencyId", null);
            _tableEditorService.AddColumn(tableModel, "CurrencyPairId", null, ControlType.Select, new SelectList(currencies, "Id", "Name"));
            _tableEditorService.AddColumn(tableModel, "Buy", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "Sell", null, ControlType.Input, null);

            return(tableModel);
        }
        private TableEditorModel GetTableModel(IEnumerable <ResourceManagementModel> entities, ResourceManagementModel entity)
        {
            var entityType = typeof(ResourceManagementModel);

            var tableModel = new TableEditorModel("Resources", entityType, "Id", entities, entity);

            var stocks = _resourceManagementService.GetStocks().OrderBy(s => s.Name);

            _tableEditorService.AddColumn(tableModel, "Id", null);
            _tableEditorService.AddColumn(tableModel, "Name", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "PriceBase", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "Price", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "Performance", null, ControlType.Input, null);
            _tableEditorService.AddColumn(tableModel, "StockId", null, ControlType.Select, new SelectList(stocks, "Id", "Name"));

            return(tableModel);
        }
        public ManagementTableViewModel(
            TableEditorModel table,
            string createActionName,
            string editActionName,
            string deleteActionName,
            IDictionary <string, string> createRouteValues = null,
            IDictionary <string, string> editRouteValues   = null,
            IDictionary <string, string> deleteRouteValues = null)
        {
            Table            = table;
            CreateActionName = createActionName;
            EditActionName   = editActionName;
            DeleteActionName = deleteActionName;

            CreateRouteValues = createRouteValues;
            EditRouteValues   = editRouteValues;
            DeleteRouteValues = deleteRouteValues;
        }
        public void AddColumn(TableEditorModel table, string propertyName, string name, ControlType controlType, SelectList selectListItems)
        {
            var validationAttributes = GetValidationAttributes(table.EntityType, propertyName);

            table.AddColumn(propertyName, name, controlType, validationAttributes, selectListItems);
        }
 public void AddColumn(TableEditorModel table, string propertyName, string name)
 {
     table.AddColumn(propertyName, name);
 }
Example #12
0
        public virtual ActionResult Render(TableEditorModel tableEditorModel)
        {
            var result = _tablePanelPresentationBuilder.Get(tableEditorModel);

            return(PartialView(ViewPath, result));
        }