employees done, departments list+add
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,15 +7,15 @@
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\form_modify_employee.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|c:\\users\\warlock\\source\\repos\\payrollsystem\\payrollsystem\\form_employees.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|C:\\Users\\warlock\\source\\repos\\PayrollSystem\\payrollsystem\\form_employees.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\form_employees.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|c:\\users\\warlock\\source\\repos\\payrollsystem\\payrollsystem\\form_modify_employee.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|C:\\Users\\warlock\\source\\repos\\PayrollSystem\\payrollsystem\\form_modify_employee.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\form_modify_employee.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|c:\\users\\warlock\\source\\repos\\payrollsystem\\payrollsystem\\form_dashboard.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|C:\\Users\\warlock\\source\\repos\\PayrollSystem\\payrollsystem\\form_dashboard.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\form_dashboard.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
@@ -23,11 +23,11 @@
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\form_main.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|c:\\users\\warlock\\source\\repos\\payrollsystem\\payrollsystem\\helpers.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|C:\\Users\\warlock\\source\\repos\\PayrollSystem\\payrollsystem\\helpers.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\helpers.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|c:\\users\\warlock\\source\\repos\\payrollsystem\\payrollsystem\\form_employees.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"AbsoluteMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|C:\\Users\\warlock\\source\\repos\\PayrollSystem\\payrollsystem\\form_employees.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{F11EDBAB-9CD5-45D6-A949-595713DC63E2}|PayrollSystem\\PayrollSystem.csproj|solutionrelative:payrollsystem\\form_employees.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
@@ -74,8 +74,7 @@
|
||||
"RelativeToolTip": "PayrollSystem\\Helpers.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAApAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T17:37:30.193Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T17:37:30.193Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -85,7 +84,7 @@
|
||||
"RelativeDocumentMoniker": "PayrollSystem\\form_modify_employee.cs",
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\form_modify_employee.cs",
|
||||
"RelativeToolTip": "PayrollSystem\\form_modify_employee.cs",
|
||||
"ViewState": "AQIAABEAAAAAAAAAAAAQwCUAAABGAAAA",
|
||||
"ViewState": "AQIAABEAAAAAAAAAAAAxwCUAAABGAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T17:31:29.274Z",
|
||||
"EditorCaption": ""
|
||||
@@ -99,8 +98,7 @@
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\form_modify_employee.cs [Design]",
|
||||
"RelativeToolTip": "PayrollSystem\\form_modify_employee.cs [Design]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T17:28:33.607Z",
|
||||
"EditorCaption": " [Design]"
|
||||
"WhenOpened": "2024-08-25T17:28:33.607Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -112,8 +110,7 @@
|
||||
"RelativeToolTip": "PayrollSystem\\form_employees.cs",
|
||||
"ViewState": "AQIAAEIAAAAAAAAAAAAmwEcAAABKAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T17:03:13.406Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T17:03:13.406Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -124,8 +121,7 @@
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\form_employees.cs [Design]",
|
||||
"RelativeToolTip": "PayrollSystem\\form_employees.cs [Design]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T17:03:11.483Z",
|
||||
"EditorCaption": " [Design]"
|
||||
"WhenOpened": "2024-08-25T17:03:11.483Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -137,8 +133,7 @@
|
||||
"RelativeToolTip": "PayrollSystem\\form_dashboard.cs",
|
||||
"ViewState": "AQIAAAYAAAAAAAAAAAAIwBsAAABKAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T11:01:49.474Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T11:01:49.474Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -149,8 +144,7 @@
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\payrolldbDataSet.xsd",
|
||||
"RelativeToolTip": "PayrollSystem\\payrolldbDataSet.xsd",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003579|",
|
||||
"WhenOpened": "2024-08-25T10:05:24.481Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T10:05:24.481Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -162,8 +156,7 @@
|
||||
"RelativeToolTip": "PayrollSystem\\Program.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAgAAAAEAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T10:05:19.141Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T10:05:19.141Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -175,8 +168,7 @@
|
||||
"RelativeToolTip": "PayrollSystem\\Form1.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABwAAABTAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T06:05:16.764Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T06:05:16.764Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -188,8 +180,7 @@
|
||||
"RelativeToolTip": "PayrollSystem\\form_main.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABgAAAAkAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T06:04:04.236Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-08-25T06:04:04.236Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -200,8 +191,7 @@
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\form_dashboard.cs [Design]",
|
||||
"RelativeToolTip": "PayrollSystem\\form_dashboard.cs [Design]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T05:38:00.048Z",
|
||||
"EditorCaption": " [Design]"
|
||||
"WhenOpened": "2024-08-25T05:38:00.048Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -212,8 +202,7 @@
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\form_main.cs [Design]",
|
||||
"RelativeToolTip": "PayrollSystem\\form_main.cs [Design]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T05:32:49.675Z",
|
||||
"EditorCaption": " [Design]"
|
||||
"WhenOpened": "2024-08-25T05:32:49.675Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -224,8 +213,7 @@
|
||||
"ToolTip": "C:\\Users\\warlock\\source\\repos\\PayrollSystem\\PayrollSystem\\Form1.cs [Design]",
|
||||
"RelativeToolTip": "PayrollSystem\\Form1.cs [Design]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-08-25T05:21:39.964Z",
|
||||
"EditorCaption": " [Design]"
|
||||
"WhenOpened": "2024-08-25T05:21:39.964Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -73,6 +73,12 @@
|
||||
<Compile Include="form_dashboard.Designer.cs">
|
||||
<DependentUpon>form_dashboard.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form_departments.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="form_departments.Designer.cs">
|
||||
<DependentUpon>form_departments.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form_employees.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -85,6 +91,12 @@
|
||||
<Compile Include="form_main.Designer.cs">
|
||||
<DependentUpon>form_main.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form_modify_department.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="form_modify_department.Designer.cs">
|
||||
<DependentUpon>form_modify_department.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form_modify_employee.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -110,12 +122,18 @@
|
||||
<EmbeddedResource Include="form_dashboard.resx">
|
||||
<DependentUpon>form_dashboard.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form_departments.resx">
|
||||
<DependentUpon>form_departments.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form_employees.resx">
|
||||
<DependentUpon>form_employees.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form_main.resx">
|
||||
<DependentUpon>form_main.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form_modify_department.resx">
|
||||
<DependentUpon>form_modify_department.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form_modify_employee.resx">
|
||||
<DependentUpon>form_modify_employee.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
148
PayrollSystem/form_departments.Designer.cs
generated
Normal file
148
PayrollSystem/form_departments.Designer.cs
generated
Normal file
@@ -0,0 +1,148 @@
|
||||
namespace PayrollSystem
|
||||
{
|
||||
partial class form_departments
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.list_departments = new System.Windows.Forms.ListView();
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.btnEdit = new System.Windows.Forms.Button();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.btnShowEmployees = new System.Windows.Forms.Button();
|
||||
this.col_ID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.col_Name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.col_basic = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.col_employees = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// list_departments
|
||||
//
|
||||
this.list_departments.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.col_ID,
|
||||
this.col_Name,
|
||||
this.col_basic,
|
||||
this.col_employees});
|
||||
this.list_departments.FullRowSelect = true;
|
||||
this.list_departments.HideSelection = false;
|
||||
this.list_departments.Location = new System.Drawing.Point(12, 12);
|
||||
this.list_departments.MultiSelect = false;
|
||||
this.list_departments.Name = "list_departments";
|
||||
this.list_departments.Size = new System.Drawing.Size(911, 633);
|
||||
this.list_departments.TabIndex = 0;
|
||||
this.list_departments.UseCompatibleStateImageBehavior = false;
|
||||
this.list_departments.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Location = new System.Drawing.Point(929, 12);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(106, 62);
|
||||
this.btnAdd.TabIndex = 1;
|
||||
this.btnAdd.Text = "Add New Department";
|
||||
this.btnAdd.UseVisualStyleBackColor = true;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// btnEdit
|
||||
//
|
||||
this.btnEdit.Enabled = false;
|
||||
this.btnEdit.Location = new System.Drawing.Point(929, 80);
|
||||
this.btnEdit.Name = "btnEdit";
|
||||
this.btnEdit.Size = new System.Drawing.Size(106, 62);
|
||||
this.btnEdit.TabIndex = 2;
|
||||
this.btnEdit.Text = "Edit selected Department";
|
||||
this.btnEdit.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.Enabled = false;
|
||||
this.btnRemove.Location = new System.Drawing.Point(929, 148);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(106, 62);
|
||||
this.btnRemove.TabIndex = 3;
|
||||
this.btnRemove.Text = "Remove selected Department";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnShowEmployees
|
||||
//
|
||||
this.btnShowEmployees.Location = new System.Drawing.Point(929, 583);
|
||||
this.btnShowEmployees.Name = "btnShowEmployees";
|
||||
this.btnShowEmployees.Size = new System.Drawing.Size(106, 62);
|
||||
this.btnShowEmployees.TabIndex = 4;
|
||||
this.btnShowEmployees.Text = "Show Employees in Selected";
|
||||
this.btnShowEmployees.UseVisualStyleBackColor = true;
|
||||
this.btnShowEmployees.Click += new System.EventHandler(this.btnShowEmployees_Click);
|
||||
//
|
||||
// col_ID
|
||||
//
|
||||
this.col_ID.Text = "ID";
|
||||
//
|
||||
// col_Name
|
||||
//
|
||||
this.col_Name.Text = "Name";
|
||||
this.col_Name.Width = 284;
|
||||
//
|
||||
// col_basic
|
||||
//
|
||||
this.col_basic.Text = "Basic";
|
||||
this.col_basic.Width = 194;
|
||||
//
|
||||
// col_employees
|
||||
//
|
||||
this.col_employees.Text = "Employee Count";
|
||||
this.col_employees.Width = 135;
|
||||
//
|
||||
// form_departments
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1047, 657);
|
||||
this.Controls.Add(this.btnShowEmployees);
|
||||
this.Controls.Add(this.btnRemove);
|
||||
this.Controls.Add(this.btnEdit);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.list_departments);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "form_departments";
|
||||
this.Text = "form_departments";
|
||||
this.Load += new System.EventHandler(this.form_departments_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView list_departments;
|
||||
private System.Windows.Forms.Button btnAdd;
|
||||
private System.Windows.Forms.Button btnEdit;
|
||||
private System.Windows.Forms.Button btnRemove;
|
||||
private System.Windows.Forms.Button btnShowEmployees;
|
||||
private System.Windows.Forms.ColumnHeader col_ID;
|
||||
private System.Windows.Forms.ColumnHeader col_Name;
|
||||
private System.Windows.Forms.ColumnHeader col_basic;
|
||||
private System.Windows.Forms.ColumnHeader col_employees;
|
||||
}
|
||||
}
|
||||
78
PayrollSystem/form_departments.cs
Normal file
78
PayrollSystem/form_departments.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PayrollSystem
|
||||
{
|
||||
public partial class form_departments : Form
|
||||
{
|
||||
public form_departments()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void form_departments_Load(object sender, EventArgs e)
|
||||
{
|
||||
Search();
|
||||
}
|
||||
|
||||
|
||||
void Search()
|
||||
{
|
||||
string query = @"
|
||||
SELECT
|
||||
Departments.ID,
|
||||
Departments.Name,
|
||||
Departments.Basic,
|
||||
COUNT(Employees.ID) AS EmployeeCount
|
||||
FROM
|
||||
Departments
|
||||
LEFT JOIN
|
||||
Employees ON Departments.ID = Employees.Department_ID
|
||||
GROUP BY
|
||||
Departments.ID, Departments.Name, Departments.Basic;
|
||||
";
|
||||
|
||||
using (SqlConnection con = new SqlConnection(Helpers.conString))
|
||||
{
|
||||
con.Open();
|
||||
using (SqlCommand cmd = new SqlCommand(query, con)) {
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
list_departments.Items.Clear();
|
||||
while (reader.Read()) {
|
||||
ListViewItem newItem = new ListViewItem(reader["ID"].ToString());
|
||||
newItem.SubItems.Add(reader["Name"].ToString());
|
||||
newItem.SubItems.Add(reader["Basic"].ToString());
|
||||
newItem.SubItems.Add(reader["EmployeeCount"].ToString());
|
||||
|
||||
list_departments.Items.Add(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
con.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
form_modify_department addForm = new form_modify_department();
|
||||
addForm.ShowDialog();
|
||||
|
||||
Search();
|
||||
}
|
||||
|
||||
private void btnShowEmployees_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
120
PayrollSystem/form_departments.resx
Normal file
120
PayrollSystem/form_departments.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
47
PayrollSystem/form_employees.Designer.cs
generated
47
PayrollSystem/form_employees.Designer.cs
generated
@@ -47,8 +47,8 @@
|
||||
this.combo_date_type = new System.Windows.Forms.ComboBox();
|
||||
this.joined_date_picker = new System.Windows.Forms.DateTimePicker();
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.btnEdit = new System.Windows.Forms.Button();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// list_employees
|
||||
@@ -60,13 +60,16 @@
|
||||
this.col_basic,
|
||||
this.col_allowance,
|
||||
this.col_joined});
|
||||
this.list_employees.FullRowSelect = true;
|
||||
this.list_employees.HideSelection = false;
|
||||
this.list_employees.Location = new System.Drawing.Point(12, 72);
|
||||
this.list_employees.MultiSelect = false;
|
||||
this.list_employees.Name = "list_employees";
|
||||
this.list_employees.Size = new System.Drawing.Size(941, 573);
|
||||
this.list_employees.TabIndex = 0;
|
||||
this.list_employees.UseCompatibleStateImageBehavior = false;
|
||||
this.list_employees.View = System.Windows.Forms.View.Details;
|
||||
this.list_employees.SelectedIndexChanged += new System.EventHandler(this.list_employees_SelectedIndexChanged);
|
||||
//
|
||||
// col_id
|
||||
//
|
||||
@@ -212,31 +215,35 @@
|
||||
this.btnAdd.UseVisualStyleBackColor = true;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// button1
|
||||
// btnEdit
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(960, 130);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 52);
|
||||
this.button1.TabIndex = 13;
|
||||
this.button1.Text = "Edit Employee";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.btnEdit.Enabled = false;
|
||||
this.btnEdit.Location = new System.Drawing.Point(960, 130);
|
||||
this.btnEdit.Name = "btnEdit";
|
||||
this.btnEdit.Size = new System.Drawing.Size(75, 52);
|
||||
this.btnEdit.TabIndex = 13;
|
||||
this.btnEdit.Text = "Edit Employee";
|
||||
this.btnEdit.UseVisualStyleBackColor = true;
|
||||
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
|
||||
//
|
||||
// button2
|
||||
// btnRemove
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(959, 188);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 52);
|
||||
this.button2.TabIndex = 14;
|
||||
this.button2.Text = "Remove Employee";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Enabled = false;
|
||||
this.btnRemove.Location = new System.Drawing.Point(959, 188);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(75, 52);
|
||||
this.btnRemove.TabIndex = 14;
|
||||
this.btnRemove.Text = "Remove Employee";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
|
||||
//
|
||||
// form_employees
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1047, 657);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.btnRemove);
|
||||
this.Controls.Add(this.btnEdit);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.joined_date_picker);
|
||||
this.Controls.Add(this.combo_date_type);
|
||||
@@ -280,7 +287,7 @@
|
||||
private System.Windows.Forms.ColumnHeader col_allowance;
|
||||
private System.Windows.Forms.ColumnHeader col_joined;
|
||||
private System.Windows.Forms.Button btnAdd;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button btnEdit;
|
||||
private System.Windows.Forms.Button btnRemove;
|
||||
}
|
||||
}
|
||||
@@ -74,23 +74,23 @@ namespace PayrollSystem
|
||||
con.Open();
|
||||
//Prepare the WHERE Clauses
|
||||
List<string> clauses = new List<string>();
|
||||
if(txtID.Text.Length > 0) { clauses.Add($"Employees.ID='%{txtID.Text}%'"); }
|
||||
if (txtName.Text.Length > 0) { clauses.Add($"Employees.Name='%{txtID.Text}%'"); }
|
||||
if(txtID.Text.Length > 0) { clauses.Add($"Employees.ID={txtID.Text}"); }
|
||||
if (txtName.Text.Length > 0) { clauses.Add($"Employees.Name='%{txtName.Text}%'"); }
|
||||
|
||||
if(combo_date_type.SelectedItem.ToString() != "Anytime") {
|
||||
string condition = "=";
|
||||
if (combo_date_type.SelectedItem.ToString() == "After")
|
||||
{
|
||||
condition = "<";
|
||||
condition = ">";
|
||||
}else if(combo_date_type.SelectedItem.ToString() == "Before")
|
||||
{
|
||||
condition = ">";
|
||||
condition = "<";
|
||||
}
|
||||
clauses.Add($"Employees.Joined_Date{condition}{joined_date_picker.Value}");
|
||||
clauses.Add($"Employees.Joined_Date{condition}'{joined_date_picker.Value}'");
|
||||
}
|
||||
if(combo_department.SelectedItem.ToString() != "Any")
|
||||
{
|
||||
clauses.Add($"Departments.Name={combo_department.SelectedItem.ToString()}");
|
||||
clauses.Add($"Departments.Name='{combo_department.SelectedItem.ToString()}'");
|
||||
}
|
||||
|
||||
//Calculate the final WHERE statement
|
||||
@@ -101,7 +101,7 @@ namespace PayrollSystem
|
||||
}
|
||||
|
||||
string baseQuery = "SELECT Employees.ID, Employees.Name, Departments.Name as DepartmentName, Departments.Basic, Employees.Allowance, Employees.Joined_Date FROM Employees JOIN Departments ON Employees.Department_ID=Departments.ID";
|
||||
MessageBox.Show(baseQuery + querySuffix);
|
||||
// MessageBox.Show(baseQuery + querySuffix);
|
||||
using (SqlCommand cmd = new SqlCommand(baseQuery + querySuffix, con))
|
||||
{
|
||||
|
||||
@@ -132,5 +132,56 @@ namespace PayrollSystem
|
||||
|
||||
Search();
|
||||
}
|
||||
|
||||
private void list_employees_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshUI();
|
||||
}
|
||||
|
||||
void RefreshUI()
|
||||
{
|
||||
btnEdit.Enabled = list_employees.SelectedItems.Count > 0;
|
||||
btnRemove.Enabled = list_employees.SelectedItems.Count > 0;
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshUI();
|
||||
if (!btnEdit.Enabled) { return; }
|
||||
|
||||
form_modify_employee modifyForm = new form_modify_employee(int.Parse(list_employees.SelectedItems[0].Text));
|
||||
modifyForm.ShowDialog();
|
||||
|
||||
Search();
|
||||
}
|
||||
|
||||
private void btnRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshUI();
|
||||
if (!btnRemove.Enabled) { return; }
|
||||
|
||||
DialogResult confirmation = MessageBox.Show($"Are you sure to remove this Employee?\n\n{list_employees.SelectedItems[0].SubItems[1].Text}", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (confirmation == DialogResult.Yes)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(Helpers.conString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand cmd = new SqlCommand("DELETE FROM Employees WHERE ID=@id", conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@id", list_employees.SelectedItems[0].Text);
|
||||
|
||||
int result = cmd.ExecuteNonQuery();
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
MessageBox.Show($"There was an error removing employee", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
Search();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
PayrollSystem/form_main.Designer.cs
generated
4
PayrollSystem/form_main.Designer.cs
generated
@@ -66,6 +66,7 @@
|
||||
this.btn_departments.TabIndex = 2;
|
||||
this.btn_departments.Text = "Departments";
|
||||
this.btn_departments.UseVisualStyleBackColor = true;
|
||||
this.btn_departments.Click += new System.EventHandler(this.btn_departments_Click);
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
@@ -76,6 +77,7 @@
|
||||
this.btnExit.TabIndex = 3;
|
||||
this.btnExit.Text = "Exit";
|
||||
this.btnExit.UseVisualStyleBackColor = true;
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
@@ -96,6 +98,8 @@
|
||||
this.Controls.Add(this.btn_dash);
|
||||
this.Name = "form_main";
|
||||
this.Text = "Payroll Management System - Dashboard";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.form_main_FormClosed);
|
||||
this.Load += new System.EventHandler(this.form_main_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace PayrollSystem
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowDash();
|
||||
}
|
||||
|
||||
void ShowDash()
|
||||
{
|
||||
form_dashboard dashboard = new form_dashboard();
|
||||
dashboard.TopLevel = false;
|
||||
@@ -36,5 +41,31 @@ namespace PayrollSystem
|
||||
panel1.Controls.Add(employees);
|
||||
employees.Show();
|
||||
}
|
||||
|
||||
private void btn_departments_Click(object sender, EventArgs e)
|
||||
{
|
||||
form_departments deparments = new form_departments();
|
||||
deparments.TopLevel = false;
|
||||
deparments.AutoScroll = true;
|
||||
panel1.Controls.Clear();
|
||||
panel1.Controls.Add(deparments);
|
||||
deparments.Show();
|
||||
|
||||
}
|
||||
|
||||
private void form_main_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void form_main_Load(object sender, EventArgs e)
|
||||
{
|
||||
ShowDash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
136
PayrollSystem/form_modify_department.Designer.cs
generated
Normal file
136
PayrollSystem/form_modify_department.Designer.cs
generated
Normal file
@@ -0,0 +1,136 @@
|
||||
namespace PayrollSystem
|
||||
{
|
||||
partial class form_modify_department
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
this.txtBasic = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.btn_cancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(32, 34);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(99, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Department Name :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(92, 65);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(39, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "Basic :";
|
||||
//
|
||||
// txtName
|
||||
//
|
||||
this.txtName.Location = new System.Drawing.Point(137, 31);
|
||||
this.txtName.Name = "txtName";
|
||||
this.txtName.Size = new System.Drawing.Size(302, 20);
|
||||
this.txtName.TabIndex = 2;
|
||||
//
|
||||
// txtBasic
|
||||
//
|
||||
this.txtBasic.Location = new System.Drawing.Point(137, 62);
|
||||
this.txtBasic.Name = "txtBasic";
|
||||
this.txtBasic.Size = new System.Drawing.Size(188, 20);
|
||||
this.txtBasic.TabIndex = 3;
|
||||
this.txtBasic.Text = "0";
|
||||
this.txtBasic.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(331, 65);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(20, 13);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "Rs";
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Location = new System.Drawing.Point(318, 105);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAdd.TabIndex = 5;
|
||||
this.btnAdd.Text = "Add";
|
||||
this.btnAdd.UseVisualStyleBackColor = true;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// btn_cancel
|
||||
//
|
||||
this.btn_cancel.Location = new System.Drawing.Point(399, 105);
|
||||
this.btn_cancel.Name = "btn_cancel";
|
||||
this.btn_cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btn_cancel.TabIndex = 6;
|
||||
this.btn_cancel.Text = "Cancel";
|
||||
this.btn_cancel.UseVisualStyleBackColor = true;
|
||||
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
|
||||
//
|
||||
// form_modify_department
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(486, 140);
|
||||
this.Controls.Add(this.btn_cancel);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.txtBasic);
|
||||
this.Controls.Add(this.txtName);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "form_modify_department";
|
||||
this.Text = "form_modify_department";
|
||||
this.Load += new System.EventHandler(this.form_modify_department_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtName;
|
||||
private System.Windows.Forms.TextBox txtBasic;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button btnAdd;
|
||||
private System.Windows.Forms.Button btn_cancel;
|
||||
}
|
||||
}
|
||||
85
PayrollSystem/form_modify_department.cs
Normal file
85
PayrollSystem/form_modify_department.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PayrollSystem
|
||||
{
|
||||
public partial class form_modify_department : Form
|
||||
{
|
||||
int editingId=-1;
|
||||
bool isEditing => editingId >= 0;
|
||||
public form_modify_department(int editId=-1)
|
||||
{
|
||||
InitializeComponent();
|
||||
editingId = editId;
|
||||
}
|
||||
|
||||
private void form_modify_department_Load(object sender, EventArgs e)
|
||||
{
|
||||
Text = isEditing ? "Edit Department" : "Add new Department";
|
||||
btnAdd.Text = isEditing ? "Edit" : "Add";
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Validate inputs
|
||||
if(txtName.Text.Length <= 1) { MessageBox.Show("Please enter a name longer than 1 letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
|
||||
int basic = 0;
|
||||
try
|
||||
{
|
||||
basic = Convert.ToInt32(txtBasic.Text);
|
||||
if(basic <= 0)
|
||||
{
|
||||
MessageBox.Show("Enter a valid basic pay amount, Employees must be paid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Enter a number on the basic", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
|
||||
}
|
||||
|
||||
|
||||
if (isEditing)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Insert();
|
||||
}
|
||||
}
|
||||
|
||||
void Insert()
|
||||
{
|
||||
using (SqlConnection con = new SqlConnection(Helpers.conString))
|
||||
{
|
||||
con.Open();
|
||||
using (SqlCommand cmd = new SqlCommand("INSERT INTO Departments (Name, Basic) VALUES(@name,@basic)", con))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@name", txtName.Text);
|
||||
cmd.Parameters.AddWithValue("@basic", txtBasic.Text);
|
||||
|
||||
int result = cmd.ExecuteNonQuery();
|
||||
if (result < 0)
|
||||
{
|
||||
MessageBox.Show("There was an error adding new department", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
con.Close();
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btn_cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
PayrollSystem/form_modify_department.resx
Normal file
120
PayrollSystem/form_modify_department.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -41,6 +41,42 @@ namespace PayrollSystem
|
||||
if (combo_department.Items.Count > 0) { combo_department.SelectedIndex = 0; }
|
||||
}
|
||||
}
|
||||
|
||||
if (isEditing)
|
||||
{
|
||||
using(SqlCommand cmd = new SqlCommand("SELECT * FROM Employees WHERE ID=@id",con))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@id", editingId);
|
||||
|
||||
using(SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
txtName.Text = reader["Name"].ToString();
|
||||
txtAllowance.Text = reader["Allowance"].ToString();
|
||||
|
||||
string depId = reader["Department_ID"].ToString();
|
||||
foreach(KeyValuePair<string,string> department in departmentIdDic)
|
||||
{
|
||||
if(department.Value == depId)
|
||||
{
|
||||
for(int i=0; i < combo_department.Items.Count; i++)
|
||||
{
|
||||
if(combo_department.Items[i].ToString() == depId)
|
||||
{
|
||||
combo_department.SelectedIndex =i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
date_joined.Value = DateTime.Parse(reader["Joined_Date"].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
con.Close();
|
||||
}
|
||||
|
||||
@@ -55,11 +91,31 @@ namespace PayrollSystem
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Validate the inputs
|
||||
if(txtName.Text.Length <= 2) { MessageBox.Show("Please enter a name longer than 2 letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
|
||||
try
|
||||
{
|
||||
int allowance = Convert.ToInt32(txtAllowance.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Enter a valid input on the allowance", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
|
||||
}
|
||||
|
||||
|
||||
using (SqlConnection connection = new SqlConnection(Helpers.conString))
|
||||
{
|
||||
string query = "INSERT INTO Employees (Name, Department_ID, Allowance, Joined_Date) VALUES(@name, @depId, @allowance, @joinedDate)";
|
||||
if (isEditing)
|
||||
{
|
||||
query = "UPDATE Employees SET Name=@name, Department_ID=@depId, Allowance=@allowance, Joined_Date=@joinedDate WHERE ID=@id";
|
||||
}
|
||||
using (SqlCommand command = new SqlCommand(query, connection))
|
||||
{
|
||||
if (isEditing)
|
||||
{
|
||||
command.Parameters.AddWithValue("@id", editingId);
|
||||
}
|
||||
command.Parameters.AddWithValue("@name", txtName.Text);
|
||||
command.Parameters.AddWithValue("@depId", departmentIdDic[combo_department.SelectedItem.ToString()]);
|
||||
command.Parameters.AddWithValue("@allowance", txtAllowance.Text);
|
||||
@@ -71,10 +127,12 @@ namespace PayrollSystem
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
MessageBox.Show("There was an error adding new employee", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show($"There was an error {(isEditing ? "editing" : "adding new")} employee", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
f0475c0bcd5a36c968bb1dae4fa9ab9f3ebd0b02be5078e6215513bfbd4b243e
|
||||
13d37ad0a7cb2bc32946ea1a632a9a66c057688644a20571be28f2c378649b21
|
||||
|
||||
@@ -14,3 +14,5 @@ C:\Users\warlock\source\repos\PayrollSystem\PayrollSystem\bin\Debug\payrolldb.md
|
||||
C:\Users\warlock\source\repos\PayrollSystem\PayrollSystem\bin\Debug\payrolldb_log.ldf
|
||||
C:\Users\warlock\source\repos\PayrollSystem\PayrollSystem\obj\Debug\PayrollSystem.form_employees.resources
|
||||
C:\Users\warlock\source\repos\PayrollSystem\PayrollSystem\obj\Debug\PayrollSystem.form_modify_employee.resources
|
||||
C:\Users\warlock\source\repos\PayrollSystem\PayrollSystem\obj\Debug\PayrollSystem.form_departments.resources
|
||||
C:\Users\warlock\source\repos\PayrollSystem\PayrollSystem\obj\Debug\PayrollSystem.form_modify_department.resources
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
PayrollSystem/obj/Debug/PayrollSystem.form_departments.resources
Normal file
BIN
PayrollSystem/obj/Debug/PayrollSystem.form_departments.resources
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user