-
Notifications
You must be signed in to change notification settings - Fork 0
/
Views.cs
120 lines (101 loc) · 3.08 KB
/
Views.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flower_Space
{
public class Views
{
Dictionary<string, ViewofBloom> View = new Dictionary<string, ViewofBloom>();
string nl = Environment.NewLine;
public Views()
{
DataTable Views = BloomData.GetViews();
foreach ( DataRow row in Views.Rows)
{
ViewofBloom view = new ViewofBloom();
view._name = row.Field<string>(0);
view._description = row.Field<string>(1);
view._allocated = false;
view._allocatedTo = -1;
View.Add(view._name, view);
}
}
public bool AllocateBloomView(string ViewName, int ViewIndex)
{
foreach (ViewofBloom view in View.Values)
{
if ( view._name == ViewName)
{
if ( !view._allocated )
{
view._allocated = true;
view._allocatedTo = ViewIndex;
}
}
}
return false;
}
public List<string> GetAllocatedBloomView(int ViewerIndex)
{
List<string> views = new List<string>();
foreach (ViewofBloom view in View.Values)
{
if (view._allocatedTo == ViewerIndex)
{
views.Add(view._name);
}
}
return views;
}
public List<string> UnAllocatedBloomViews()
{
List<string> mylist = new List<string>();
foreach (ViewofBloom view in View.Values)
{
if ( !view._allocated) { mylist.Add(view._name); };
}
return mylist;
}
public void FillBloomViewComboBox(System.Windows.Forms.CheckedListBox BloomViewCheckedListBox)
{
foreach (ViewofBloom view in View.Values)
{
if (!view._allocated)
{ BloomViewCheckedListBox.Items.Add(view._name); }
}
}
public string getViewDescription(string PhotoViewName)
{
foreach (ViewofBloom view in View.Values)
{
if (view._name == PhotoViewName)
{
return view._description;
}
}
return "";
}
public string Report(int ViewerIndex)
{
string rpt = "Bloom viewes:";
foreach (ViewofBloom view in View.Values)
{
if (view._allocatedTo == ViewerIndex)
{
rpt = rpt + nl + view._name + nl + view._description + nl;
}
}
return rpt;
}
}
public class ViewofBloom
{
public string _name;
public string _description;
public bool _allocated;
public int _allocatedTo;
}
}