Public Configuration dialog

zhaozj2021-02-16  105

using System; using System.Drawing; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Configuration; using System.Windows.Forms; using System.Data;

Namespace Datalibrary {///

/// Configuration Management /// public class disposalconduct: system.windows.forms.form {/// // // Required designer variable. /// private System.Windows.Forms.Button closeButton; private System.ComponentModel.Container components = null; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System. Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; private System. Windows.Forms.TextBox textBox4; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox textBox5; private System.Windows.Forms.Label label5; private DisposalConductService DisposalConductService1;

///

/// Configuration Management /// public disposalconduct () {// Windows Form Designer Support for // InitializationComponent ();

// // TODO: added after InitializeComponent call any constructor code // string SystemDir = System.Environment.SystemDirectory; DisposalConductService1 = new DisposalConductService (SystemDir "// CBERP_Dis.DLL"); this.textBox1.Text = DisposalConductService1.GetValue ("Servername", ""). Tostring (); this.textbox2.text = disposalconductService1.getValue ("sqlaccount", "sa"). Tostring (); this.textBox3.text = disposalconductService1.getValue (" Password "," jiayu520 "). TOSTRING (); this.textBox5.text = this.textBox3.text; this.textbox4.text = disposalconductService1.getValue (" Database "," cberp "). Tostring ();} // /

/// Clean all the resources being used. /// Protected Override Void Dispose (Bool Disposing) {if (disponents! = Null) {components.dispose ();}} Base.Dispose

#Region Design Interface Generation Code ///

/// Designer Supports the required method - Do not use the code editor to modify the // / this method.

/// private (this.closebutton = new system.windows.forms.button (); this.label1 = new system.windows.forms.label (); this.label2 = new system. Windows.Forms.Label (); this.label3 = new system.windows.forms.label (); this.label4 = new system.windows.forms.label (); this.textbox1 = new system.windows.Forms.TextBox (); This.textBox2 = new system.windows.forms.textbox (); this.textbox3 = new system.windows.forms.textbox (); this.textbox4 = new system.windows.Forms.TextBox (); this. Button1 = new system.windows.Forms.Button (); this.textbox5 = new system.windows.forms.textbox (); this.label5 = new system.windows.forms.label (); this.suspendlayout (); / / // closebutton // this.closebutton.location = new system.drawing.point (277, 92); this.closebutton.name = "closebutton"; this.closebutton.size = new system.drawing.size (66, 25 ); This.closebutton.tabindex = 7; this.closebutton.text = "Close"; this.closebutton.click = new sys Tem.EventHandler (this.closebutton_click); /// Label1 // this.label1.autosize = true; this.label1.location = new system.drawing.point (12, 16); this.label1.name = "Label1 "; This.label1.size = new system.drawing.size (66, 17); this.label1.tabindex = 4; this.label1.text =" server name: "; /// label2 // this.label2 .Autosize = true; this.label2.location = new system.drawing.point (18, 43); this.label2.name = "label2"; this.label2.size = new system.drawing.size (60, 17) This.label2.tabindex = 4; this.label2.text = "SQL account:";

/// label3 // this.label3.autosize = true; this.label3.Location = new system.drawing.point (18, 70); this.label3.name = "label3"; this.label3.size = new System.drawing.size (60, 17); this.label3.tabindex = 4; this.label3.text = "SQL password:"; // // label4 // this.label4.autosize = true; this.label4. Location = new system.drawing.point (12, 124); this.label4.name = "label4"; this.label4.size = new system.drawing.size (66, 17); this.label4.tabindex = 4; This.label4.text = "Database Name:"; // // textBox1 // this.textBox1.Location = new system.drawing.point (102, 14); this.textbox1.name = "textbox1"; this.TextBox1 .Size = new system.drawing.size (162, 21); this.textBox1.tabindex = 1; this.textBox1.text = ""; /// textbox2 // this.textbox2.location = new system.drawing. Point (102, 41); this.TextBox2.name = "textBox2"; this.textbox2.size = new system.drawing.size (162, 21); this.textbox2.tabindex = 2; this.TextBox2.text = " "// // t ExtBox3 // this.textbox3.location = new system.drawing.point (102, 68); this.textbox3.name = "textbox3"; this.textbox3.passwordchar = '*'; this.TextBox3.size = new system. Drawing.size (162, 21); this.textBox3.Tabindex = 3; this.textBox3.text = ""; /// textbox4 // this.textbox4.location = new system.drawing.point (102, 122) This.TextBox4.name = "textbox4"; this.textbox4.size = new system.drawing.size (162, 21); this.TextBox4.TabINDEX = 5; this.TextBox4.text = ""

// // button1 // this.button1.location = new system.drawing.point (277, 46); this.button1.name = "button1"; this.button1.size = new system.drawing.size (66, 26); this.button1.tabindex = 6; this.button1.text = "save"; this.button1.click = new system.eventhandler (this.button1_click); //// textbox5 // this.textbox5.location = new system.drawing.point (102, 95); this.textBox5.name = "textbox5"; this.textbox5.passwordchar = '*'; this.textbox5.size = new system.drawing.size (162, 21) "This.TextBox5.tabindex = 4; this.textbox5.text =" "; /// label5 // this.label5.location = new system.drawing.point (12, 97) This.Label5.name = "label5"; this.label5.size = new system.drawing.size (66, 17); this.label5.Tabindex = 4; this.Label5.text = "Confirm Password:"; / / // disposalconductuct // this.acceptButton = this.button1; this.autoscalebasesize = new system.drawing.size (6, 14); this.clientsize = new system.drawing.size 355, 157); this.Controls.add (this.button1); this.Controls.add (this.TextBox1); this.Controls.add (this.TextBox2); this.Controls.add (this.TextBox3); this. .Controls.add (this.textbox4); this.Controls.add (this.TextBox5); this.controls.add (this.label1); this.controls.add (this.closebutton); this.controls.add (This.Add (this .label2); this.controls.add (this.label3); this.controls.add (this.label4); this.controls.add (this.Label5); this.formorderstyle = system.Windows.Forms.FormBorderstyle.FixedDialog This.maximizebox = false; this.minimizebox = false; this.name =

"Disposalconduct"; this.showintaskbar = false; this.startPosition = system.windows.forms.formstartPosition.centerscreen; this.text = "Running environment settings"; this.ResumeLayout (false);} #ENDREGION

Private void closebutton_click (object sender, system.eventargs e) {this.close (); this.dispose ();

private void button1_Click (object sender, System.EventArgs e) {if (this.textBox3.Text = this.textBox5.Text!) MessageBox.Show ( "different password and confirmation!"); else {this.DisposalConductService1.UpdateValue ( "ServerName", this.textBox1.Text); this.DisposalConductService1.UpdateValue ( "SqlAccount", this.textBox2.Text); this.DisposalConductService1.UpdateValue ( "PassWord", this.textBox3.Text); this.DisposalConductService1.UpdateValue ( "DataBase", this.textBox4.Text); MessageBox.Show ( "save settings successfully!"); DataLibrary.SqlConnect sqlconn = new SqlConnect (); sqlconn.ConnString = "server =" DisposalConductService1.GetValue ( "ServerName" "(local)") "; user id =" DisposalconductService1.getValue ("SQLACCOUNT", "SA") "; password =" DisposalconductService1.GetValue ("Password", "jiayu520") "; dataBase = " DisposalconductService1.GetValue (" Database "," cberp ");}}}}

转载请注明原文地址:https://www.9cbs.com/read-10712.html

New Post(0)