1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4:
5: namespace Ia.Ngn.Cl.Model.Ui
6: {
7: ////////////////////////////////////////////////////////////////////////////
8:
9: /// <summary publish="true">
10: /// Inventory For DataGridView support class for Optical Fiber Network (OFN) ui model.
11: /// </summary>
12: ///
13: /// <remarks>
14: /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
15: ///
16: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
17: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
18: ///
19: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
20: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21: ///
22: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
23: ///
24: /// Copyright notice: This notice may not be removed or altered from any source distribution.
25: /// </remarks>
26: public class InventoryForDataGridView
27: {
28: /// <summary/>
29: public int Id { get; set; }
30:
31: /// <summary/>
32: public string Name { get; set; }
33:
34: /// <summary/>
35: public string CompanyName { get; set; }
36:
37: /// <summary/>
38: public string Description { get; set; }
39:
40: /// <summary/>
41: public string BarCode { get; set; }
42:
43: /// <summary/>
44: public int Quantity { get; set; }
45:
46: /// <summary/>
47: public DateTime Created { get; set; }
48:
49: /// <summary/>
50: public DateTime Updated { get; set; }
51:
52: ////////////////////////////////////////////////////////////////////////////
53:
54: /// <summary>
55: ///
56: /// </summary>
57: public static List<Ia.Ngn.Cl.Model.Ui.InventoryForDataGridView> ReadUiList()
58: {
59: List<Ia.Ngn.Cl.Model.Ui.InventoryForDataGridView> inventoryForDataGridView;
60:
61: using (var db = new Ia.Ngn.Cl.Model.Ngn())
62: {
63: inventoryForDataGridView = (from i in db.Inventories select i).AsEnumerable().Select(q => new InventoryForDataGridView
64: {
65: Id = q.Id,
66: Name = q.Name,
67: CompanyName = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.VendorNameFromId(q.Company),
68: Description = q.Description,
69: BarCode = q.BarCode,
70: Quantity = q.Quantity,
71: Created = q.Created,
72: Updated = q.Updated
73: }).ToList();
74: }
75:
76: return inventoryForDataGridView;
77: }
78:
79: ////////////////////////////////////////////////////////////////////////////
80: ////////////////////////////////////////////////////////////////////////////
81: }
82:
83: ////////////////////////////////////////////////////////////////////////////
84: ////////////////////////////////////////////////////////////////////////////
85: }