├── Sample Project ├── obj │ └── Debug │ │ ├── Sample OOP Pro.csproj.CoreCompileInputs.cache │ │ ├── Sample OOP Pro.exe │ │ ├── Sample OOP Pro.pdb │ │ ├── Sample_OOP_Pro.FormMain.resources │ │ ├── DesignTimeResolveAssemblyReferences.cache │ │ ├── Sample_OOP_Pro.Forms.FormInputs.resources │ │ ├── Sample_OOP_Pro.Forms.FormLogin.resources │ │ ├── Sample_OOP_Pro.Forms.FormUpload.resources │ │ ├── Sample OOP Pro.csproj.GenerateResource.cache │ │ ├── Sample_OOP_Pro.Forms.FormDashboard.resources │ │ ├── TempPE │ │ └── Properties.Resources.Designer.cs.dll │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── Sample OOP Pro.csproj.AssemblyReference.cache │ │ ├── Sample_OOP_Pro.Forms.FormDataGridView.resources │ │ ├── Sample_OOP_Pro.Properties.Resources.resources │ │ ├── .NETFramework,Version=v4.5.AssemblyAttributes.cs │ │ ├── .NETFramework,Version=v4.5.2.AssemblyAttributes.cs │ │ └── Sample OOP Pro.csproj.FileListAbsolute.txt ├── bin │ └── Debug │ │ ├── ZstdNet.dll │ │ ├── MySql.Data.dll │ │ ├── System.Memory.dll │ │ ├── Google.Protobuf.dll │ │ ├── Sample OOP Pro.exe │ │ ├── Sample OOP Pro.pdb │ │ ├── System.Buffers.dll │ │ ├── Ubiety.Dns.Core.dll │ │ ├── K4os.Hash.xxHash.dll │ │ ├── BouncyCastle.Crypto.dll │ │ ├── K4os.Compression.LZ4.dll │ │ ├── K4os.Compression.LZ4.Streams.dll │ │ └── Sample OOP Pro.exe.config ├── .vs │ └── Sample OOP Pro │ │ └── v16 │ │ └── .suo ├── App.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── public_vars.cs ├── Forms │ ├── FormUpload.cs │ ├── FormDataGridView.cs │ ├── FormLogin.cs │ ├── FormUpload.Designer.cs │ ├── FormInputs.cs │ ├── FormDashboard.cs │ ├── FormDataGridView.Designer.cs │ ├── FormInputs.resx │ ├── FormLogin.resx │ ├── FormUpload.resx │ ├── FormDashboard.resx │ ├── FormDataGridView.resx │ ├── FormDashboard.Designer.cs │ ├── FormInputs.Designer.cs │ └── FormLogin.Designer.cs ├── Program.cs ├── Sample OOP Pro.sln ├── FormMain.cs ├── Config.cs ├── Classes │ ├── Visualizer.cs │ ├── Upload.cs │ ├── Str_Date_Time.cs │ ├── Form_UI.cs │ ├── Database.cs │ └── Validation.cs ├── FormMain.resx ├── Sample OOP Pro.csproj └── FormMain.Designer.cs ├── .vs └── Sample OOP Pro │ └── v16 │ └── .suo ├── Database └── dbinformation.sql ├── Config.cs └── Classes ├── Visualizer.cs ├── Upload.cs ├── Str_Date_Time.cs ├── Form_UI.cs ├── Database.cs └── Validation.cs /Sample Project/obj/Debug/Sample OOP Pro.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | ad3c7c3cb8c8426f8769600df83150f6cdb4c37a 2 | -------------------------------------------------------------------------------- /.vs/Sample OOP Pro/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/.vs/Sample OOP Pro/v16/.suo -------------------------------------------------------------------------------- /Sample Project/bin/Debug/ZstdNet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/ZstdNet.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/MySql.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/MySql.Data.dll -------------------------------------------------------------------------------- /Sample Project/.vs/Sample OOP Pro/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/.vs/Sample OOP Pro/v16/.suo -------------------------------------------------------------------------------- /Sample Project/bin/Debug/System.Memory.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/System.Memory.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/Google.Protobuf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/Google.Protobuf.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/Sample OOP Pro.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/Sample OOP Pro.exe -------------------------------------------------------------------------------- /Sample Project/bin/Debug/Sample OOP Pro.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/Sample OOP Pro.pdb -------------------------------------------------------------------------------- /Sample Project/bin/Debug/System.Buffers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/System.Buffers.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/Ubiety.Dns.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/Ubiety.Dns.Core.dll -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample OOP Pro.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample OOP Pro.exe -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample OOP Pro.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample OOP Pro.pdb -------------------------------------------------------------------------------- /Sample Project/bin/Debug/K4os.Hash.xxHash.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/K4os.Hash.xxHash.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/BouncyCastle.Crypto.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/BouncyCastle.Crypto.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/K4os.Compression.LZ4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/K4os.Compression.LZ4.dll -------------------------------------------------------------------------------- /Sample Project/bin/Debug/K4os.Compression.LZ4.Streams.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/bin/Debug/K4os.Compression.LZ4.Streams.dll -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.FormMain.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.FormMain.resources -------------------------------------------------------------------------------- /Sample Project/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormInputs.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormInputs.resources -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormLogin.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormLogin.resources -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormUpload.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormUpload.resources -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample OOP Pro.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample OOP Pro.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormDashboard.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormDashboard.resources -------------------------------------------------------------------------------- /Sample Project/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /Sample Project/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample OOP Pro.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample OOP Pro.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormDataGridView.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.Forms.FormDataGridView.resources -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample_OOP_Pro.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilfredpine/csharp-custom-classes/HEAD/Sample Project/obj/Debug/Sample_OOP_Pro.Properties.Resources.resources -------------------------------------------------------------------------------- /Sample Project/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Sample Project/bin/Debug/Sample OOP Pro.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Sample Project/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")] 5 | -------------------------------------------------------------------------------- /Sample Project/obj/Debug/.NETFramework,Version=v4.5.2.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")] 5 | -------------------------------------------------------------------------------- /Sample Project/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sample Project/public_vars.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Sample_OOP_Pro 8 | { 9 | class public_vars 10 | { 11 | public int user_id; 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormUpload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace Sample_OOP_Pro.Forms 12 | { 13 | public partial class FormUpload : Form 14 | { 15 | Config config = new Config(); 16 | public FormUpload() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void FormUpload_Load(object sender, EventArgs e) 22 | { 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sample Project/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | using Sample_OOP_Pro.Forms; 7 | 8 | namespace Sample_OOP_Pro 9 | { 10 | static class Program 11 | { 12 | /// 13 | /// The main entry point for the application. 14 | /// 15 | [STAThread] 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new FormLogin()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sample Project/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Sample_OOP_Pro.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sample Project/Sample OOP Pro.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31729.503 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample OOP Pro", "Sample OOP Pro.csproj", "{30ADA2B1-A8D1-405E-9F38-7417F7F7AC26}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {30ADA2B1-A8D1-405E-9F38-7417F7F7AC26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {30ADA2B1-A8D1-405E-9F38-7417F7F7AC26}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {30ADA2B1-A8D1-405E-9F38-7417F7F7AC26}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {30ADA2B1-A8D1-405E-9F38-7417F7F7AC26}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C04BD4CD-7D9B-462B-B6E5-56A69691DBFC} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormDataGridView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace Sample_OOP_Pro.Forms 5 | { 6 | public partial class FormDataGridView : Form 7 | { 8 | Config config = new Config(); 9 | public FormDataGridView() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | void loadUsers() 15 | { 16 | //optional 17 | string[] customheader = { "User ID", "Username", "Gender" }; 18 | 19 | //table methods 20 | config.db.table("select userid,username,sex from users", dgvUsers, customheader); 21 | } 22 | 23 | void searchUser() 24 | { 25 | //optional 26 | string[] customheader = { "User ID", "Username", "Gender" }; 27 | 28 | //table methods 29 | config.db.table("select userid,username,sex from users where username='" + txtUsername.Text + "'", dgvUsers, customheader); 30 | } 31 | 32 | private void FormDataGridView_Load(object sender, EventArgs e) 33 | { 34 | loadUsers(); 35 | } 36 | 37 | private void btnSearch_Click(object sender, EventArgs e) 38 | { 39 | searchUser(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sample Project/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Sample OOP Pro")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Sample OOP Pro")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("30ada2b1-a8d1-405e-9f38-7417f7f7ac26")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Database/dbinformation.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.9.2 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1:3306 6 | -- Generation Time: Feb 16, 2021 at 11:17 AM 7 | -- Server version: 8.0.18 8 | -- PHP Version: 7.2.25 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET AUTOCOMMIT = 0; 12 | START TRANSACTION; 13 | SET time_zone = "+00:00"; 14 | 15 | 16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 | /*!40101 SET NAMES utf8mb4 */; 20 | 21 | -- 22 | -- Database: `dbinformation` 23 | -- 24 | 25 | -- -------------------------------------------------------- 26 | 27 | -- 28 | -- Table structure for table `users` 29 | -- 30 | 31 | DROP TABLE IF EXISTS `users`; 32 | CREATE TABLE IF NOT EXISTS `users` ( 33 | `userid` int(11) NOT NULL AUTO_INCREMENT, 34 | `username` varchar(255) NOT NULL, 35 | `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 36 | `sex` varchar(6) NOT NULL, 37 | PRIMARY KEY (`userid`) 38 | ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; 39 | 40 | -- 41 | -- Dumping data for table `users` 42 | -- 43 | 44 | INSERT INTO `users` (`userid`, `username`, `password`, `sex`) VALUES 45 | (5, 'user101', 'MTIzNDU2Nzg=', 'MALE'); 46 | COMMIT; 47 | 48 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 49 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 50 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 51 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormLogin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace Sample_OOP_Pro.Forms 12 | { 13 | public partial class FormLogin : Form 14 | { 15 | Config config = new Config(); 16 | public_vars vars = new public_vars(); 17 | 18 | public FormLogin() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | void clear() 24 | { 25 | txtUsername.Clear(); 26 | txtPassword.Clear(); 27 | } 28 | 29 | private void btnLogin_Click(object sender, EventArgs e) 30 | { 31 | TextBox[] txt = { txtUsername, txtPassword }; 32 | if (!config.validate.txtRequired(txt)) 33 | { 34 | return; 35 | } 36 | 37 | var reader = config.db.select("select * from users where username = '" + txtUsername.Text + "' and password = '" + config.validate.encodePassword(txtPassword.Text) + "' "); 38 | if (reader.Read()) 39 | { 40 | //add your id to a global variable userId 41 | vars.user_id = Int32.Parse(reader["userid"].ToString()); 42 | 43 | FormMain frmain = new FormMain(); 44 | config.ui.Show(frmain, this); 45 | 46 | clear(); 47 | } 48 | else 49 | { 50 | MessageBox.Show("Invalid Username / Password!"); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormUpload.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Sample_OOP_Pro.Forms 3 | { 4 | partial class FormUpload 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.SuspendLayout(); 33 | // 34 | // FormUpload 35 | // 36 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 37 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 38 | this.ClientSize = new System.Drawing.Size(775, 516); 39 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 40 | this.Name = "FormUpload"; 41 | this.Text = "FormUpload"; 42 | this.Load += new System.EventHandler(this.FormUpload_Load); 43 | this.ResumeLayout(false); 44 | 45 | } 46 | 47 | #endregion 48 | } 49 | } -------------------------------------------------------------------------------- /Sample Project/FormMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using Sample_OOP_Pro.Forms; 5 | 6 | namespace Sample_OOP_Pro 7 | { 8 | public partial class FormMain : Form 9 | { 10 | Config config = new Config(); 11 | public Button[] menu; 12 | public FormMain() 13 | { 14 | InitializeComponent(); 15 | this.menu = new Button[]{ btnDashboard, btnDataGridView, btnInputs, btnProfile, btnLogout}; 16 | } 17 | 18 | private void btnDashboard_Click(object sender, EventArgs e) 19 | { 20 | config.ui.FormShow(new FormDashboard(), "Fill"); 21 | config.ui.active("FormDashboard", btnDashboard, Color.Blue, menu, Color.Gray); 22 | } 23 | 24 | private void btnDataGridView_Click(object sender, EventArgs e) 25 | { 26 | config.ui.FormShow(new FormDataGridView(), "Fill"); 27 | config.ui.active("FormDataGridView", btnDataGridView, Color.Blue, menu, Color.Gray); 28 | } 29 | 30 | private void btnInputs_Click(object sender, EventArgs e) 31 | { 32 | config.ui.FormShow(new FormInputs(), "Fill"); 33 | config.ui.active("FormInputs", btnInputs, Color.Blue, menu, Color.Gray); 34 | } 35 | 36 | private void btnLogout_Click(object sender, EventArgs e) 37 | { 38 | config.ui.Show(new FormLogin(), this); 39 | } 40 | 41 | private void lblExit_Click(object sender, EventArgs e) 42 | { 43 | Application.Exit(); 44 | } 45 | 46 | private void btnProfile_Click(object sender, EventArgs e) 47 | { 48 | config.ui.FormShow(new FormUpload(), "Fill"); 49 | config.ui.active("FormUpload", btnProfile, Color.Blue, menu, Color.Gray); 50 | } 51 | 52 | private void FormMain_Load(object sender, EventArgs e) 53 | { 54 | config.ui.FormShow(new FormDashboard(), "Fill"); 55 | config.ui.active("FormDashboard", btnDashboard, Color.Blue, menu, Color.Gray); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormInputs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace Sample_OOP_Pro.Forms 12 | { 13 | 14 | public partial class FormInputs : Form 15 | { 16 | Config config = new Config(); 17 | public FormInputs() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | void clearInputs() 23 | { 24 | txtPassword.Clear(); 25 | txtCPassword.Clear(); 26 | txtUsername.Clear(); 27 | cmbSex.SelectedIndex = -1; 28 | } 29 | 30 | private void btnSave_Click(object sender, EventArgs e) 31 | { 32 | // validation 33 | TextBox[] txt = { txtUsername, txtPassword, txtCPassword }; 34 | ComboBox[] cmb = { cmbSex }; 35 | if (!config.validate.txtRequired(txt, true) || !config.validate.cmbRequired(cmb, true)) 36 | return; 37 | 38 | // database 39 | if (config.db.exist("select username from users where username='" + txtUsername.Text + "'")) 40 | { 41 | MessageBox.Show("Username Already Exist"); 42 | } 43 | else 44 | { 45 | 46 | if (txtPassword.Text == txtCPassword.Text) 47 | { 48 | //3 lines save 49 | string[] column = { "username", "password", "sex" }; 50 | string[] value = { txtUsername.Text, config.validate.encodePassword(txtPassword.Text), cmbSex.Text }; 51 | config.db.save("users", column, value, "User Successfully Saved"); 52 | 53 | //or you can use // 1 line 54 | //config.db.cud("INSERT INTO users (username,password,sex) VALUES ('" + txtUsername.Text + "','" + txtPassword.Text + "','" + cmbSex.Text + "')","Successfully Saved"); 55 | 56 | clearInputs(); 57 | } 58 | else 59 | { 60 | MessageBox.Show("Password did not match!"); 61 | } 62 | 63 | } 64 | } 65 | 66 | private void txtUsername_KeyPress(object sender, KeyPressEventArgs e) 67 | { 68 | config.validate.alphanum(e); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Config.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using Classes; 37 | 38 | namespace Sample_OOP_Pro 39 | { 40 | class Config 41 | { 42 | /* 43 | * Database Information 44 | */ 45 | private static string host = "localhost"; 46 | private static string dbname = "dbinformation"; 47 | private static string dbuser = "root"; 48 | private static string dbpassword = ""; 49 | 50 | /* 51 | * Classes 52 | */ 53 | public Database db; 54 | public Validation validate; 55 | public Form_UI ui; 56 | public Visualizer visualizer; 57 | public Str_Date_Time date_time; 58 | public Upload upload; 59 | /* 60 | * Constructor 61 | */ 62 | public Config() 63 | { 64 | this.db = new Database(host, dbuser, dbpassword, dbname); 65 | this.validate = new Validation(); 66 | this.ui = new Form_UI(); 67 | this.visualizer = new Visualizer(); 68 | this.date_time = new Str_Date_Time(); 69 | this.upload = new Upload(); 70 | } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Sample Project/Config.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using Classes; 37 | 38 | namespace Sample_OOP_Pro 39 | { 40 | class Config 41 | { 42 | /* 43 | * Database Information 44 | */ 45 | private static string host = "localhost"; 46 | private static string dbname = "dbinformation"; 47 | private static string dbuser = "root"; 48 | private static string dbpassword = ""; 49 | 50 | /* 51 | * Classes 52 | */ 53 | public Database db; 54 | public Validation validate; 55 | public Form_UI ui; 56 | public Visualizer visualizer; 57 | public Str_Date_Time date_time; 58 | public Upload upload; 59 | /* 60 | * Constructor 61 | */ 62 | public Config() 63 | { 64 | this.db = new Database(host, dbuser, dbpassword, dbname); 65 | this.validate = new Validation(); 66 | this.ui = new Form_UI(); 67 | this.visualizer = new Visualizer(); 68 | this.date_time = new Str_Date_Time(); 69 | this.upload = new Upload(); 70 | } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Sample Project/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Sample_OOP_Pro.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sample_OOP_Pro.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Classes/Visualizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms.DataVisualization.Charting; 7 | 8 | namespace Classes 9 | { 10 | class Visualizer 11 | { 12 | /* Visualizing data 13 | * 14 | */ 15 | public void chart(Chart chart, string SeriesName, string[] x, int[] y, string chartType = "Column") 16 | { 17 | if (chart.Series[0].Name == "Series1") 18 | { 19 | //remove default series 20 | chart.Series.Remove(chart.Series["Series1"]); 21 | } 22 | //add new series 23 | chart.Series.Add(SeriesName); 24 | 25 | //chart Type 26 | switch (chartType) 27 | { 28 | case "Area": 29 | chart.Series[SeriesName].ChartType = SeriesChartType.Area; 30 | break; 31 | case "Bar": 32 | chart.Series[SeriesName].ChartType = SeriesChartType.Bar; 33 | break; 34 | case "BoxPlot": 35 | chart.Series[SeriesName].ChartType = SeriesChartType.BoxPlot; 36 | break; 37 | case "Bubble": 38 | chart.Series[SeriesName].ChartType = SeriesChartType.Bubble; 39 | break; 40 | case "Candlestick": 41 | chart.Series[SeriesName].ChartType = SeriesChartType.Candlestick; 42 | break; 43 | case "Doughnut": 44 | chart.Series[SeriesName].ChartType = SeriesChartType.Doughnut; 45 | break; 46 | case "ErrorBar": 47 | chart.Series[SeriesName].ChartType = SeriesChartType.ErrorBar; 48 | break; 49 | case "FastLine": 50 | chart.Series[SeriesName].ChartType = SeriesChartType.FastLine; 51 | break; 52 | case "FastPoint": 53 | chart.Series[SeriesName].ChartType = SeriesChartType.FastPoint; 54 | break; 55 | case "Funnel": 56 | chart.Series[SeriesName].ChartType = SeriesChartType.Funnel; 57 | break; 58 | case "Kagi": 59 | chart.Series[SeriesName].ChartType = SeriesChartType.Kagi; 60 | break; 61 | case "Line": 62 | chart.Series[SeriesName].ChartType = SeriesChartType.Line; 63 | break; 64 | case "Pie": 65 | chart.Series[SeriesName].ChartType = SeriesChartType.Pie; 66 | break; 67 | case "Point": 68 | chart.Series[SeriesName].ChartType = SeriesChartType.Point; 69 | break; 70 | default: 71 | chart.Series[SeriesName].ChartType = SeriesChartType.Column; 72 | break; 73 | } 74 | 75 | int count = 0; 76 | //pass the legend & value 77 | foreach (string addx in x) 78 | { 79 | chart.Series[SeriesName].Points.AddXY(addx, y[count]); 80 | count++; 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Sample Project/Classes/Visualizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms.DataVisualization.Charting; 7 | 8 | namespace Classes 9 | { 10 | class Visualizer 11 | { 12 | /* Visualizing data 13 | * 14 | */ 15 | public void chart(Chart chart, string SeriesName, string[] x, int[] y, string chartType = "Column") 16 | { 17 | if (chart.Series[0].Name == "Series1") 18 | { 19 | //remove default series 20 | chart.Series.Remove(chart.Series["Series1"]); 21 | } 22 | //add new series 23 | chart.Series.Add(SeriesName); 24 | 25 | //chart Type 26 | switch (chartType) 27 | { 28 | case "Area": 29 | chart.Series[SeriesName].ChartType = SeriesChartType.Area; 30 | break; 31 | case "Bar": 32 | chart.Series[SeriesName].ChartType = SeriesChartType.Bar; 33 | break; 34 | case "BoxPlot": 35 | chart.Series[SeriesName].ChartType = SeriesChartType.BoxPlot; 36 | break; 37 | case "Bubble": 38 | chart.Series[SeriesName].ChartType = SeriesChartType.Bubble; 39 | break; 40 | case "Candlestick": 41 | chart.Series[SeriesName].ChartType = SeriesChartType.Candlestick; 42 | break; 43 | case "Doughnut": 44 | chart.Series[SeriesName].ChartType = SeriesChartType.Doughnut; 45 | break; 46 | case "ErrorBar": 47 | chart.Series[SeriesName].ChartType = SeriesChartType.ErrorBar; 48 | break; 49 | case "FastLine": 50 | chart.Series[SeriesName].ChartType = SeriesChartType.FastLine; 51 | break; 52 | case "FastPoint": 53 | chart.Series[SeriesName].ChartType = SeriesChartType.FastPoint; 54 | break; 55 | case "Funnel": 56 | chart.Series[SeriesName].ChartType = SeriesChartType.Funnel; 57 | break; 58 | case "Kagi": 59 | chart.Series[SeriesName].ChartType = SeriesChartType.Kagi; 60 | break; 61 | case "Line": 62 | chart.Series[SeriesName].ChartType = SeriesChartType.Line; 63 | break; 64 | case "Pie": 65 | chart.Series[SeriesName].ChartType = SeriesChartType.Pie; 66 | break; 67 | case "Point": 68 | chart.Series[SeriesName].ChartType = SeriesChartType.Point; 69 | break; 70 | default: 71 | chart.Series[SeriesName].ChartType = SeriesChartType.Column; 72 | break; 73 | } 74 | 75 | int count = 0; 76 | //pass the legend & value 77 | foreach (string addx in x) 78 | { 79 | chart.Series[SeriesName].Points.AddXY(addx, y[count]); 80 | count++; 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Classes/Upload.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System.IO; 37 | using System.Windows.Forms; 38 | 39 | namespace Classes 40 | { 41 | class Upload 42 | { 43 | private string allowedFiles; 44 | private bool Multiselect; 45 | private string fileNameFullPath; 46 | private string fileNameWithoutExtension; 47 | private string newFileNameFullPath; 48 | 49 | public Upload(string allowedFiles = "Excel Files(.xls ,.xlsx)| *.xls ;*.xlsx|PDF Files(.pdf)|*.pdf|Text Files(*.txt)|*.txt|Word Files(.docx ,.doc)|*.docx;*.doc|Image Files(.jpg ,.jpeg, .png)|*.jpg;*.jpeg;*.png") 50 | { 51 | this.allowedFiles = allowedFiles; 52 | this.Multiselect = false; 53 | } 54 | 55 | public void browseFile(string newFileName) 56 | { 57 | OpenFileDialog dialog = new OpenFileDialog(); 58 | dialog.Filter = allowedFiles; 59 | dialog.Multiselect = Multiselect; 60 | 61 | if (dialog.ShowDialog() == DialogResult.OK) 62 | { 63 | 64 | //// get name of file with full path 65 | this.fileNameFullPath = dialog.FileName; 66 | 67 | //// getFile name without extension 68 | this.fileNameWithoutExtension = Path.GetFileNameWithoutExtension(this.fileNameFullPath); 69 | 70 | // get the extension 71 | string fileExtension = Path.GetExtension(this.fileNameFullPath); 72 | 73 | // new File name using Users Information 74 | // ex: juan_dela_cruz-division_name-position_title 75 | newFileName = newFileName.Replace(' ', '_'); 76 | 77 | // new path + file with new name 78 | this.newFileNameFullPath = @"\" + newFileName + fileExtension; 79 | 80 | } 81 | } 82 | 83 | public void copyFileToDirectory(string path = @"c:\system_upload\") 84 | { 85 | if (!Directory.Exists(path)) 86 | { 87 | Directory.CreateDirectory(path); 88 | } 89 | //save to folder 90 | File.Copy(this.fileNameFullPath, path + this.newFileNameFullPath, true); 91 | } 92 | 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Sample Project/Classes/Upload.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System.IO; 37 | using System.Windows.Forms; 38 | 39 | namespace Classes 40 | { 41 | class Upload 42 | { 43 | private string allowedFiles; 44 | private bool Multiselect; 45 | private string fileNameFullPath; 46 | private string fileNameWithoutExtension; 47 | private string newFileNameFullPath; 48 | 49 | public Upload(string allowedFiles = "Excel Files(.xls ,.xlsx)| *.xls ;*.xlsx|PDF Files(.pdf)|*.pdf|Text Files(*.txt)|*.txt|Word Files(.docx ,.doc)|*.docx;*.doc|Image Files(.jpg ,.jpeg, .png)|*.jpg;*.jpeg;*.png") 50 | { 51 | this.allowedFiles = allowedFiles; 52 | this.Multiselect = false; 53 | } 54 | 55 | public void browseFile(string newFileName) 56 | { 57 | OpenFileDialog dialog = new OpenFileDialog(); 58 | dialog.Filter = allowedFiles; 59 | dialog.Multiselect = Multiselect; 60 | 61 | if (dialog.ShowDialog() == DialogResult.OK) 62 | { 63 | 64 | //// get name of file with full path 65 | this.fileNameFullPath = dialog.FileName; 66 | 67 | //// getFile name without extension 68 | this.fileNameWithoutExtension = Path.GetFileNameWithoutExtension(this.fileNameFullPath); 69 | 70 | // get the extension 71 | string fileExtension = Path.GetExtension(this.fileNameFullPath); 72 | 73 | // new File name using Users Information 74 | // ex: juan_dela_cruz-division_name-position_title 75 | newFileName = newFileName.Replace(' ', '_'); 76 | 77 | // new path + file with new name 78 | this.newFileNameFullPath = @"\" + newFileName + fileExtension; 79 | 80 | } 81 | } 82 | 83 | public void copyFileToDirectory(string path = @"c:\system_upload\") 84 | { 85 | if (!Directory.Exists(path)) 86 | { 87 | Directory.CreateDirectory(path); 88 | } 89 | //save to folder 90 | File.Copy(this.fileNameFullPath, path + this.newFileNameFullPath, true); 91 | } 92 | 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormDashboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace Sample_OOP_Pro.Forms 12 | { 13 | public partial class FormDashboard : Form 14 | { 15 | Config config = new Config(); 16 | public_vars vars = new public_vars(); 17 | public FormDashboard() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void FormDashboard_Load(object sender, EventArgs e) 23 | { 24 | loadChartSample_Static(); 25 | loadChart_from_DB(); 26 | loadChartSample_Static_line(); 27 | } 28 | 29 | void loadChartSample_Static() 30 | { 31 | /* 32 | * SERIES MALE 33 | */ 34 | 35 | // Array Legend 36 | string[] X = { "BSIT", "BSED" }; 37 | // Add item to array Legend 38 | X = X.Concat(new string[] { "AB" }).ToArray(); 39 | // new X is "BSIT", "BSED", "AB" 40 | 41 | 42 | // Array Value 43 | int[] Y = { 12, 14 }; 44 | // Add item to array 45 | Y = Y.Concat(new int[] { 2 }).ToArray(); 46 | // Y = 12, 14, 2 47 | 48 | 49 | // Pass to Chart Methods = Male Series 50 | config.visualizer.chart(chartRight, "Male", X, Y, "Column"); 51 | 52 | //_________________________________________________________________________________ 53 | 54 | /* 55 | * NEW SERIES FEMALE 56 | */ 57 | 58 | // new 59 | string[] x2 = { "BSIT", "BSED", "AB" }; 60 | int[] y2 = { 6, 0, 16 }; 61 | 62 | // Female 63 | config.visualizer.chart(chartRight, "Female", x2, y2, "Column"); 64 | } 65 | 66 | void loadChart_from_DB() 67 | { 68 | /* 69 | * SERIES SEX 70 | */ 71 | string[] X = { }; 72 | int[] Y = { }; 73 | 74 | var reader = config.db.select("select count(*) as c, sex from users group by sex"); 75 | while (reader.Read()) 76 | { 77 | X = X.Concat(new string[] { reader["sex"].ToString() }).ToArray(); 78 | Y = Y.Concat(new int[] { Int32.Parse(reader["c"].ToString()) }).ToArray(); 79 | } 80 | 81 | // Chart Methods 82 | // ChartSeries = "Sex"; ChartType = "Column"; 83 | config.visualizer.chart(chartLeft, "Sex", X, Y, "Column"); 84 | 85 | } 86 | 87 | void loadChartSample_Static_line() 88 | { 89 | /* 90 | * SERIES MALE 91 | */ 92 | 93 | // Array Legend 94 | string[] X = { "BSIT", "BSED" }; 95 | // Add item to array Legend 96 | X = X.Concat(new string[] { "AB" }).ToArray(); 97 | // new X is "BSIT", "BSED", "AB" 98 | 99 | 100 | // Array Value 101 | int[] Y = { 12, 14 }; 102 | // Add item to array 103 | Y = Y.Concat(new int[] { 2 }).ToArray(); 104 | // Y = 12, 14, 2 105 | 106 | 107 | // Pass to Chart Methods = Male Series 108 | config.visualizer.chart(chartTop, "Male", X, Y, "Line"); 109 | 110 | //_________________________________________________________________________________ 111 | 112 | /* 113 | * NEW SERIES FEMALE 114 | */ 115 | 116 | // new 117 | string[] x2 = { "BSIT", "BSED", "AB" }; 118 | int[] y2 = { 6, 0, 16 }; 119 | 120 | // Female 121 | config.visualizer.chart(chartTop, "Female", x2, y2, "Line"); 122 | } 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /Classes/Str_Date_Time.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | using System; 36 | 37 | namespace Classes 38 | { 39 | /* Working with String date to DateTime 40 | * 41 | */ 42 | class Str_Date_Time 43 | { 44 | private string default_date_format; 45 | public Str_Date_Time(string format = "MM/dd/yyyy") 46 | { 47 | this.default_date_format = format; 48 | } 49 | 50 | public string reFormat(string date) 51 | { 52 | DateTime dt; 53 | var isValidDate = DateTime.TryParse(date, out dt); 54 | if (isValidDate) 55 | return dt.ToString(this.default_date_format); 56 | else 57 | return $"{date} is not a valid date string"; 58 | } 59 | 60 | public string toReadableDate(string date) 61 | { 62 | DateTime dt; 63 | var isValidDate = DateTime.TryParse(date, out dt); 64 | if (isValidDate) 65 | return dt.ToString("MMMM dd, yyyy"); 66 | else 67 | return $"{date} is not a valid date string"; 68 | } 69 | 70 | public string toTimeStamp(string date) 71 | { 72 | DateTime dt; 73 | var isValidDate = DateTime.TryParse(date, out dt); 74 | if (isValidDate) 75 | return dt.Ticks.ToString(); 76 | else 77 | return $"{date} is not a valid date string"; 78 | } 79 | 80 | public string getDate(string date) 81 | { 82 | DateTime dt; 83 | var isValidDate = DateTime.TryParse(date, out dt); 84 | if (isValidDate) 85 | return dt.Day.ToString(); 86 | else 87 | return $"{date} is not a valid date string"; 88 | } 89 | 90 | public string getMonth(string date) 91 | { 92 | DateTime dt; 93 | var isValidDate = DateTime.TryParse(date, out dt); 94 | if (isValidDate) 95 | return dt.Month.ToString(); 96 | else 97 | return $"{date} is not a valid date string"; 98 | } 99 | 100 | public string getYear(string date) 101 | { 102 | DateTime dt; 103 | var isValidDate = DateTime.TryParse(date, out dt); 104 | if (isValidDate) 105 | return dt.Year.ToString(); 106 | else 107 | return $"{date} is not a valid date string"; 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Sample Project/Classes/Str_Date_Time.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | using System; 36 | 37 | namespace Classes 38 | { 39 | /* Working with String date to DateTime 40 | * 41 | */ 42 | class Str_Date_Time 43 | { 44 | private string default_date_format; 45 | public Str_Date_Time(string format = "MM/dd/yyyy") 46 | { 47 | this.default_date_format = format; 48 | } 49 | 50 | public string reFormat(string date) 51 | { 52 | DateTime dt; 53 | var isValidDate = DateTime.TryParse(date, out dt); 54 | if (isValidDate) 55 | return dt.ToString(this.default_date_format); 56 | else 57 | return $"{date} is not a valid date string"; 58 | } 59 | 60 | public string toReadableDate(string date) 61 | { 62 | DateTime dt; 63 | var isValidDate = DateTime.TryParse(date, out dt); 64 | if (isValidDate) 65 | return dt.ToString("MMMM dd, yyyy"); 66 | else 67 | return $"{date} is not a valid date string"; 68 | } 69 | 70 | public string toTimeStamp(string date) 71 | { 72 | DateTime dt; 73 | var isValidDate = DateTime.TryParse(date, out dt); 74 | if (isValidDate) 75 | return dt.Ticks.ToString(); 76 | else 77 | return $"{date} is not a valid date string"; 78 | } 79 | 80 | public string getDate(string date) 81 | { 82 | DateTime dt; 83 | var isValidDate = DateTime.TryParse(date, out dt); 84 | if (isValidDate) 85 | return dt.Day.ToString(); 86 | else 87 | return $"{date} is not a valid date string"; 88 | } 89 | 90 | public string getMonth(string date) 91 | { 92 | DateTime dt; 93 | var isValidDate = DateTime.TryParse(date, out dt); 94 | if (isValidDate) 95 | return dt.Month.ToString(); 96 | else 97 | return $"{date} is not a valid date string"; 98 | } 99 | 100 | public string getYear(string date) 101 | { 102 | DateTime dt; 103 | var isValidDate = DateTime.TryParse(date, out dt); 104 | if (isValidDate) 105 | return dt.Year.ToString(); 106 | else 107 | return $"{date} is not a valid date string"; 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormDataGridView.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Sample_OOP_Pro.Forms 3 | { 4 | partial class FormDataGridView 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.panel3 = new System.Windows.Forms.Panel(); 33 | this.btnSearch = new System.Windows.Forms.Button(); 34 | this.txtUsername = new System.Windows.Forms.TextBox(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | this.dgvUsers = new System.Windows.Forms.DataGridView(); 37 | this.panel3.SuspendLayout(); 38 | ((System.ComponentModel.ISupportInitialize)(this.dgvUsers)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // panel3 42 | // 43 | this.panel3.BackColor = System.Drawing.Color.White; 44 | this.panel3.Controls.Add(this.btnSearch); 45 | this.panel3.Controls.Add(this.txtUsername); 46 | this.panel3.Controls.Add(this.label1); 47 | this.panel3.Controls.Add(this.dgvUsers); 48 | this.panel3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 49 | this.panel3.Location = new System.Drawing.Point(13, 13); 50 | this.panel3.Margin = new System.Windows.Forms.Padding(4); 51 | this.panel3.Name = "panel3"; 52 | this.panel3.Size = new System.Drawing.Size(896, 514); 53 | this.panel3.TabIndex = 7; 54 | // 55 | // btnSearch 56 | // 57 | this.btnSearch.Location = new System.Drawing.Point(455, 20); 58 | this.btnSearch.Margin = new System.Windows.Forms.Padding(4); 59 | this.btnSearch.Name = "btnSearch"; 60 | this.btnSearch.Size = new System.Drawing.Size(144, 33); 61 | this.btnSearch.TabIndex = 3; 62 | this.btnSearch.Text = "Search"; 63 | this.btnSearch.UseVisualStyleBackColor = true; 64 | this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); 65 | // 66 | // txtUsername 67 | // 68 | this.txtUsername.Location = new System.Drawing.Point(201, 21); 69 | this.txtUsername.Margin = new System.Windows.Forms.Padding(4); 70 | this.txtUsername.Name = "txtUsername"; 71 | this.txtUsername.Size = new System.Drawing.Size(244, 30); 72 | this.txtUsername.TabIndex = 2; 73 | // 74 | // label1 75 | // 76 | this.label1.AutoSize = true; 77 | this.label1.Location = new System.Drawing.Point(4, 27); 78 | this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 79 | this.label1.Name = "label1"; 80 | this.label1.Size = new System.Drawing.Size(176, 25); 81 | this.label1.TabIndex = 1; 82 | this.label1.Text = "Search Username:"; 83 | // 84 | // dgvUsers 85 | // 86 | this.dgvUsers.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 87 | this.dgvUsers.Location = new System.Drawing.Point(4, 60); 88 | this.dgvUsers.Margin = new System.Windows.Forms.Padding(4); 89 | this.dgvUsers.Name = "dgvUsers"; 90 | this.dgvUsers.RowHeadersWidth = 51; 91 | this.dgvUsers.Size = new System.Drawing.Size(888, 450); 92 | this.dgvUsers.TabIndex = 0; 93 | // 94 | // FormDataGridView 95 | // 96 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 97 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 98 | this.ClientSize = new System.Drawing.Size(919, 537); 99 | this.Controls.Add(this.panel3); 100 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 101 | this.Name = "FormDataGridView"; 102 | this.Text = "FormDataGridView"; 103 | this.Load += new System.EventHandler(this.FormDataGridView_Load); 104 | this.panel3.ResumeLayout(false); 105 | this.panel3.PerformLayout(); 106 | ((System.ComponentModel.ISupportInitialize)(this.dgvUsers)).EndInit(); 107 | this.ResumeLayout(false); 108 | 109 | } 110 | 111 | #endregion 112 | 113 | private System.Windows.Forms.Panel panel3; 114 | private System.Windows.Forms.Button btnSearch; 115 | private System.Windows.Forms.TextBox txtUsername; 116 | private System.Windows.Forms.Label label1; 117 | private System.Windows.Forms.DataGridView dgvUsers; 118 | } 119 | } -------------------------------------------------------------------------------- /Sample Project/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Classes/Form_UI.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System.Drawing; 37 | using System.Windows.Forms; 38 | 39 | namespace Classes 40 | { 41 | class Form_UI 42 | { 43 | #region Default 44 | 45 | /* Show next then hide the current 46 | * 47 | */ 48 | public void Show(Form frmNew, Form frmOld) 49 | { 50 | frmNew.Show(); 51 | frmOld.Hide(); 52 | } 53 | 54 | /* Show Form as dialog box (Focus Mode) 55 | * 56 | */ 57 | public void Dialog(Form frm) 58 | { 59 | frm.ShowDialog(); 60 | } 61 | 62 | #endregion 63 | 64 | #region Multiple Document Interface 65 | 66 | /* MDI show form 67 | * 68 | */ 69 | public void FormShow(Form frm, string dstyle = "Fill") 70 | { 71 | Form formMain = new Form() { FormBorderStyle = FormBorderStyle.None }; 72 | // get the active MDI container 73 | foreach (Form formActive in Application.OpenForms) 74 | { 75 | if(formActive.IsMdiContainer == true) 76 | { 77 | formMain = formActive; 78 | } 79 | } 80 | // close active child form 81 | try 82 | { 83 | Form fr = new Form() { FormBorderStyle = FormBorderStyle.None }; 84 | 85 | fr.MdiParent = formMain; 86 | fr.Dock = DockStyle.Fill; 87 | fr.Show(); 88 | foreach (Form child in formMain.MdiChildren) 89 | { 90 | child.Close(); 91 | } 92 | } 93 | catch { } 94 | 95 | // show child form 96 | frm.MdiParent = formMain; 97 | switch (dstyle) 98 | { 99 | case "Fill": 100 | frm.Dock = DockStyle.Fill; 101 | break; 102 | case "Top": 103 | frm.Dock = DockStyle.Top; 104 | break; 105 | case "Right": 106 | frm.Dock = DockStyle.Right; 107 | break; 108 | case "Bottom": 109 | frm.Dock = DockStyle.Bottom; 110 | break; 111 | case "Left": 112 | frm.Dock = DockStyle.Left; 113 | break; 114 | default: 115 | frm.Dock = DockStyle.None; 116 | break; 117 | } 118 | frm.Show(); 119 | } 120 | 121 | /* MDI active menu 122 | * 123 | */ 124 | public void active(string form, Button btn, Color col, Button[] menu, Color def_color) 125 | { 126 | // reset backcolor of menu 127 | foreach (Button button in menu) 128 | { 129 | button.BackColor = def_color; 130 | } 131 | 132 | Form formMain = new Form() { FormBorderStyle = FormBorderStyle.None }; 133 | 134 | // get the active MDI form 135 | foreach (Form formActive in Application.OpenForms) 136 | { 137 | if (formActive.IsMdiContainer == true) 138 | { 139 | formMain = formActive; 140 | } 141 | } 142 | 143 | // change backcolor of active menu 144 | foreach (Form child in formMain.MdiChildren) 145 | { 146 | if (child.Name.ToString() == form) 147 | { 148 | btn.BackColor = col; 149 | } 150 | } 151 | 152 | 153 | } 154 | 155 | #endregion 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Sample Project/FormMain.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Sample Project/Classes/Form_UI.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System.Drawing; 37 | using System.Windows.Forms; 38 | 39 | namespace Classes 40 | { 41 | class Form_UI 42 | { 43 | #region Default 44 | 45 | /* Show next then hide the current 46 | * 47 | */ 48 | public void Show(Form frmNew, Form frmOld) 49 | { 50 | frmNew.Show(); 51 | frmOld.Hide(); 52 | } 53 | 54 | /* Show Form as dialog box (Focus Mode) 55 | * 56 | */ 57 | public void Dialog(Form frm) 58 | { 59 | frm.ShowDialog(); 60 | } 61 | 62 | #endregion 63 | 64 | #region Multiple Document Interface 65 | 66 | /* MDI show form 67 | * 68 | */ 69 | public void FormShow(Form frm, string dstyle = "Fill") 70 | { 71 | Form formMain = new Form() { FormBorderStyle = FormBorderStyle.None }; 72 | // get the active MDI container 73 | foreach (Form formActive in Application.OpenForms) 74 | { 75 | if(formActive.IsMdiContainer == true) 76 | { 77 | formMain = formActive; 78 | } 79 | } 80 | // close active child form 81 | try 82 | { 83 | Form fr = new Form() { FormBorderStyle = FormBorderStyle.None }; 84 | 85 | fr.MdiParent = formMain; 86 | fr.Dock = DockStyle.Fill; 87 | fr.Show(); 88 | foreach (Form child in formMain.MdiChildren) 89 | { 90 | child.Close(); 91 | } 92 | } 93 | catch { } 94 | 95 | // show child form 96 | frm.MdiParent = formMain; 97 | switch (dstyle) 98 | { 99 | case "Fill": 100 | frm.Dock = DockStyle.Fill; 101 | break; 102 | case "Top": 103 | frm.Dock = DockStyle.Top; 104 | break; 105 | case "Right": 106 | frm.Dock = DockStyle.Right; 107 | break; 108 | case "Bottom": 109 | frm.Dock = DockStyle.Bottom; 110 | break; 111 | case "Left": 112 | frm.Dock = DockStyle.Left; 113 | break; 114 | default: 115 | frm.Dock = DockStyle.None; 116 | break; 117 | } 118 | frm.Show(); 119 | } 120 | 121 | /* MDI active menu 122 | * 123 | */ 124 | public void active(string form, Button btn, Color col, Button[] menu, Color def_color) 125 | { 126 | // reset backcolor of menu 127 | foreach (Button button in menu) 128 | { 129 | button.BackColor = def_color; 130 | } 131 | 132 | Form formMain = new Form() { FormBorderStyle = FormBorderStyle.None }; 133 | 134 | // get the active MDI form 135 | foreach (Form formActive in Application.OpenForms) 136 | { 137 | if (formActive.IsMdiContainer == true) 138 | { 139 | formMain = formActive; 140 | } 141 | } 142 | 143 | // change backcolor of active menu 144 | foreach (Form child in formMain.MdiChildren) 145 | { 146 | if (child.Name.ToString() == form) 147 | { 148 | btn.BackColor = col; 149 | } 150 | } 151 | 152 | 153 | } 154 | 155 | #endregion 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormInputs.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormLogin.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormUpload.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormDashboard.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormDataGridView.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Sample Project/Sample OOP Pro.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {30ADA2B1-A8D1-405E-9F38-7417F7F7AC26} 8 | WinExe 9 | Sample_OOP_Pro 10 | Sample OOP Pro 11 | v4.5.2 12 | 512 13 | true 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | False 38 | ..\..\..\..\..\Program Files (x86)\MySQL\MySQL Connector Net 8.0.27\Assemblies\v4.5.2\MySql.Data.dll 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 | Form 64 | 65 | 66 | FormMain.cs 67 | 68 | 69 | Form 70 | 71 | 72 | FormDashboard.cs 73 | 74 | 75 | Form 76 | 77 | 78 | FormDataGridView.cs 79 | 80 | 81 | Form 82 | 83 | 84 | FormInputs.cs 85 | 86 | 87 | Form 88 | 89 | 90 | FormLogin.cs 91 | 92 | 93 | Form 94 | 95 | 96 | FormUpload.cs 97 | 98 | 99 | 100 | 101 | 102 | FormMain.cs 103 | 104 | 105 | FormDashboard.cs 106 | 107 | 108 | FormDataGridView.cs 109 | 110 | 111 | FormInputs.cs 112 | 113 | 114 | FormLogin.cs 115 | 116 | 117 | FormUpload.cs 118 | 119 | 120 | ResXFileCodeGenerator 121 | Resources.Designer.cs 122 | Designer 123 | 124 | 125 | True 126 | Resources.resx 127 | True 128 | 129 | 130 | SettingsSingleFileGenerator 131 | Settings.Designer.cs 132 | 133 | 134 | True 135 | Settings.settings 136 | True 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /Sample Project/Forms/FormDashboard.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Sample_OOP_Pro.Forms 3 | { 4 | partial class FormDashboard 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 33 | System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 34 | System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series(); 35 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 36 | System.Windows.Forms.DataVisualization.Charting.Legend legend5 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 37 | System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series(); 38 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 39 | System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 40 | System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series(); 41 | this.chartLeft = new System.Windows.Forms.DataVisualization.Charting.Chart(); 42 | this.chartRight = new System.Windows.Forms.DataVisualization.Charting.Chart(); 43 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 44 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 45 | this.chartTop = new System.Windows.Forms.DataVisualization.Charting.Chart(); 46 | ((System.ComponentModel.ISupportInitialize)(this.chartLeft)).BeginInit(); 47 | ((System.ComponentModel.ISupportInitialize)(this.chartRight)).BeginInit(); 48 | this.groupBox1.SuspendLayout(); 49 | this.groupBox2.SuspendLayout(); 50 | ((System.ComponentModel.ISupportInitialize)(this.chartTop)).BeginInit(); 51 | this.SuspendLayout(); 52 | // 53 | // chartLeft 54 | // 55 | chartArea4.Name = "ChartArea1"; 56 | this.chartLeft.ChartAreas.Add(chartArea4); 57 | legend4.Name = "Legend1"; 58 | this.chartLeft.Legends.Add(legend4); 59 | this.chartLeft.Location = new System.Drawing.Point(12, 32); 60 | this.chartLeft.Name = "chartLeft"; 61 | series4.ChartArea = "ChartArea1"; 62 | series4.Legend = "Legend1"; 63 | series4.Name = "Series1"; 64 | this.chartLeft.Series.Add(series4); 65 | this.chartLeft.Size = new System.Drawing.Size(396, 246); 66 | this.chartLeft.TabIndex = 0; 67 | this.chartLeft.Text = "chartLeft"; 68 | // 69 | // chartRight 70 | // 71 | chartArea5.Name = "ChartArea1"; 72 | this.chartRight.ChartAreas.Add(chartArea5); 73 | legend5.Name = "Legend1"; 74 | this.chartRight.Legends.Add(legend5); 75 | this.chartRight.Location = new System.Drawing.Point(11, 32); 76 | this.chartRight.Name = "chartRight"; 77 | series5.ChartArea = "ChartArea1"; 78 | series5.Legend = "Legend1"; 79 | series5.Name = "Series1"; 80 | this.chartRight.Series.Add(series5); 81 | this.chartRight.Size = new System.Drawing.Size(395, 246); 82 | this.chartRight.TabIndex = 1; 83 | this.chartRight.Text = "chartRight"; 84 | // 85 | // groupBox1 86 | // 87 | this.groupBox1.Controls.Add(this.chartRight); 88 | this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 89 | this.groupBox1.Location = new System.Drawing.Point(462, 351); 90 | this.groupBox1.Name = "groupBox1"; 91 | this.groupBox1.Size = new System.Drawing.Size(421, 295); 92 | this.groupBox1.TabIndex = 2; 93 | this.groupBox1.TabStop = false; 94 | this.groupBox1.Text = "Static"; 95 | // 96 | // groupBox2 97 | // 98 | this.groupBox2.Controls.Add(this.chartLeft); 99 | this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 100 | this.groupBox2.Location = new System.Drawing.Point(23, 351); 101 | this.groupBox2.Name = "groupBox2"; 102 | this.groupBox2.Size = new System.Drawing.Size(422, 295); 103 | this.groupBox2.TabIndex = 3; 104 | this.groupBox2.TabStop = false; 105 | this.groupBox2.Text = "From Database"; 106 | // 107 | // chartTop 108 | // 109 | chartArea6.Name = "ChartArea1"; 110 | this.chartTop.ChartAreas.Add(chartArea6); 111 | legend6.Name = "Legend1"; 112 | this.chartTop.Legends.Add(legend6); 113 | this.chartTop.Location = new System.Drawing.Point(23, 24); 114 | this.chartTop.Name = "chartTop"; 115 | series6.ChartArea = "ChartArea1"; 116 | series6.Legend = "Legend1"; 117 | series6.Name = "Series1"; 118 | this.chartTop.Series.Add(series6); 119 | this.chartTop.Size = new System.Drawing.Size(860, 304); 120 | this.chartTop.TabIndex = 1; 121 | this.chartTop.Text = "chartTop"; 122 | // 123 | // FormDashboard 124 | // 125 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 126 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 127 | this.ClientSize = new System.Drawing.Size(906, 675); 128 | this.Controls.Add(this.chartTop); 129 | this.Controls.Add(this.groupBox2); 130 | this.Controls.Add(this.groupBox1); 131 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 132 | this.Name = "FormDashboard"; 133 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 134 | this.Text = "FormDashboard"; 135 | this.Load += new System.EventHandler(this.FormDashboard_Load); 136 | ((System.ComponentModel.ISupportInitialize)(this.chartLeft)).EndInit(); 137 | ((System.ComponentModel.ISupportInitialize)(this.chartRight)).EndInit(); 138 | this.groupBox1.ResumeLayout(false); 139 | this.groupBox2.ResumeLayout(false); 140 | ((System.ComponentModel.ISupportInitialize)(this.chartTop)).EndInit(); 141 | this.ResumeLayout(false); 142 | 143 | } 144 | 145 | #endregion 146 | 147 | private System.Windows.Forms.DataVisualization.Charting.Chart chartLeft; 148 | private System.Windows.Forms.DataVisualization.Charting.Chart chartRight; 149 | private System.Windows.Forms.GroupBox groupBox1; 150 | private System.Windows.Forms.GroupBox groupBox2; 151 | private System.Windows.Forms.DataVisualization.Charting.Chart chartTop; 152 | } 153 | } -------------------------------------------------------------------------------- /Sample Project/Forms/FormInputs.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Sample_OOP_Pro.Forms 3 | { 4 | partial class FormInputs 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.panel3 = new System.Windows.Forms.Panel(); 33 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 34 | this.label4 = new System.Windows.Forms.Label(); 35 | this.txtCPassword = new System.Windows.Forms.TextBox(); 36 | this.cmbSex = new System.Windows.Forms.ComboBox(); 37 | this.label3 = new System.Windows.Forms.Label(); 38 | this.label2 = new System.Windows.Forms.Label(); 39 | this.txtPassword = new System.Windows.Forms.TextBox(); 40 | this.label1 = new System.Windows.Forms.Label(); 41 | this.btnSave = new System.Windows.Forms.Button(); 42 | this.txtUsername = new System.Windows.Forms.TextBox(); 43 | this.panel3.SuspendLayout(); 44 | this.groupBox1.SuspendLayout(); 45 | this.SuspendLayout(); 46 | // 47 | // panel3 48 | // 49 | this.panel3.BackColor = System.Drawing.Color.White; 50 | this.panel3.Controls.Add(this.groupBox1); 51 | this.panel3.Location = new System.Drawing.Point(12, 12); 52 | this.panel3.Name = "panel3"; 53 | this.panel3.Size = new System.Drawing.Size(672, 418); 54 | this.panel3.TabIndex = 7; 55 | // 56 | // groupBox1 57 | // 58 | this.groupBox1.Controls.Add(this.label4); 59 | this.groupBox1.Controls.Add(this.txtCPassword); 60 | this.groupBox1.Controls.Add(this.cmbSex); 61 | this.groupBox1.Controls.Add(this.label3); 62 | this.groupBox1.Controls.Add(this.label2); 63 | this.groupBox1.Controls.Add(this.txtPassword); 64 | this.groupBox1.Controls.Add(this.label1); 65 | this.groupBox1.Controls.Add(this.btnSave); 66 | this.groupBox1.Controls.Add(this.txtUsername); 67 | this.groupBox1.Location = new System.Drawing.Point(175, 42); 68 | this.groupBox1.Name = "groupBox1"; 69 | this.groupBox1.Size = new System.Drawing.Size(311, 347); 70 | this.groupBox1.TabIndex = 0; 71 | this.groupBox1.TabStop = false; 72 | this.groupBox1.Text = "Create New User"; 73 | // 74 | // label4 75 | // 76 | this.label4.AutoSize = true; 77 | this.label4.Location = new System.Drawing.Point(16, 173); 78 | this.label4.Name = "label4"; 79 | this.label4.Size = new System.Drawing.Size(121, 17); 80 | this.label4.TabIndex = 8; 81 | this.label4.Text = "Confirm Password"; 82 | // 83 | // txtCPassword 84 | // 85 | this.txtCPassword.Location = new System.Drawing.Point(20, 196); 86 | this.txtCPassword.Name = "txtCPassword"; 87 | this.txtCPassword.PasswordChar = '*'; 88 | this.txtCPassword.Size = new System.Drawing.Size(271, 22); 89 | this.txtCPassword.TabIndex = 7; 90 | // 91 | // cmbSex 92 | // 93 | this.cmbSex.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 94 | this.cmbSex.FormattingEnabled = true; 95 | this.cmbSex.Items.AddRange(new object[] { 96 | "MALE", 97 | "FEMALE"}); 98 | this.cmbSex.Location = new System.Drawing.Point(20, 261); 99 | this.cmbSex.Name = "cmbSex"; 100 | this.cmbSex.Size = new System.Drawing.Size(121, 24); 101 | this.cmbSex.TabIndex = 6; 102 | // 103 | // label3 104 | // 105 | this.label3.AutoSize = true; 106 | this.label3.Location = new System.Drawing.Point(16, 237); 107 | this.label3.Name = "label3"; 108 | this.label3.Size = new System.Drawing.Size(31, 17); 109 | this.label3.TabIndex = 5; 110 | this.label3.Text = "Sex"; 111 | // 112 | // label2 113 | // 114 | this.label2.AutoSize = true; 115 | this.label2.Location = new System.Drawing.Point(16, 108); 116 | this.label2.Name = "label2"; 117 | this.label2.Size = new System.Drawing.Size(69, 17); 118 | this.label2.TabIndex = 4; 119 | this.label2.Text = "Password"; 120 | // 121 | // txtPassword 122 | // 123 | this.txtPassword.Location = new System.Drawing.Point(20, 131); 124 | this.txtPassword.Name = "txtPassword"; 125 | this.txtPassword.PasswordChar = '*'; 126 | this.txtPassword.Size = new System.Drawing.Size(271, 22); 127 | this.txtPassword.TabIndex = 3; 128 | // 129 | // label1 130 | // 131 | this.label1.AutoSize = true; 132 | this.label1.Location = new System.Drawing.Point(16, 51); 133 | this.label1.Name = "label1"; 134 | this.label1.Size = new System.Drawing.Size(73, 17); 135 | this.label1.TabIndex = 2; 136 | this.label1.Text = "Username"; 137 | // 138 | // btnSave 139 | // 140 | this.btnSave.Location = new System.Drawing.Point(216, 304); 141 | this.btnSave.Name = "btnSave"; 142 | this.btnSave.Size = new System.Drawing.Size(75, 37); 143 | this.btnSave.TabIndex = 1; 144 | this.btnSave.Text = "Save"; 145 | this.btnSave.UseVisualStyleBackColor = true; 146 | this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 147 | // 148 | // txtUsername 149 | // 150 | this.txtUsername.Location = new System.Drawing.Point(20, 74); 151 | this.txtUsername.Name = "txtUsername"; 152 | this.txtUsername.Size = new System.Drawing.Size(271, 22); 153 | this.txtUsername.TabIndex = 0; 154 | this.txtUsername.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtUsername_KeyPress); 155 | // 156 | // FormInputs 157 | // 158 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 159 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 160 | this.ClientSize = new System.Drawing.Size(703, 447); 161 | this.Controls.Add(this.panel3); 162 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 163 | this.Name = "FormInputs"; 164 | this.Text = "FormInputs"; 165 | this.panel3.ResumeLayout(false); 166 | this.groupBox1.ResumeLayout(false); 167 | this.groupBox1.PerformLayout(); 168 | this.ResumeLayout(false); 169 | 170 | } 171 | 172 | #endregion 173 | 174 | private System.Windows.Forms.Panel panel3; 175 | private System.Windows.Forms.GroupBox groupBox1; 176 | private System.Windows.Forms.Label label4; 177 | private System.Windows.Forms.TextBox txtCPassword; 178 | private System.Windows.Forms.ComboBox cmbSex; 179 | private System.Windows.Forms.Label label3; 180 | private System.Windows.Forms.Label label2; 181 | private System.Windows.Forms.TextBox txtPassword; 182 | private System.Windows.Forms.Label label1; 183 | private System.Windows.Forms.Button btnSave; 184 | private System.Windows.Forms.TextBox txtUsername; 185 | } 186 | } -------------------------------------------------------------------------------- /Sample Project/Forms/FormLogin.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Sample_OOP_Pro.Forms 3 | { 4 | partial class FormLogin 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.lblExit = new System.Windows.Forms.Label(); 33 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 34 | this.txtPassword = new System.Windows.Forms.TextBox(); 35 | this.label2 = new System.Windows.Forms.Label(); 36 | this.btnLogin = new System.Windows.Forms.Button(); 37 | this.txtUsername = new System.Windows.Forms.TextBox(); 38 | this.label1 = new System.Windows.Forms.Label(); 39 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // lblExit 43 | // 44 | this.lblExit.AutoSize = true; 45 | this.lblExit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); 46 | this.lblExit.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 47 | this.lblExit.ForeColor = System.Drawing.Color.White; 48 | this.lblExit.Location = new System.Drawing.Point(420, 12); 49 | this.lblExit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 50 | this.lblExit.Name = "lblExit"; 51 | this.lblExit.Size = new System.Drawing.Size(25, 29); 52 | this.lblExit.TabIndex = 13; 53 | this.lblExit.Text = "x"; 54 | // 55 | // pictureBox1 56 | // 57 | this.pictureBox1.Location = new System.Drawing.Point(119, 82); 58 | this.pictureBox1.Margin = new System.Windows.Forms.Padding(4); 59 | this.pictureBox1.Name = "pictureBox1"; 60 | this.pictureBox1.Size = new System.Drawing.Size(204, 176); 61 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 62 | this.pictureBox1.TabIndex = 12; 63 | this.pictureBox1.TabStop = false; 64 | // 65 | // txtPassword 66 | // 67 | this.txtPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 68 | this.txtPassword.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); 69 | this.txtPassword.Location = new System.Drawing.Point(33, 413); 70 | this.txtPassword.Margin = new System.Windows.Forms.Padding(4); 71 | this.txtPassword.Name = "txtPassword"; 72 | this.txtPassword.PasswordChar = '*'; 73 | this.txtPassword.Size = new System.Drawing.Size(383, 30); 74 | this.txtPassword.TabIndex = 11; 75 | this.txtPassword.Text = "12345678"; 76 | // 77 | // label2 78 | // 79 | this.label2.AutoSize = true; 80 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 81 | this.label2.ForeColor = System.Drawing.Color.White; 82 | this.label2.Location = new System.Drawing.Point(28, 385); 83 | this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 84 | this.label2.Name = "label2"; 85 | this.label2.Size = new System.Drawing.Size(104, 25); 86 | this.label2.TabIndex = 10; 87 | this.label2.Text = "Password:"; 88 | // 89 | // btnLogin 90 | // 91 | this.btnLogin.BackColor = System.Drawing.Color.White; 92 | this.btnLogin.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 93 | this.btnLogin.Location = new System.Drawing.Point(289, 481); 94 | this.btnLogin.Margin = new System.Windows.Forms.Padding(4); 95 | this.btnLogin.Name = "btnLogin"; 96 | this.btnLogin.Size = new System.Drawing.Size(128, 36); 97 | this.btnLogin.TabIndex = 9; 98 | this.btnLogin.Text = "Login"; 99 | this.btnLogin.UseVisualStyleBackColor = false; 100 | this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); 101 | // 102 | // txtUsername 103 | // 104 | this.txtUsername.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 105 | this.txtUsername.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); 106 | this.txtUsername.Location = new System.Drawing.Point(33, 323); 107 | this.txtUsername.Margin = new System.Windows.Forms.Padding(4); 108 | this.txtUsername.Name = "txtUsername"; 109 | this.txtUsername.Size = new System.Drawing.Size(383, 30); 110 | this.txtUsername.TabIndex = 8; 111 | this.txtUsername.Text = "user101"; 112 | // 113 | // label1 114 | // 115 | this.label1.AutoSize = true; 116 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 117 | this.label1.ForeColor = System.Drawing.Color.White; 118 | this.label1.Location = new System.Drawing.Point(28, 295); 119 | this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 120 | this.label1.Name = "label1"; 121 | this.label1.Size = new System.Drawing.Size(108, 25); 122 | this.label1.TabIndex = 7; 123 | this.label1.Text = "Username:"; 124 | // 125 | // FormLogin 126 | // 127 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 128 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 129 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); 130 | this.ClientSize = new System.Drawing.Size(455, 556); 131 | this.Controls.Add(this.lblExit); 132 | this.Controls.Add(this.pictureBox1); 133 | this.Controls.Add(this.txtPassword); 134 | this.Controls.Add(this.label2); 135 | this.Controls.Add(this.btnLogin); 136 | this.Controls.Add(this.txtUsername); 137 | this.Controls.Add(this.label1); 138 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 139 | this.Name = "FormLogin"; 140 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 141 | this.Text = "FormLogin"; 142 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 143 | this.ResumeLayout(false); 144 | this.PerformLayout(); 145 | 146 | } 147 | 148 | #endregion 149 | 150 | private System.Windows.Forms.Label lblExit; 151 | private System.Windows.Forms.PictureBox pictureBox1; 152 | private System.Windows.Forms.TextBox txtPassword; 153 | private System.Windows.Forms.Label label2; 154 | private System.Windows.Forms.Button btnLogin; 155 | private System.Windows.Forms.TextBox txtUsername; 156 | private System.Windows.Forms.Label label1; 157 | } 158 | } -------------------------------------------------------------------------------- /Classes/Database.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System; 37 | using System.Data; 38 | using System.Windows.Forms; 39 | using MySql.Data.MySqlClient; 40 | 41 | namespace Classes 42 | { 43 | class Database 44 | { 45 | private static string constring; 46 | /* MySql Classes 47 | * 48 | */ 49 | public MySqlConnection con; 50 | MySqlCommand cmd; 51 | MySqlDataReader reader; 52 | MySqlDataAdapter da; 53 | DataTable dt; 54 | 55 | /* Check Database Connection 56 | * 57 | */ 58 | public Database(string host, string user, string password, string database) 59 | { 60 | try 61 | { 62 | constring = "server="+ host+";uid=" + user + ";pwd='" + password + "';database=" + database; 63 | con = new MySqlConnection(constring); 64 | if (con.State == ConnectionState.Closed) 65 | { 66 | con.Open(); 67 | } 68 | } 69 | catch(MySqlException e) 70 | { 71 | MessageBox.Show(e.Message.ToString()); 72 | } 73 | } 74 | 75 | /* Select or search = return a row 76 | * 77 | */ 78 | public MySqlDataReader select(string qry) 79 | { 80 | con = new MySqlConnection(constring); 81 | con.Open(); 82 | 83 | cmd = new MySqlCommand(qry, con); 84 | reader = cmd.ExecuteReader(); 85 | return reader; 86 | } 87 | 88 | /* create / update / delete 89 | * 90 | */ 91 | public void cud(string qry, string msg = "Transaction Completed!") 92 | { 93 | con = new MySqlConnection(constring); 94 | con.Open(); 95 | 96 | cmd = new MySqlCommand(qry, con); 97 | if (cmd.ExecuteNonQuery() > 0) 98 | { 99 | MessageBox.Show(msg); 100 | } 101 | else 102 | { 103 | MessageBox.Show("Sorry! There's something wrong."); 104 | } 105 | } 106 | 107 | /* Save 108 | * 109 | */ 110 | public void save(string table, string[] column, string[] bind, string msg = "Successfully saved.") 111 | { 112 | 113 | con = new MySqlConnection(constring); 114 | con.Open(); 115 | 116 | string fields = ""; 117 | foreach (string col in column) 118 | { 119 | fields = fields + col + ','; 120 | } 121 | 122 | string value = ""; 123 | foreach (string val in bind) 124 | { 125 | value = value + "'" + val + "',"; 126 | } 127 | 128 | var qry = "INSERT INTO " + table + "(" + fields.TrimEnd(',') + ") VALUES(" + value.TrimEnd(',') + ")"; 129 | 130 | cmd = new MySqlCommand(qry, con); 131 | if (cmd.ExecuteNonQuery() > 0) 132 | { 133 | MessageBox.Show(msg); 134 | } 135 | else 136 | { 137 | MessageBox.Show("Sorry! There's something wrong."); 138 | } 139 | } 140 | 141 | /* Datasource / Select Multiple Rows / for DataGridView 142 | * 143 | */ 144 | public void table(string qry, DataGridView dgv, string[] header = null) 145 | { 146 | /*DataGridView Properties*/ 147 | dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; 148 | dgv.MultiSelect = false; 149 | dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; 150 | dgv.EditMode = DataGridViewEditMode.EditProgrammatically; 151 | 152 | /*Database*/ 153 | con = new MySqlConnection(constring); 154 | con.Open(); 155 | 156 | da = new MySqlDataAdapter(qry, con); 157 | dt = new DataTable(); 158 | da.Fill(dt); 159 | dgv.DataSource = dt; 160 | 161 | /*Custom Header*/ 162 | if (header != null) 163 | { 164 | foreach (DataGridViewColumn dgvcolumn in dgv.Columns) 165 | { 166 | dgvcolumn.HeaderText = header[dgvcolumn.Index]; 167 | } 168 | } 169 | dgv.ClearSelection(); 170 | } 171 | 172 | /* Select & Display to ComboBox 173 | * 174 | */ 175 | public void list(string qry, ComboBox comboBox) 176 | { 177 | /*ComboBox Properties*/ 178 | comboBox.Items.Clear(); 179 | comboBox.DropDownStyle = ComboBoxStyle.DropDownList; 180 | 181 | con = new MySqlConnection(constring); 182 | con.Open(); 183 | 184 | cmd = new MySqlCommand(qry, con); 185 | reader = cmd.ExecuteReader(); 186 | 187 | while (reader.Read()) 188 | { 189 | comboBox.Items.Add(reader[0].ToString()); 190 | comboBox.AutoCompleteCustomSource.Add(reader[0].ToString()); 191 | } 192 | } 193 | 194 | /* Check data if exist 195 | * return bool 196 | */ 197 | public bool exist(string qry) 198 | { 199 | con = new MySqlConnection(constring); 200 | con.Open(); 201 | 202 | cmd = new MySqlCommand(qry, con); 203 | reader = cmd.ExecuteReader(); 204 | if (reader.Read()) 205 | return true; 206 | else 207 | return false; 208 | } 209 | 210 | /* Select the Maximum Inserted Id 211 | * return int (id) 212 | */ 213 | public int maxid(String column, String tbl) 214 | { 215 | con = new MySqlConnection(constring); 216 | con.Open(); 217 | 218 | var cmd = new MySqlCommand("SELECT MAX(" + column + ") from " + tbl + "", con); 219 | 220 | var reader = cmd.ExecuteReader(); 221 | if (reader.Read()) 222 | { 223 | try 224 | { 225 | return reader.GetInt32(0) + 1; 226 | } 227 | catch (Exception) 228 | { 229 | return 1; 230 | } 231 | } 232 | return 1; 233 | } 234 | 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /Sample Project/Classes/Database.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System; 37 | using System.Data; 38 | using System.Windows.Forms; 39 | using MySql.Data.MySqlClient; 40 | 41 | namespace Classes 42 | { 43 | class Database 44 | { 45 | private static string constring; 46 | /* MySql Classes 47 | * 48 | */ 49 | public MySqlConnection con; 50 | MySqlCommand cmd; 51 | MySqlDataReader reader; 52 | MySqlDataAdapter da; 53 | DataTable dt; 54 | 55 | /* Check Database Connection 56 | * 57 | */ 58 | public Database(string host, string user, string password, string database) 59 | { 60 | try 61 | { 62 | constring = "server="+ host+";uid=" + user + ";pwd='" + password + "';database=" + database; 63 | con = new MySqlConnection(constring); 64 | if (con.State == ConnectionState.Closed) 65 | { 66 | con.Open(); 67 | } 68 | } 69 | catch(MySqlException e) 70 | { 71 | MessageBox.Show(e.Message.ToString()); 72 | } 73 | } 74 | 75 | /* Select or search = return a row 76 | * 77 | */ 78 | public MySqlDataReader select(string qry) 79 | { 80 | con = new MySqlConnection(constring); 81 | con.Open(); 82 | 83 | cmd = new MySqlCommand(qry, con); 84 | reader = cmd.ExecuteReader(); 85 | return reader; 86 | } 87 | 88 | /* create / update / delete 89 | * 90 | */ 91 | public void cud(string qry, string msg = "Transaction Completed!") 92 | { 93 | con = new MySqlConnection(constring); 94 | con.Open(); 95 | 96 | cmd = new MySqlCommand(qry, con); 97 | if (cmd.ExecuteNonQuery() > 0) 98 | { 99 | MessageBox.Show(msg); 100 | } 101 | else 102 | { 103 | MessageBox.Show("Sorry! There's something wrong."); 104 | } 105 | } 106 | 107 | /* Save 108 | * 109 | */ 110 | public void save(string table, string[] column, string[] bind, string msg = "Successfully saved.") 111 | { 112 | 113 | con = new MySqlConnection(constring); 114 | con.Open(); 115 | 116 | string fields = ""; 117 | foreach (string col in column) 118 | { 119 | fields = fields + col + ','; 120 | } 121 | 122 | string value = ""; 123 | foreach (string val in bind) 124 | { 125 | value = value + "'" + val + "',"; 126 | } 127 | 128 | var qry = "INSERT INTO " + table + "(" + fields.TrimEnd(',') + ") VALUES(" + value.TrimEnd(',') + ")"; 129 | 130 | cmd = new MySqlCommand(qry, con); 131 | if (cmd.ExecuteNonQuery() > 0) 132 | { 133 | MessageBox.Show(msg); 134 | } 135 | else 136 | { 137 | MessageBox.Show("Sorry! There's something wrong."); 138 | } 139 | } 140 | 141 | /* Datasource / Select Multiple Rows / for DataGridView 142 | * 143 | */ 144 | public void table(string qry, DataGridView dgv, string[] header = null) 145 | { 146 | /*DataGridView Properties*/ 147 | dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; 148 | dgv.MultiSelect = false; 149 | dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; 150 | dgv.EditMode = DataGridViewEditMode.EditProgrammatically; 151 | 152 | /*Database*/ 153 | con = new MySqlConnection(constring); 154 | con.Open(); 155 | 156 | da = new MySqlDataAdapter(qry, con); 157 | dt = new DataTable(); 158 | da.Fill(dt); 159 | dgv.DataSource = dt; 160 | 161 | /*Custom Header*/ 162 | if (header != null) 163 | { 164 | foreach (DataGridViewColumn dgvcolumn in dgv.Columns) 165 | { 166 | dgvcolumn.HeaderText = header[dgvcolumn.Index]; 167 | } 168 | } 169 | dgv.ClearSelection(); 170 | } 171 | 172 | /* Select & Display to ComboBox 173 | * 174 | */ 175 | public void list(string qry, ComboBox comboBox) 176 | { 177 | /*ComboBox Properties*/ 178 | comboBox.Items.Clear(); 179 | comboBox.DropDownStyle = ComboBoxStyle.DropDownList; 180 | 181 | con = new MySqlConnection(constring); 182 | con.Open(); 183 | 184 | cmd = new MySqlCommand(qry, con); 185 | reader = cmd.ExecuteReader(); 186 | 187 | while (reader.Read()) 188 | { 189 | comboBox.Items.Add(reader[0].ToString()); 190 | comboBox.AutoCompleteCustomSource.Add(reader[0].ToString()); 191 | } 192 | } 193 | 194 | /* Check data if exist 195 | * return bool 196 | */ 197 | public bool exist(string qry) 198 | { 199 | con = new MySqlConnection(constring); 200 | con.Open(); 201 | 202 | cmd = new MySqlCommand(qry, con); 203 | reader = cmd.ExecuteReader(); 204 | if (reader.Read()) 205 | return true; 206 | else 207 | return false; 208 | } 209 | 210 | /* Select the Maximum Inserted Id 211 | * return int (id) 212 | */ 213 | public int maxid(String column, String tbl) 214 | { 215 | con = new MySqlConnection(constring); 216 | con.Open(); 217 | 218 | var cmd = new MySqlCommand("SELECT MAX(" + column + ") from " + tbl + "", con); 219 | 220 | var reader = cmd.ExecuteReader(); 221 | if (reader.Read()) 222 | { 223 | try 224 | { 225 | return reader.GetInt32(0) + 1; 226 | } 227 | catch (Exception) 228 | { 229 | return 1; 230 | } 231 | } 232 | return 1; 233 | } 234 | 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /Classes/Validation.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System; 37 | using System.Text.RegularExpressions; 38 | using System.Windows.Forms; 39 | 40 | namespace Classes 41 | { 42 | class Validation 43 | { 44 | /* Password encrypt 45 | * 46 | */ 47 | public string encodePassword(string password) 48 | { 49 | try 50 | { 51 | byte[] encData_byte = new byte[password.Length]; 52 | encData_byte = System.Text.Encoding.UTF8.GetBytes(password); 53 | return Convert.ToBase64String(encData_byte); 54 | } 55 | catch (Exception ex) 56 | { 57 | throw new Exception(ex.Message); 58 | } 59 | } 60 | 61 | /* Password decrypt 62 | * 63 | */ 64 | public string decodePassword(string encodedData) 65 | { 66 | try 67 | { 68 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 69 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); 70 | byte[] todecode_byte = Convert.FromBase64String(encodedData); 71 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 72 | char[] decoded_char = new char[charCount]; 73 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); 74 | return new String(decoded_char); 75 | } 76 | catch (Exception ex) 77 | { 78 | throw new Exception(ex.Message); 79 | } 80 | } 81 | 82 | /* Validate Required Textbox 83 | * return false if some fields are empty 84 | */ 85 | public bool txtRequired(TextBox[] txt, bool allow_message = false, string msg = "Please fillup required fields!") 86 | { 87 | bool empt = false; 88 | foreach (TextBox tb in txt) 89 | { 90 | if (tb.Text == null || tb.Text == "") 91 | { 92 | empt = true; 93 | } 94 | } 95 | if (empt) 96 | { 97 | if (allow_message) 98 | MessageBox.Show(msg); 99 | return false; 100 | } 101 | return true; 102 | } 103 | 104 | /* Validate Required ComboBox 105 | * return false if some fields are empty 106 | */ 107 | public bool cmbRequired(ComboBox[] cmb, bool allow_message = false, string msg = "Please select required fields!") 108 | { 109 | bool empt = false; 110 | foreach (ComboBox cb in cmb) 111 | { 112 | if (cb.SelectedIndex == -1 || cb.Text == "" || cb.Text == null) 113 | { 114 | empt = true; 115 | } 116 | } 117 | if (empt) 118 | { 119 | if (allow_message) 120 | MessageBox.Show(msg); 121 | return false; 122 | } 123 | return true; 124 | } 125 | 126 | /* Validate Email 127 | * return true if valid 128 | */ 129 | public bool isEmailValid(TextBox txtEmail, string emailPattern = @"^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$", bool allow_message = false, string msg = "Invalid Email!") 130 | { 131 | bool valid = Regex.IsMatch(txtEmail.Text, emailPattern); 132 | if (!valid) 133 | { 134 | if (allow_message) 135 | MessageBox.Show(msg); 136 | return false; 137 | } 138 | return true; 139 | } 140 | 141 | /* Validate Phone 142 | * return true if valid 143 | */ 144 | public bool isPhoneValid(TextBox txtPhone, string phonePattern = @"^[2-9]\d{2}-\d{3}-\d{4}$", bool allow_message = false, string msg = "Invalid Phone!") 145 | { 146 | bool valid = Regex.IsMatch(txtPhone.Text, phonePattern); 147 | if (!valid) 148 | { 149 | if (allow_message) 150 | MessageBox.Show(msg); 151 | return false; 152 | } 153 | return true; 154 | } 155 | 156 | /* Validate Zip 157 | * return true if valid 158 | */ 159 | public bool isZipValid(TextBox txtZip, string zipPattern = @"^\d{3}\s?\d{3}$", bool allow_message = false, string msg = "Invalid Zip!") 160 | { 161 | bool valid = Regex.IsMatch(txtZip.Text, zipPattern); 162 | if (!valid) 163 | { 164 | if (allow_message) 165 | MessageBox.Show(msg); 166 | return false; 167 | } 168 | return true; 169 | } 170 | 171 | /* Validate Custom Pattern 172 | * return true if valid 173 | */ 174 | public bool isValidInput(TextBox[] txt, string Pattern, bool allow_message = false, string msg = "Something invalid in your inputs!") 175 | { 176 | bool valid = false; 177 | foreach (TextBox tb in txt) 178 | { 179 | valid = Regex.IsMatch(tb.Text, Pattern); 180 | } 181 | if (valid) 182 | { 183 | if(allow_message) 184 | MessageBox.Show(msg); 185 | return false; 186 | } 187 | return true; 188 | } 189 | 190 | /* Allows only letters 191 | * 192 | */ 193 | public void alpha(KeyPressEventArgs e) 194 | { 195 | if (!char.IsLetter(e.KeyChar)) 196 | { 197 | e.Handled = true; 198 | } 199 | } 200 | 201 | /* Allows only numbers 202 | * 203 | */ 204 | public void num(KeyPressEventArgs e) 205 | { 206 | if (!char.IsNumber(e.KeyChar)) 207 | { 208 | e.Handled = true; 209 | } 210 | } 211 | 212 | /* Allows only letters & numbers 213 | * 214 | */ 215 | public void alphanum(KeyPressEventArgs e) 216 | { 217 | if (!char.IsLetterOrDigit(e.KeyChar)) 218 | { 219 | e.Handled = true; 220 | } 221 | } 222 | 223 | /* Allows only special characters 224 | * 225 | */ 226 | public void specialchar(KeyPressEventArgs e) 227 | { 228 | if (char.IsLetterOrDigit(e.KeyChar)) 229 | { 230 | e.Handled = true; 231 | } 232 | } 233 | 234 | /* Allows only letters, space, backspace 235 | * 236 | */ 237 | public void alphaspaceback(KeyPressEventArgs e) 238 | { 239 | if (!char.IsLetter(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar)) 240 | { 241 | if (e.KeyChar != (char)8) // BackSpace 242 | { 243 | e.Handled = true; 244 | } 245 | } 246 | } 247 | 248 | /* Allows only numbers, space, backspace 249 | * 250 | */ 251 | public void numspaceback(KeyPressEventArgs e) 252 | { 253 | if (!char.IsNumber(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar)) 254 | { 255 | if (e.KeyChar != (char)8) // BackSpace 256 | { 257 | e.Handled = true; 258 | } 259 | } 260 | } 261 | 262 | /* Allows only letters, numbers, space, backspace 263 | * 264 | */ 265 | public void alphanumspaceback(KeyPressEventArgs e) 266 | { 267 | if (!char.IsLetterOrDigit(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar)) 268 | { 269 | if (e.KeyChar != (char)8) // BackSpace 270 | { 271 | e.Handled = true; 272 | } 273 | } 274 | } 275 | 276 | 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /Sample Project/Classes/Validation.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * __________________________________________________________________ 3 | * 4 | * C-Sharf Custom Classes 5 | * __________________________________________________________________ 6 | * 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 Wilfred V. Pine 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the Software is 16 | * furnished to do so, subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in 19 | * all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | * THE SOFTWARE. 28 | * 29 | * @package C-Sharf Custom Classes 30 | * @author Wilfred V. Pine 31 | * @copyright Copyright 2020 (https://red.confired.com) 32 | * @link https://confired.com 33 | * @license https://opensource.org/licenses/MIT MIT License 34 | */ 35 | 36 | using System; 37 | using System.Text.RegularExpressions; 38 | using System.Windows.Forms; 39 | 40 | namespace Classes 41 | { 42 | class Validation 43 | { 44 | /* Password encrypt 45 | * 46 | */ 47 | public string encodePassword(string password) 48 | { 49 | try 50 | { 51 | byte[] encData_byte = new byte[password.Length]; 52 | encData_byte = System.Text.Encoding.UTF8.GetBytes(password); 53 | return Convert.ToBase64String(encData_byte); 54 | } 55 | catch (Exception ex) 56 | { 57 | throw new Exception(ex.Message); 58 | } 59 | } 60 | 61 | /* Password decrypt 62 | * 63 | */ 64 | public string decodePassword(string encodedData) 65 | { 66 | try 67 | { 68 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 69 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); 70 | byte[] todecode_byte = Convert.FromBase64String(encodedData); 71 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 72 | char[] decoded_char = new char[charCount]; 73 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); 74 | return new String(decoded_char); 75 | } 76 | catch (Exception ex) 77 | { 78 | throw new Exception(ex.Message); 79 | } 80 | } 81 | 82 | /* Validate Required Textbox 83 | * return false if some fields are empty 84 | */ 85 | public bool txtRequired(TextBox[] txt, bool allow_message = false, string msg = "Please fillup required fields!") 86 | { 87 | bool empt = false; 88 | foreach (TextBox tb in txt) 89 | { 90 | if (tb.Text == null || tb.Text == "") 91 | { 92 | empt = true; 93 | } 94 | } 95 | if (empt) 96 | { 97 | if (allow_message) 98 | MessageBox.Show(msg); 99 | return false; 100 | } 101 | return true; 102 | } 103 | 104 | /* Validate Required ComboBox 105 | * return false if some fields are empty 106 | */ 107 | public bool cmbRequired(ComboBox[] cmb, bool allow_message = false, string msg = "Please select required fields!") 108 | { 109 | bool empt = false; 110 | foreach (ComboBox cb in cmb) 111 | { 112 | if (cb.SelectedIndex == -1 || cb.Text == "" || cb.Text == null) 113 | { 114 | empt = true; 115 | } 116 | } 117 | if (empt) 118 | { 119 | if (allow_message) 120 | MessageBox.Show(msg); 121 | return false; 122 | } 123 | return true; 124 | } 125 | 126 | /* Validate Email 127 | * return true if valid 128 | */ 129 | public bool isEmailValid(TextBox txtEmail, string emailPattern = @"^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$", bool allow_message = false, string msg = "Invalid Email!") 130 | { 131 | bool valid = Regex.IsMatch(txtEmail.Text, emailPattern); 132 | if (!valid) 133 | { 134 | if (allow_message) 135 | MessageBox.Show(msg); 136 | return false; 137 | } 138 | return true; 139 | } 140 | 141 | /* Validate Phone 142 | * return true if valid 143 | */ 144 | public bool isPhoneValid(TextBox txtPhone, string phonePattern = @"^[2-9]\d{2}-\d{3}-\d{4}$", bool allow_message = false, string msg = "Invalid Phone!") 145 | { 146 | bool valid = Regex.IsMatch(txtPhone.Text, phonePattern); 147 | if (!valid) 148 | { 149 | if (allow_message) 150 | MessageBox.Show(msg); 151 | return false; 152 | } 153 | return true; 154 | } 155 | 156 | /* Validate Zip 157 | * return true if valid 158 | */ 159 | public bool isZipValid(TextBox txtZip, string zipPattern = @"^\d{3}\s?\d{3}$", bool allow_message = false, string msg = "Invalid Zip!") 160 | { 161 | bool valid = Regex.IsMatch(txtZip.Text, zipPattern); 162 | if (!valid) 163 | { 164 | if (allow_message) 165 | MessageBox.Show(msg); 166 | return false; 167 | } 168 | return true; 169 | } 170 | 171 | /* Validate Custom Pattern 172 | * return true if valid 173 | */ 174 | public bool isValidInput(TextBox[] txt, string Pattern, bool allow_message = false, string msg = "Something invalid in your inputs!") 175 | { 176 | bool valid = false; 177 | foreach (TextBox tb in txt) 178 | { 179 | valid = Regex.IsMatch(tb.Text, Pattern); 180 | } 181 | if (valid) 182 | { 183 | if(allow_message) 184 | MessageBox.Show(msg); 185 | return false; 186 | } 187 | return true; 188 | } 189 | 190 | /* Allows only letters 191 | * 192 | */ 193 | public void alpha(KeyPressEventArgs e) 194 | { 195 | if (!char.IsLetter(e.KeyChar)) 196 | { 197 | e.Handled = true; 198 | } 199 | } 200 | 201 | /* Allows only numbers 202 | * 203 | */ 204 | public void num(KeyPressEventArgs e) 205 | { 206 | if (!char.IsNumber(e.KeyChar)) 207 | { 208 | e.Handled = true; 209 | } 210 | } 211 | 212 | /* Allows only letters & numbers 213 | * 214 | */ 215 | public void alphanum(KeyPressEventArgs e) 216 | { 217 | if (!char.IsLetterOrDigit(e.KeyChar)) 218 | { 219 | e.Handled = true; 220 | } 221 | } 222 | 223 | /* Allows only special characters 224 | * 225 | */ 226 | public void specialchar(KeyPressEventArgs e) 227 | { 228 | if (char.IsLetterOrDigit(e.KeyChar)) 229 | { 230 | e.Handled = true; 231 | } 232 | } 233 | 234 | /* Allows only letters, space, backspace 235 | * 236 | */ 237 | public void alphaspaceback(KeyPressEventArgs e) 238 | { 239 | if (!char.IsLetter(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar)) 240 | { 241 | if (e.KeyChar != (char)8) // BackSpace 242 | { 243 | e.Handled = true; 244 | } 245 | } 246 | } 247 | 248 | /* Allows only numbers, space, backspace 249 | * 250 | */ 251 | public void numspaceback(KeyPressEventArgs e) 252 | { 253 | if (!char.IsNumber(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar)) 254 | { 255 | if (e.KeyChar != (char)8) // BackSpace 256 | { 257 | e.Handled = true; 258 | } 259 | } 260 | } 261 | 262 | /* Allows only letters, numbers, space, backspace 263 | * 264 | */ 265 | public void alphanumspaceback(KeyPressEventArgs e) 266 | { 267 | if (!char.IsLetterOrDigit(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar)) 268 | { 269 | if (e.KeyChar != (char)8) // BackSpace 270 | { 271 | e.Handled = true; 272 | } 273 | } 274 | } 275 | 276 | 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /Sample Project/obj/Debug/Sample OOP Pro.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\Sample OOP Pro.exe.config 2 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\Sample OOP Pro.exe 3 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\Sample OOP Pro.pdb 4 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample OOP Pro.csproj.AssemblyReference.cache 5 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.FormMain.resources 6 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.Properties.Resources.resources 7 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample OOP Pro.csproj.GenerateResource.cache 8 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample OOP Pro.csproj.CoreCompileInputs.cache 9 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample OOP Pro.exe 10 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample OOP Pro.pdb 11 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.Forms.FormLogin.resources 12 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\MySql.Data.dll 13 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\Google.Protobuf.dll 14 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\ZstdNet.dll 15 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\K4os.Compression.LZ4.Streams.dll 16 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\BouncyCastle.Crypto.dll 17 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\Ubiety.Dns.Core.dll 18 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\System.Memory.dll 19 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\System.Buffers.dll 20 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\K4os.Compression.LZ4.dll 21 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\K4os.Hash.xxHash.dll 22 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\bin\Debug\MySql.Data.xml 23 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.Forms.FormDashboard.resources 24 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.Forms.FormDataGridView.resources 25 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.Forms.FormInputs.resources 26 | C:\Users\wilfred pine\source\repos\Sample OOP Pro\obj\Debug\Sample_OOP_Pro.Forms.FormUpload.resources 27 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\Sample OOP Pro.exe.config 28 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\Sample OOP Pro.exe 29 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\Sample OOP Pro.pdb 30 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\MySql.Data.dll 31 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\Google.Protobuf.dll 32 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\ZstdNet.dll 33 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\K4os.Compression.LZ4.Streams.dll 34 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\BouncyCastle.Crypto.dll 35 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\Ubiety.Dns.Core.dll 36 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\System.Memory.dll 37 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\System.Buffers.dll 38 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\K4os.Compression.LZ4.dll 39 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\K4os.Hash.xxHash.dll 40 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\bin\Debug\MySql.Data.xml 41 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample OOP Pro.csproj.AssemblyReference.cache 42 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.FormMain.resources 43 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.Forms.FormDashboard.resources 44 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.Forms.FormDataGridView.resources 45 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.Forms.FormInputs.resources 46 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.Forms.FormLogin.resources 47 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.Forms.FormUpload.resources 48 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample_OOP_Pro.Properties.Resources.resources 49 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample OOP Pro.csproj.GenerateResource.cache 50 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample OOP Pro.csproj.CoreCompileInputs.cache 51 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample OOP Pro.exe 52 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\obj\Debug\Sample OOP Pro.pdb 53 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\Sample OOP Pro.exe.config 54 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\Sample OOP Pro.exe 55 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\Sample OOP Pro.pdb 56 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\MySql.Data.dll 57 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\Google.Protobuf.dll 58 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\ZstdNet.dll 59 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\K4os.Compression.LZ4.Streams.dll 60 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\BouncyCastle.Crypto.dll 61 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\Ubiety.Dns.Core.dll 62 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\System.Memory.dll 63 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\System.Buffers.dll 64 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\K4os.Compression.LZ4.dll 65 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\K4os.Hash.xxHash.dll 66 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\bin\Debug\MySql.Data.xml 67 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.csproj.AssemblyReference.cache 68 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.FormMain.resources 69 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormDashboard.resources 70 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormDataGridView.resources 71 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormInputs.resources 72 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormLogin.resources 73 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormUpload.resources 74 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Properties.Resources.resources 75 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.csproj.GenerateResource.cache 76 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.csproj.CoreCompileInputs.cache 77 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.exe 78 | C:\Users\wilfred pine\source\repos\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.pdb 79 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\Sample OOP Pro.exe.config 80 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\Sample OOP Pro.exe 81 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\Sample OOP Pro.pdb 82 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\MySql.Data.dll 83 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\Google.Protobuf.dll 84 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\ZstdNet.dll 85 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\K4os.Compression.LZ4.Streams.dll 86 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\BouncyCastle.Crypto.dll 87 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\Ubiety.Dns.Core.dll 88 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\System.Memory.dll 89 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\System.Buffers.dll 90 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\K4os.Compression.LZ4.dll 91 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\K4os.Hash.xxHash.dll 92 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\bin\Debug\MySql.Data.xml 93 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.csproj.AssemblyReference.cache 94 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.FormMain.resources 95 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormDashboard.resources 96 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormDataGridView.resources 97 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormInputs.resources 98 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormLogin.resources 99 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Forms.FormUpload.resources 100 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample_OOP_Pro.Properties.Resources.resources 101 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.csproj.GenerateResource.cache 102 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.csproj.CoreCompileInputs.cache 103 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.exe 104 | C:\wamp64\www\Github\csharp-custom-classes\Sample Project\obj\Debug\Sample OOP Pro.pdb 105 | -------------------------------------------------------------------------------- /Sample Project/FormMain.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Sample_OOP_Pro 3 | { 4 | partial class FormMain 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.panel1 = new System.Windows.Forms.Panel(); 33 | this.btnProfile = new System.Windows.Forms.Button(); 34 | this.btnInputs = new System.Windows.Forms.Button(); 35 | this.btnLogout = new System.Windows.Forms.Button(); 36 | this.btnDataGridView = new System.Windows.Forms.Button(); 37 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 38 | this.btnDashboard = new System.Windows.Forms.Button(); 39 | this.panel2 = new System.Windows.Forms.Panel(); 40 | this.label1 = new System.Windows.Forms.Label(); 41 | this.lblExit = new System.Windows.Forms.Label(); 42 | this.panel1.SuspendLayout(); 43 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 44 | this.panel2.SuspendLayout(); 45 | this.SuspendLayout(); 46 | // 47 | // panel1 48 | // 49 | this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); 50 | this.panel1.Controls.Add(this.btnProfile); 51 | this.panel1.Controls.Add(this.btnInputs); 52 | this.panel1.Controls.Add(this.btnLogout); 53 | this.panel1.Controls.Add(this.btnDataGridView); 54 | this.panel1.Controls.Add(this.pictureBox1); 55 | this.panel1.Controls.Add(this.btnDashboard); 56 | this.panel1.Dock = System.Windows.Forms.DockStyle.Left; 57 | this.panel1.Location = new System.Drawing.Point(0, 43); 58 | this.panel1.Margin = new System.Windows.Forms.Padding(4); 59 | this.panel1.Name = "panel1"; 60 | this.panel1.Size = new System.Drawing.Size(300, 666); 61 | this.panel1.TabIndex = 3; 62 | // 63 | // btnProfile 64 | // 65 | this.btnProfile.BackColor = System.Drawing.Color.DimGray; 66 | this.btnProfile.Cursor = System.Windows.Forms.Cursors.Hand; 67 | this.btnProfile.FlatAppearance.BorderSize = 0; 68 | this.btnProfile.FlatAppearance.MouseOverBackColor = System.Drawing.Color.SteelBlue; 69 | this.btnProfile.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 70 | this.btnProfile.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 71 | this.btnProfile.ForeColor = System.Drawing.Color.White; 72 | this.btnProfile.Location = new System.Drawing.Point(1, 367); 73 | this.btnProfile.Margin = new System.Windows.Forms.Padding(4); 74 | this.btnProfile.Name = "btnProfile"; 75 | this.btnProfile.Size = new System.Drawing.Size(300, 58); 76 | this.btnProfile.TabIndex = 5; 77 | this.btnProfile.Text = "Profile"; 78 | this.btnProfile.UseVisualStyleBackColor = false; 79 | this.btnProfile.Click += new System.EventHandler(this.btnProfile_Click); 80 | // 81 | // btnInputs 82 | // 83 | this.btnInputs.BackColor = System.Drawing.Color.DimGray; 84 | this.btnInputs.Cursor = System.Windows.Forms.Cursors.Hand; 85 | this.btnInputs.FlatAppearance.BorderSize = 0; 86 | this.btnInputs.FlatAppearance.MouseOverBackColor = System.Drawing.Color.SteelBlue; 87 | this.btnInputs.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 88 | this.btnInputs.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 89 | this.btnInputs.ForeColor = System.Drawing.Color.White; 90 | this.btnInputs.Location = new System.Drawing.Point(0, 308); 91 | this.btnInputs.Margin = new System.Windows.Forms.Padding(4); 92 | this.btnInputs.Name = "btnInputs"; 93 | this.btnInputs.Size = new System.Drawing.Size(300, 58); 94 | this.btnInputs.TabIndex = 4; 95 | this.btnInputs.Text = "Inputs"; 96 | this.btnInputs.UseVisualStyleBackColor = false; 97 | this.btnInputs.Click += new System.EventHandler(this.btnInputs_Click); 98 | // 99 | // btnLogout 100 | // 101 | this.btnLogout.BackColor = System.Drawing.Color.DimGray; 102 | this.btnLogout.Cursor = System.Windows.Forms.Cursors.Hand; 103 | this.btnLogout.FlatAppearance.BorderSize = 0; 104 | this.btnLogout.FlatAppearance.MouseOverBackColor = System.Drawing.Color.SteelBlue; 105 | this.btnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 106 | this.btnLogout.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 107 | this.btnLogout.ForeColor = System.Drawing.Color.White; 108 | this.btnLogout.Location = new System.Drawing.Point(-1, 426); 109 | this.btnLogout.Margin = new System.Windows.Forms.Padding(4); 110 | this.btnLogout.Name = "btnLogout"; 111 | this.btnLogout.Size = new System.Drawing.Size(300, 58); 112 | this.btnLogout.TabIndex = 3; 113 | this.btnLogout.Text = "Logout"; 114 | this.btnLogout.UseVisualStyleBackColor = false; 115 | this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click); 116 | // 117 | // btnDataGridView 118 | // 119 | this.btnDataGridView.BackColor = System.Drawing.Color.DimGray; 120 | this.btnDataGridView.Cursor = System.Windows.Forms.Cursors.Hand; 121 | this.btnDataGridView.FlatAppearance.BorderSize = 0; 122 | this.btnDataGridView.FlatAppearance.MouseOverBackColor = System.Drawing.Color.SteelBlue; 123 | this.btnDataGridView.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 124 | this.btnDataGridView.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 125 | this.btnDataGridView.ForeColor = System.Drawing.Color.White; 126 | this.btnDataGridView.Location = new System.Drawing.Point(0, 249); 127 | this.btnDataGridView.Margin = new System.Windows.Forms.Padding(4); 128 | this.btnDataGridView.Name = "btnDataGridView"; 129 | this.btnDataGridView.Size = new System.Drawing.Size(300, 58); 130 | this.btnDataGridView.TabIndex = 2; 131 | this.btnDataGridView.Text = "DataGridView"; 132 | this.btnDataGridView.UseVisualStyleBackColor = false; 133 | this.btnDataGridView.Click += new System.EventHandler(this.btnDataGridView_Click); 134 | // 135 | // pictureBox1 136 | // 137 | this.pictureBox1.Location = new System.Drawing.Point(72, 31); 138 | this.pictureBox1.Margin = new System.Windows.Forms.Padding(4); 139 | this.pictureBox1.Name = "pictureBox1"; 140 | this.pictureBox1.Size = new System.Drawing.Size(160, 135); 141 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 142 | this.pictureBox1.TabIndex = 1; 143 | this.pictureBox1.TabStop = false; 144 | // 145 | // btnDashboard 146 | // 147 | this.btnDashboard.BackColor = System.Drawing.Color.DimGray; 148 | this.btnDashboard.Cursor = System.Windows.Forms.Cursors.Hand; 149 | this.btnDashboard.FlatAppearance.BorderSize = 0; 150 | this.btnDashboard.FlatAppearance.MouseOverBackColor = System.Drawing.Color.SteelBlue; 151 | this.btnDashboard.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 152 | this.btnDashboard.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 153 | this.btnDashboard.ForeColor = System.Drawing.Color.White; 154 | this.btnDashboard.Location = new System.Drawing.Point(0, 190); 155 | this.btnDashboard.Margin = new System.Windows.Forms.Padding(4); 156 | this.btnDashboard.Name = "btnDashboard"; 157 | this.btnDashboard.Size = new System.Drawing.Size(300, 58); 158 | this.btnDashboard.TabIndex = 0; 159 | this.btnDashboard.Text = "Dashboard"; 160 | this.btnDashboard.UseVisualStyleBackColor = false; 161 | this.btnDashboard.Click += new System.EventHandler(this.btnDashboard_Click); 162 | // 163 | // panel2 164 | // 165 | this.panel2.BackColor = System.Drawing.Color.SteelBlue; 166 | this.panel2.Controls.Add(this.label1); 167 | this.panel2.Controls.Add(this.lblExit); 168 | this.panel2.Dock = System.Windows.Forms.DockStyle.Top; 169 | this.panel2.Location = new System.Drawing.Point(0, 0); 170 | this.panel2.Margin = new System.Windows.Forms.Padding(4); 171 | this.panel2.Name = "panel2"; 172 | this.panel2.Size = new System.Drawing.Size(1217, 43); 173 | this.panel2.TabIndex = 4; 174 | // 175 | // label1 176 | // 177 | this.label1.AutoSize = true; 178 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 179 | this.label1.ForeColor = System.Drawing.Color.White; 180 | this.label1.Location = new System.Drawing.Point(8, 9); 181 | this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 182 | this.label1.Name = "label1"; 183 | this.label1.Size = new System.Drawing.Size(308, 25); 184 | this.label1.TabIndex = 8; 185 | this.label1.Text = "Multiple Document Interface (MDI)"; 186 | // 187 | // lblExit 188 | // 189 | this.lblExit.AutoSize = true; 190 | this.lblExit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); 191 | this.lblExit.Cursor = System.Windows.Forms.Cursors.Hand; 192 | this.lblExit.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 193 | this.lblExit.ForeColor = System.Drawing.Color.White; 194 | this.lblExit.Location = new System.Drawing.Point(1185, 4); 195 | this.lblExit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 196 | this.lblExit.Name = "lblExit"; 197 | this.lblExit.Size = new System.Drawing.Size(28, 31); 198 | this.lblExit.TabIndex = 7; 199 | this.lblExit.Text = "x"; 200 | this.lblExit.Click += new System.EventHandler(this.lblExit_Click); 201 | // 202 | // FormMain 203 | // 204 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 205 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 206 | this.ClientSize = new System.Drawing.Size(1217, 709); 207 | this.Controls.Add(this.panel1); 208 | this.Controls.Add(this.panel2); 209 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 210 | this.IsMdiContainer = true; 211 | this.Name = "FormMain"; 212 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 213 | this.Text = "Dashboard"; 214 | this.Load += new System.EventHandler(this.FormMain_Load); 215 | this.panel1.ResumeLayout(false); 216 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 217 | this.panel2.ResumeLayout(false); 218 | this.panel2.PerformLayout(); 219 | this.ResumeLayout(false); 220 | 221 | } 222 | 223 | #endregion 224 | 225 | private System.Windows.Forms.Panel panel1; 226 | private System.Windows.Forms.Button btnInputs; 227 | private System.Windows.Forms.Button btnLogout; 228 | private System.Windows.Forms.Button btnDataGridView; 229 | private System.Windows.Forms.PictureBox pictureBox1; 230 | private System.Windows.Forms.Button btnDashboard; 231 | private System.Windows.Forms.Panel panel2; 232 | private System.Windows.Forms.Label label1; 233 | private System.Windows.Forms.Label lblExit; 234 | private System.Windows.Forms.Button btnProfile; 235 | } 236 | } 237 | 238 | --------------------------------------------------------------------------------