123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System.Collections.Generic;
- using InABox.Core;
- namespace PRSDesktop.Integrations.V6;
- public class V6Variation : V6Object
- {
- [CodeEditor(Visible = Visible.Default)]
- [EditorSequence(1)]
- [RequiredColumn]
- public string ID { get; set; }
-
- [TextBoxEditor(Visible=Visible.Default)]
- [EditorSequence(2)]
- [RequiredColumn]
- public string Description { get; set; }
-
- [CurrencyEditor]
- [EditorSequence(3)]
- public double SellPrice {get; set; }
-
- public override void ValidateQuery(string sql, List<string> errors)
- {
- ValidateField(sql,nameof(ID), errors);
- ValidateField(sql, nameof(Description), errors);
- }
-
- public string GetReference()
- {
- var result = $"V6:{ID}";
- return result;
- }
- public static bool ParseReference(string? reference, out string variation)
- {
- variation = "";
- if (reference?.StartsWith("V6:") != true)
- return false;
- var comps = reference.Split(':');
- if (comps.Length < 2)
- return false;
- if (comps.Length > 1)
- variation = comps[1];
- return true;
- }
- public static string SQL = $@"
- select
- q.QUOTE_NUM_SUFF as {nameof(ID)},
- q.QUOTE_TITLE as {nameof(Description)},
- q.nett_sell_price + q.nett_sell_prc_lab as {nameof(SellPrice)}
- from
- Quote q
- where
- 1=1
- and
- coalesce(q.QUOTE_NUM_SUFF,'') <> ''
- ";
- }
|