Professional Documents
Culture Documents
Informatics College Pokhara: Application Development CS6004NA
Informatics College Pokhara: Application Development CS6004NA
Application Development
CS6004NA
Coursework 1
With the great contribution of Mr. Ashim Batajoo the course work was
completed within the time frame.
Table of Contents
1. Introduction ............................................................................................... 1
1.1 Current Scenario ................................................................................. 1
1.2 Proposed System ............................................................................... 1
2. User Manual ............................................................................................. 2
3. Journal Articles ....................................................................................... 18
4. System Architecture................................................................................ 20
Class Diagram ............................................................................................ 21
Individual Diagram ...................................................................................... 22
Flowchart for Reports ................................................................................. 28
Daily Report ............................................................................................ 28
Weekly Report ........................................................................................ 29
Algorithms of Reports ................................................................................. 30
Daily Report ............................................................................................ 30
Weekly Report ........................................................................................ 30
5. Sorting Algorithm .................................................................................... 31
6. Reflection ................................................................................................ 33
7. Conclusion .............................................................................................. 34
Bibliography ................................................................................................... 35
References .................................................................................................... 36
Appendix ........................................................................................................ 37
Table of Figure
Figure 1 Login Screen...................................................................................... 2
Figure 2 Main Screen....................................................................................... 3
Figure 3 Visitor Entry Section .......................................................................... 4
Figure 4 Museum Closed message ................................................................. 5
Figure 5 Museum opening message ................................................................ 5
Figure 6 Add Visitor Entry Details Screen ........................................................ 6
Figure 7 Visitor Entry Detail Added successfully .............................................. 7
Figure 8 Dialog Screen for exporting data ....................................................... 7
Figure 9 CSV data in Microsoft Excel .............................................................. 8
Figure 10 Import from CSV dialog.................................................................... 8
Figure 11 Data imported from CSV file ............................................................ 9
Figure 12 Unsorted Data ................................................................................ 10
Figure 13 Sorted Data as per total minutes ................................................... 11
Figure 14 Visitor Detail Screen ...................................................................... 11
Figure 15 Visitor Name in Combo Box ........................................................... 12
Figure 16 Invalid Email notification ................................................................ 12
Figure 17 Valid Visitor Detail Data ................................................................. 13
Figure 18 Visitor Details added successfully .................................................. 13
Figure 19 Daily Report Screen ....................................................................... 14
Figure 20 Chart Display of Daily Report......................................................... 15
Figure 21 List view of Daily Report ................................................................ 15
Figure 22 Weekly Report Screen ................................................................... 16
Figure 23 Weekly Chart ................................................................................. 16
Figure 24 List view of Weekly Report............................................................. 17
Figure 25 Architecture Diagram ..................................................................... 20
Figure 26 Class Diagram ............................................................................... 21
Figure 27 Visitor Repository Individual Diagram ............................................ 22
Figure 28 VisitorEntryDetail ........................................................................... 24
Figure 29 weeklyReportChart ........................................................................ 25
Figure 30 DailyReportChart ........................................................................... 26
Figure 31 Flowchart for Daily Report ............................................................. 28
Figure 32 Flowchart for Weekly Chart............................................................ 29
Figure 33 Flowchart for Weekly Chart............................................................ 30
CS6004NA Application Development
1. Introduction
The designed system is Museum Management System. The system is
highly designed developed and test under various circumstances. The
features and functions that are required by Museum are almost fulfilled by
the developed system. It consist of features like adding visitor’s entry and
exit time and calculate the total minutes spend by the visitor. In addition to
that, details information of the entered visitor can be added such as their
first name, email address, contact number and occupation. Furthermore,
there is a features to view daily and weekly table and chart. Other available
features are well explained in other sections of the report.
Page | 1
CS6004NA Application Development
2. User Manual
There are screenshot below which will illustrate a user how to operate the
system.
As the end user operates the system the initial screen will be the security
screen. The username and password of the system is “admin”. Only a valid
username and password can provide access to the system.
Page | 2
CS6004NA Application Development
Page | 3
CS6004NA Application Development
To check all the data about visitor entry and to add new visitor user should
simply click in the ‘Visitor Entry’ option from the top right corner. As the user
clicks following screen will appear.
A user can only allow to use this feature from Monday to Friday and within the
time frame of 10 A.M to 5 P.M. The following message will display when above
condition is not satisfied.
Page | 4
CS6004NA Application Development
Page | 5
CS6004NA Application Development
When the user access the system in a valid day and time can now access the
facility of adding visitor entry details.
Page | 6
CS6004NA Application Development
Page | 7
CS6004NA Application Development
Page | 8
CS6004NA Application Development
Page | 9
CS6004NA Application Development
As the user keep adding data, added data are displayed in an unsorted format
which looks alike.
An end user can sort data present in the grid by clicking on ‘Sort by Total
Minutes’ which is present in bottom left corner. The sorted data looks alike.
Page | 10
CS6004NA Application Development
Page | 11
CS6004NA Application Development
A visitor that has entered into museum needs to provide their details such as
Last Name, email address, phone number and occupation. The entered visitor
are displayed in the combo box as shown below.
Page | 12
CS6004NA Application Development
In the context of adding number a user can provide number including +977-. In
Last name and occupation section numeric value cannot be entered. A valid
data looks like:
Page | 13
CS6004NA Application Development
The feature which are present such as ‘Import from CSV’, ‘Export to CSV’, Save
( Serialize ), and Retrieve (Deserialize) works the same as in the Visitor Entry
Detail Screen.
In addition to that, a key feature is the report section. Report features like Daily
Report and Chart and Weekly Report and Chart. To access the report section
a user should click on the Report section and choose either Daily or Weekly.
Accessing the Daily Section. The following screen will appear.
Page | 14
CS6004NA Application Development
To view the Daily Detail in a chart section a user should simply click on Display
Chart and following screen will appear.
Page | 15
CS6004NA Application Development
Page | 16
CS6004NA Application Development
To view the data into a list view a user can simply click on ‘Display Sorted List’
and following screen will appear.
Page | 17
CS6004NA Application Development
3. Journal Articles
I. New technologies are commencement to cause important changes in the
way museums execute their functions and in the way they are supposed by
the public. The rapid adaptation of text and images into digital form will affect
work procedures within the museum. Attached with the advent of high speed
digital systems, this union will permit the museum to offer more info to a
wider overall public (Jones-Garmil, 2014).
III. The connection among museums and mass media as well as the likely
impact of info technology on museums are labelled. The “virtual museum”
is defined as a means to establish access, context, and outreach by using
information technology. The Internet opens the “virtual museum” to a
cooperating dialog with virtual visitors and invites them to make a virtual
museum familiarity that is related to a real museum experience. Some
research is described on how the Internet can be used as a information base
and trends from surveys how museums and virtual visitors use the Internet
as a communication tool (Schweibenz, 2004).
Page | 18
CS6004NA Application Development
IV. The museum offers a initial point from which to inspect the fundamental
nature of collaborative work and interdisciplinary scholarship. This article
examines the socio-technological influence of presenting progressive
information technology into the Spurlock Museum, a museum of world
history and culture at the University of Illinois. It speaks the operation of
such methodologies as computer-supported cooperative work (CSCW) and
computer-mediated communication (CMC) in the museum environment
(Marty, n.d.).
Page | 19
CS6004NA Application Development
4. System Architecture
Architecture Diagram
Page | 20
CS6004NA Application Development
Class Diagram
Page | 21
CS6004NA Application Development
Individual Diagram
1. VisitorRepository
Methods Description Diagram
DeserializeVisitorDataDeserialization of
visitor data.
ExportToCSV Exporting visitor details
into a csv file.
GenerateId Generating a primary
id of visitor for
respective data.
ReadFromCSV Read the visitor data
that are available in a
CSV file.
SerializeVisitorData Serialization of visitor’s
data.
SortUsingTotalMinutes Sorting the user data
as per Total Minutes.
Page | 22
CS6004NA Application Development
2. VisitorEntry
Methods Description Diagram
cardNametextBox It is used for taking
input of Card Name of
the Visitor.
VisitorEntry_Load To add features when
the Visitor Entry screen
loads.
Page | 23
CS6004NA Application Development
3. VisitorEntryDetail
Methods Description Diagram
ExportToCSV Exporting visitor
details into a csv
file.
ReadFromCSV Read the visitor
data that are
available in a
CSV file.
retrieveDeserializeVisitorData Deserialization of
visitor data.
Figure 28 VisitorEntryDetail
Page | 24
CS6004NA Application Development
4. weeklyReportChart
Methods Description Diagram
displayChartButton To visit the daily chart
as per the daily report.
displayTableButton To visit the table of the
daily data.
LoadVisitorDetial To load the visitor
details and add then in
chart and in list.
pictureBox1_Click This is the exit icon
added in the screen
and which is used to
terminate the form.
Figure 29 weeklyReportChart
Page | 25
CS6004NA Application Development
5. DailyReportChart
Methods Description Diagram
displayChartButton To visit the weekly
chart as per the weekly
report.
displayTableButton To visit the table of the
daily data.
LoadVisitorDetial To load the visitor
details and add then in
chart and in list.
pictureBox1_Click This is the exit icon
added in the screen
and which is used to
terminate the form.
Figure 30 DailyReportChart
Page | 26
CS6004NA Application Development
6. Login
Methods Description Diagram
ErrorMess It is used to display the
error message when
username and
password are not
correct.
Logbtn_Click It is used to validate
the username and
password and let user
enter the system when
username and
password are correct.
pictureBox2_Click It is used to terminate
the program.
Page | 27
CS6004NA Application Development
Page | 28
CS6004NA Application Development
Weekly Report
Page | 29
CS6004NA Application Development
Algorithms of Reports
Daily Report
Steps:
1. Start
5. Check whether there is visitor entry data of the particular day or not
9. Stop
Weekly Report
Steps:
1. Start
9. Stop
Page | 30
CS6004NA Application Development
5. Sorting Algorithm
The sorting Algorithm used in the Museum System is bubble sorting
algorithm.
Bubble sort is a basic arranging calculation. This arranging calculation is
correlation based calculation in which each match of neighbouring
components is analysed and the components are swapped in the event
that they are not altogether. This calculation isn't reasonable for substantial
informational indexes as its normal and most pessimistic scenario
multifaceted nature are of Ο(n2) where n is the quantity of things.
Working Mechanism:
We take an unsorted array for our example. Bubble sort takes Ο(n 2) time
so we're keeping it short and precise.
Bubble sort starts with very first two elements, comparing them to check
which one is greater.
We find that 27 is smaller than 33 and these two values must be swapped.
Page | 31
CS6004NA Application Development
Next we compare 33 and 35. We find that both are in already sorted
positions.
We know then that 10 is smaller 35. Hence they are not sorted.
We swap these values. We find that we have reached the end of the array.
After one iteration, the array should look like this −
To be precise, we are now showing how an array should look like after
each iteration. After the second iteration, it should look like this −
Notice that after each iteration, at least one value moves at the end.
And when there's no swap required, bubble sorts learns that an array is
completely sorted.
Page | 32
CS6004NA Application Development
6. Reflection
The developed system is Digitalized Museum Management System. It is
developed using Visual Studio 2017 with the C# language version 7.3. The
business logic used in the system reflects the real working environment of
the Museum. The GUI designed is highly user interface and user with basic
system administration can operate the system.
An end user can have the facilities of add the In Time and Out Time of the
visitor along with their name. The total duration spend by the visitor is
calculated automatically by the system. The details of the entered visitor
can be added such as: Last Name, phone number, email address and
occupation can be added manually by the user. In addition to that, a user
can check out the daily and weekly chart along with the list.
I had some previous experience with Visual Studio. With this experience I
had got some plus point while doing this coursework. I came to get more
working and experience with the language. Features like creating chart
generating list In addition to that, sorting of data form the grid was a new
thing for me. Furthermore, import and exporting to CSV file was new aspect
for me. Overall evaluation with the great support of Mr. Ashim Batajoo I
had a great experience with the Application Development of the Museum.
Page | 33
CS6004NA Application Development
7. Conclusion
The initial coursework for the module CS6004NA Application Development
was to build up a guest the executives framework for an exhibition hall. It
required a long time to build up the task in Visual Studio Enterprise 2017
utilizing C# programming dialect. The framework has login screen to add
security to the task. After login, the framework shows a primary screen
where every one of the functionalities are found. Aside from various shape
components, class outline for every one of the structures and classes were
utilized.
Page | 34
CS6004NA Application Development
Bibliography
Jones-Garmil, 2014. The Transformation of the Museum and the Way it's
Perceived..
Marty, n.d. Museum informatics and collaborative technologies: The emerging
socio-technological dimension of information science in museum environments.
2012.
Schweibenz, 2004. Virtual Museum.
Williams, 2012. Microsoft Visual C# (Core Reference). s.l.:Microsoft Press
Redmond..
Page | 35
CS6004NA Application Development
References
Erichero, (2008). Create One Application for both Desktop and Web. [Online]
Available at: https://www.codeproject.com/Articles/30542/Create-One-
Application-for-both-Desktop-and-Web [Accessed 24th January, 2019]
Sharp, J., 2018. Microsoft Visual C# Step by Step (9th Edition) (developer
Reference). Microsoft Press.
Working with C# List (Code Examples). 2019. Working with C# List (Code
Examples). [ONLINE] Available at: https://www.c-sharpcorner.com/article/c-
sharp-list/. [Accessed 24 January 2019].
dotnet-bot. 2019. Data Binding Overview | Microsoft Docs. [ONLINE] Available
at: https://docs.microsoft.com/en-us/dotnet/framework/wpf/data/data-binding-
overview. [Accessed 24 January 2019].
Dot Net for All. 2019. Bubble Sort with Simple Explanation in C# • Dot Net for
All. [ONLINE] Available at: https://www.dotnetforall.com/bubble-sort-simple-
explanation-c/. [Accessed 24 January 2019].
rpetrusha. 2019. How to: Verify that Strings Are in Valid Email Format |
Microsoft Docs. [ONLINE] Available at: https://docs.microsoft.com/en-
us/dotnet/standard/base-types/how-to-verify-that-strings-are-in-valid-email-
format. [Accessed 24 January 2019].
Liberty, J., 2003. Programming C#, Third Edition. O'reilly Media.
tutorialspoint.com. 2019. Data Structures and Algorithms Bubble Sort.
[ONLINE] Available at:
https://www.tutorialspoint.com/data_structures_algorithms/bubble_sort_algorit
hm.htm. [Accessed 24 January 2019].
Page | 36
CS6004NA Application Development
Appendix
Login.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
Page | 37
CS6004NA Application Development
MuseumSystem.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
Page | 38
CS6004NA Application Development
Visitor.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
Page | 39
CS6004NA Application Development
VisitorDetail.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace MuseumMgntSystem
{
[Serializable()]
//default constructor
public VisitorDetail() { }
Page | 40
CS6004NA Application Development
info.AddValue(KEY3, Email);
info.AddValue(KEY4, Contact);
info.AddValue(KEY5, Occupation);
}
}
}
VisitorDetailForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class VisitorDetailForm : Form
{
_visitorDetailRepository.SaveVisitorDetails((List<VisitorDetail>)_visitorDetail
BindingSource.DataSource);
Page | 41
CS6004NA Application Development
if (result == System.Windows.Forms.DialogResult.OK)
{
//export filename and our data list to the ExportToCSV class.
_visitorDetailRepository.ExportToCSV((List<VisitorDetail>)_visitorDetailBinding
Source.DataSource, dialog.FileName);
}
}
_visitorDetailRepository.SaveVisitorDetails((List<VisitorDetail>)_visitorDetail
BindingSource.DataSource);
}
Page | 42
CS6004NA Application Development
visitorDetailGrid.DataSource = _visitorDetailBindingSource;
visitorDetailGrid.ReadOnly = true;
}
}
}
VisitorDetailRepository.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public class VisitorDetailRepository
{
private List<VisitorDetail> _visitorDetailList = new
List<VisitorDetail>();
private string filePath =
Path.GetDirectoryName(Application.ExecutablePath);
}
stream.Close();
}
}
private void SerializeVisitorData(List<VisitorDetail> visitorDetails)
{
Stream str = File.Open(filePath + @"\visitorDataDetail.dat",
FileMode.Create);
BinaryFormatter bF = new BinaryFormatter();
bF.Serialize(str, visitorDetails);
str.Flush();
str.Close();
MessageBox.Show("Visitor Detail added successfully.", "Data
saved.", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public void SaveVisitorDetails(List<VisitorDetail> visitorDetails)
{
SerializeVisitorData(visitorDetails);
}
Page | 43
CS6004NA Application Development
}
catch (Exception ex)
{
MessageBox.Show("Not able to save the data", "Error Saving
data", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return visitorDetailList;
}
public int GenerateId()
{
int id = 0;
if (_visitorDetailList != null && _visitorDetailList.Count > 0)
{
id = _visitorDetailList.Max(a => a.VisitorDetailId);
}
return id + 1;
}
public void ExportToCSV(List<VisitorDetail> visitorDetails, string
filePath)
{
try
{
if (visitorDetails.Count > 0)
{
var propList =
visitorDetails[0].GetType().GetProperties().Select(prop => prop.Name).ToList();
//TextWriter is used to create outputand streamWriter is
used to read file location
Page | 44
CS6004NA Application Development
TW.WriteLine();
//writes values
foreach (var val in visitorDetails)
{
foreach (PropertyInfo prop in
val.GetType().GetProperties())
{
TW.Write(prop.GetValue(val, null).ToString() +
",");
}
TW.WriteLine();
}
}
MessageBox.Show("Visitor details saved successfuly", "Saved
Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
Process.Start(filePath);
}
}
catch (Exception ex)
{
MessageBox.Show("Not able to save the data", "Error Saving
data", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public List<VisitorDetail> GetVisitorDataDetails()
{
DeSerializeVisitorData();
if (_visitorDetailList != null && _visitorDetailList.Count > 0)
{
return _visitorDetailList;
}
else
{
_visitorDetailList = new List<VisitorDetail>();
return _visitorDetailList;
}
}
}
}
VisitorEntry.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class VisitorEntry : Form
{
public VisitorEntry()
{
Page | 45
CS6004NA Application Development
InitializeComponent();
}
get
{
outTimePicker.MinDate = DateTime.Parse("10:01:00");
outTimePicker.MaxDate = DateTime.Parse("16:59:00");
if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday ||
DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
{
MessageBox.Show("The ABC Museum remains closed on weekends.",
"Museum Closed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.Close();
}
if (DateTime.Now <= DateTime.Parse("9:59:00") || DateTime.Now >=
DateTime.Parse("17:00:00"))
{
MessageBox.Show("The ABC Museum opens from 10 A.M to 5 P.M",
"Museum Closed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.Close();
}
Page | 46
CS6004NA Application Development
{
e.Handled = !(char.IsLetter(e.KeyChar) || e.KeyChar ==
(char)Keys.Back);
}
}
}
VisitorEntryDetail.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class VisitorEntryDetail : Form
{
//repository class has all the logic to save and retrieve data.
//making a object of visitorRepository class.
public VisitorRepository _visitorRepository = new VisitorRepository();
//making object of BindingSource clss to store visitor data.
public BindingSource _visitorBindingSource = new BindingSource();
public VisitorEntryDetail()
{
InitializeComponent();
}
Page | 47
CS6004NA Application Development
_visitorRepository.SaveVisitors((List<Visitor>)_visitorBindingSource.DataSource
);
}
}
if (result == System.Windows.Forms.DialogResult.OK)
{
//export filename and our data list to the ExportToCSV class.
_visitorRepository.ExportToCSV((List<Visitor>)_visitorBindingSource.DataSource,
dialog.FileName);
}
}
_visitorRepository.SaveVisitors((List<Visitor>)_visitorBindingSource.DataSource
);
Page | 48
CS6004NA Application Development
}
}
VisitorRepository.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
Page | 49
CS6004NA Application Development
Page | 50
CS6004NA Application Development
}
//step 5: close the stream. after opening a stream it should always
be closed.
stream.Close();
}
}
catch (Exception ex)
{
MessageBox.Show("Cannot get the data right now. Please visit
later");
}
}
//saves c# list object, converts to object data and saves in the file location.
Page | 51
CS6004NA Application Development
//start: public methods of this class. only these methods can be accessed
by other classes
Page | 52
CS6004NA Application Development
visitor.TotalMinutes = Convert.ToDouble(values[6]);
visitorList.Add(visitor);
}
_visitorList = visitorList;
}
catch (Exception ex)
{
MessageBox.Show("Not able to save the data", "Error Saving data",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return visitorList;
Page | 53
CS6004NA Application Development
TW.Write(prop.ToString() + ",");
}
TW.WriteLine();
//writes values
foreach (var val in visitors)
{
foreach (PropertyInfo prop in val.GetType().GetProperties())
{
TW.Write(prop.GetValue(val, null).ToString() + ",");
}
TW.WriteLine();
}
}
MessageBox.Show("Visitor details saved successfuly", "Saved
Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
Process.Start(filePath);
}
}
catch (Exception ex)
{
MessageBox.Show("Not able to save the data", "Error Saving data",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Page | 54
CS6004NA Application Development
//accepts list of visitor and serializes the data to save as a object state.
public void SaveVisitors(List<Visitor> visitors)
{
//call this method to save the file.
SerializeVisitorData(visitors);
}
Page | 55
CS6004NA Application Development
return id + 1;
}
public List<Visitor> SortUsingTotalMinutes()
{
for (int i = 0; i < _visitorList.Count; i++)
{
for (int j = 0; j < _visitorList.Count - 1; j++)
{
var val1 = Convert.ToInt32(_visitorList[j].TotalMinutes);
var val2 = Convert.ToInt32(_visitorList[j + 1].TotalMinutes);
if (val1 > val2)
{
var temp = _visitorList[j + 1];
_visitorList[j + 1] = _visitorList[j];
_visitorList[j] = temp;
}
}
}
return _visitorList;
}
public List<Visitor> GetWeeksData()
{
DeSerializeVisitorData();
if (_visitorList != null && _visitorList.Count > 0)
{
//set to start of week i.e Monday of current week.
var startOfWeek =
DateTime.Now.AddDays(((int)DateTime.Now.DayOfWeek * -1) + 1);
//set time as 10:00:00
startOfWeek = new DateTime(startOfWeek.Year,
startOfWeek.Month, startOfWeek.Day, 00, 0, 0);
Page | 56
CS6004NA Application Development
Page | 57
CS6004NA Application Development
{
DeSerializeVisitorData();
if (_visitorList != null && _visitorList.Count > 0)
{
else
{
_visitorList = new List<Visitor>();
return _visitorList;
}
}
Page | 58
CS6004NA Application Development
}
}
WeeklyReportChart.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class weeklyReportChart : Form
{
private VisitorRepository _visitorRepository = new VisitorRepository();
private List<Visitor> _visitorList = new List<Visitor>();
public weeklyReportChart()
{
InitializeComponent();
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
this.Close();
}
Page | 59
CS6004NA Application Development
weeklyGrid.Visible = true;
visitorDetailChart.Visible = false;
foreach (var visitor in _visitorList)
{
var dayName = visitor.Date.DayOfWeek.ToString();
var totalMinutes = visitor.TotalMinutes.ToString();
var totalCount = visitor.Count.ToString();
this.weeklyGrid.Rows.Add(totalCount, dayName, totalMinutes);
}
displayTableButton.Enabled = false;
}
}
}
DailyChartReport.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
public partial class DailyReportChart : Form
{
private VisitorRepository _visitorRepository = new VisitorRepository();
private List<Visitor> _visitorList = new List<Visitor>();
public DailyReportChart()
{
InitializeComponent();
}
dailyGrid.Visible = false;
visitorDailyDetailChart.Visible = true;
foreach (var visitor in _visitorList)
{
Page | 60
CS6004NA Application Development
visitorDailyDetailChart.Series["Total
Minutes"].Points.AddXY(visitor.Date.DayOfWeek.ToString(),
visitor.TotalMinutes.ToString());
}
displayChartButton.Enabled = false;
AddVisitorDetails.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MuseumMgntSystem
{
Page | 61
CS6004NA Application Development
visitorComboBox.DataSource = _visitorBindingSource;
visitorComboBox.DisplayMember = "CardName";
visitorComboBox.ValueMember = "CardName";
}
public VisitorDetail VisitorDetail
{
get
{
var visitorDetail = new VisitorDetail();
visitorDetail.CardName =
Convert.ToString(visitorComboBox.SelectedValue);
visitorDetail.LastName = lastNameTextBox.Text;
visitorDetail.Email = emailTextBox.Text;
visitorDetail.Contact = contactNumberTextBox.Text;
visitorDetail.Occupation = occupationTextBox.Text;
return visitorDetail;
}
}
Page | 62
CS6004NA Application Development
}
}
Page | 63