diff --git a/NoSQLSolution/.vs/NoSQLSolution/v17/.suo b/NoSQLSolution/.vs/NoSQLSolution/v17/.suo index f54fb39..29d5bea 100644 Binary files a/NoSQLSolution/.vs/NoSQLSolution/v17/.suo and b/NoSQLSolution/.vs/NoSQLSolution/v17/.suo differ diff --git a/NoSQLSolution/DAL/EmployeeDao.cs b/NoSQLSolution/DAL/EmployeeDao.cs index e072aab..c21d085 100644 --- a/NoSQLSolution/DAL/EmployeeDao.cs +++ b/NoSQLSolution/DAL/EmployeeDao.cs @@ -16,5 +16,14 @@ public List GetAllRegularUsers() var filter = Builders.Filter.Eq("UserType", UserType.RegularUser); return database.GetCollection("Employees").Find(filter).ToList(); } + public void Insert(Employee employee) + { + database.GetCollection("Employees").InsertOne(employee); + } + + public Employee Get(ObjectId id) + { + return database.GetCollection("Employees").Find(employee => employee._id == id).FirstOrDefault(); + } } } diff --git a/NoSQLSolution/DAL/TicketsDao.cs b/NoSQLSolution/DAL/TicketsDao.cs index d997fde..4091b0e 100644 --- a/NoSQLSolution/DAL/TicketsDao.cs +++ b/NoSQLSolution/DAL/TicketsDao.cs @@ -20,7 +20,7 @@ public TicketsDao() public List GetAllTickets() { - FilterDefinition filter = Builders.Filter.Gt("Priority", TicketPriority.Closed); // Only check for tickets that are relevant + var filter = Builders.Filter.Ne(t => t.Priority, TicketPriority.Closed); return ticketCollection.Find(filter).ToList(); } @@ -49,5 +49,12 @@ public void updateTicket(Ticket ticket) if (!ticketCollection.UpdateOne(filter, update).IsAcknowledged) throw new Exception("Ticket could not be updated"); } + public void CloseTicket(int ticketId) + { + var filter = Builders.Filter.Eq(t => t.TicketId, ticketId); + var update = Builders.Update.Set(t => t.Priority, TicketPriority.Closed); + ticketCollection.UpdateOne(filter, update); + } + } } diff --git a/NoSQLSolution/DAL/bin/Debug/DAL.dll b/NoSQLSolution/DAL/bin/Debug/DAL.dll index fe8e47a..17b7be6 100644 Binary files a/NoSQLSolution/DAL/bin/Debug/DAL.dll and b/NoSQLSolution/DAL/bin/Debug/DAL.dll differ diff --git a/NoSQLSolution/DAL/bin/Debug/DAL.pdb b/NoSQLSolution/DAL/bin/Debug/DAL.pdb index a676e63..f9d3e72 100644 Binary files a/NoSQLSolution/DAL/bin/Debug/DAL.pdb and b/NoSQLSolution/DAL/bin/Debug/DAL.pdb differ diff --git a/NoSQLSolution/DAL/bin/Debug/Model.dll b/NoSQLSolution/DAL/bin/Debug/Model.dll index 16d4971..15335e3 100644 Binary files a/NoSQLSolution/DAL/bin/Debug/Model.dll and b/NoSQLSolution/DAL/bin/Debug/Model.dll differ diff --git a/NoSQLSolution/DAL/bin/Debug/Model.pdb b/NoSQLSolution/DAL/bin/Debug/Model.pdb index 6e1c358..c7d4767 100644 Binary files a/NoSQLSolution/DAL/bin/Debug/Model.pdb and b/NoSQLSolution/DAL/bin/Debug/Model.pdb differ diff --git a/NoSQLSolution/DAL/obj/Debug/DAL.csproj.AssemblyReference.cache b/NoSQLSolution/DAL/obj/Debug/DAL.csproj.AssemblyReference.cache index 3b7461e..1acf3ad 100644 Binary files a/NoSQLSolution/DAL/obj/Debug/DAL.csproj.AssemblyReference.cache and b/NoSQLSolution/DAL/obj/Debug/DAL.csproj.AssemblyReference.cache differ diff --git a/NoSQLSolution/DAL/obj/Debug/DAL.csproj.CoreCompileInputs.cache b/NoSQLSolution/DAL/obj/Debug/DAL.csproj.CoreCompileInputs.cache index 10ebff6..deb07da 100644 --- a/NoSQLSolution/DAL/obj/Debug/DAL.csproj.CoreCompileInputs.cache +++ b/NoSQLSolution/DAL/obj/Debug/DAL.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -bd96249f908118f60dc0685b102b566ec5cb27c0 +ff1149b5bc7fee515a1a04966ebe3b009300a7d9 diff --git a/NoSQLSolution/DAL/obj/Debug/DAL.csproj.FileListAbsolute.txt b/NoSQLSolution/DAL/obj/Debug/DAL.csproj.FileListAbsolute.txt index 280466d..b546029 100644 --- a/NoSQLSolution/DAL/obj/Debug/DAL.csproj.FileListAbsolute.txt +++ b/NoSQLSolution/DAL/obj/Debug/DAL.csproj.FileListAbsolute.txt @@ -56,3 +56,32 @@ C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project N C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.csproj.CopyComplete C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.dll C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\snappy32.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\snappy64.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\libzstd.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\mongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\DAL.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\DAL.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\DnsClient.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\Model.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Bson.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Driver.Core.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Driver.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Libmongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\SharpCompress.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\System.Buffers.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\System.ValueTuple.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\Model.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\DnsClient.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Bson.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Driver.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\MongoDB.Driver.Core.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\System.Buffers.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\bin\Debug\System.ValueTuple.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.csproj.AssemblyReference.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.csproj.CoreCompileInputs.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.csproj.CopyComplete +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DAL\obj\Debug\DAL.pdb diff --git a/NoSQLSolution/DAL/obj/Debug/DAL.dll b/NoSQLSolution/DAL/obj/Debug/DAL.dll index fe8e47a..17b7be6 100644 Binary files a/NoSQLSolution/DAL/obj/Debug/DAL.dll and b/NoSQLSolution/DAL/obj/Debug/DAL.dll differ diff --git a/NoSQLSolution/DAL/obj/Debug/DAL.pdb b/NoSQLSolution/DAL/obj/Debug/DAL.pdb index a676e63..f9d3e72 100644 Binary files a/NoSQLSolution/DAL/obj/Debug/DAL.pdb and b/NoSQLSolution/DAL/obj/Debug/DAL.pdb differ diff --git a/NoSQLSolution/DemoApp/AddTicketForm.cs b/NoSQLSolution/DemoApp/AddTicketForm.cs index 1d6598e..e9d4e39 100644 --- a/NoSQLSolution/DemoApp/AddTicketForm.cs +++ b/NoSQLSolution/DemoApp/AddTicketForm.cs @@ -117,6 +117,7 @@ protected virtual void btnSubmit_Click(object sender, EventArgs e) else { ticketsLogic.insertTicket(new Ticket(MongoDB.Bson.ObjectId.Empty, -1, employee._id, employee.Email, dateTimePickerTicket.Value, (TypeOfIncident)Enum.Parse(typeof(TypeOfIncident), comboBoxType.Text), (TicketPriority)Enum.Parse(typeof(TicketPriority), comboBoxPriority.Text), (Deadlines)Enum.Parse(typeof(Deadlines), comboBoxDeadline.Text), textBoxDescription.Text)); + this.DialogResult = DialogResult.OK; this.Close(); MessageBox.Show("ticket is added", ""); } diff --git a/NoSQLSolution/DemoApp/AddUserForm.Designer.cs b/NoSQLSolution/DemoApp/AddUserForm.Designer.cs index 445a398..4218d55 100644 --- a/NoSQLSolution/DemoApp/AddUserForm.Designer.cs +++ b/NoSQLSolution/DemoApp/AddUserForm.Designer.cs @@ -28,8 +28,8 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.comboBoxLocation = new System.Windows.Forms.ComboBox(); - this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.cbLocationBranch = new System.Windows.Forms.ComboBox(); + this.cbUserType = new System.Windows.Forms.ComboBox(); this.btnSubmit = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.txtboxLastName = new System.Windows.Forms.TextBox(); @@ -44,24 +44,24 @@ private void InitializeComponent() this.txtboxFirstName = new System.Windows.Forms.TextBox(); this.txtboxEmail = new System.Windows.Forms.TextBox(); this.txtboxPhoneNumber = new System.Windows.Forms.TextBox(); - this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.chkSendPassword = new System.Windows.Forms.RadioButton(); this.SuspendLayout(); // - // comboBoxLocation + // cbLocationBranch // - this.comboBoxLocation.FormattingEnabled = true; - this.comboBoxLocation.Location = new System.Drawing.Point(292, 219); - this.comboBoxLocation.Name = "comboBoxLocation"; - this.comboBoxLocation.Size = new System.Drawing.Size(250, 21); - this.comboBoxLocation.TabIndex = 33; + this.cbLocationBranch.FormattingEnabled = true; + this.cbLocationBranch.Location = new System.Drawing.Point(292, 219); + this.cbLocationBranch.Name = "cbLocationBranch"; + this.cbLocationBranch.Size = new System.Drawing.Size(250, 21); + this.cbLocationBranch.TabIndex = 33; // - // comboBox2 + // cbUserType // - this.comboBox2.FormattingEnabled = true; - this.comboBox2.Location = new System.Drawing.Point(292, 144); - this.comboBox2.Name = "comboBox2"; - this.comboBox2.Size = new System.Drawing.Size(250, 21); - this.comboBox2.TabIndex = 30; + this.cbUserType.FormattingEnabled = true; + this.cbUserType.Location = new System.Drawing.Point(292, 144); + this.cbUserType.Name = "cbUserType"; + this.cbUserType.Size = new System.Drawing.Size(250, 21); + this.cbUserType.TabIndex = 30; // // btnSubmit // @@ -71,6 +71,7 @@ private void InitializeComponent() this.btnSubmit.TabIndex = 28; this.btnSubmit.Text = "ADD USER"; this.btnSubmit.UseVisualStyleBackColor = true; + this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click); // // btnCancel // @@ -80,6 +81,7 @@ private void InitializeComponent() this.btnCancel.TabIndex = 27; this.btnCancel.Text = "CANCEL"; this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // txtboxLastName // @@ -182,16 +184,16 @@ private void InitializeComponent() this.txtboxPhoneNumber.Size = new System.Drawing.Size(250, 20); this.txtboxPhoneNumber.TabIndex = 36; // - // radioButton1 + // chkSendPassword // - this.radioButton1.Checked = true; - this.radioButton1.Location = new System.Drawing.Point(292, 246); - this.radioButton1.Name = "radioButton1"; - this.radioButton1.Size = new System.Drawing.Size(250, 30); - this.radioButton1.TabIndex = 37; - this.radioButton1.TabStop = true; - this.radioButton1.Text = "yes, a password e-mail will be sent to the user"; - this.radioButton1.UseVisualStyleBackColor = true; + this.chkSendPassword.Checked = true; + this.chkSendPassword.Location = new System.Drawing.Point(292, 246); + this.chkSendPassword.Name = "chkSendPassword"; + this.chkSendPassword.Size = new System.Drawing.Size(250, 30); + this.chkSendPassword.TabIndex = 37; + this.chkSendPassword.TabStop = true; + this.chkSendPassword.Text = "yes, a password e-mail will be sent to the user"; + this.chkSendPassword.UseVisualStyleBackColor = true; // // AddUserForm // @@ -199,12 +201,12 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(734, 461); - this.Controls.Add(this.radioButton1); + this.Controls.Add(this.chkSendPassword); this.Controls.Add(this.txtboxPhoneNumber); this.Controls.Add(this.txtboxEmail); this.Controls.Add(this.txtboxFirstName); - this.Controls.Add(this.comboBoxLocation); - this.Controls.Add(this.comboBox2); + this.Controls.Add(this.cbLocationBranch); + this.Controls.Add(this.cbUserType); this.Controls.Add(this.btnSubmit); this.Controls.Add(this.btnCancel); this.Controls.Add(this.txtboxLastName); @@ -225,8 +227,8 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.ComboBox comboBoxLocation; - private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.ComboBox cbLocationBranch; + private System.Windows.Forms.ComboBox cbUserType; private System.Windows.Forms.Button btnSubmit; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.TextBox txtboxLastName; @@ -241,6 +243,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtboxFirstName; private System.Windows.Forms.TextBox txtboxEmail; private System.Windows.Forms.TextBox txtboxPhoneNumber; - private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.RadioButton chkSendPassword; } } \ No newline at end of file diff --git a/NoSQLSolution/DemoApp/AddUserForm.cs b/NoSQLSolution/DemoApp/AddUserForm.cs index 33eee62..67161cd 100644 --- a/NoSQLSolution/DemoApp/AddUserForm.cs +++ b/NoSQLSolution/DemoApp/AddUserForm.cs @@ -1,20 +1,67 @@ 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; +using Model; +using Logic; +using System.IO; namespace DemoApp { public partial class AddUserForm : Form { - public AddUserForm() + private EmployeeLogic employeeLogic; + private ManageUsersForm manageUsersForm; + public AddUserForm(ManageUsersForm userManagementForm) { InitializeComponent(); + this.manageUsersForm = userManagementForm; + employeeLogic = new EmployeeLogic(); + cbUserType.DataSource = Enum.GetValues(typeof(UserType)); + cbLocationBranch.DataSource = Enum.GetValues(typeof(LocationBranch)); + } + public void btnSubmit_Click(object sender, EventArgs e) + { + string password = GenerateRandomPassword(); + + if (string.IsNullOrWhiteSpace(txtboxFirstName.Text) || + string.IsNullOrWhiteSpace(txtboxLastName.Text) || + string.IsNullOrWhiteSpace(txtboxEmail.Text) || + string.IsNullOrWhiteSpace(txtboxPhoneNumber.Text)) + { + MessageBox.Show("Please fill in all fields."); + return; + } + Employee newEmployee = new Employee + { + Firstname = txtboxFirstName.Text.Trim(), + Lastname = txtboxLastName.Text.Trim(), + Email = txtboxEmail.Text.Trim(), + Phonenumber = txtboxPhoneNumber.Text.Trim(), + UserType = (UserType)cbUserType.SelectedItem, + BranchLocation = (LocationBranch)cbLocationBranch.SelectedItem, + Password = password, + }; + + try + { + employeeLogic.AddEmployee(newEmployee); + manageUsersForm.AddUserToListView(newEmployee, password); + MessageBox.Show("Employee added successfully"); + this.DialogResult = DialogResult.OK; + this.Close(); + } + catch (Exception ex) + { + MessageBox.Show($"Error adding employee: {ex.Message}", "Error"); + } + } + private string GenerateRandomPassword() + { + return Path.GetRandomFileName().Replace(".", "").Substring(0, 12); + } + private void btnCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); } } } diff --git a/NoSQLSolution/DemoApp/ManageUsersForm.Designer.cs b/NoSQLSolution/DemoApp/ManageUsersForm.Designer.cs index 8fba955..a5100fd 100644 --- a/NoSQLSolution/DemoApp/ManageUsersForm.Designer.cs +++ b/NoSQLSolution/DemoApp/ManageUsersForm.Designer.cs @@ -42,8 +42,8 @@ private void InitializeComponent() this.Date = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Status = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.btnAddUser = new System.Windows.Forms.Button(); - this.txtBoxFilter = new System.Windows.Forms.TextBox(); this.lblUserManagement = new System.Windows.Forms.Label(); + this.lvUsers = new System.Windows.Forms.ListView(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -126,32 +126,35 @@ private void InitializeComponent() this.btnAddUser.TabIndex = 14; this.btnAddUser.Text = "+ ADD NEW USER"; this.btnAddUser.UseVisualStyleBackColor = true; - // - // txtBoxFilter - // - this.txtBoxFilter.Location = new System.Drawing.Point(24, 170); - this.txtBoxFilter.Name = "txtBoxFilter"; - this.txtBoxFilter.Size = new System.Drawing.Size(100, 20); - this.txtBoxFilter.TabIndex = 13; + this.btnAddUser.Click += new System.EventHandler(this.BtnAddUser_Click); // // lblUserManagement // this.lblUserManagement.AutoSize = true; this.lblUserManagement.Font = new System.Drawing.Font("Microsoft Sans Serif", 24.25F); - this.lblUserManagement.Location = new System.Drawing.Point(20, 120); + this.lblUserManagement.Location = new System.Drawing.Point(20, 130); this.lblUserManagement.Name = "lblUserManagement"; this.lblUserManagement.Size = new System.Drawing.Size(285, 38); this.lblUserManagement.TabIndex = 12; this.lblUserManagement.Text = "User management"; // + // lvUsers + // + this.lvUsers.HideSelection = false; + this.lvUsers.Location = new System.Drawing.Point(27, 233); + this.lvUsers.Name = "lvUsers"; + this.lvUsers.Size = new System.Drawing.Size(593, 458); + this.lvUsers.TabIndex = 16; + this.lvUsers.UseCompatibleStateImageBehavior = false; + // // ManageUsersForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(644, 811); + this.Controls.Add(this.lvUsers); this.Controls.Add(this.listViewResults); this.Controls.Add(this.btnAddUser); - this.Controls.Add(this.txtBoxFilter); this.Controls.Add(this.lblUserManagement); this.Controls.Add(this.lblSubTitle); this.Controls.Add(this.lblTitle); @@ -161,6 +164,7 @@ private void InitializeComponent() this.Controls.Add(this.pictureBox1); this.Name = "ManageUsersForm"; this.Text = "ManageUsersForm"; + this.Load += new System.EventHandler(this.ManageUsersForm_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -182,7 +186,10 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader Date; private System.Windows.Forms.ColumnHeader Status; private System.Windows.Forms.Button btnAddUser; - private System.Windows.Forms.TextBox txtBoxFilter; private System.Windows.Forms.Label lblUserManagement; + private System.Windows.Forms.ListView lvUsers; + + + } } \ No newline at end of file diff --git a/NoSQLSolution/DemoApp/ManageUsersForm.cs b/NoSQLSolution/DemoApp/ManageUsersForm.cs index 9a4f07c..ea986d6 100644 --- a/NoSQLSolution/DemoApp/ManageUsersForm.cs +++ b/NoSQLSolution/DemoApp/ManageUsersForm.cs @@ -7,14 +7,74 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Logic; +using Model; namespace DemoApp { public partial class ManageUsersForm : Form { + private EmployeeLogic employeeLogic; + private Employee currentUser; public ManageUsersForm() { InitializeComponent(); + employeeLogic = new EmployeeLogic(); + btnAddUser.Click += BtnAddUser_Click; + Load += ManageUsersForm_Load; + } + public ManageUsersForm(Employee currentUser) + { + InitializeComponent(); + this.currentUser = currentUser; + btnAddUser.Enabled = currentUser.UserType == UserType.ServiceDesk; + } + private void BtnAddUser_Click(object sender, EventArgs e) + { + if (currentUser != null && currentUser.UserType == UserType.ServiceDesk) + { + AddUserForm addUserForm = new AddUserForm(this); + addUserForm.ShowDialog(); + } + else + { + MessageBox.Show("Only serviceDesk users are allowed to add new users."); + } + } + private void ManageUsersForm_Load(object sender, EventArgs e) + { + InitializeListViewColumns(); + lvUsers.Items.Clear(); + LoadUsers(); + } + private void InitializeListViewColumns() + { + lvUsers.Columns.Clear(); + + lvUsers.View = View.Details; + lvUsers.Columns.Add("Firstname", 120); + lvUsers.Columns.Add("Lastname", 120); + lvUsers.Columns.Add("Email", 200); + lvUsers.Columns.Add("Password", 200); + } + private void LoadUsers() + { + var employees = employeeLogic.GetAllRegularUsers(); + foreach (var employee in employees) + { + AddUserToListView(employee, "*****"); + } + } + public void AddUserToListView(Employee employee, string password) + { + var item = new ListViewItem(new[] { + employee.Firstname, + employee.Lastname, + employee.Email, + employee.Password, + }); + lvUsers.Items.Add(item); + lvUsers.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } } } diff --git a/NoSQLSolution/DemoApp/Program.cs b/NoSQLSolution/DemoApp/Program.cs index b0281ce..06ef031 100644 --- a/NoSQLSolution/DemoApp/Program.cs +++ b/NoSQLSolution/DemoApp/Program.cs @@ -20,7 +20,7 @@ static void Main() Application.SetCompatibleTextRenderingDefault(false); // tijdelijke employee - Employee employee = new Employee(ObjectId.Parse("6523b6d07171c0f1c35705f8"), 1, "Jfreese@gardengroup.nl", "Jaap", "Freese", "JFreese", "1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014", UserType.RegularUser); + Employee employee = new Employee(ObjectId.Parse("6523b6d07171c0f1c35705f8"), 1, "Jfreese@gardengroup.nl", "Jaap", "Freese", "JFreese", "1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014", UserType.RegularUser, LocationBranch.IT, "06 123456789"); Application.Run(new TicketOverviewForm(employee)); } } diff --git a/NoSQLSolution/DemoApp/TicketOverviewForm.Designer.cs b/NoSQLSolution/DemoApp/TicketOverviewForm.Designer.cs index 9cf119d..6e8240f 100644 --- a/NoSQLSolution/DemoApp/TicketOverviewForm.Designer.cs +++ b/NoSQLSolution/DemoApp/TicketOverviewForm.Designer.cs @@ -44,6 +44,7 @@ private void InitializeComponent() this.Date = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Status = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lblFilter = new System.Windows.Forms.Label(); + this.btnCloseTicket = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -177,12 +178,23 @@ private void InitializeComponent() this.lblFilter.TabIndex = 10; this.lblFilter.Text = "Filter by E-mail:"; // + // btnCloseTicket + // + this.btnCloseTicket.BackColor = System.Drawing.Color.Gainsboro; + this.btnCloseTicket.Location = new System.Drawing.Point(342, 170); + this.btnCloseTicket.Name = "btnCloseTicket"; + this.btnCloseTicket.Size = new System.Drawing.Size(105, 30); + this.btnCloseTicket.TabIndex = 12; + this.btnCloseTicket.Text = "CLOSE TICKET"; + this.btnCloseTicket.UseVisualStyleBackColor = false; + // // TicketOverviewForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(644, 811); + this.Controls.Add(this.btnCloseTicket); this.Controls.Add(this.lblFilter); this.Controls.Add(this.listViewResults); this.Controls.Add(this.btnCreateIncident); @@ -221,5 +233,6 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader Date; private System.Windows.Forms.ColumnHeader Status; private System.Windows.Forms.Label lblFilter; + private System.Windows.Forms.Button btnCloseTicket; } } \ No newline at end of file diff --git a/NoSQLSolution/DemoApp/TicketOverviewForm.cs b/NoSQLSolution/DemoApp/TicketOverviewForm.cs index aff640b..a521bfe 100644 --- a/NoSQLSolution/DemoApp/TicketOverviewForm.cs +++ b/NoSQLSolution/DemoApp/TicketOverviewForm.cs @@ -17,36 +17,36 @@ public partial class TicketOverviewForm : Form { private TicketsLogic ticketsLogic; private Employee employee; - + private Employee currentUser; public TicketOverviewForm(Employee employee) { InitializeComponent(); + this.currentUser = currentUser; + btnUserManagement.Click += btnUserManagement_Click; + btnCloseTicket.Click += btnCloseTicket_Click; this.employee = employee; ticketsLogic = new TicketsLogic(); - // set settings for the listview listViewResults.View = View.Details; listViewResults.FullRowSelect = true; listViewResults.MultiSelect = false; loadTickets(); - // only show filter if user is a servicedesk employee, others can only see their own tickets if (employee.UserType == UserType.ServiceDesk) { lblFilter.Visible = false; txtBoxFilter.Visible = false; } } - private void loadTickets() { - List tickets = new List(); try { - listViewResults.Items.Clear(); // making sure there is no duplicate items in the listview + listViewResults.Items.Clear(); + + List tickets = ticketsLogic.GetAllTickets(); - tickets = ticketsLogic.loadTickets(employee); foreach (Ticket ticket in tickets) { ListViewItem ticketItem = new ListViewItem($"{ticket.TicketId}"); @@ -63,14 +63,11 @@ private void loadTickets() MessageBox.Show(ex.Message, "Error ocurred"); } } - private void txtBoxFilter_Leave(object sender, EventArgs e) { - // Only use filter if text is entered if (txtBoxFilter.Text.Length > 0) loadTickets(); } - private void listViewResults_MouseClick(object sender, MouseEventArgs e) { ListViewItem selectedItem = listViewResults.SelectedItems[0]; @@ -78,18 +75,14 @@ private void listViewResults_MouseClick(object sender, MouseEventArgs e) private void btnCreateIncident_Click(object sender, EventArgs e) { - try + AddTicketForm addTicketForm = new AddTicketForm(employee); + var dialogResult = addTicketForm.ShowDialog(); + + if (dialogResult == DialogResult.OK) { - AddTicketForm addTicketForm = new AddTicketForm(employee); - addTicketForm.ShowDialog(); loadTickets(); } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Error ocurred"); - } } - private void listViewResults_MouseDoubleClick(object sender, MouseEventArgs e) { try @@ -100,8 +93,54 @@ private void listViewResults_MouseDoubleClick(object sender, MouseEventArgs e) } catch (Exception ex) { - MessageBox.Show(ex.Message, "Error ocurred"); + MessageBox.Show(ex.Message, "Error"); + } + } + private void btnUserManagement_Click(object sender, EventArgs e) + { + try + { + ManageUsersForm manageUsersForm = new ManageUsersForm(); + this.Hide(); + manageUsersForm.ShowDialog(); + this.Close(); + } + + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Error"); + } + } + private void btnCloseTicket_Click(object sender, EventArgs e) + { + if (currentUser != null && currentUser.UserType == UserType.ServiceDesk) + { + if (listViewResults.SelectedItems.Count == 0) + { + MessageBox.Show("Please select a ticket to close."); + return; + } + var result = MessageBox.Show("Are you sure you want to close this ticket?", "Confirm Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + try + { + var selectedTicketItem = listViewResults.SelectedItems[0]; + var selectedTicket = (Ticket)selectedTicketItem.Tag; + + ticketsLogic.CloseTicket(selectedTicket.TicketId); + listViewResults.Items.Remove(selectedTicketItem); + } + catch (Exception ex) + { + MessageBox.Show($"Error closing ticket: {ex.Message}", "Error"); + } + } + } + else + { + MessageBox.Show("Only ServiceDesk users are allowed to close tickets.", "Access Denied"); } } } -} +} \ No newline at end of file diff --git a/NoSQLSolution/DemoApp/bin/Debug/DAL.dll b/NoSQLSolution/DemoApp/bin/Debug/DAL.dll index fe8e47a..17b7be6 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/DAL.dll and b/NoSQLSolution/DemoApp/bin/Debug/DAL.dll differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/DAL.pdb b/NoSQLSolution/DemoApp/bin/Debug/DAL.pdb index a676e63..f9d3e72 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/DAL.pdb and b/NoSQLSolution/DemoApp/bin/Debug/DAL.pdb differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/DemoApp.exe b/NoSQLSolution/DemoApp/bin/Debug/DemoApp.exe index c8b8868..3416881 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/DemoApp.exe and b/NoSQLSolution/DemoApp/bin/Debug/DemoApp.exe differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/DemoApp.pdb b/NoSQLSolution/DemoApp/bin/Debug/DemoApp.pdb index 5a68e41..5c8ade6 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/DemoApp.pdb and b/NoSQLSolution/DemoApp/bin/Debug/DemoApp.pdb differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/Logic.dll b/NoSQLSolution/DemoApp/bin/Debug/Logic.dll index bbafe55..1f3bf63 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/Logic.dll and b/NoSQLSolution/DemoApp/bin/Debug/Logic.dll differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/Logic.pdb b/NoSQLSolution/DemoApp/bin/Debug/Logic.pdb index a85a9be..ddc7673 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/Logic.pdb and b/NoSQLSolution/DemoApp/bin/Debug/Logic.pdb differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/Model.dll b/NoSQLSolution/DemoApp/bin/Debug/Model.dll index 16d4971..15335e3 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/Model.dll and b/NoSQLSolution/DemoApp/bin/Debug/Model.dll differ diff --git a/NoSQLSolution/DemoApp/bin/Debug/Model.pdb b/NoSQLSolution/DemoApp/bin/Debug/Model.pdb index 6e1c358..c7d4767 100644 Binary files a/NoSQLSolution/DemoApp/bin/Debug/Model.pdb and b/NoSQLSolution/DemoApp/bin/Debug/Model.pdb differ diff --git a/NoSQLSolution/DemoApp/obj/Debug/DemoApp.exe b/NoSQLSolution/DemoApp/obj/Debug/DemoApp.exe index c8b8868..3416881 100644 Binary files a/NoSQLSolution/DemoApp/obj/Debug/DemoApp.exe and b/NoSQLSolution/DemoApp/obj/Debug/DemoApp.exe differ diff --git a/NoSQLSolution/DemoApp/obj/Debug/DemoApp.pdb b/NoSQLSolution/DemoApp/obj/Debug/DemoApp.pdb index 5a68e41..5c8ade6 100644 Binary files a/NoSQLSolution/DemoApp/obj/Debug/DemoApp.pdb and b/NoSQLSolution/DemoApp/obj/Debug/DemoApp.pdb differ diff --git a/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 41c5738..1d6ebc8 100644 Binary files a/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index afd1fb7..3240591 100644 Binary files a/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/NoSQLSolution/DemoApp/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.AssemblyReference.cache b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.AssemblyReference.cache index af4ab7e..812b9a0 100644 Binary files a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.AssemblyReference.cache and b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.AssemblyReference.cache differ diff --git a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.CoreCompileInputs.cache b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.CoreCompileInputs.cache index 66139ea..d242cba 100644 --- a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.CoreCompileInputs.cache +++ b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -f9ee86a2ab5283fdc603d3d7d531ceb44dfc50e7 +e451e862b7e34b07964287e85cd0d28dd86e4e16 diff --git a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.FileListAbsolute.txt b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.FileListAbsolute.txt index f88555f..bfd6541 100644 --- a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.FileListAbsolute.txt +++ b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.FileListAbsolute.txt @@ -81,3 +81,50 @@ C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project N C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.AddUserForm.resources C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.ManageUsersForm.resources C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.TicketView.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\UI.csproj.AssemblyReference.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\UI.csproj.SuggestedBindingRedirects.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.AddTicketForm.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.AddUserForm.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.DashboardStatsForm.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.LoginForm.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.ManageUsersForm.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.Properties.Resources.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.TicketOverviewForm.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.TicketView.resources +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\UI.csproj.GenerateResource.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\UI.csproj.CoreCompileInputs.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.exe +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\DemoApp.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\snappy32.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\snappy64.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\libzstd.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\mongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DemoApp.exe.config +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DemoApp.exe +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DemoApp.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\CircularProgressBar.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DnsClient.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\Logic.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\Model.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Bson.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Driver.Core.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Driver.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Libmongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\SharpCompress.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\System.Buffers.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\System.ValueTuple.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\WinFormAnimation.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DAL.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\Logic.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\Model.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\CircularProgressBar.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DnsClient.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Bson.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Driver.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\MongoDB.Driver.Core.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\System.Buffers.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\System.ValueTuple.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\bin\Debug\DAL.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\DemoApp\obj\Debug\UI.csproj.CopyComplete diff --git a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.GenerateResource.cache b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.GenerateResource.cache index 1dda7b0..b2a52f1 100644 Binary files a/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.GenerateResource.cache and b/NoSQLSolution/DemoApp/obj/Debug/UI.csproj.GenerateResource.cache differ diff --git a/NoSQLSolution/Logic/EmployeeLogic.cs b/NoSQLSolution/Logic/EmployeeLogic.cs index 4e5bf4c..c7a1556 100644 --- a/NoSQLSolution/Logic/EmployeeLogic.cs +++ b/NoSQLSolution/Logic/EmployeeLogic.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net.Mail; using System.Text; using System.Threading.Tasks; @@ -11,6 +12,7 @@ namespace Logic public class EmployeeLogic { private EmployeeDao employeeDao; + private TicketsDao ticketsDao; public EmployeeLogic() { @@ -20,5 +22,10 @@ public List GetAllRegularUsers() { return employeeDao.GetAllRegularUsers(); } + public void AddEmployee(Employee employee) + { + employeeDao.Insert(employee); + + } } } diff --git a/NoSQLSolution/Logic/TicketsLogic.cs b/NoSQLSolution/Logic/TicketsLogic.cs index 67d645b..c605bf0 100644 --- a/NoSQLSolution/Logic/TicketsLogic.cs +++ b/NoSQLSolution/Logic/TicketsLogic.cs @@ -44,5 +44,9 @@ public void updateTicket(Ticket ticket) { ticketsDao.updateTicket(ticket); } + public void CloseTicket(int ticketId) + { + ticketsDao.CloseTicket(ticketId); + } } } diff --git a/NoSQLSolution/Logic/bin/Debug/DAL.dll b/NoSQLSolution/Logic/bin/Debug/DAL.dll index fe8e47a..17b7be6 100644 Binary files a/NoSQLSolution/Logic/bin/Debug/DAL.dll and b/NoSQLSolution/Logic/bin/Debug/DAL.dll differ diff --git a/NoSQLSolution/Logic/bin/Debug/DAL.pdb b/NoSQLSolution/Logic/bin/Debug/DAL.pdb index a676e63..f9d3e72 100644 Binary files a/NoSQLSolution/Logic/bin/Debug/DAL.pdb and b/NoSQLSolution/Logic/bin/Debug/DAL.pdb differ diff --git a/NoSQLSolution/Logic/bin/Debug/Logic.dll b/NoSQLSolution/Logic/bin/Debug/Logic.dll index bbafe55..1f3bf63 100644 Binary files a/NoSQLSolution/Logic/bin/Debug/Logic.dll and b/NoSQLSolution/Logic/bin/Debug/Logic.dll differ diff --git a/NoSQLSolution/Logic/bin/Debug/Logic.pdb b/NoSQLSolution/Logic/bin/Debug/Logic.pdb index a85a9be..ddc7673 100644 Binary files a/NoSQLSolution/Logic/bin/Debug/Logic.pdb and b/NoSQLSolution/Logic/bin/Debug/Logic.pdb differ diff --git a/NoSQLSolution/Logic/bin/Debug/Model.dll b/NoSQLSolution/Logic/bin/Debug/Model.dll index 16d4971..15335e3 100644 Binary files a/NoSQLSolution/Logic/bin/Debug/Model.dll and b/NoSQLSolution/Logic/bin/Debug/Model.dll differ diff --git a/NoSQLSolution/Logic/bin/Debug/Model.pdb b/NoSQLSolution/Logic/bin/Debug/Model.pdb index 6e1c358..c7d4767 100644 Binary files a/NoSQLSolution/Logic/bin/Debug/Model.pdb and b/NoSQLSolution/Logic/bin/Debug/Model.pdb differ diff --git a/NoSQLSolution/Logic/obj/Debug/Logic.csproj.AssemblyReference.cache b/NoSQLSolution/Logic/obj/Debug/Logic.csproj.AssemblyReference.cache index 4d8529e..32f09be 100644 Binary files a/NoSQLSolution/Logic/obj/Debug/Logic.csproj.AssemblyReference.cache and b/NoSQLSolution/Logic/obj/Debug/Logic.csproj.AssemblyReference.cache differ diff --git a/NoSQLSolution/Logic/obj/Debug/Logic.csproj.CoreCompileInputs.cache b/NoSQLSolution/Logic/obj/Debug/Logic.csproj.CoreCompileInputs.cache index ef5da42..90d5f20 100644 --- a/NoSQLSolution/Logic/obj/Debug/Logic.csproj.CoreCompileInputs.cache +++ b/NoSQLSolution/Logic/obj/Debug/Logic.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -369675a84cab0ce6c5158b68ce9815538e276a87 +33eae2473f712119f30ba2716b2977c3ee143a85 diff --git a/NoSQLSolution/Logic/obj/Debug/Logic.csproj.FileListAbsolute.txt b/NoSQLSolution/Logic/obj/Debug/Logic.csproj.FileListAbsolute.txt index 0cbf04c..8b743f6 100644 --- a/NoSQLSolution/Logic/obj/Debug/Logic.csproj.FileListAbsolute.txt +++ b/NoSQLSolution/Logic/obj/Debug/Logic.csproj.FileListAbsolute.txt @@ -60,3 +60,34 @@ C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project N C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.csproj.CopyComplete C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.dll C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\snappy32.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\snappy64.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\libzstd.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\mongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\Logic.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\Logic.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\DAL.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\Model.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Driver.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Bson.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Driver.Core.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Libmongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\DnsClient.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\System.ValueTuple.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\SharpCompress.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\System.Buffers.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\DAL.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\Model.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Driver.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Bson.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\MongoDB.Driver.Core.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\DnsClient.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\System.ValueTuple.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\bin\Debug\System.Buffers.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.csproj.AssemblyReference.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.csproj.CoreCompileInputs.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.csproj.CopyComplete +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Logic\obj\Debug\Logic.pdb diff --git a/NoSQLSolution/Logic/obj/Debug/Logic.dll b/NoSQLSolution/Logic/obj/Debug/Logic.dll index bbafe55..1f3bf63 100644 Binary files a/NoSQLSolution/Logic/obj/Debug/Logic.dll and b/NoSQLSolution/Logic/obj/Debug/Logic.dll differ diff --git a/NoSQLSolution/Logic/obj/Debug/Logic.pdb b/NoSQLSolution/Logic/obj/Debug/Logic.pdb index a85a9be..ddc7673 100644 Binary files a/NoSQLSolution/Logic/obj/Debug/Logic.pdb and b/NoSQLSolution/Logic/obj/Debug/Logic.pdb differ diff --git a/NoSQLSolution/Model/Employee.cs b/NoSQLSolution/Model/Employee.cs index 2549666..4d74928 100644 --- a/NoSQLSolution/Model/Employee.cs +++ b/NoSQLSolution/Model/Employee.cs @@ -17,8 +17,12 @@ public class Employee public string Username; public string Password; public UserType UserType; + public LocationBranch BranchLocation; + public string Phonenumber; - public Employee(ObjectId id, int ID, string email, string firstname, string lastname, string username, string password, UserType userType) + public Employee(ObjectId id, int ID, string email, string firstname, string lastname, + string username, string password, UserType userType, + LocationBranch branchLocation, string phoneNumber) { _id = id; EmployeeId = ID; @@ -28,11 +32,27 @@ public Employee(ObjectId id, int ID, string email, string firstname, string last Username = username; Password = password; UserType = userType; + BranchLocation = branchLocation; + Phonenumber = phoneNumber; + } + public Employee(int ID, string email, string firstname, string lastname, + string username, string password, UserType userType, + LocationBranch branchLocation, string phoneNumber) + { + EmployeeId = ID; + Email = email; + Firstname = firstname; + Lastname = lastname; + Username = username; + Password = password; + UserType = userType; + BranchLocation = branchLocation; + Phonenumber = phoneNumber; } - public override string ToString() + public Employee() { - return this.Username.ToString(); } } } + diff --git a/NoSQLSolution/Model/LocationBranch.cs b/NoSQLSolution/Model/LocationBranch.cs new file mode 100644 index 0000000..3b2281f --- /dev/null +++ b/NoSQLSolution/Model/LocationBranch.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public enum LocationBranch + { + IT, Finance, Medical + } +} diff --git a/NoSQLSolution/Model/Model.csproj b/NoSQLSolution/Model/Model.csproj index 5ef4688..39a0f9f 100644 --- a/NoSQLSolution/Model/Model.csproj +++ b/NoSQLSolution/Model/Model.csproj @@ -113,6 +113,7 @@ + diff --git a/NoSQLSolution/Model/bin/Debug/Model.dll b/NoSQLSolution/Model/bin/Debug/Model.dll index 16d4971..15335e3 100644 Binary files a/NoSQLSolution/Model/bin/Debug/Model.dll and b/NoSQLSolution/Model/bin/Debug/Model.dll differ diff --git a/NoSQLSolution/Model/bin/Debug/Model.pdb b/NoSQLSolution/Model/bin/Debug/Model.pdb index 6e1c358..c7d4767 100644 Binary files a/NoSQLSolution/Model/bin/Debug/Model.pdb and b/NoSQLSolution/Model/bin/Debug/Model.pdb differ diff --git a/NoSQLSolution/Model/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/NoSQLSolution/Model/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 90ca57e..9c2fe83 100644 Binary files a/NoSQLSolution/Model/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/NoSQLSolution/Model/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/NoSQLSolution/Model/obj/Debug/Model.csproj.AssemblyReference.cache b/NoSQLSolution/Model/obj/Debug/Model.csproj.AssemblyReference.cache index b9c6483..ae70a7e 100644 Binary files a/NoSQLSolution/Model/obj/Debug/Model.csproj.AssemblyReference.cache and b/NoSQLSolution/Model/obj/Debug/Model.csproj.AssemblyReference.cache differ diff --git a/NoSQLSolution/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache b/NoSQLSolution/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache index cc150f3..fce05d1 100644 --- a/NoSQLSolution/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache +++ b/NoSQLSolution/Model/obj/Debug/Model.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -6aabc7b18f46f7098576897e79b0af53ab38f1e6 +0be1d2ca2bb9653a58d773e71e76e6280e99fdaa diff --git a/NoSQLSolution/Model/obj/Debug/Model.csproj.FileListAbsolute.txt b/NoSQLSolution/Model/obj/Debug/Model.csproj.FileListAbsolute.txt index 63c5536..2efc71c 100644 --- a/NoSQLSolution/Model/obj/Debug/Model.csproj.FileListAbsolute.txt +++ b/NoSQLSolution/Model/obj/Debug/Model.csproj.FileListAbsolute.txt @@ -52,3 +52,30 @@ C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project N C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\Model\obj\Debug\Model.csproj.CopyComplete C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\Model\obj\Debug\Model.dll C:\Users\coen\OneDrive - Hogeschool Inholland\Laptop\Documenten\School\Project NoSQL\NoSQLSolution\Model\obj\Debug\Model.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\snappy32.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\snappy64.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\libzstd.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\mongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\Model.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\Model.pdb +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\DnsClient.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Bson.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Driver.Core.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Driver.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Libmongocrypt.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\SharpCompress.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\System.Buffers.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\System.ValueTuple.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\DnsClient.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Bson.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Driver.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\MongoDB.Driver.Core.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\System.Buffers.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\bin\Debug\System.ValueTuple.xml +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\obj\Debug\Model.csproj.AssemblyReference.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\obj\Debug\Model.csproj.CopyComplete +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\obj\Debug\Model.dll +C:\Users\selim\source\Project NoSQL\Project-NoSQL\NoSQLSolution\Model\obj\Debug\Model.pdb diff --git a/NoSQLSolution/Model/obj/Debug/Model.dll b/NoSQLSolution/Model/obj/Debug/Model.dll index 16d4971..15335e3 100644 Binary files a/NoSQLSolution/Model/obj/Debug/Model.dll and b/NoSQLSolution/Model/obj/Debug/Model.dll differ diff --git a/NoSQLSolution/Model/obj/Debug/Model.pdb b/NoSQLSolution/Model/obj/Debug/Model.pdb index 6e1c358..c7d4767 100644 Binary files a/NoSQLSolution/Model/obj/Debug/Model.pdb and b/NoSQLSolution/Model/obj/Debug/Model.pdb differ