protected override void InitializeGrid() { base.InitializeGrid(); ColumnController cc = new ColumnController(); CellTextNumber ctn = new CellTextNumber("Id") { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; cc.Add(new Column(Translator.GetString("Number"), ctn, 0.1, "Id") { MinWidth = 90 }); cc.Add(new Column(Translator.GetString("Name"), "Name", 1, "Name") { MinWidth = 100 }); grid.ColumnController = cc; btnGroups.Visible = false; btnGroups.Active = false; btnGroups_Toggled(null, null); }
protected virtual void AddNumberColumn(ColumnController cc) { CellTextNumber ctn = new CellTextNumber("Id") { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; cc.Add(new Column(Translator.GetString("Number"), ctn, 0.1, "Id") { MinWidth = 90 }); }
private void InitializeDocumentNumbersGrid() { ColumnController columnController = new ColumnController(); CellTextLookup <OperationType> cellOperationType = new CellTextLookup <OperationType> ("OperationType") { Lookup = Enum.GetValues(typeof(OperationType)) .Cast <OperationType> () .Where(operationType => operationType > 0) .ToDictionary(k => k, Translator.GetOperationTypeGlobalName) }; columnController.Add(new Column(Translator.GetString("Operation"), cellOperationType, 1)); CellTextNumber cellNum = new CellTextNumber("StartNumber") { IsEditable = true, FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; Column colStart = new Column(Translator.GetString("Start number"), cellNum, 0.1) { MinWidth = 110 }; colStart.ButtonPressEvent += ColumnDocumentNumber_ButtonPressEvent; colStart.KeyPressEvent += ColumnDocumentNumber_KeyPressEvent; columnController.Add(colStart); columnController.Add(new Column(Translator.GetString("Used numbers"), new CellProgress("UsageDescription", "Usage"), 0.1) { MinWidth = 180 }); gridDocumentNumbers = new ListView { Name = "gridDocumentNumbers", ColumnController = columnController, WidthRequest = 400, AllowMultipleSelect = false, CellsFucusable = true, RulesHint = true }; scwDocumentNumbers.Add(gridDocumentNumbers); gridDocumentNumbers.Show(); }
protected override void InitializeGrid() { base.InitializeGrid(); grid.HeightRequest = 300; grid.WidthRequest = 500; GetEntities(); grid.Model = entities; ColumnController columnController = new ColumnController(); CellTextNumber cellTextNumber = new CellTextNumber("Id") { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; string documentNumber = Translator.GetString("Payment No."); columnController.Add(new Column(documentNumber, cellTextNumber, 1, cellTextNumber.PropertyName) { MinWidth = 70 }); string partner = Translator.GetString("Partner"); columnController.Add(new Column(partner, "PartnerName", 2, "PartnerName") { MinWidth = 100 }); CellTextCurrency cellTextDouble = new CellTextCurrency("Quantity"); string balance = Translator.GetString("Balance"); columnController.Add(new Column(balance, cellTextDouble, 1, cellTextDouble.PropertyName) { MinWidth = 70 }); grid.ColumnController = columnController; }
protected override void InitializeGrid() { base.InitializeGrid(); grid.WidthRequest = 620; grid.HeightRequest = 300; ColumnController columnController = new ColumnController(); CellTextNumber cellTextNumber = new CellTextNumber("OperationId") { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; string documentNumber = Translator.GetString("Document No."); columnController.Add(new Column(documentNumber, cellTextNumber, 1, cellTextNumber.PropertyName) { MinWidth = 70 }); CellTextLookup <int> cellOperation = new CellTextLookup <int> ("OperationType"); foreach (OperationType operationType in Enum.GetValues(typeof(OperationType))) { if (operationType > 0) { cellOperation.Lookup.Add((int)operationType, Translator.GetOperationTypeGlobalName(operationType)); } } string operation = Translator.GetString("Operation"); columnController.Add(new Column(operation, cellOperation, 1, cellOperation.PropertyName) { MinWidth = 70 }); string partner = Translator.GetString("Partner"); columnController.Add(new Column(partner, "PartnerName", 2, "PartnerName") { MinWidth = 100 }); string location = Translator.GetString("Location"); columnController.Add(new Column(location, "LocationName", 2, "LocationName") { MinWidth = 100 }); CellTextCurrency cellTextDouble = new CellTextCurrency("Quantity"); string balance = Translator.GetString("Balance"); columnController.Add(new Column(balance, cellTextDouble, 1, cellTextDouble.PropertyName) { MinWidth = 70 }); grid.ColumnController = columnController; }
private void InitializeGrid() { try { if (initialized) { return; } ColumnController cc = new ColumnController(); supportsSumming = false; for (int i = 0; i < dataQueryResult.Result.Columns.Count; i++) { DbField field = dataQueryResult.Columns [i].Field; DataType fieldType = ReportProvider.GetDataFieldType(field); string columnName = dataQueryResult.Result.Columns [i]; string columnHeaderText = ReportProvider.GetReportFieldColumnName(dataQueryResult, i); CellText cell; bool thisColumnSummable = false; switch (fieldType) { case DataType.Date: cell = new CellTextDate(columnName); break; case DataType.DateTime: cell = new CellTextDateTime(columnName); break; case DataType.Quantity: cell = new CellTextQuantity(columnName); thisColumnSummable = true; break; case DataType.CurrencyIn: cell = new CellTextCurrency(columnName, PriceType.Purchase); thisColumnSummable = true; break; case DataType.CurrencyOut: cell = new CellTextCurrency(columnName); thisColumnSummable = true; break; case DataType.Currency: cell = new CellTextCurrency(columnName, PriceType.Unknown); thisColumnSummable = true; break; case DataType.Percent: cell = new CellTextDouble(columnName) { FixedFaction = BusinessDomain.AppConfiguration.PercentPrecision }; break; case DataType.Id: case DataType.UserId: cell = new CellTextNumber(columnName); break; case DataType.DocumentNumber: cell = new CellTextNumber(columnName) { FixedDigits = BusinessDomain.AppConfiguration.DocumentNumberLength }; break; case DataType.OperationType: cell = new CellTextLookup <int> (columnName); CellTextLookup <int> cellOperationType = (CellTextLookup <int>)cell; foreach (OperationType operationType in Enum.GetValues(typeof(OperationType))) { if (operationType > 0) { cellOperationType.Lookup.Add((int)operationType, Translator.GetOperationTypeName(operationType)); } } break; case DataType.DocumentType: cell = new CellTextLookup <int> (columnName).Load(DocumentBase.GetAllDocumentTypes()); break; case DataType.BasePaymentType: cell = new CellTextLookup <int> (columnName).Load(PaymentType.GetAllBaseTypePairs()); break; case DataType.PaymentType: cell = new CellTextLookup <long> (columnName); CellTextLookup <long> cellPaymentType = (CellTextLookup <long>)cell; foreach (PaymentType paymentType in PaymentType.GetAll()) { cellPaymentType.Lookup.Add(paymentType.Id, paymentType.Name); } break; case DataType.PriceGroupType: cell = new CellTextLookup <int> (columnName).Load(Currency.GetAllPriceGroups()); break; case DataType.PartnerType: cell = new CellTextLookup <int> (columnName).Load(Partner.GetAllTypes()); break; case DataType.ItemType: cell = new CellTextLookup <int> (columnName).Load(Item.GetAllTypes()); break; case DataType.UserAccessLevel: cell = new CellTextLookup <int> (columnName).Load(User.GetAllAccessLevels()); break; case DataType.TurnoverType: cell = new CellTextLookup <int> (columnName).Load(CashBookEntry.GetAllTurnoverTypes()); break; case DataType.TurnoverDirection: cell = new CellTextLookup <int> (columnName).Load(CashBookEntry.GetAllTurnoverDirections()); break; case DataType.TaxGroupCode: cell = new CellTextLookup <string> (columnName).Load(VATGroup.AllCodes); break; case DataType.Sign: cell = new CellTextLookup <int> (columnName).Load(Payment.GetAllSignTypes()); break; case DataType.PaymentMode: cell = new CellTextLookup <int> (columnName).Load(Payment.GetAllModeTypes()); break; case DataType.Text: cell = new CellText(columnName); break; default: continue; } Column col = new Column(columnHeaderText, cell, 0.1, columnName) { MinWidth = 100, Visible = !skip.Contains(field) && CheckColumnVisible(dataQueryResult, i) }; cc.Add(col); supportsSumming |= thisColumnSummable && col.Visible; } grid.ColumnController = cc; // Prevent the grid from reapplying the old sort grid.Model = null; grid.Model = model; grid.AllowSelect = true; grid.AllowMultipleSelect = true; grid.CellsFucusable = true; grid.RulesHint = true; grid.SortColumnsHint = true; grid.RowActivated -= grid_RowActivated; grid.RowActivated += grid_RowActivated; initialized = true; } finally { EventHandler onInitialized = Initialized; if (onInitialized != null) { onInitialized(this, EventArgs.Empty); } } }