001
// ListView1
002
string
[] checkedINfileList = Directory.GetFiles(
"O:\\TestDaws\\CSDB\\CheckedIN"
);
003
004
005
foreach
(
file
in
checkedINfileList)
006
{
007
FileInfo f =
new
FileInfo(file);
008
009
long
fileSize = f.Length;
010
DateTime file_date = f.LastWriteTime;
011
fileName = Path.GetFileName(file);
012
013
ListViewItem item =
ListViewItem(fileName);
014
015
listView1.Items.Add(item);
016
item.SubItems.Add(fileSize.ToString() +
" Kb"
017
item.SubItems.Add(file_date.ToString());
018
019
}
020
//ListView2
021
[] checkedOUTfileList = Directory.GetFiles(
"O:\\TestDaws\\CSDB\\CheckedOUT"
022
023
024
checkedOUTfileList)
025
026
027
028
029
030
031
032
ListViewItem item2 =
033
034
listView2.Items.Add(item2);
035
item2.SubItems.Add(fileSize.ToString() +
036
item2.SubItems.Add(file_date.ToString());
037
038
039
040
//NEED TO ADD THE VALUE STORED IN THE 4TH COLUMN (POS 3) OF LISTVIEW1 IN HERE
041
//THE 4TH COLUMN IS POPULATED FURTHER DOWN THE CODE WITH THE BUTTON_2 CLICK EVEN HANDLER
042
043
044
045
046
047
048
049
050
//Check Out Button Click
051
public
ListView.SelectedListViewItemCollection mySelectedItems;
052
053
private
void
button1_Click(
object
sender, EventArgs e)
054
055
mySelectedItems = listView1.SelectedItems;
056
057
toDir =
;
058
fromDir =
059
060
if
(mySelectedItems.Count > 0)
061
062
063
(ListViewItem items
mySelectedItems)
064
065
try
066
067
File.Move(fromDir +
"\\"
+ items.Text, toDir +
+ items.Text);
068
MessageBox.Show(
"Checking Out: \n"
069
listView2.Refresh();
070
071
072
073
//for (int i = 0; i < listView1.Items.Count; i++)
074
//{
075
076
// ListViewItem newList = new ListViewItem();
077
078
// if (listView1.Items[i].SubItems[3].ToString() != null)
079
// {
080
// string test = listView1.Items[i].SubItems[3].ToString();
081
082
// newList.SubItems.Add(test);
083
// }
084
085
//}
086
087
listView1.Items.Remove(items);
088
089
090
091
catch
(Exception ex)
092
093
"Error"
+ ex);
094
095
096
097
098
099
100
101
102
//Add Note Button Click
103
button2_Click(
104
105
106
107
108
(textBox1.Text !=
null
&& mySelectedItems.Count > 0)
109
110
111
112
(ListViewItem itemsForNote
113
itemsForNote.SubItems.Add(textBox1.Text);
114
115
116
117
118
119
120
121
else
122
123
"Please select DMs and write note in the box"
,
"Forgotton Something?"
124
125
126
127
128
129
contextMenuStrip1_Opening(
sender, CancelEventArgs e)
130
131
132
133
134
//Remove Note
135
removeNoteToolStripMenuItem_Click(
136
137
138
139
140
141
(ListViewItem myItem
142
myItem.SubItems.Remove(myItem.SubItems[3]);
143
144
145
146
147