Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using MaterialSkin;
- using MaterialSkin.Controls;
- using SQLite;
- namespace Auto
- {
- public partial class Form2 : MaterialForm
- {
- public SQLiteConnection connection;
- public Form2()
- {
- InitializeComponent();
- var materialSkinManager = MaterialSkinManager.Instance;
- materialSkinManager.AddFormToManage(this);
- materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
- // Configure color schema
- materialSkinManager.ColorScheme = new ColorScheme(
- Primary.Blue400, Primary.Blue500,
- Primary.Blue500, Accent.LightBlue200,
- TextShade.WHITE
- );
- }
- private void initialize()
- {
- string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
- path = path + @"\AutoBase";
- if (!Directory.Exists(path))
- {
- DirectoryInfo di = Directory.CreateDirectory(path);
- }
- string db_path = Path.Combine(path, "clients.db3");
- connection = new SQLiteConnection(db_path);
- }
- private void Form2_Load(object sender, EventArgs e)
- {
- }
- private void materialFlatButton1_Click(object sender, EventArgs e)
- {
- initialize();
- using (connection)
- {
- var table = connection.Table<Helpers.Clients>();
- var newClient = new Helpers.Clients();
- newClient.name = materialSingleLineTextField1.Text;
- newClient.phone = materialSingleLineTextField2.Text;
- connection.Insert(newClient);
- }
- this.DialogResult = DialogResult.OK;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement