Skip to content

Commit c1ce8a3

Browse files
author
Jayson Ragasa
committed
more cleanup
1 parent e020402 commit c1ce8a3

File tree

10 files changed

+29
-78
lines changed

10 files changed

+29
-78
lines changed

Database/Database.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using System;
22
using System.Configuration;
3-
using System.Collections.Generic;
43
using System.Data;
54
using System.Data.SQLite;
6-
using System.Text;
75

86
namespace Database
97
{

Database/Database.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<ItemGroup>
7575
<Compile Include="Database.cs" />
7676
<Compile Include="Groups.cs" />
77+
<Compile Include="Models\Model_GroupDetails.cs" />
7778
<Compile Include="Models\Model_ServerDetails.cs" />
7879
<Compile Include="Properties\AssemblyInfo.cs" />
7980
<Compile Include="RijndaelHelper.cs" />

Database/Groups.cs

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,10 @@
1-
using System;
1+
using Database.Models;
2+
using System;
23
using System.Collections;
3-
using System.Collections.Generic;
4-
using System.Data;
54
using System.Data.SQLite;
6-
using System.Text;
75

86
namespace Database
97
{
10-
public class GroupDetails
11-
{
12-
int _groupID = 0;
13-
string _group_name = string.Empty;
14-
int _serverCount = 0;
15-
16-
public GroupDetails()
17-
{
18-
}
19-
20-
public int GroupID
21-
{
22-
set
23-
{
24-
this._groupID = value;
25-
}
26-
get
27-
{
28-
return this._groupID;
29-
}
30-
}
31-
32-
public string GroupName
33-
{
34-
set
35-
{
36-
this._group_name = value;
37-
}
38-
get
39-
{
40-
return this._group_name;
41-
}
42-
}
43-
44-
public int ServerCount
45-
{
46-
set
47-
{
48-
this._serverCount = value;
49-
}
50-
get
51-
{
52-
return this._serverCount;
53-
}
54-
}
55-
}
56-
578
public class Groups : Database
589
{
5910
ArrayList _alGroups = new ArrayList();
@@ -83,7 +34,7 @@ public void Read()
8334
{
8435
while (reader.Read())
8536
{
86-
GroupDetails gd = new GroupDetails();
37+
Model_GroupDetails gd = new Model_GroupDetails();
8738
gd.GroupID = int.Parse(reader["groupid"].ToString());
8839
gd.GroupName = reader["group_name"].ToString();
8940

@@ -100,7 +51,7 @@ public void Read()
10051
CloseConnection();
10152
}
10253

103-
public void Save(bool isNew, GroupDetails group_details)
54+
public void Save(bool isNew, Model_GroupDetails group_details)
10455
{
10556
if (isNew)
10657
{
@@ -112,7 +63,7 @@ public void Save(bool isNew, GroupDetails group_details)
11263
}
11364
}
11465

115-
private void Save(GroupDetails group_details)
66+
private void Save(Model_GroupDetails group_details)
11667
{
11768
string sql = "INSERT INTO Groups(groupid, group_name) VALUES((select count(Groups.groupid) from groups) + 1, @gname);";
11869
SQLiteParameter[] parameters = {
@@ -142,7 +93,7 @@ private void Save(GroupDetails group_details)
14293
CloseConnection();
14394
}
14495

145-
private void Update(GroupDetails group_details)
96+
private void Update(Model_GroupDetails group_details)
14697
{
14798
string sql = "UPDATE Groups SET groupid = @gid, group_name = @gname WHERE groupid = @gid";
14899
SQLiteParameter[] parameters = {
@@ -264,7 +215,7 @@ public void GetGroupsWithServerCount()
264215

265216
while (reader.Read())
266217
{
267-
GroupDetails gd = new GroupDetails();
218+
Model_GroupDetails gd = new Model_GroupDetails();
268219
gd.GroupID = int.Parse(reader["groupid"].ToString());
269220
gd.GroupName = reader["group_name"].ToString();
270221
gd.ServerCount = int.Parse(reader["ServerCount"].ToString());

Database/Models/Model_GroupDetails.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace Database.Models
2+
{
3+
public class Model_GroupDetails
4+
{
5+
public int GroupID { get; set; } = 0;
6+
7+
public string GroupName { get; set; } = string.Empty;
8+
9+
public int ServerCount { get; set; } = 0;
10+
}
11+
}

Database/RijndaelHelper.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
using System;
2-
using System.Text;
3-
using RijndaelEncryptDecrypt;
1+
using RijndaelEncryptDecrypt;
42

5-
public class RijndaelSettings
3+
public class RijndaelSettings
64
{
75
public static string PassPhrase = "4e7046087d6e8eefe1b41bddf8bde56c";
86
public static string SaltValue = "36ec281f88fb483b5726ccfc81bae6d9";

Database/Servers.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
using Database.Models;
22
using System;
33
using System.Collections;
4-
using System.Collections.Generic;
5-
using System.Data;
64
using System.Data.SQLite;
7-
using System.Text;
85

96
namespace Database
107
{

RemoteDesktopClient/Class Modules/Common Helpers/GlobalHelper.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
using System;
2-
using System.Collections;
3-
using System.Collections.Generic;
4-
using System.Text;
1+
using Database;
2+
using Database.Models;
53
using System.Windows.Forms;
6-
using Database;
74

85
namespace MultiRemoteDesktopClient
96
{
@@ -65,7 +62,7 @@ public static void PopulateGroupsDropDown(ComboBox cb, string selected_text)
6562

6663
dbGroups.Read();
6764

68-
foreach (Database.GroupDetails gd in dbGroups.ArrayListGroups)
65+
foreach (Model_GroupDetails gd in dbGroups.ArrayListGroups)
6966
{
7067
cb.Items.Add(gd.GroupName);
7168
}

RemoteDesktopClient/Controls/NitificationContextMenu.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using Database.Models;
22
using System;
33
using System.Collections;
4-
using System.Collections.Generic;
5-
using System.Text;
64
using System.Windows.Forms;
75

86
namespace MultiRemoteDesktopClient
@@ -35,7 +33,7 @@ private void AddMenuItems()
3533
ToolStripMenuItem[] menuItemGroups = new ToolStripMenuItem[groups.Count];
3634

3735
int cnt = 0;
38-
foreach (Database.GroupDetails gd in groups)
36+
foreach (Model_GroupDetails gd in groups)
3937
{
4038
//if (gd.ServerCount == 0) { continue; }
4139

RemoteDesktopClient/Forms/GroupManagerWindow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void btnUpdate_Click(object sender, EventArgs e)
4646
if (group_name == null) { return; }
4747

4848
int groupid = int.Parse(lvGroups.SelectedItems[0].Tag.ToString());
49-
Database.GroupDetails gd = new Database.GroupDetails();
49+
Model_GroupDetails gd = new Model_GroupDetails();
5050
gd.GroupID = groupid;
5151
gd.GroupName = group_name;
5252
GlobalHelper.dbGroups.Save(false, gd);
@@ -112,7 +112,7 @@ void btnCreate_Click(object sender, EventArgs e)
112112
string group_name = CreateForm(string.Empty);
113113
if (group_name == null) { return; }
114114

115-
Database.GroupDetails gd = new Database.GroupDetails();
115+
Model_GroupDetails gd = new Model_GroupDetails();
116116
gd.GroupName = group_name;
117117

118118
try
@@ -214,7 +214,7 @@ private void PopulateListView(ListView lv)
214214
lv.Items.Clear();
215215

216216
GlobalHelper.dbGroups.GetGroupsWithServerCount();
217-
foreach (Database.GroupDetails gd in GlobalHelper.dbGroups.ArrayListGroups)
217+
foreach (Model_GroupDetails gd in GlobalHelper.dbGroups.ArrayListGroups)
218218
{
219219
ListViewItem item = new ListViewItem(gd.GroupName);
220220
item.SubItems.Add(gd.ServerCount.ToString());

RemoteDesktopClient/Forms/Partial Class/RemoteDesktopClient Form/Methods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void GetGroups()
4646
{
4747
GlobalHelper.dbGroups.Read();
4848

49-
foreach (Database.GroupDetails gd in GlobalHelper.dbGroups.ArrayListGroups)
49+
foreach (Model_GroupDetails gd in GlobalHelper.dbGroups.ArrayListGroups)
5050
{
5151
// add groups to ListView
5252
ListViewGroup lvg = new ListViewGroup("gid" + gd.GroupID.ToString(), gd.GroupName);

0 commit comments

Comments
 (0)