基线 SVN r240
SVN-Revision: r240
This commit is contained in:
+176
@@ -0,0 +1,176 @@
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
partial class FrmConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmConfig));
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtDBName = new System.Windows.Forms.TextBox();
|
||||
this.txtServerName = new System.Windows.Forms.TextBox();
|
||||
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnConnect = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnSave = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnExit = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtDBName);
|
||||
this.groupBox1.Controls.Add(this.txtServerName);
|
||||
this.groupBox1.Controls.Add(this.labelControl2);
|
||||
this.groupBox1.Controls.Add(this.labelControl1);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(15, 13);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBox1.Size = new System.Drawing.Size(291, 93);
|
||||
this.groupBox1.TabIndex = 4;
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// txtDBName
|
||||
//
|
||||
this.txtDBName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtDBName.Location = new System.Drawing.Point(89, 55);
|
||||
this.txtDBName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.txtDBName.MaxLength = 50;
|
||||
this.txtDBName.Name = "txtDBName";
|
||||
this.txtDBName.Size = new System.Drawing.Size(185, 26);
|
||||
this.txtDBName.TabIndex = 7;
|
||||
//
|
||||
// txtServerName
|
||||
//
|
||||
this.txtServerName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtServerName.Location = new System.Drawing.Point(89, 19);
|
||||
this.txtServerName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.txtServerName.MaxLength = 50;
|
||||
this.txtServerName.Name = "txtServerName";
|
||||
this.txtServerName.Size = new System.Drawing.Size(185, 26);
|
||||
this.txtServerName.TabIndex = 6;
|
||||
//
|
||||
// labelControl2
|
||||
//
|
||||
this.labelControl2.Location = new System.Drawing.Point(14, 60);
|
||||
this.labelControl2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.labelControl2.Name = "labelControl2";
|
||||
this.labelControl2.Size = new System.Drawing.Size(75, 18);
|
||||
this.labelControl2.TabIndex = 5;
|
||||
this.labelControl2.Text = "数据库名称";
|
||||
//
|
||||
// labelControl1
|
||||
//
|
||||
this.labelControl1.Location = new System.Drawing.Point(14, 24);
|
||||
this.labelControl1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.labelControl1.Name = "labelControl1";
|
||||
this.labelControl1.Size = new System.Drawing.Size(75, 18);
|
||||
this.labelControl1.TabIndex = 4;
|
||||
this.labelControl1.Text = "数据库地址";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(8, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(0, 18);
|
||||
this.label1.TabIndex = 0;
|
||||
//
|
||||
// btnConnect
|
||||
//
|
||||
this.btnConnect.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnConnect.Location = new System.Drawing.Point(26, 114);
|
||||
this.btnConnect.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnConnect.Name = "btnConnect";
|
||||
this.btnConnect.Size = new System.Drawing.Size(71, 30);
|
||||
this.btnConnect.TabIndex = 8;
|
||||
this.btnConnect.Text = "测试连接";
|
||||
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSave.Location = new System.Drawing.Point(124, 114);
|
||||
this.btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(71, 30);
|
||||
this.btnSave.TabIndex = 9;
|
||||
this.btnSave.Text = "保存配置";
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnExit.Location = new System.Drawing.Point(218, 114);
|
||||
this.btnExit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(71, 30);
|
||||
this.btnExit.TabIndex = 10;
|
||||
this.btnExit.Text = "退出";
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// FrmConfig
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(318, 164);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.btnConnect);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FrmConfig";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "数据库连接配置";
|
||||
this.Load += new System.EventHandler(this.FrmConfig_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl1;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl2;
|
||||
private DevExpress.XtraEditors.SimpleButton btnConnect;
|
||||
private System.Windows.Forms.TextBox txtDBName;
|
||||
private System.Windows.Forms.TextBox txtServerName;
|
||||
private DevExpress.XtraEditors.SimpleButton btnSave;
|
||||
private DevExpress.XtraEditors.SimpleButton btnExit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/******************************
|
||||
* 说明:数据库配置界面
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-08-09
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
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 DevExpress.XtraEditors;
|
||||
using Lskj.Core;
|
||||
using Lskj.Control;
|
||||
using Lskj.Data;
|
||||
using Lskj.PubMrpAnalyze.Model;
|
||||
using Lskj.Business.Impl;
|
||||
using System.IO;
|
||||
using Lskj.Business;
|
||||
using Lskj.Control.Model;
|
||||
using System.Net;
|
||||
using DevExpress.Utils.OAuth.Provider;
|
||||
using Lskj.Util;
|
||||
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库配置界面
|
||||
/// </summary>
|
||||
public partial class FrmConfig : XtraForm
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认下载地址
|
||||
/// </summary>
|
||||
public string filePath = string.Empty;
|
||||
/// <summary>
|
||||
/// 返回地址值
|
||||
/// </summary>
|
||||
public string outText = string.Empty;
|
||||
|
||||
public FrmConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:窗口加载</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void FrmConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DBConfig.Instance.ReadConfig(true);
|
||||
this.txtServerName.Text = DBConfig.Instance.ServerName;
|
||||
this.txtDBName.Text = DBConfig.Instance.DataBase;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:测试数据库连接</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnConnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectServer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:保存配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectServer(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:退出配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:连接服务器</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="isSave">if set to <c>true</c> [is save].</param>
|
||||
private void ConnectServer(bool isSave = false)
|
||||
{
|
||||
string serverName = this.txtServerName.Text.Trim();
|
||||
string dbName = this.txtDBName.Text.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(serverName))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ServerNameIsNull);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(dbName))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ServerDBIsNull);
|
||||
return;
|
||||
}
|
||||
DBConfig.Instance.ServerName = serverName;
|
||||
DBConfig.Instance.DataBase = dbName;
|
||||
|
||||
// 测试数据库连接
|
||||
try
|
||||
{
|
||||
if (DBConfig.Instance.CreateConnection())
|
||||
{
|
||||
if (DelphiHelper.Delphi_Init(new StringBuilder(DBConfig.Instance.GetDelphiConnection())) == 0)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.UnConnectServer + "[By Delphi]");
|
||||
return;
|
||||
}
|
||||
if (isSave)
|
||||
{
|
||||
DBConfig.Instance.WriteConfig();
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectSuccess);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
//IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "0");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,243 @@
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
partial class FrmConfigLocal
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmConfigLocal));
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtPort = new System.Windows.Forms.TextBox();
|
||||
this.txtIP = new System.Windows.Forms.TextBox();
|
||||
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnConnect = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnSave = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnExit = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.txtZTName = new System.Windows.Forms.TextBox();
|
||||
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.txtZT = new DevExpress.XtraEditors.GridLookUpEdit();
|
||||
this.gridLookUpEdit1View = new DevExpress.XtraGrid.Views.Grid.GridView();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtZT.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridLookUpEdit1View)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtZT);
|
||||
this.groupBox1.Controls.Add(this.txtZTName);
|
||||
this.groupBox1.Controls.Add(this.labelControl4);
|
||||
this.groupBox1.Controls.Add(this.labelControl3);
|
||||
this.groupBox1.Controls.Add(this.txtPort);
|
||||
this.groupBox1.Controls.Add(this.txtIP);
|
||||
this.groupBox1.Controls.Add(this.labelControl2);
|
||||
this.groupBox1.Controls.Add(this.labelControl1);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(15, 13);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBox1.Size = new System.Drawing.Size(291, 159);
|
||||
this.groupBox1.TabIndex = 4;
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// txtPort
|
||||
//
|
||||
this.txtPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtPort.Location = new System.Drawing.Point(66, 89);
|
||||
this.txtPort.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.txtPort.MaxLength = 50;
|
||||
this.txtPort.Name = "txtPort";
|
||||
this.txtPort.Size = new System.Drawing.Size(210, 26);
|
||||
this.txtPort.TabIndex = 7;
|
||||
//
|
||||
// txtIP
|
||||
//
|
||||
this.txtIP.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtIP.Location = new System.Drawing.Point(66, 53);
|
||||
this.txtIP.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.txtIP.MaxLength = 50;
|
||||
this.txtIP.Name = "txtIP";
|
||||
this.txtIP.Size = new System.Drawing.Size(210, 26);
|
||||
this.txtIP.TabIndex = 6;
|
||||
//
|
||||
// labelControl2
|
||||
//
|
||||
this.labelControl2.Location = new System.Drawing.Point(16, 94);
|
||||
this.labelControl2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.labelControl2.Name = "labelControl2";
|
||||
this.labelControl2.Size = new System.Drawing.Size(45, 18);
|
||||
this.labelControl2.TabIndex = 5;
|
||||
this.labelControl2.Text = "端口号";
|
||||
//
|
||||
// labelControl1
|
||||
//
|
||||
this.labelControl1.Location = new System.Drawing.Point(16, 58);
|
||||
this.labelControl1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.labelControl1.Name = "labelControl1";
|
||||
this.labelControl1.Size = new System.Drawing.Size(44, 18);
|
||||
this.labelControl1.TabIndex = 4;
|
||||
this.labelControl1.Text = "IP地址";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(8, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(0, 18);
|
||||
this.label1.TabIndex = 0;
|
||||
//
|
||||
// btnConnect
|
||||
//
|
||||
this.btnConnect.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnConnect.Location = new System.Drawing.Point(28, 180);
|
||||
this.btnConnect.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnConnect.Name = "btnConnect";
|
||||
this.btnConnect.Size = new System.Drawing.Size(71, 30);
|
||||
this.btnConnect.TabIndex = 8;
|
||||
this.btnConnect.Text = "测试连接";
|
||||
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSave.Location = new System.Drawing.Point(126, 180);
|
||||
this.btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(71, 30);
|
||||
this.btnSave.TabIndex = 9;
|
||||
this.btnSave.Text = "保存配置";
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnExit.Location = new System.Drawing.Point(220, 180);
|
||||
this.btnExit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(71, 30);
|
||||
this.btnExit.TabIndex = 10;
|
||||
this.btnExit.Text = "退出";
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// labelControl3
|
||||
//
|
||||
this.labelControl3.Location = new System.Drawing.Point(16, 23);
|
||||
this.labelControl3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.labelControl3.Name = "labelControl3";
|
||||
this.labelControl3.Size = new System.Drawing.Size(30, 18);
|
||||
this.labelControl3.TabIndex = 8;
|
||||
this.labelControl3.Text = "账套";
|
||||
//
|
||||
// txtZTName
|
||||
//
|
||||
this.txtZTName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtZTName.Location = new System.Drawing.Point(66, 123);
|
||||
this.txtZTName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.txtZTName.MaxLength = 50;
|
||||
this.txtZTName.Name = "txtZTName";
|
||||
this.txtZTName.Size = new System.Drawing.Size(210, 26);
|
||||
this.txtZTName.TabIndex = 11;
|
||||
//
|
||||
// labelControl4
|
||||
//
|
||||
this.labelControl4.Location = new System.Drawing.Point(16, 128);
|
||||
this.labelControl4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.labelControl4.Name = "labelControl4";
|
||||
this.labelControl4.Size = new System.Drawing.Size(45, 18);
|
||||
this.labelControl4.TabIndex = 10;
|
||||
this.labelControl4.Text = "账套名";
|
||||
//
|
||||
// txtZT
|
||||
//
|
||||
this.txtZT.EditValue = "";
|
||||
this.txtZT.Location = new System.Drawing.Point(66, 20);
|
||||
this.txtZT.Name = "txtZT";
|
||||
this.txtZT.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9.5F);
|
||||
this.txtZT.Properties.Appearance.Options.UseFont = true;
|
||||
this.txtZT.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
|
||||
this.txtZT.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
|
||||
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
|
||||
this.txtZT.Properties.View = this.gridLookUpEdit1View;
|
||||
this.txtZT.Size = new System.Drawing.Size(210, 26);
|
||||
this.txtZT.TabIndex = 12;
|
||||
//
|
||||
// gridLookUpEdit1View
|
||||
//
|
||||
this.gridLookUpEdit1View.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
|
||||
this.gridLookUpEdit1View.Name = "gridLookUpEdit1View";
|
||||
this.gridLookUpEdit1View.OptionsSelection.EnableAppearanceFocusedCell = false;
|
||||
this.gridLookUpEdit1View.OptionsView.ShowGroupPanel = false;
|
||||
//
|
||||
// FrmConfigLocal
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(318, 223);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.btnConnect);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FrmConfigLocal";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "服务器直连配置";
|
||||
this.Load += new System.EventHandler(this.FrmConfig_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtZT.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridLookUpEdit1View)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl1;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl2;
|
||||
private DevExpress.XtraEditors.SimpleButton btnConnect;
|
||||
private System.Windows.Forms.TextBox txtPort;
|
||||
private System.Windows.Forms.TextBox txtIP;
|
||||
private DevExpress.XtraEditors.SimpleButton btnSave;
|
||||
private DevExpress.XtraEditors.SimpleButton btnExit;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl3;
|
||||
private System.Windows.Forms.TextBox txtZTName;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl4;
|
||||
private DevExpress.XtraEditors.GridLookUpEdit txtZT;
|
||||
private DevExpress.XtraGrid.Views.Grid.GridView gridLookUpEdit1View;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
using DevExpress.XtraEditors;
|
||||
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 Lskj.Core;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control;
|
||||
using Lskj.Data;
|
||||
using Lskj.Util;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
public partial class FrmConfigLocal : XtraForm
|
||||
{/// <summary>
|
||||
/// 默认下载地址
|
||||
/// </summary>
|
||||
public string filePath = string.Empty;
|
||||
/// <summary>
|
||||
/// 返回地址值
|
||||
/// </summary>
|
||||
public string outText = string.Empty;
|
||||
/// <summary>
|
||||
/// 账套数据
|
||||
/// </summary>
|
||||
public DataTable sourceTab = new DataTable();
|
||||
public FrmConfigLocal()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.txtIP.KeyUp += OnTxtEdit_KeyUp;
|
||||
this.txtPort.KeyUp += OnTxtEdit_KeyUp;
|
||||
this.txtZT.EditValueChanged += OnTxtZT_EditValueChanged;
|
||||
}
|
||||
|
||||
private void OnTxtZT_EditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow focusRow = (this.txtZT.GetSelectedDataRow() as DataRowView).Row;
|
||||
this.txtIP.Text = (focusRow["dm"] + "").Split(':')[0];
|
||||
this.txtPort.Text = (focusRow["dm"] + "").Split(':')[1];
|
||||
this.txtZTName.Text = focusRow["mc"] + "";
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTxtEdit_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
string IPProt = string.Format("{0}:{1}", this.txtIP.Text, this.txtPort.Text);
|
||||
DataRow[] rows = sourceTab.Select(string.Format("dm='{0}'", IPProt));
|
||||
if (rows != null && rows.Count() > 0)
|
||||
{
|
||||
this.txtZT.EditValue = IPProt;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:窗口加载</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void FrmConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
sourceTab.Columns.Add("dm");
|
||||
sourceTab.Columns.Add("mc");
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> sourceDic = IniHelper.GetSectionKeys("SystemResources.ini", "SystemResources");
|
||||
foreach (string key in sourceDic.Keys)
|
||||
{
|
||||
if (key.Contains("DownloadAESStr_"))
|
||||
{
|
||||
DataRow row = sourceTab.NewRow();
|
||||
string[] keyArgs = key.Split('_');
|
||||
if (keyArgs.Length == 2)
|
||||
{
|
||||
row["dm"] = keyArgs[1];//ip+port
|
||||
row["mc"] = sourceDic[key].Split('^')[0];//账套名
|
||||
sourceTab.Rows.Add(row);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
this.txtZT.Properties.View.Columns.AddVisible("dm", "地址");
|
||||
this.txtZT.Properties.View.Columns.AddVisible("mc", "账套名称");
|
||||
this.txtZT.Properties.DataSource = sourceTab; //数据源
|
||||
this.txtZT.Properties.ValueMember = "dm";
|
||||
this.txtZT.Properties.DisplayMember = "mc";
|
||||
this.txtZT.Properties.View.BestFitColumns();
|
||||
this.txtZT.Properties.View.Columns["dm"].Visible = false;
|
||||
|
||||
this.txtZT.EditValue = string.Format("{0}:{1}", IniHelper.Read("SystemResources.ini", "LocalLastIP"), IniHelper.Read("SystemResources.ini", "LocalLastPort"));
|
||||
//this.txtIP.Text = IniHelper.Read("SystemResources.ini", "LocalLastIP");
|
||||
//this.txtPort.Text = IniHelper.Read("SystemResources.ini", "LocalLastPort");
|
||||
//this.txtZTName.Text = IniHelper.Read("SystemResources.ini", "LocalLastPortName");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:测试数据库连接</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnConnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectServer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:保存配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectServer(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:退出配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:连接服务器</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="isSave">if set to <c>true</c> [is save].</param>
|
||||
private void ConnectServer(bool isSave = false)
|
||||
{
|
||||
string serverName = DBConfig.Instance.ServerName;
|
||||
string dbName = DBConfig.Instance.DataBase;
|
||||
// 测试数据库连接
|
||||
try
|
||||
{
|
||||
string ip = this.txtIP.Text;
|
||||
string defaultPort = ":" + this.txtPort.Text;
|
||||
//服务器下载
|
||||
string newServerName = !serverName.StartsWith("http") ? "http://" + ip + defaultPort : ip + defaultPort;
|
||||
newServerName = !newServerName.EndsWith("/") ? newServerName + "/" : newServerName;
|
||||
string newfilePath = Path.Combine(newServerName, "SystemResources.txt");
|
||||
//string name = WebRequest.Create(filePath).GetResponse().GetResponseStream().ToString();
|
||||
string fileName = "SystemResources.txt";//客户端保存的文件名
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.Encoding = Encoding.UTF8;
|
||||
//这里使用DownloadString方法,如果是不需要对文件的文本内容做处理,直接保存,那么可以直接使用功能DownloadFile(url,savepath)直接进行文件保存。
|
||||
string newoutText = newfilePath != filePath ? webClient.DownloadString(newfilePath) : outText;
|
||||
outText = newoutText.Trim();
|
||||
filePath = newfilePath;
|
||||
//File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemResources.txt"), outText);
|
||||
string args = AESUtil.Decrypt(outText);
|
||||
string[] controlAfgs = args.Split('^');
|
||||
if (controlAfgs != null && controlAfgs.Length == 5)
|
||||
{
|
||||
DBConfig.Instance.ServerName = controlAfgs[0];
|
||||
DBConfig.Instance.DataBase = controlAfgs[1];
|
||||
string Connection = "Server={0};Database={1};Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5;MultipleActiveResultSets=true";
|
||||
string dephistr = "Provider=SQLOLEDB.1;Server={0};Database={1};Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5";
|
||||
Connection = AESUtil.Encrypt(Connection);
|
||||
dephistr = AESUtil.Encrypt(dephistr);
|
||||
DBConfig.Instance.dephiConnection = dephistr;
|
||||
DBConfig.Instance.Connection = Connection;
|
||||
if (DBConfig.Instance.CreateConnection(Connection))
|
||||
{
|
||||
if (isSave)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtZTName.Text))
|
||||
{
|
||||
string IPPort = string.Format("{0}:{1}", this.txtIP.Text, this.txtPort.Text);
|
||||
string writeText = string.Format("{0}^{1}", this.txtZTName.Text, outText);
|
||||
IniHelper.Write("SystemResources.ini", string.Format("DownloadAESStr_{0}", IPPort), writeText);
|
||||
IniHelper.Write("SystemResources.ini", "LocalLastIP", this.txtIP.Text);
|
||||
IniHelper.Write("SystemResources.ini", "LocalLastPort", this.txtPort.Text);
|
||||
IniHelper.Write("SystemResources.ini", "LocalLastPortName", this.txtZTName.Text);
|
||||
DBConfig.Instance.WriteConfig("LocalLastIP", this.txtIP.Text);
|
||||
DBConfig.Instance.WriteConfig("LocalLastPort", this.txtPort.Text);
|
||||
DBConfig.Instance.WriteConfig("LocalLastPortName", this.txtZTName.Text);
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show("请设置账套名!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectSuccess);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
//IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "1");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+114
@@ -0,0 +1,114 @@
|
||||
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
partial class FrmConfigSet
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmConfigSet));
|
||||
this.frmConfigBtn = new System.Windows.Forms.RadioButton();
|
||||
this.frmConfigLocalBtn = new System.Windows.Forms.RadioButton();
|
||||
this.btnSettings = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnChange = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// frmConfigBtn
|
||||
//
|
||||
this.frmConfigBtn.AutoSize = true;
|
||||
this.frmConfigBtn.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.frmConfigBtn.ForeColor = System.Drawing.Color.Blue;
|
||||
this.frmConfigBtn.Location = new System.Drawing.Point(22, 36);
|
||||
this.frmConfigBtn.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.frmConfigBtn.Name = "frmConfigBtn";
|
||||
this.frmConfigBtn.Size = new System.Drawing.Size(130, 23);
|
||||
this.frmConfigBtn.TabIndex = 0;
|
||||
this.frmConfigBtn.TabStop = true;
|
||||
this.frmConfigBtn.Text = "数据库连接";
|
||||
this.frmConfigBtn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmConfigLocalBtn
|
||||
//
|
||||
this.frmConfigLocalBtn.AutoSize = true;
|
||||
this.frmConfigLocalBtn.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.frmConfigLocalBtn.ForeColor = System.Drawing.Color.Blue;
|
||||
this.frmConfigLocalBtn.Location = new System.Drawing.Point(22, 88);
|
||||
this.frmConfigLocalBtn.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.frmConfigLocalBtn.Name = "frmConfigLocalBtn";
|
||||
this.frmConfigLocalBtn.Size = new System.Drawing.Size(130, 23);
|
||||
this.frmConfigLocalBtn.TabIndex = 1;
|
||||
this.frmConfigLocalBtn.TabStop = true;
|
||||
this.frmConfigLocalBtn.Text = "服务器直连";
|
||||
this.frmConfigLocalBtn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnSettings
|
||||
//
|
||||
this.btnSettings.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSettings.Location = new System.Drawing.Point(184, 28);
|
||||
this.btnSettings.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||
this.btnSettings.Name = "btnSettings";
|
||||
this.btnSettings.Size = new System.Drawing.Size(54, 42);
|
||||
this.btnSettings.TabIndex = 9;
|
||||
this.btnSettings.Text = "设置";
|
||||
//
|
||||
// btnChange
|
||||
//
|
||||
this.btnChange.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnChange.Location = new System.Drawing.Point(184, 79);
|
||||
this.btnChange.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||
this.btnChange.Name = "btnChange";
|
||||
this.btnChange.Size = new System.Drawing.Size(54, 42);
|
||||
this.btnChange.TabIndex = 10;
|
||||
this.btnChange.Text = "保存";
|
||||
//
|
||||
// FrmConfigSet
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(261, 150);
|
||||
this.Controls.Add(this.btnChange);
|
||||
this.Controls.Add(this.btnSettings);
|
||||
this.Controls.Add(this.frmConfigLocalBtn);
|
||||
this.Controls.Add(this.frmConfigBtn);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FrmConfigSet";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "连接模式设置";
|
||||
this.Load += new System.EventHandler(this.FrmConfigSet_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RadioButton frmConfigBtn;
|
||||
private System.Windows.Forms.RadioButton frmConfigLocalBtn;
|
||||
private DevExpress.XtraEditors.SimpleButton btnSettings;
|
||||
private DevExpress.XtraEditors.SimpleButton btnChange;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
using DevExpress.XtraEditors;
|
||||
using Lskj.Control;
|
||||
using Lskj.Core;
|
||||
using Lskj.Data;
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
public partial class FrmConfigSet : XtraForm
|
||||
{
|
||||
public FrmConfigSet()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void FrmConfigSet_Load(object sender, EventArgs e)
|
||||
{
|
||||
string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemResources.ini");
|
||||
if (!File.Exists(file))
|
||||
{
|
||||
FileStream fileStream = new FileStream(file, FileMode.CreateNew);
|
||||
fileStream.Close();
|
||||
this.frmConfigBtn.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string configFlag = IniHelper.Read("SystemResources.ini", "FrmConfigFlag");
|
||||
if (configFlag.Equals("1"))
|
||||
this.frmConfigLocalBtn.Checked = true;
|
||||
else
|
||||
this.frmConfigBtn.Checked = true;
|
||||
}
|
||||
this.btnSettings.Click += new EventHandler(OnBtnSettings_Click);
|
||||
this.btnChange.Click += new EventHandler(OnBtnChange_Click);
|
||||
}
|
||||
|
||||
private void OnBtnChange_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.frmConfigLocalBtn.Checked)
|
||||
{
|
||||
try
|
||||
{
|
||||
string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemResources.ini");
|
||||
if (File.Exists(file))
|
||||
{
|
||||
string lastIPPort = string.Format("{0}:{1}", IniHelper.Read("SystemResources.ini", "LocalLastIP"), IniHelper.Read("SystemResources.ini", "LocalLastPort"));
|
||||
string downloadAESStrKey = string.Format("DownloadAESStr_{0}", lastIPPort);
|
||||
string[] downloadAESStrValue = IniHelper.Read("SystemResources.ini", downloadAESStrKey).Split('^');
|
||||
string downloadAESStr = downloadAESStrValue.Length == 2 ? downloadAESStrValue[1] : "";
|
||||
if (!string.IsNullOrEmpty(downloadAESStr))
|
||||
{
|
||||
string args = AESUtil.Decrypt(downloadAESStr);
|
||||
string[] controlAfgs = args.Split('^');
|
||||
if (controlAfgs != null && controlAfgs.Length == 5)
|
||||
{
|
||||
DBConfig.Instance.ServerName = controlAfgs[0];
|
||||
DBConfig.Instance.DataBase = controlAfgs[1];
|
||||
string Connection = "Server={0};Database={1};Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5;MultipleActiveResultSets=true";
|
||||
string dephistr = "Provider=SQLOLEDB.1;Server={0};Database={1};Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5";
|
||||
Connection = AESUtil.Encrypt(Connection);
|
||||
dephistr = AESUtil.Encrypt(dephistr);
|
||||
DBConfig.Instance.dephiConnection = dephistr;
|
||||
if (DBConfig.Instance.CreateConnection(Connection))
|
||||
{
|
||||
DBConfig.Instance.Connection = Connection;
|
||||
this.DialogResult = DialogResult.OK;
|
||||
IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "1");
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show("未检测到配置数据,切换失败!\r\n请进行手动设置!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show("配置文件不存在,请手动设置!");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
}
|
||||
else if (this.frmConfigBtn.Checked)
|
||||
{
|
||||
DBConfig.Instance.ReadConfig(true);
|
||||
string serverName = DBConfig.Instance.ServerName;
|
||||
string dbName = DBConfig.Instance.DataBase;
|
||||
if (string.IsNullOrWhiteSpace(serverName))
|
||||
{
|
||||
MessageUtil.Show("数据库地址为空,切换失败");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(dbName))
|
||||
{
|
||||
MessageUtil.Show("数据库名称为空,切换失败");
|
||||
return;
|
||||
}
|
||||
DBConfig.Instance.ServerName = serverName;
|
||||
DBConfig.Instance.DataBase = dbName;
|
||||
try
|
||||
{
|
||||
if (DBConfig.Instance.CreateConnection())
|
||||
{
|
||||
if (DelphiHelper.Delphi_Init(new StringBuilder(DBConfig.Instance.GetDelphiConnection())) == 0)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.UnConnectServer + "[By Delphi]");
|
||||
return;
|
||||
}
|
||||
DBConfig.Instance.WriteConfig();
|
||||
this.DialogResult = DialogResult.OK;
|
||||
IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "0");
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnBtnSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dialogResult;
|
||||
if (this.frmConfigBtn.Checked)
|
||||
{
|
||||
this.Hide();
|
||||
FrmConfig frmConfig = new FrmConfig();
|
||||
dialogResult = frmConfig.ShowDialog();
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "0");
|
||||
}
|
||||
this.Show();
|
||||
}
|
||||
else if (this.frmConfigLocalBtn.Checked)
|
||||
{
|
||||
this.Hide();
|
||||
FrmConfigLocal frmConfigLocal = new FrmConfigLocal();
|
||||
dialogResult = frmConfigLocal.ShowDialog();
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "1");
|
||||
}
|
||||
this.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogResult = DialogResult.Cancel;
|
||||
}
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
this.DialogResult = dialogResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+310
@@ -0,0 +1,310 @@
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
partial class FrmLogin
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmLogin));
|
||||
this.lblCopyright = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.btnSetConfig = new System.Windows.Forms.Label();
|
||||
this.chkUpdate = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.chkClient = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.chkLogin = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.txtPassword = new DevExpress.XtraEditors.TextEdit();
|
||||
this.btnColse = new System.Windows.Forms.Button();
|
||||
this.cbLedger = new DevExpress.XtraEditors.ComboBoxEdit();
|
||||
this.autoGridLookUpEdit1View = new DevExpress.XtraGrid.Views.Grid.GridView();
|
||||
this.chkNotice = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.plTop = new System.Windows.Forms.Panel();
|
||||
this.btnLogin = new System.Windows.Forms.PictureBox();
|
||||
this.chkRemPwd = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.lueUserName = new Lskj.Control.AutoGridLookUp();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkUpdate.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkClient.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkLogin.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtPassword.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cbLedger.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.autoGridLookUpEdit1View)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkNotice.Properties)).BeginInit();
|
||||
this.plTop.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.btnLogin)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkRemPwd.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lueUserName.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblCopyright
|
||||
//
|
||||
this.lblCopyright.AutoSize = true;
|
||||
this.lblCopyright.BackColor = System.Drawing.Color.White;
|
||||
this.lblCopyright.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.lblCopyright.ForeColor = System.Drawing.Color.Black;
|
||||
this.lblCopyright.Location = new System.Drawing.Point(403, 425);
|
||||
this.lblCopyright.Name = "lblCopyright";
|
||||
this.lblCopyright.Size = new System.Drawing.Size(253, 17);
|
||||
this.lblCopyright.TabIndex = 34;
|
||||
this.lblCopyright.Text = "版权所有:成都朗速科技有限公司 版本:V7.0";
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BackgroundImage = global::Lskj.PubMrpAnalyze.Properties.Resources.setting;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(305, 425);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(16, 16);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox1.TabIndex = 32;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// btnSetConfig
|
||||
//
|
||||
this.btnSetConfig.AutoSize = true;
|
||||
this.btnSetConfig.BackColor = System.Drawing.Color.White;
|
||||
this.btnSetConfig.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSetConfig.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.btnSetConfig.ForeColor = System.Drawing.Color.Blue;
|
||||
this.btnSetConfig.Location = new System.Drawing.Point(321, 425);
|
||||
this.btnSetConfig.Name = "btnSetConfig";
|
||||
this.btnSetConfig.Size = new System.Drawing.Size(68, 17);
|
||||
this.btnSetConfig.TabIndex = 30;
|
||||
this.btnSetConfig.Text = "设置服务器";
|
||||
this.btnSetConfig.Click += new System.EventHandler(this.OnSetConfigClick);
|
||||
//
|
||||
// chkUpdate
|
||||
//
|
||||
this.chkUpdate.Location = new System.Drawing.Point(26, 423);
|
||||
this.chkUpdate.Name = "chkUpdate";
|
||||
this.chkUpdate.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.chkUpdate.Properties.Appearance.Options.UseFont = true;
|
||||
this.chkUpdate.Properties.Caption = "自动升级";
|
||||
this.chkUpdate.Size = new System.Drawing.Size(75, 21);
|
||||
this.chkUpdate.TabIndex = 36;
|
||||
//
|
||||
// chkClient
|
||||
//
|
||||
this.chkClient.Location = new System.Drawing.Point(112, 423);
|
||||
this.chkClient.Name = "chkClient";
|
||||
this.chkClient.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.chkClient.Properties.Appearance.Options.UseFont = true;
|
||||
this.chkClient.Properties.Caption = "智能客户端";
|
||||
this.chkClient.Size = new System.Drawing.Size(87, 21);
|
||||
this.chkClient.TabIndex = 37;
|
||||
//
|
||||
// chkLogin
|
||||
//
|
||||
this.chkLogin.Location = new System.Drawing.Point(431, 295);
|
||||
this.chkLogin.Name = "chkLogin";
|
||||
this.chkLogin.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
this.chkLogin.Properties.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.chkLogin.Properties.Appearance.Options.UseFont = true;
|
||||
this.chkLogin.Properties.Appearance.Options.UseForeColor = true;
|
||||
this.chkLogin.Properties.Caption = "强制登录";
|
||||
this.chkLogin.Size = new System.Drawing.Size(85, 24);
|
||||
this.chkLogin.TabIndex = 38;
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.EditValue = "";
|
||||
this.txtPassword.Location = new System.Drawing.Point(431, 251);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 11F);
|
||||
this.txtPassword.Properties.Appearance.Options.UseFont = true;
|
||||
this.txtPassword.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.txtPassword.Properties.NullValuePrompt = "请输入密码";
|
||||
this.txtPassword.Properties.NullValuePromptShowForEmptyValue = true;
|
||||
this.txtPassword.Properties.PasswordChar = '*';
|
||||
this.txtPassword.Size = new System.Drawing.Size(174, 24);
|
||||
this.txtPassword.TabIndex = 0;
|
||||
this.txtPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPasswordKeyDown);
|
||||
//
|
||||
// btnColse
|
||||
//
|
||||
this.btnColse.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnColse.BackgroundImage = global::Lskj.PubMrpAnalyze.Properties.Resources.login_close_default;
|
||||
this.btnColse.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.btnColse.FlatAppearance.BorderSize = 0;
|
||||
this.btnColse.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnColse.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnColse.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnColse.Location = new System.Drawing.Point(626, 12);
|
||||
this.btnColse.Name = "btnColse";
|
||||
this.btnColse.Size = new System.Drawing.Size(30, 30);
|
||||
this.btnColse.TabIndex = 46;
|
||||
this.btnColse.UseVisualStyleBackColor = false;
|
||||
this.btnColse.Click += new System.EventHandler(this.OnColseClick);
|
||||
//
|
||||
// cbLedger
|
||||
//
|
||||
this.cbLedger.Location = new System.Drawing.Point(431, 153);
|
||||
this.cbLedger.Name = "cbLedger";
|
||||
this.cbLedger.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
this.cbLedger.Properties.Appearance.Options.UseFont = true;
|
||||
this.cbLedger.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.cbLedger.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
|
||||
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
|
||||
this.cbLedger.Properties.NullValuePrompt = "请选择账薄";
|
||||
this.cbLedger.Properties.ShowNullValuePromptWhenFocused = true;
|
||||
this.cbLedger.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
||||
this.cbLedger.Properties.Closed += new DevExpress.XtraEditors.Controls.ClosedEventHandler(this.OnLedgerClosed);
|
||||
this.cbLedger.Size = new System.Drawing.Size(174, 24);
|
||||
this.cbLedger.TabIndex = 47;
|
||||
//
|
||||
// autoGridLookUpEdit1View
|
||||
//
|
||||
this.autoGridLookUpEdit1View.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
|
||||
this.autoGridLookUpEdit1View.Name = "autoGridLookUpEdit1View";
|
||||
this.autoGridLookUpEdit1View.OptionsSelection.EnableAppearanceFocusedCell = false;
|
||||
this.autoGridLookUpEdit1View.OptionsView.ShowGroupPanel = false;
|
||||
//
|
||||
// chkNotice
|
||||
//
|
||||
this.chkNotice.Location = new System.Drawing.Point(214, 423);
|
||||
this.chkNotice.Name = "chkNotice";
|
||||
this.chkNotice.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.chkNotice.Properties.Appearance.Options.UseFont = true;
|
||||
this.chkNotice.Properties.Caption = "消息通知";
|
||||
this.chkNotice.Size = new System.Drawing.Size(70, 21);
|
||||
this.chkNotice.TabIndex = 50;
|
||||
//
|
||||
// plTop
|
||||
//
|
||||
this.plTop.BackColor = System.Drawing.Color.Transparent;
|
||||
this.plTop.Controls.Add(this.btnColse);
|
||||
this.plTop.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.plTop.Location = new System.Drawing.Point(0, 0);
|
||||
this.plTop.Name = "plTop";
|
||||
this.plTop.Size = new System.Drawing.Size(664, 65);
|
||||
this.plTop.TabIndex = 48;
|
||||
this.plTop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.plTop_MouseDown);
|
||||
this.plTop.MouseMove += new System.Windows.Forms.MouseEventHandler(this.plTop_MouseMove);
|
||||
this.plTop.MouseUp += new System.Windows.Forms.MouseEventHandler(this.plTop_MouseUp);
|
||||
//
|
||||
// btnLogin
|
||||
//
|
||||
this.btnLogin.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnLogin.BackgroundImage = global::Lskj.PubMrpAnalyze.Properties.Resources.login_btn;
|
||||
this.btnLogin.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.btnLogin.Location = new System.Drawing.Point(431, 326);
|
||||
this.btnLogin.Name = "btnLogin";
|
||||
this.btnLogin.Size = new System.Drawing.Size(174, 38);
|
||||
this.btnLogin.TabIndex = 42;
|
||||
this.btnLogin.TabStop = false;
|
||||
this.btnLogin.Click += new System.EventHandler(this.OnLoginClick);
|
||||
this.btnLogin.MouseLeave += new System.EventHandler(this.OnLoginMouseLeave);
|
||||
this.btnLogin.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnLoginMouseMove);
|
||||
//
|
||||
// chkRemPwd
|
||||
//
|
||||
this.chkRemPwd.Location = new System.Drawing.Point(522, 295);
|
||||
this.chkRemPwd.Name = "chkRemPwd";
|
||||
this.chkRemPwd.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
this.chkRemPwd.Properties.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.chkRemPwd.Properties.Appearance.Options.UseFont = true;
|
||||
this.chkRemPwd.Properties.Appearance.Options.UseForeColor = true;
|
||||
this.chkRemPwd.Properties.Caption = "记住密码";
|
||||
this.chkRemPwd.Size = new System.Drawing.Size(85, 24);
|
||||
this.chkRemPwd.TabIndex = 38;
|
||||
//
|
||||
// lueUserName
|
||||
//
|
||||
this.lueUserName.DataSource = null;
|
||||
this.lueUserName.EditValue = "";
|
||||
this.lueUserName.Location = new System.Drawing.Point(431, 204);
|
||||
this.lueUserName.Name = "lueUserName";
|
||||
this.lueUserName.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 11F);
|
||||
this.lueUserName.Properties.Appearance.Options.UseFont = true;
|
||||
this.lueUserName.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.lueUserName.Properties.NullValuePrompt = "请输入账号";
|
||||
this.lueUserName.Properties.NullValuePromptShowForEmptyValue = true;
|
||||
this.lueUserName.Size = new System.Drawing.Size(174, 24);
|
||||
this.lueUserName.TabIndex = 49;
|
||||
this.lueUserName.EditValueChanged += new System.EventHandler(this.OnEditValueChanged);
|
||||
//
|
||||
// FrmLogin
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackgroundImage = global::Lskj.PubMrpAnalyze.Properties.Resources.newlogin;
|
||||
this.ClientSize = new System.Drawing.Size(664, 451);
|
||||
this.Controls.Add(this.chkNotice);
|
||||
this.Controls.Add(this.lueUserName);
|
||||
this.Controls.Add(this.cbLedger);
|
||||
this.Controls.Add(this.txtPassword);
|
||||
this.Controls.Add(this.btnLogin);
|
||||
this.Controls.Add(this.chkRemPwd);
|
||||
this.Controls.Add(this.chkLogin);
|
||||
this.Controls.Add(this.chkClient);
|
||||
this.Controls.Add(this.chkUpdate);
|
||||
this.Controls.Add(this.lblCopyright);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.btnSetConfig);
|
||||
this.Controls.Add(this.plTop);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FrmLogin";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "用户登陆";
|
||||
this.Load += new System.EventHandler(this.OnLoginLoad);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkUpdate.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkClient.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkLogin.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtPassword.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cbLedger.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.autoGridLookUpEdit1View)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkNotice.Properties)).EndInit();
|
||||
this.plTop.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.btnLogin)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkRemPwd.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lueUserName.Properties)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lblCopyright;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Label btnSetConfig;
|
||||
private DevExpress.XtraEditors.CheckEdit chkUpdate;
|
||||
private DevExpress.XtraEditors.CheckEdit chkClient;
|
||||
private DevExpress.XtraEditors.CheckEdit chkLogin;
|
||||
private DevExpress.XtraEditors.TextEdit txtPassword;
|
||||
private System.Windows.Forms.Button btnColse;
|
||||
private DevExpress.XtraEditors.ComboBoxEdit cbLedger;
|
||||
private Lskj.Control.AutoGridLookUp lueUserName;
|
||||
private DevExpress.XtraGrid.Views.Grid.GridView autoGridLookUpEdit1View;
|
||||
private DevExpress.XtraEditors.CheckEdit chkNotice;
|
||||
private System.Windows.Forms.Panel plTop;
|
||||
private System.Windows.Forms.PictureBox btnLogin;
|
||||
private DevExpress.XtraEditors.CheckEdit chkRemPwd;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+216
@@ -0,0 +1,216 @@
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
partial class FrmPassword
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPassword));
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtPassAfter = new System.Windows.Forms.TextBox();
|
||||
this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.txtPassBefore = new System.Windows.Forms.TextBox();
|
||||
this.txtUserName = new System.Windows.Forms.TextBox();
|
||||
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnSave = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnExit = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtPassAfter);
|
||||
this.groupBox1.Controls.Add(this.labelControl3);
|
||||
this.groupBox1.Controls.Add(this.txtPassBefore);
|
||||
this.groupBox1.Controls.Add(this.txtUserName);
|
||||
this.groupBox1.Controls.Add(this.labelControl2);
|
||||
this.groupBox1.Controls.Add(this.labelControl1);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(219, 87);
|
||||
this.groupBox1.TabIndex = 11;
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// txtPassAfter
|
||||
//
|
||||
this.txtPassAfter.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtPassAfter.Location = new System.Drawing.Point(67, 61);
|
||||
this.txtPassAfter.MaxLength = 50;
|
||||
this.txtPassAfter.Name = "txtPassAfter";
|
||||
this.txtPassAfter.PasswordChar = '*';
|
||||
this.txtPassAfter.Size = new System.Drawing.Size(139, 21);
|
||||
this.txtPassAfter.TabIndex = 9;
|
||||
//
|
||||
// labelControl3
|
||||
//
|
||||
this.labelControl3.Location = new System.Drawing.Point(10, 64);
|
||||
this.labelControl3.Name = "labelControl3";
|
||||
this.labelControl3.Size = new System.Drawing.Size(48, 14);
|
||||
this.labelControl3.TabIndex = 8;
|
||||
this.labelControl3.Text = "确认密码";
|
||||
//
|
||||
// txtPassBefore
|
||||
//
|
||||
this.txtPassBefore.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtPassBefore.Location = new System.Drawing.Point(67, 37);
|
||||
this.txtPassBefore.MaxLength = 50;
|
||||
this.txtPassBefore.Name = "txtPassBefore";
|
||||
this.txtPassBefore.PasswordChar = '*';
|
||||
this.txtPassBefore.Size = new System.Drawing.Size(139, 21);
|
||||
this.txtPassBefore.TabIndex = 7;
|
||||
//
|
||||
// txtUserName
|
||||
//
|
||||
this.txtUserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtUserName.Location = new System.Drawing.Point(67, 13);
|
||||
this.txtUserName.MaxLength = 50;
|
||||
this.txtUserName.Name = "txtUserName";
|
||||
this.txtUserName.ReadOnly = true;
|
||||
this.txtUserName.Size = new System.Drawing.Size(139, 21);
|
||||
this.txtUserName.TabIndex = 6;
|
||||
//
|
||||
// labelControl2
|
||||
//
|
||||
this.labelControl2.Location = new System.Drawing.Point(10, 40);
|
||||
this.labelControl2.Name = "labelControl2";
|
||||
this.labelControl2.Size = new System.Drawing.Size(48, 14);
|
||||
this.labelControl2.TabIndex = 5;
|
||||
this.labelControl2.Text = "登录密码";
|
||||
//
|
||||
// labelControl1
|
||||
//
|
||||
this.labelControl1.Location = new System.Drawing.Point(10, 16);
|
||||
this.labelControl1.Name = "labelControl1";
|
||||
this.labelControl1.Size = new System.Drawing.Size(48, 14);
|
||||
this.labelControl1.TabIndex = 4;
|
||||
this.labelControl1.Text = "登录用户";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 17);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(0, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSave.Location = new System.Drawing.Point(53, 164);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(53, 20);
|
||||
this.btnSave.TabIndex = 13;
|
||||
this.btnSave.Text = "保存";
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnExit.Location = new System.Drawing.Point(123, 164);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(53, 20);
|
||||
this.btnExit.TabIndex = 14;
|
||||
this.btnExit.Text = "取消";
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 96);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(155, 12);
|
||||
this.label2.TabIndex = 15;
|
||||
this.label2.Text = "密码要求:1、必须包含数字";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(69, 116);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(155, 12);
|
||||
this.label3.TabIndex = 16;
|
||||
this.label3.Text = "2、必须包含小写或大写字母";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(69, 134);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(89, 12);
|
||||
this.label4.TabIndex = 17;
|
||||
this.label4.Text = "3、至少8个字符";
|
||||
//
|
||||
// FrmPassword
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(221)))), ((int)(((byte)(238)))));
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
this.Appearance.Options.UseFont = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(225, 192);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FrmPassword";
|
||||
this.Text = "强制修改密码";
|
||||
this.Load += new System.EventHandler(this.FrmPassword_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox txtPassBefore;
|
||||
private System.Windows.Forms.TextBox txtUserName;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl2;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private DevExpress.XtraEditors.SimpleButton btnSave;
|
||||
private DevExpress.XtraEditors.SimpleButton btnExit;
|
||||
private System.Windows.Forms.TextBox txtPassAfter;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/******************************
|
||||
* 说明:强制修改密码
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-08-12
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
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 DevExpress.XtraEditors;
|
||||
using Lskj.Control;
|
||||
using Lskj.Data;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Lskj.PubMrpAnalyze
|
||||
{
|
||||
/// <summary>
|
||||
/// 强制修改密码
|
||||
/// </summary>
|
||||
public partial class FrmPassword : BaseForm
|
||||
{
|
||||
public string UserId;
|
||||
public string UserName;
|
||||
Regex regex = new Regex(@"(?=.*[0-9]) #必须包含数字
|
||||
(?=.*[a-zA-Z]) #必须包含小写或大写字母
|
||||
(?=.*[^a-zA-Z0-9]) #必须包含符号
|
||||
.{8,18} #至少6个字符,最多18个字符
|
||||
", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
|
||||
public FrmPassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:界面加载时</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void FrmPassword_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.txtUserName.Text = UserName;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:修改保存</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string pass_before = txtPassBefore.Text.Trim();
|
||||
string pass_after = txtPassAfter.Text.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(pass_before) || string.IsNullOrWhiteSpace(pass_after))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.PasswordNotNull);
|
||||
return;
|
||||
}
|
||||
if (!pass_before.Equals(pass_after))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.PasswordInconformity);
|
||||
return;
|
||||
}
|
||||
// 验证密码标准
|
||||
if (SystemInfo.Instance.VerfyPasswordStrength ? !regex.IsMatch(pass_after) : false)
|
||||
{
|
||||
MessageUtil.Show("密码不符合要求!");
|
||||
return;
|
||||
}
|
||||
|
||||
int result = MainImpl.ForceUpdatePassword(UserId, pass_after);
|
||||
switch (result)
|
||||
{
|
||||
case 0: // 用户不存在
|
||||
MessageUtil.Show(ResourceKeys.UserNotFound);
|
||||
break;
|
||||
case 1:
|
||||
MessageUtil.Show(ResourceKeys.PasswordUpdateSuccess);
|
||||
ERPInfo.Instance.Password = SHAHelper.EncryptPassword(pass_after);
|
||||
this.DialogResult = DialogResult.OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show("修改密码出错!" + Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:取消修改</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user