1 Expiry | 2 Contract | 3 Status | 4 Last | 5 Open | 6 Bvol | 7 Bid | 8 RFQ | 9 Ask | 10 Avol | 11 High | 12 Low | 13 Time | 14 Vol | 15 Sett | 16 Lvol | 17 2nd Last | 18 3rd Last | 19 Opn Int | 20 Change |
The uses a Repository object in the view model, passed to the viewmodel as a list allowing foreach() in Razor. @foreach (var item in Model.DecoratedDisplayColumns) { <th width="@(item.Size)"><b>@(item.Title)</b> </th> } The ViewModel: public List<DecoratedDisplay> DecoratedDisplayColumns { get; set; } is populated in the Controller via a static class that calls a new member function: viewModel.DecoratedDisplayColumns = LookUp.GetDecoratedDisplay(); | |||||||||||||||||||
The object has a htmlString() function method to return in HTML a Table Row which requires @MvcHtmlString.Create() is used before Razor() rendering it. Syntax: @foreach (var item in Model.DecoratedDisplayColumns) { @( @MvcHtmlString.Create( item.htmlString() ) ); } | |||||||||||||||||||
exp | Expiry | #ffffff | #000000 | 30 | |||||||||||||||
cnt | Contract | #ffffff | #000000 | 30 | |||||||||||||||
mkt | Status | #ffffff | #000000 | 16 | |||||||||||||||
lst | Last | #ffffff | #000000 | 16 | |||||||||||||||
opn | Open | #ffffff | #000000 | 30 | |||||||||||||||
BL | Bvol | #ffffff | #000000 | 30 | |||||||||||||||
BP | Bid | #a7ccf6 | #000000 | 30 | |||||||||||||||
rfq | RFQ | #ffffff | #000000 | 30 | |||||||||||||||
SP | Ask | #f5beaa | #000000 | 30 | |||||||||||||||
SL | Avol | #ffffff | #000000 | 30 | |||||||||||||||
hgh | High | #ffffff | #000000 | 30 | |||||||||||||||
low | Low | #ffffff | #000000 | 30 | |||||||||||||||
tme | Time | #ffffff | #000000 | 30 | |||||||||||||||
vol | Vol | #ffffff | #000000 | 30 | |||||||||||||||
set | Sett | #ffffff | #000000 | 30 | |||||||||||||||
lvl | Lvol | #ffffff | #000000 | 30 | |||||||||||||||
slt | 2nd Last | #ffffff | #000000 | 30 | |||||||||||||||
tlt | 3rd Last | #ffffff | #000000 | 30 | |||||||||||||||
oin | Opn Int | #ffffff | #000000 | 40 | |||||||||||||||
chg | Change | #ffffff | #000000 | 30 | |||||||||||||||
Now the more powerful repository object <WebMarketDisplay> with internal ArrayList and Hashtable support has a fetch(n). Syntax: @for (var i = 20 ; i > 0 ; i--) { @( @MvcHtmlString.Create( Model.WMDColumns.fetch(i).htmlString() ) ); } | |||||||||||||||||||
chg | Change | #ffffff | #000000 | 30 | |||||||||||||||
vol | Volume | #ffffff | #000000 | 30 | |||||||||||||||
oin | Opn Int | #ffffff | #000000 | 40 | |||||||||||||||
set | Settle | #ffffff | #000000 | 30 | |||||||||||||||
opn | Open | #ffffff | #000000 | 30 | |||||||||||||||
tlt | 3rd Last | #ffffff | #000000 | 30 | |||||||||||||||
slt | 2nd Last | #ffffff | #000000 | 30 | |||||||||||||||
low | Lowest | #ffffff | #000000 | 30 | |||||||||||||||
hgh | Highest | #ffffff | #000000 | 30 | |||||||||||||||
SL | Avol | #ffffff | #000000 | 30 | |||||||||||||||
SP | Ask | #f5beaa | #000000 | 30 | |||||||||||||||
rfq | RFQ | #ffffff | #000000 | 30 | |||||||||||||||
BP | Bid | #a7ccf6 | #000000 | 30 | |||||||||||||||
BL | Bvol | #ffffff | #000000 | 30 | |||||||||||||||
tme | Time | #ffffff | #000000 | 30 | |||||||||||||||
lvl | Lvol | #ffffff | #000000 | 30 | |||||||||||||||
lst | Last | #ffffff | #000000 | 12 | |||||||||||||||
mkt | Status | #ffffff | #000000 | 12 | |||||||||||||||
cnt | Contract | #ffffff | #000000 | 60 | |||||||||||||||
exp | Expiry | #ffffff | #000000 | 30 | |||||||||||||||
Output Object 10 By Attribute Name, using this style of Syntax: @( @MvcHtmlString.Create(Model.WMDColumns.fetch(10).Title ) ) | @( @MvcHtmlString.Create(Model.WMDColumns.fetch(10).Color ) ) 10 | SP | Ask | #f5beaa | #000000 | 30 |
WMDColumns: DecoratedDisplayColumns:
jQueryBound WMDColumns: This [Title] Select has defaulted to #4 in its list, its on change handler is in jQuery.
jQueryBound WMDColumns: This [Color] Select has defaulted to #14 in its list, its on change handler is in jQuery.
Below is Data From Stored Proceedure
CREATE PROCEDURE [dbo].[TSI_Calendar_Query] AS BEGIN SELECT D_Contract.ContractNo AS D_Contract_ContractNo, D_Contract.ContractType, D_Contract.CONTRACT, D_Contract.Title AS D_Contract_Title, D_ContractType.IDN, D_ContractType.Title AS D_ContractType_Title, D_ContractType.ICODE, D_Calendar.Yieldpoint AS D_Calendar_Yieldpoint, D_Calendar.deliveryMonth, D_Calendar.Mnemonic, D_Calendar.monthCode, D_Calendar.Expires, D_Curve.ContractNo AS D_Curve_ContractNo, D_Curve.Yieldpoint AS D_Curve_Yieldpoint FROM (D_Contract INNER JOIN D_ContractType ON D_Contract.ContractType = D_ContractType.IDN) INNER JOIN (D_Calendar INNER JOIN D_Curve ON D_Calendar.Yieldpoint = D_Curve.Yieldpoint) ON D_Contract.ContractNo = D_Curve.ContractNo Order By D_Contract.ContractNo, D_Calendar.deliveryMonth; END
ContractNo | ContractType | Contract | IDN | InstrumentCODE | YieldPt | Month | Mnemonic | monthCode | Expires | CurveContract | CurveYieldPt |
1 | 2 | HO | 2 | FP---EMM | 1 | 20130315 | Mar13 | H3 | 3/15/2013 12:00:00 AM | 1 | 1 |
1 | 2 | HO | 2 | FP---EMM | 2 | 20130415 | Apr13 | J3 | 4/15/2013 12:00:00 AM | 1 | 2 |
1 | 2 | HO | 2 | FP---EMM | 3 | 20130515 | May13 | K3 | 5/15/2013 12:00:00 AM | 1 | 3 |
1 | 2 | HO | 2 | FP---EMM | 5 | 20130715 | Jul13 | N3 | 7/15/2013 12:00:00 AM | 1 | 5 |
1 | 2 | HO | 2 | FP---EMM | 6 | 20130815 | Aug13 | Q3 | 8/15/2013 12:00:00 AM | 1 | 6 |
1 | 2 | HO | 2 | FP---EMM | 7 | 20130915 | Sep13 | U3 | 9/15/2013 12:00:00 AM | 1 | 7 |
1 | 2 | HO | 2 | FP---EMM | 8 | 20131015 | Oct13 | V3 | 10/15/2013 12:00:00 AM | 1 | 8 |
1 | 2 | HO | 2 | FP---EMM | 9 | 20131115 | Nov13 | X3 | 11/15/2013 12:00:00 AM | 1 | 9 |
1 | 2 | HO | 2 | FP---EMM | 10 | 20131215 | Dec13 | Z3 | 12/15/2013 12:00:00 AM | 1 | 10 |
1 | 2 | HO | 2 | FP---EMM | 11 | 20140115 | Jan14 | F4 | 1/15/2014 12:00:00 AM | 1 | 11 |
1 | 2 | HO | 2 | FP---EMM | 12 | 20140215 | Feb14 | G4 | 2/15/2014 12:00:00 AM | 1 | 12 |
1 | 2 | HO | 2 | FP---EMM | 13 | 20140315 | Mar14 | H4 | 3/15/2014 12:00:00 AM | 1 | 13 |
1 | 2 | HO | 2 | FP---EMM | 14 | 20150315 | Mar15 | H5 | 3/15/2015 12:00:00 AM | 1 | 14 |
1 | 2 | HO | 2 | FP---EMM | 15 | 20160315 | Mar16 | H6 | 3/15/2016 12:00:00 AM | 1 | 15 |
1 | 2 | HO | 2 | FP---EMM | 16 | 20170315 | Mar17 | H7 | 3/15/2017 12:00:00 AM | 1 | 16 |
1 | 2 | HO | 2 | FP---EMM | 17 | 20180315 | Mar18 | H8 | 3/15/2018 12:00:00 AM | 1 | 17 |
3 | 2 | CL | 2 | FP---EMM | 1 | 20130315 | Mar13 | H3 | 3/15/2013 12:00:00 AM | 3 | 1 |
3 | 2 | CL | 2 | FP---EMM | 2 | 20130415 | Apr13 | J3 | 4/15/2013 12:00:00 AM | 3 | 2 |
3 | 2 | CL | 2 | FP---EMM | 3 | 20130515 | May13 | K3 | 5/15/2013 12:00:00 AM | 3 | 3 |
3 | 2 | CL | 2 | FP---EMM | 5 | 20130715 | Jul13 | N3 | 7/15/2013 12:00:00 AM | 3 | 5 |
3 | 2 | CL | 2 | FP---EMM | 6 | 20130815 | Aug13 | Q3 | 8/15/2013 12:00:00 AM | 3 | 6 |
3 | 2 | CL | 2 | FP---EMM | 7 | 20130915 | Sep13 | U3 | 9/15/2013 12:00:00 AM | 3 | 7 |
3 | 2 | CL | 2 | FP---EMM | 8 | 20131015 | Oct13 | V3 | 10/15/2013 12:00:00 AM | 3 | 8 |
3 | 2 | CL | 2 | FP---EMM | 9 | 20131115 | Nov13 | X3 | 11/15/2013 12:00:00 AM | 3 | 9 |
3 | 2 | CL | 2 | FP---EMM | 10 | 20131215 | Dec13 | Z3 | 12/15/2013 12:00:00 AM | 3 | 10 |
3 | 2 | CL | 2 | FP---EMM | 11 | 20140115 | Jan14 | F4 | 1/15/2014 12:00:00 AM | 3 | 11 |
3 | 2 | CL | 2 | FP---EMM | 12 | 20140215 | Feb14 | G4 | 2/15/2014 12:00:00 AM | 3 | 12 |
3 | 2 | CL | 2 | FP---EMM | 13 | 20140315 | Mar14 | H4 | 3/15/2014 12:00:00 AM | 3 | 13 |
3 | 2 | CL | 2 | FP---EMM | 14 | 20150315 | Mar15 | H5 | 3/15/2015 12:00:00 AM | 3 | 14 |
3 | 2 | CL | 2 | FP---EMM | 15 | 20160315 | Mar16 | H6 | 3/15/2016 12:00:00 AM | 3 | 15 |
3 | 2 | CL | 2 | FP---EMM | 16 | 20170315 | Mar17 | H7 | 3/15/2017 12:00:00 AM | 3 | 16 |
3 | 2 | CL | 2 | FP---EMM | 17 | 20180315 | Mar18 | H8 | 3/15/2018 12:00:00 AM | 3 | 17 |
Above is Data Using DecoratedController.cs public ActionResult Details(int id = 0)
ID | KeyName | Flag | Amount | Number | Birthday |
---|---|---|---|---|---|
4 | fred here | e | 1.00 | 11324 | 10-Nov-1989 |
5 | 4526 | Q | 62.00 | 3146 | 28-May-1932 |
7 | 6611 | s | 5.00 | 12 | 11-Jun-1973 |
9 | minus | g | 12.10 | 6666 | 13-Aug-1967 |
10 | nn | g | 123.45 | 654321 | 16-Sep-1968 |
11 | gg | f | 0.12 | 12345 | 20-Aug-1965 |
12 | minus | x | 5.00 | 5 | 20-Apr-1958 |
13 | Darren | M | 12.00 | 12 | 20-Dec-1960 |
14 | hjk | f | 4.00 | 5 | 18-Sep-2015 |
15 | ret | M | 4.00 | 4 | 02-Sep-2015 |
16 | ert | t | 5.00 | 56 | 20-Sep-2015 |
17 | a | f | 1.00 | 2 | 04-Jan-2016 |
18 | 3190 | w | 5.00 | 43 | 13-Feb-2016 |
19 | abc | f | 123.00 | 12 | 02-Feb-2016 |
20 | Peter | f | 655.00 | 65554 | 07-Mar-2016 |
21 | try65yrty | i | 65.00 | 123445 | 08-Mar-2016 |
22 | 3258 | h | 3.00 | 1234 | 14-Mar-2016 |
24 | ghghgh | h | 5456.00 | 5545 | 10-Oct-2017 |
25 | Roger | X | 123.34 | 1234 | 31-Dec-2017 |
26 | Jude | g | 0.00 | 0 | 20-Apr-2019 |
27 | 0.00 | 0 | 11-Oct-2022 |
Above is a selection from Holding Table joined to the Gift Table.