添加项目文件。
This commit is contained in:
1 parent
d68cdea124
commit
faaf9136d6
51 files changed
+11674
No files matched your search
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
{
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
textBox1.Text = "admin";
|
||||
textBox2.Text = "admin";
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text) || comboBox1.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("输入信息为空,请确认");
|
||||
}
|
||||
|
||||
SQLiteHelper<t_user> sQLiteHelper = new db.SQLiteHelper<t_user>();
|
||||
var result = sQLiteHelper.QuerySingle(a=>a.username == textBox1.Text && a.password == textBox2.Text);
|
||||
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
var result_combox = sQLiteHelper1.QuerySingle(a=>a.id == (int)comboBox1.SelectedValue);
|
||||
if (!result.Success || !result_combox.Success)
|
||||
{
|
||||
MessageBox.Show("账号/密码/产线错误!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Init.t_User = result.Data;
|
||||
Init.t_Line = result_combox.Data;
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoginForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
var result_combox = sQLiteHelper1.QueryAll();
|
||||
if (!result_combox.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败");
|
||||
return;
|
||||
}
|
||||
|
||||
// 绑定数据源到 ComboBox
|
||||
comboBox1.DataSource = result_combox.Data;
|
||||
comboBox1.DisplayMember = "linename";
|
||||
comboBox1.ValueMember = "id";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user