// It shows a menu where is the list of all products on a table that can be selected for payment public ActionResult PayPartial(int?id, string order) { if (id != null) { try { // Finding the selected table is order to list the Sold Products on it ITableModel table = tableData.FindById((int)id); // Selection of the order of the list table.SoldProducts = MainMenuHelper.OrderListSoldProducts(table.SoldProducts, order); table.OrderSoldProducts = order; return(View(table)); } catch (Exception ex) { log.Error("Could't load tables from Database", ex); return(View("ErrorRetriveData")); } } else { log.Error("The table ID was null while trying to access"); return(View("ErrorTable")); } }
public FindForm(TableViewControlModel tableViewWf, ICompoundScrollableControl tableView) { InitializeComponent(); InitializeComponent2(); searchResultsTableView = new TableViewControlModel(null); tableView1.Client = searchResultsTableView; searchResultsTableView.origColumnHeaderHeight = 26; searchResultsTableView.HasHelp = true; searchResultsTableView.MultiSelect = true; searchResultsTableView.Sortable = true; searchResultsTableView.TableModel = null; this.tableViewWf = tableViewWf; this.tableView = tableView; tableModel = tableViewWf.TableModel; wildcardsComboBox.SelectedIndex = 0; wildcardsComboBox.Enabled = false; helpButton.Enabled = false; columnSelectButton.Enabled = false; lookInComboBox.Items.Add("Whole table"); for (int i = 0; i < tableModel.ColumnCount; i++) { lookInComboBox.Items.Add(tableModel.GetColumnName(i)); } lookInComboBox.Items.Add("Multiple columns"); lookInComboBox.SelectedIndex = 0; lookInComboBox.SelectedIndexChanged += LookInComboBoxSelectedIndexChanged; useCheckBox.Visible = false; wildcardsComboBox.Visible = false; helpButton.Visible = false; searchResultsTableView.SelectionChanged += SearchResultsTableSelectionChanged; expressionTextBox.TextChanged += (sender, args) => { searchRowIndView = -1; }; expressionTextBox.Focus(); expressionTextBox.SelectAll(); }
public FindForm(TableViewControlModel tableViewWf, ICompoundScrollableControl tableView) { InitializeComponent(); tableView1Wf = new TableViewControlModel(); tableView1.Client = tableView1Wf; tableView1Wf.origColumnHeaderHeight = 26; tableView1Wf.HasHelp = true; tableView1Wf.MultiSelect = true; tableView1Wf.Sortable = true; tableView1Wf.TableModel = null; this.tableViewWf = tableViewWf; this.tableView = tableView; tableModel = tableViewWf.TableModel; wildcardsComboBox.SelectedIndex = 0; wildcardsComboBox.Enabled = false; helpButton.Enabled = false; columnSelectButton.Enabled = false; lookInComboBox.Items.Add("Whole table"); for (int i = 0; i < tableModel.ColumnCount; i++){ lookInComboBox.Items.Add(tableModel.GetColumnName(i)); } lookInComboBox.Items.Add("Multiple columns"); lookInComboBox.SelectedIndex = 0; lookInComboBox.SelectedIndexChanged += LookInComboBoxSelectedIndexChanged; useCheckBox.Visible = false; wildcardsComboBox.Visible = false; helpButton.Visible = false; tableView1Wf.SelectionChanged += TableView1SelectionChanged; expressionTextBox.Focus(); expressionTextBox.SelectAll(); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { if (databaseContext == null) { throw new ArgumentNullException(nameof(databaseContext)); } if (StringContext == null) { throw new Exception($"The provided {nameof(StringContext)} is null"); } ITableModel table = databaseContext.Table; if (table == null) { throw new Exception($"The {nameof(TableModel)} is not set"); } string TrimedStringContext = TrimContextFromContextWrapper(StringContext); var autoGeneratedValueColumns = table.Columns.Where(m => m.IsAutoGeneratedValue).ToList(); var result = string.Join(string.Empty, autoGeneratedValueColumns.Select(currentColumn => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentColumn)))); return(result); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; if (table == null) { throw new Exception($"The {nameof(table)} is not set"); } if (table.Columns == null) { throw new Exception($"The {nameof(table.Columns)} are not set in {nameof(table)}"); } if (table.Columns.Any(m => m == null)) { throw new Exception($"There is a null reference in the {nameof(table.Columns)} from {nameof(table)}"); } string TrimedStringContext = TrimContextFromContextWrapper(StringContext); var indexedColumns = table.Columns.Where(m => m.IsIndexed); var eachIndexedcolumnResult = indexedColumns .Select(currentColumn => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentColumn))); var result = string.Join(string.Empty, eachIndexedcolumnResult); return(result); }
public ActionResult Create([Bind(Include = "ID,NumberOfTable,AreaID,Occupied")] TableModel table) { if (ModelState.IsValid) { try { // Checking if already exist a table with same number if (tableData.CheckIfAlreadyExist(table.NumberOfTable.ToString()) == false) { ITableModel model = table; tableData.Create(model); return(RedirectToAction("Index")); } else { log.Info("The user tried to add a table that already existed"); return(View("AlreadyExists")); } } catch (Exception ex) { log.Error("Could't create a new table in the Database", ex); return(View("ErrorRetriveData")); } } else { log.Error("The model state of the table is invalid"); return(View("WrongData")); } }
// Asks for confirmation in order to delete a table from the database public ActionResult Delete(int?id) { if (id != null) { try { ITableModel table = tableData.FindById((int)id); if (table == null) { log.Error("Could't find a table in the Database - return null"); return(View("ErrorDelete")); } if (table.SoldProducts.Count > 0) { log.Info("The user tried to delete a table that was opened"); return(View("OpenedTable")); } return(View(table)); } catch (Exception ex) { log.Error("Could't find a table in the Database", ex); return(View("ErrorRetriveData")); } } else { log.Error("The table ID was null while trying to delete"); return(View("ErrorDelete")); } }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { if (databaseContext == null) { throw new ArgumentNullException(nameof(databaseContext)); } if (StringContext == null) { throw new Exception($"The provided {nameof(StringContext)} is null"); } ITableModel table = databaseContext.Table; if (table == null) { throw new Exception($"The {nameof(TableModel)} is not set"); } string TrimedStringContext = TrimContextFromContextWrapper(StringContext); if (!(table?.Columns ?? new List <IColumnModel>()).Any(m => m.IsIndexed)) { return(String.Empty); } var result = TemplateHandler. HandleFunctionTemplate (TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, table)); return(result); }
// Menu where is a table with its products and available categories of products public ActionResult TableCategories(int?id, string order) { if (id != null) { try { // Joining list of categories and selected table to a single model mainPageModel.Categories = categoryData.GetAll().OrderBy(x => x.Name).ToList(); ITableModel table = tableData.FindById((int)id); if (table == null) { log.Error("Could't find a table in the Database - return null"); return(View("ErrorTable")); } // Selection of the order of the list table.SoldProducts = MainMenuHelper.OrderListSoldProducts(table.SoldProducts, order); mainPageModel.Tables.Add(table); } catch (Exception ex) { log.Error("Could't load categories or tables from Database", ex); return(View("ErrorRetriveData")); } return(View(mainPageModel)); } else { log.Error("The table ID was null while trying to access"); return(View("ErrorTable")); } }
// Menu where is a table with its products and available products do add a from selected category public ActionResult TableProducts(int?idTable, int?idCategory) { if (idCategory != null) { try { // Joining list of products and selected table to a single model ITableModel table = tableData.FindById((int)idTable); mainPageModel.Tables.Add(table); mainPageModel.Products = productData.GetBySubGroup((int)idCategory).OrderBy(x => x.Name).ToList(); } catch (Exception ex) { log.Error("Could't load products or tables from Database", ex); return(View("ErrorRetriveData")); } return(View(mainPageModel)); } else { log.Error("The category ID was null while trying to access"); return(View("ErrorCategory")); } }
public ActionResult PayPartial(int id, int[] Paid, string order) { if (Paid != null) { try { // Finding the sold products from the table that are selected to be paid List <ISoldProductModel> fullList = soldProductData.GetByTable(id); // Selection of the order of the list fullList = MainMenuHelper.OrderListSoldProducts(fullList, order); // Moving in the database the selected sold products to a table of all sold products accomplished MainMenuHelper.PaySelectedSoldProducts(fullList, Paid, soldProductData, soldProductAccomplishedData); //if the table is without any product set it to empty if (fullList.Count() < 1) { ITableModel table = tableData.FindById(id); table.Occupied = false; tableData.Update(table); } } catch (Exception ex) { log.Error("Could't load sold products or tables from Database", ex); return(View("ErrorRetriveData")); } } return(RedirectToAction("Tables")); }
internal void RegisterModel(ITableModel model) { lock (_models) { var r = new WeakReference(model); _models[(model as qxDotNet.Core.Object).clientId] = r; } }
// PUT: api/Tables/5 public void Put([FromBody] TableModel table) { if (ModelState.IsValid) { ITableModel model = table; tableData.Update(model); } }
void FillCache() { ITableModel model = Controller.Model; int sectionCount = model.GetSectionCount(); var newCellCache = new List <Cell>(); var newIsHeaderCache = new List <bool>(); var newNextIsHeaderCache = new List <bool>(); for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) { var sectionTitle = model.GetSectionTitle(sectionIndex); var sectionTextColor = model.GetSectionTextColor(sectionIndex); var sectionRowCount = model.GetRowCount(sectionIndex); if (!string.IsNullOrEmpty(sectionTitle)) { Cell headerCell = model.GetHeaderCell(sectionIndex); if (headerCell == null) { headerCell = new TextCell { Text = sectionTitle, TextColor = sectionTextColor } } ; headerCell.Parent = _view; newIsHeaderCache.Add(true); newNextIsHeaderCache.Add(sectionRowCount == 0 && sectionIndex < sectionCount - 1); newCellCache.Add(headerCell); } for (int i = 0; i < sectionRowCount; i++) { newIsHeaderCache.Add(false); newNextIsHeaderCache.Add(i == sectionRowCount - 1 && sectionIndex < sectionCount - 1); newCellCache.Add((Cell)model.GetItem(sectionIndex, i)); } } _cellCache = newCellCache.ToArray(); _isHeaderCache = newIsHeaderCache.ToArray(); _nextIsHeaderCache = newNextIsHeaderCache.ToArray(); } void InvalidateCellCache() { _cellCache = null; _isHeaderCache = null; _nextIsHeaderCache = null; } void OnModelChanged(object sender, EventArgs e) { InvalidateCellCache(); NotifyDataSetChanged(); }
public IDatabaseContext CopyWithOverride(IDatabaseContext copied, ITableModel table, IConstraintVisitorContext constraintVisitorContext) { return(new ProcessorDatabaseContext() { Table = table, ConstraintVisitorContext = constraintVisitorContext, Database = copied.Database, }); }
/// <inheritdoc /> public ISelectStatementBuilder WithTable(ITableModel tableModel) { if (_selectTables.Any((model) => model.TableName == tableModel.TableName)) { return(this); } tableModel.DatabaseProvider = DatabaseProvider; _selectTables.Add(tableModel); return(this); }
// POST: api/Tables public void Post([FromBody] TableModel table) { if (ModelState.IsValid) { if (tableData.CheckIfAlreadyExist(table.NumberOfTable.ToString()) == false) { ITableModel model = table; tableData.Create(model); } } }
internal MoveTableSelectionModel(ITableModel<Move> model) : base( (row, column) => { if(model.IndexInRange(row, column)) return model.DataAt(row, column) != null; return false; } ) { model.CheckNull("model"); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; string TrimedStringContext = TrimContextFromContextWrapper(StringContext); if (!TrimedStringContext.Equals("")) { throw new Exception($"There is a problem with the provided {nameof(StringContext)} :'{StringContext}' to the suited word '{Signature}'"); } return(table.Name); }
Cell GetCellForPosition(int position, out bool isHeader, out bool nextIsHeader) { isHeader = false; nextIsHeader = false; ITableModel model = Controller.Model; int sectionCount = model.GetSectionCount(); for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) { int size = model.GetRowCount(sectionIndex) + 1; if (position == 0) { isHeader = true; nextIsHeader = size == 0 && sectionIndex < sectionCount - 1; Cell header = model.GetHeaderCell(sectionIndex); Cell resultCell = null; if (header != null) { resultCell = header; } if (resultCell == null) { resultCell = new TextCell { Text = model.GetSectionTitle(sectionIndex) } } ; resultCell.Parent = _view; return(resultCell); } if (position < size) { nextIsHeader = position == size - 1; return((Cell)model.GetItem(sectionIndex, position - 1)); } position -= size; } return(null); } }
public TableViewSelectionAgentForm(ITableModel tableModel) { InitializeComponent(); cancelButton.Click += CancelButton_OnClick; okButton.Click += OkButton_OnClick; if (tableModel == null){ return; } foreach (ITableSelectionAgent agent in TableView.selectionAgents){ sourceBox.Items.Add(agent.Title); } for (int i = 0; i < tableModel.ColumnCount; i++){ columnBox.Items.Add(tableModel.GetColumnName(i)); } }
public PersistableTableModel ToPersistable(ITableModel converted) { var result = new PersistableTableModel(); result.Name = converted.Name; result.Schema = converted.Schema; if (converted.Columns != null) { result.Columns = converted.Columns.Select(ToPersistable).ToList(); } if (converted.ForeignKeyConstraints != null) { result.ForeignKeyConstraints = converted.ForeignKeyConstraints.Select(ToPersistable).ToList(); } return(result); }
protected override void HandleItemClick(AdapterView parent, AView nview, int position, long id) { ITableModel model = Controller.Model; if (position < 0 || position >= CellCache.Length) { return; } if (IsHeaderCache[position]) { return; } model.RowSelected(CellCache[position]); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; string TrimedStringContext = TrimContextFromContextWrapper(StringContext); var columns = table.Columns; if (columns == null) { throw new ArgumentException($"{table.Columns} are not set for {nameof(table)}"); } var notAutoGeneratedColumn = columns.Where(currentColumn => currentColumn.IsNotNull).ToList(); var result = string.Join(string.Empty, notAutoGeneratedColumn.Select(currentColumn => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentColumn)))); return(result); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; string TrimedStringContext = TrimContextFromContextWrapper(StringContext); if (!(table?.Columns ?? new List <IColumnModel>()).Any(m => m.IsAutoGeneratedValue)) { return(String.Empty); } var result = TemplateHandler. HandleFunctionTemplate (TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, table)); return(result); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; string trimedStringContext = TrimContextFromContextWrapper(StringContext); var constraints = table.ForeignKeyConstraints; if (constraints == null) { throw new ArgumentNullException(nameof(table.ForeignKeyConstraints)); } var result = string.Join(string.Empty, constraints.Select(constraint => TemplateHandler.HandleTemplate(trimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, constraint)))); return(result); }
public TableViewSelectionAgentForm(ITableModel tableModel) { InitializeComponent(); cancelButton.Click += CancelButton_OnClick; okButton.Click += OkButton_OnClick; if (tableModel == null) { return; } foreach (ITableSelectionAgent agent in TableView.selectionAgents) { sourceBox.Items.Add(agent.Title); } for (int i = 0; i < tableModel.ColumnCount; i++) { columnBox.Items.Add(tableModel.GetColumnName(i)); } }
public ActionResult TableAddProduct(int?idTable, int?idCategory, int?idProduct) { if (idProduct != null) { try { // Finding the selected product and the table where is going to be added ITableModel table = tableData.FindById((int)idTable); IProductModel product = productData.FindById((int)idProduct); if (product == null) { log.Error("Could't find a product in the Database - return null"); return(View("ErrorAddProduct")); } // Creates a SoldProductModel from a ProductModel that can be added to a list in each TableModel ISoldProductModel soldProduct = MappingObjects.ProductToSoldProduct(product, (int)idTable, tableData); soldProductData.Create(soldProduct); // Sets the current table as opened (Occupied by products) table.Occupied = true; tableData.Update(table); table.SoldProducts = soldProductData.GetByTable(table.ID); // Joins list of products and selected table to a single model mainPageModel.Products = productData.GetBySubGroup((int)idCategory).OrderBy(x => x.Name).ToList();; mainPageModel.Tables.Add(table); } catch (Exception ex) { log.Error("Could't load products, sold products or tables from Database", ex); return(View("ErrorRetriveData")); } return(View(mainPageModel)); } else { log.Error("The product ID was null while trying to access"); return(View("ErrorAddProduct")); } }
public override string HandleTrimedContext(string StringTrimedContext, IDatabaseContext databaseContext) { if (StringTrimedContext == null) { return(null); } if (databaseContext == null) { throw new ArgumentNullException(nameof(databaseContext)); } ITableModel table = databaseContext.Table; if (table == null) { return(StringTrimedContext); } return(TemplateHandler. HandleTemplate(StringTrimedContext, databaseContext)); }
private void MakeDependant(ITableModel depending, ITableModel dependence) { if (depending.ForeignKeyConstraints == null) { depending.ForeignKeyConstraints = new List <IForeignKeyConstraintModel>(); } depending.ForeignKeyConstraints.Add(new ForeignKeyConstraintModel() { Elements = new List <IForeignKeyConstraintElementModel>() { new ForeignKeyConstraintElementModel() { Foreign = new ColumnReferenceModel() { TableName = dependence.Name } } } }); }
public FindForm(TableView tableView) { InitializeComponent(); this.tableView = tableView; tableModel = tableView.TableModel; wildcardsComboBox.SelectedIndex = 0; wildcardsComboBox.Enabled = false; helpButton.Enabled = false; columnSelectButton.Enabled = false; lookInComboBox.Items.Add("Whole table"); for (int i = 0; i < tableModel.ColumnCount; i++) { lookInComboBox.Items.Add(tableModel.GetColumnName(i)); } lookInComboBox.Items.Add("Multiple columns"); lookInComboBox.SelectedIndex = 0; lookInComboBox.SelectedIndexChanged += LookInComboBoxSelectedIndexChanged; useCheckBox.Visible = false; wildcardsComboBox.Visible = false; helpButton.Visible = false; tableView1.SelectionChanged += TableView1SelectionChanged; }
public ActionResult PayAllConfirm(int id) { try { // Finding the sold products from the table that are confirmed as paid List <ISoldProductModel> sold = soldProductData.GetByTable(id); // Moving in the database the sold products to a table of all sold products accomplished MainMenuHelper.PaySoldProducts(sold, soldProductData, soldProductAccomplishedData); //Set the table to empty ITableModel table = tableData.FindById(id); table.Occupied = false; tableData.Update(table); } catch (Exception ex) { log.Error("Could't load sold products or tables from Database", ex); return(View("ErrorRetriveData")); } return(RedirectToAction("Tables")); }
protected override void HandleItemClick(AdapterView parent, AView nview, int position, long id) { ITableModel model = Controller.Model; int sectionCount = model.GetSectionCount(); for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) { if (position == 0) { return; } int size = model.GetRowCount(sectionIndex) + 1; if (position < size) { model.RowSelected(sectionIndex, position - 1); return; } position -= size; } }
public void SetVisibleRows(IList<int> rows) { model = new SubTableModel(origModel, rows.ToArray()); modelRowSel = new bool[model.RowCount]; order = ArrayUtils.ConsecutiveInts(model.RowCount); inverseOrder = ArrayUtils.ConsecutiveInts(model.RowCount); sortCol = -1; sortState = SortState.Unsorted; Invalidate(true); if (SelectionChanged != null){ SelectionChanged(this, new EventArgs()); } }
public FilterForm(TableView tableView) { InitializeComponent(); this.tableView = tableView; tableModel = tableView.TableModel; }
public SubTableModel(ITableModel baseModel, int[] rows, int[] columns) { this.baseModel = baseModel; this.rows = rows; this.columns = columns; }
public SubTableModel(ITableModel baseModel, int[] rows) : this(baseModel, rows, null) { }
public void RemoveUnselectedRows() { int[] x = GetSelectedRows(); model = new SubTableModel(model, x); modelRowSel = new bool[model.RowCount]; order = ArrayUtils.ConsecutiveInts(model.RowCount); inverseOrder = ArrayUtils.ConsecutiveInts(model.RowCount); sortCol = -1; sortState = SortState.Unsorted; VisibleY = 0; Invalidate(true); if (SelectionChanged != null){ SelectionChanged(this, new EventArgs()); } }
public void ShowAllRows() { model = origModel; modelRowSel = new bool[model.RowCount]; order = ArrayUtils.ConsecutiveInts(model.RowCount); inverseOrder = ArrayUtils.ConsecutiveInts(model.RowCount); sortCol = -1; sortState = SortState.Unsorted; Invalidate(true); if (SelectionChanged != null){ SelectionChanged(this, new EventArgs()); } }