init lserp cs 5.0

This commit is contained in:
cyf
2026-07-10 15:25:05 +08:00
commit 90f3fda86a
3799 changed files with 976868 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using CommonLib;
using CommonLib.data;
using DevExpress.XtraEditors;
namespace ERPClient {
public partial class FrmConfig : XtraForm {
public FrmConfig() {
InitializeComponent();
DevExpress.Skins.SkinManager.EnableFormSkins();
}
private void btnTestConnect_Click(object sender, EventArgs e) {
TestConfig(false);
}
private void btnSave_Click(object sender, EventArgs e) {
TestConfig(true);
}
private void TestConfig(bool bSave) {
if (txtServerName.Text.Trim() == string.Empty) {
MessageBox.Show("请输入服务器名称或IP");
return;
}
if (txtDBName.Text.Trim() == string.Empty) {
MessageBox.Show("请输入数据库名称!");
return;
}
DBConfig.Instance.ServerName = txtServerName.Text.Trim();
DBConfig.Instance.datastr = txtDBName.Text.Trim();
Cursor = Cursors.Hand;
try {
string connectionStr = DBConfig.Instance.GetConStr();
using (SqlConnection conn = new SqlConnection(connectionStr)) {
conn.Open();
conn.Close();
conn.Dispose();
}
if (bSave) {
MessageBox.Show("保存成功,系统需要重启.");
DBConfig.Instance.WriteConfig();
DialogResult = DialogResult.OK;
Close();
}
else {
MessageBox.Show("连接正确.");
}
}
catch (Exception ex) {
MessageBox.Show("连接失败,请确认配置是否正确!");
}
finally {
Cursor = Cursors.Default;
}
}
private void btnQuit_Click(object sender, EventArgs e) {
Close();
}
private void FrmConfig_Load(object sender, EventArgs e) {
txtServerName.Text = DBConfig.Instance.ServerName;
txtDBName.Text = DBConfig.Instance.datastr;
}
}
}