Laboratory Monitoring Project in C#
The Laboratory Monitoring Project in C# is an automated system developed in C# and MySQL is used for the database. The Laboratory Monitoring Project is a user-friendly system that users can easily operate and understood how the system will operate. In The Laboratory Monitoring Project, we can view with ease the list of items that contain the barcode number, brand, description, location, and parts, etc. The user can view the reports in charts and graphs to see the daily reports, damaged, lost, and items, etc.
Functional Requirements of Laboratory Monitoring System
Let’s see the following Functional Requirements of the system
- The user can Add/delete/view/update Items
- The user can Transfer Items
- Under Maintenance Items
- The user can searchLost Items
- The user can view Damaged Items
- Add/delete/view/update Parts
- Add/delete/view/update Brands
- Add/delete/view/update Locations
- Add/delete/view/update Computer Set
- Add/delete/view/update Users
- The user can Print List of Items
- The user can Print List of Damaged Items
- The user can Print List of Transferred Items
- The user can Print List of Lost Items
- The user can Print List of Under Maintenance Items
- The user can Logout
- The user can Login
- The user can Register
How to log in with Admin user?
Username:Â admin
Password:Â admin
frmBrand.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ComputerMonitoringSystem { public partial class frmBrand : Form { public frmBrand() { InitializeComponent(); } SQLConfig config = new SQLConfig(); usableFunction funct = new usableFunction(); string BrandID = "0"; string sql; private void btnnew_Click(object sender, EventArgs e) { BrandID = "0"; txtBrand.Clear(); txtDesc.Clear(); sql = "Select BrandID,`Brand`,`Description` From tblbrand"; config.Load_DTG(sql, dtglist); } private void frmBrand_Load(object sender, EventArgs e) { btnnew_Click(sender, e); } private void dtglist_CellClick(object sender, DataGridViewCellEventArgs e) { BrandID = dtglist.CurrentRow.Cells[0].Value.ToString(); txtBrand.Text = dtglist.CurrentRow.Cells[1].Value.ToString(); txtDesc.Text = dtglist.CurrentRow.Cells[2].Value.ToString(); } private void btnsave_Click(object sender, EventArgs e) { if( txtBrand.Text == "") { funct.messagerequired(); } sql = "Select * From tblbrand WHERE BrandID = " + BrandID; config.singleResult(sql); if(config.dt.Rows.Count > 0) { sql = "UPDATE `tblBrand` SET `Brand`='" + txtBrand.Text + "',`Description`='" + txtDesc.Text + "' WHERE BrandID=" + BrandID; config.Execute_CUD(sql, "error to execute the query", "Brand has been updated in the database."); } else { sql = "INSERT INTO `tblBrand` (`Brand`,`Description`) VALUES ('" + txtBrand.Text + "','" + txtDesc.Text + "')"; config.Execute_CUD(sql, "error to execute the query", "New brand has been saved in the database"); } frmBrand_Load(sender, e); } private void txtSearch_TextChanged(object sender, EventArgs e) { sql = "Select BrandID,`Brand`,`Description` From tblbrand WHERE Brand Like '%" + txtSearch.Text + "%'"; config.Load_DTG(sql, dtglist); } private void btnDelete_Click(object sender, EventArgs e) { sql = "DELETE From tblbrand WHERE BrandID = " + BrandID; config.Execute_CUD(sql, "error to execute the query", "Brand has been deleted in the database"); frmBrand_Load(sender, e); } } } |
frmLost.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ComputerMonitoringSystem { public partial class frmLost : Form { public frmLost() { InitializeComponent(); } SQLConfig config = new SQLConfig(); usableFunction funct = new usableFunction(); string sql; int CompSetID, maxrow; private void txtSearch_TextChanged(object sender, EventArgs e) { sql = "SELECT ItemID, `Parts`,`Location`, `ComputerSet` " + "FROM `tblbrand` b,`tblitems` i, `tblparts` p, `tbllocation` l,tblcompset c " + "WHERE b.`BrandID`=i.`BrandID` AND i.`PartsID`=p.`PartsID` AND i.`LocationID`=l.`LocationID` " + "AND i.CompSetID=c.CompSetID AND Status in ('Good','Damaged','Maintenance') AND (Parts Like '%" + txtSearch.Text + "%' OR Location Like '%" + txtSearch.Text + "%' OR ComputerSet Like '%" + txtSearch.Text + "%' OR CONCAT(Parts,' ',ComputerSet,' ', Location) LIKE '%" + txtSearch.Text + "%') AND Status!='Lost'"; config.Load_DTG(sql, dtgList); dtgList.Columns[0].Visible = false; } private void dtgList_CellClick(object sender, DataGridViewCellEventArgs e) { sql = "SELECT *,i.Description as ItemDesc " + " FROM `tblbrand` b,`tblitems` i, `tblparts` p, `tbllocation` l,tblcompset c " + "WHERE b.`BrandID`=i.`BrandID` AND i.`PartsID`=p.`PartsID` " + "AND i.`LocationID`=l.`LocationID` AND i.CompSetID=c.CompSetID AND Status in ('Good','Damaged','Maintenance') AND ItemID=" + dtgList.CurrentRow.Cells[0].Value; maxrow = config.maxrow(sql); if (maxrow > 0) { txtBarcode.Text = config.dt.Rows[0].Field<string>("Barcode"); txtBrand.Text = config.dt.Rows[0].Field<string>("Brand"); txtItems.Text = config.dt.Rows[0].Field<string>("ItemDesc"); txtParts.Text = config.dt.Rows[0].Field<string>("Parts"); txtLocated.Text = config.dt.Rows[0].Field<string>("Location"); txtCompSet.Text = config.dt.Rows[0].Field<string>("ComputerSet"); } } private void btnTransfer_Click(object sender, EventArgs e) { if( txtBarcode.Text == "") { funct.messagerequired(); } sql = "UPDATE `tblitems` SET `Status`='Lost',RecievedDate = Now() WHERE `ItemID`=" + dtgList.CurrentRow.Cells[0].Value; config.Execute_Query(sql); frmLost_Load(sender, e); MessageBox.Show("Computer parts has been lost."); } private void frmLost_Load(object sender, EventArgs e) { sql = "SELECT ItemID, `Parts`,`Location`, `ComputerSet` FROM `tblbrand` b,`tblitems` i, `tblparts` p, `tbllocation` l,tblcompset c WHERE b.`BrandID`=i.`BrandID` AND i.`PartsID`=p.`PartsID` AND i.`LocationID`=l.`LocationID` AND i.CompSetID=c.CompSetID AND Status!='Lost'"; config.Load_DTG(sql, dtgList); dtgList.Columns[0].Visible = false; funct.clearTxt(GroupBox1); } } } |
frmMaintenance.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ComputerMonitoringSystem { public partial class frmMaintenance : Form { public frmMaintenance() { InitializeComponent(); } SQLConfig config = new SQLConfig(); usableFunction funct = new usableFunction(); string sql; int CompSetID, maxrow; private void txtSearch_TextChanged(object sender, EventArgs e) { sql = "SELECT ItemID, `Parts`,`Location`, `ComputerSet` " + "FROM `tblbrand` b,`tblitems` i, `tblparts` p, `tbllocation` l,tblcompset c " + "WHERE b.`BrandID`=i.`BrandID` AND i.`PartsID`=p.`PartsID` AND i.`LocationID`=l.`LocationID` " + "AND i.CompSetID=c.CompSetID AND Status='Good' AND (Parts Like '%" + txtSearch.Text + "%' OR Location Like '%" + txtSearch.Text + "%' OR ComputerSet Like '%" + txtSearch.Text + "%' OR CONCAT(Parts,' ',ComputerSet,' ', Location) LIKE '%" + txtSearch.Text + "%')"; config.Load_DTG(sql, dtgList); dtgList.Columns[0].Visible = false; } private void dtgList_CellClick(object sender, DataGridViewCellEventArgs e) { sql = "SELECT *,i.Description as ItemDesc " + " FROM `tblbrand` b,`tblitems` i, `tblparts` p, `tbllocation` l,tblcompset c " + "WHERE b.`BrandID`=i.`BrandID` AND i.`PartsID`=p.`PartsID` " + "AND i.`LocationID`=l.`LocationID` AND i.CompSetID=c.CompSetID AND Status='Good' AND ItemID=" + dtgList.CurrentRow.Cells[0].Value; maxrow = config.maxrow(sql); if (maxrow > 0) { txtBarcode.Text = config.dt.Rows[0].Field<string>("Barcode"); txtBrand.Text = config.dt.Rows[0].Field<string>("Brand"); txtItems.Text = config.dt.Rows[0].Field<string>("ItemDesc"); txtParts.Text = config.dt.Rows[0].Field<string>("Parts"); txtLocated.Text = config.dt.Rows[0].Field<string>("Location"); txtCompSet.Text = config.dt.Rows[0].Field<string>("ComputerSet"); } } private void btnTransfer_Click(object sender, EventArgs e) { if( txtBarcode.Text == "") { funct.messagerequired(); } sql = "UPDATE `tblitems` SET `Status`='Maintenance',RecievedDate = Now() WHERE `ItemID`=" + dtgList.CurrentRow.Cells[0].Value; config.Execute_Query(sql); MessageBox.Show("Computer parts has been under maintenance."); frmMaintenance_Load(sender, e); } private void frmMaintenance_Load(object sender, EventArgs e) { sql = "SELECT ItemID, `Parts`,`Location`, `ComputerSet` FROM `tblbrand` b,`tblitems` i, `tblparts` p, `tbllocation` l,tblcompset c WHERE b.`BrandID`=i.`BrandID` AND i.`PartsID`=p.`PartsID` AND i.`LocationID`=l.`LocationID` AND i.CompSetID=c.CompSetID AND Status='Good'"; config.Load_DTG(sql, dtgList); dtgList.Columns[0].Visible = false; funct.clearTxt(GroupBox1); } } } |
frmParts.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ComputerMonitoringSystem { public partial class frmParts : Form { public frmParts() { InitializeComponent(); } SQLConfig config = new SQLConfig(); usableFunction funct = new usableFunction(); string sql; int PartsID, maxrow; private void frmParts_Load(object sender, EventArgs e) { btnnew_Click(sender, e); } private void btnclose_Click(object sender, EventArgs e) { this.Close(); } private void txtSearch_TextChanged(object sender, EventArgs e) { sql = "Select PartsID,`Parts` From tblparts WHERE Parts Like '%" + txtSearch.Text + "%'"; config.Load_DTG(sql, dtglist); } private void btnsave_Click(object sender, EventArgs e) { if (txtParts.Text == "") { funct.messagerequired(); } sql = "Select * From tblparts WHERE PartsID = " + PartsID; maxrow = config.maxrow(sql); if(maxrow > 0) { sql = "UPDATE `tblparts` SET `Parts`='" + txtParts.Text + "' WHERE PartsID=" + PartsID; config.Execute_CUD(sql, "error to execute the query", "Parts has been updated in the database."); } else { sql = "INSERT INTO `tblparts` (`Parts` ) VALUES ('" + txtParts.Text + "' )"; config.Execute_CUD(sql, "error to execute the query", "New Parts has been saved in the database."); } btnnew_Click(sender, e); } private void dtglist_CellClick(object sender, DataGridViewCellEventArgs e) { PartsID = int.Parse( dtglist.CurrentRow.Cells[0].Value.ToString()); txtParts.Text = dtglist.CurrentRow.Cells[1].Value.ToString(); } private void btnnew_Click(object sender, EventArgs e) { PartsID = 0; txtParts.Clear(); sql = "Select PartsID,`Parts` From tblparts"; config.Load_DTG(sql, dtglist); } } } |
Download Full Code of Laboratory Monitoring Project in C#