1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections.Generic;
- using System.Linq;
- using InABox.Core;
- namespace Comal.Classes
- {
- [UserTracking(typeof(Quote))]
- public class KitFormula : Entity, IRemotable, IPersistent, ILicense<QuotesManagementLicense>
- {
- [EditorSequence(1)]
- [UniqueCodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
- public string Code { get; set; }
- [EditorSequence(2)]
- [TextBoxEditor]
- public string Description { get; set; }
-
- [EditorSequence(3)]
- [ExpressionEditor(null, typeof(KitFormulaExpressionGenerator))]
- public virtual string Formula { get; set; }
-
- private class KitFormulaExpressionGenerator : IExpressionModelGenerator
- {
- public List<string> GetVariables(object?[] items)
- {
- var dimensionUnits = items.Select(x => x as QuoteCostSheetItem).Where(x => x != null).Cast<QuoteCostSheetItem>();
- var variables = new List<string>();
- var props = CoreUtils.PropertyList(typeof(QuoteCostSheetItem), x => true, true);
- foreach (var prop in props.Keys)
- variables.Add(prop);
- return variables;
- }
- }
- public override string ToString()
- {
- return string.Format("{0}: {1}", Code, Description);
- }
-
- }
-
- }
|