⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginora.cs

📁 通过数据库结构自动 生成三层结构代码,相当不错的一款软件
💻 CS
字号:
namespace Codematic
{
    using LTP.CmConfig;
    using System;
    using System.ComponentModel;
    using System.Data.OracleClient;
    using System.Drawing;
    using System.Windows.Forms;
    using WiB.Pinkie.Controls;

    public class LoginOra : Form
    {
        private ButtonXP BtnCancle;
        private ButtonXP BtnOk;
        public CheckBox chk_Simple;
        private Container components;
        public string constr = "";
        public string dbname = "";
        private DbSettings dbobj = new DbSettings();
        private Label label1;
        private Label label2;
        private Label label3;
        private Label label4;
        private Label label5;
        private Label label6;
        private PictureBox pictureBox1;
        public TextBox txtPass;
        public TextBox txtServer;
        public TextBox txtUser;

        public LoginOra()
        {
            this.InitializeComponent();
        }

        private void BtnCancle_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void BtnOk_Click(object sender, EventArgs e)
        {
            try
            {
                string str = this.txtUser.Text.Trim();
                string str2 = this.txtPass.Text.Trim();
                string str3 = this.txtServer.Text.Trim();
                if ((str.Trim() == "") || (str3.Trim() == ""))
                {
                    MessageBox.Show(this, "用户名或密码不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    this.constr = "Data Source=" + str3 + "; user id=" + str + ";password=" + str2;
                    OracleConnection connection = new OracleConnection(this.constr);
                    try
                    {
                        this.Text = "正在连接服务器,请稍候...";
                        connection.Open();
                    }
                    catch
                    {
                        this.Text = "连接服务器失败!";
                        connection.Close();
                        MessageBox.Show(this, "连接服务器失败!请检查服务器地址或用户名密码是否正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                    connection.Close();
                    this.Text = "连接服务器成功!";
                    if (this.dbobj == null)
                    {
                        this.dbobj = new DbSettings();
                    }
                    this.dbobj.DbType = "Oracle";
                    this.dbobj.Server = str3;
                    this.dbobj.ConnectStr = this.constr;
                    this.dbobj.DbName = "";
                    this.dbobj.ConnectSimple = this.chk_Simple.Checked;
                    if (!DbConfig.AddSettings(this.dbobj))
                    {
                        MessageBox.Show(this, "该服务器已经存在!请更换服务器地址或检查输入是否正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        base.DialogResult = DialogResult.OK;
                        base.Close();
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(this, exception.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                LogInfo.WriteLog(exception);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FormLogin_Load(object sender, EventArgs e)
        {
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(LoginOra));
            this.pictureBox1 = new PictureBox();
            this.label1 = new Label();
            this.label2 = new Label();
            this.label3 = new Label();
            this.label4 = new Label();
            this.label5 = new Label();
            this.label6 = new Label();
            this.txtUser = new TextBox();
            this.txtPass = new TextBox();
            this.txtServer = new TextBox();
            this.BtnOk = new ButtonXP();
            this.BtnCancle = new ButtonXP();
            this.chk_Simple = new CheckBox();
            ((ISupportInitialize) this.pictureBox1).BeginInit();
            base.SuspendLayout();
            this.pictureBox1.Image = (Image) manager.GetObject("pictureBox1.Image");
            this.pictureBox1.Location = new Point(0, 0);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new Size(0xa6, 0x114);
            this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
            this.pictureBox1.TabIndex = 0;
            this.pictureBox1.TabStop = false;
            this.label1.BackColor = Color.FromArgb(0x66, 0x99, 0x99);
            this.label1.Location = new Point(0xad, 0x48);
            this.label1.Name = "label1";
            this.label1.Size = new Size(300, 1);
            this.label1.TabIndex = 1;
            this.label2.Location = new Point(0xa8, 0x30);
            this.label2.Name = "label2";
            this.label2.Size = new Size(100, 0x17);
            this.label2.TabIndex = 2;
            this.label2.Text = " 登录到数据库";
            this.label2.TextAlign = ContentAlignment.MiddleLeft;
            this.label3.Location = new Point(0xb0, 0x58);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x40, 0x17);
            this.label3.TabIndex = 3;
            this.label3.Text = "用户名:";
            this.label4.Location = new Point(0xb0, 0x73);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x40, 0x17);
            this.label4.TabIndex = 4;
            this.label4.Text = "口令(P&):";
            this.label5.Location = new Point(0xb0, 0x94);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x30, 0x17);
            this.label5.TabIndex = 5;
            this.label5.Text = "服务:";
            this.label6.Location = new Point(0xb8, 0xf8);
            this.label6.Name = "label6";
            this.label6.Size = new Size(280, 0x17);
            this.label6.TabIndex = 6;
            this.label6.Text = "版权所有(C) 2004 Maticsoft 。保留所有权利。";
            this.label6.TextAlign = ContentAlignment.BottomLeft;
            this.txtUser.BorderStyle = BorderStyle.FixedSingle;
            this.txtUser.Location = new Point(0x120, 80);
            this.txtUser.MaxLength = 30;
            this.txtUser.Name = "txtUser";
            this.txtUser.Size = new Size(0xa8, 0x15);
            this.txtUser.TabIndex = 7;
            this.txtPass.BorderStyle = BorderStyle.FixedSingle;
            this.txtPass.Location = new Point(0x120, 0x70);
            this.txtPass.MaxLength = 0x19;
            this.txtPass.Name = "txtPass";
            this.txtPass.PasswordChar = '*';
            this.txtPass.Size = new Size(0xa8, 0x15);
            this.txtPass.TabIndex = 7;
            this.txtServer.BorderStyle = BorderStyle.FixedSingle;
            this.txtServer.Location = new Point(0x120, 0x90);
            this.txtServer.MaxLength = 30;
            this.txtServer.Name = "txtServer";
            this.txtServer.Size = new Size(0xa8, 0x15);
            this.txtServer.TabIndex = 7;
            this.BtnOk._Image = null;
            this.BtnOk.BackColor = Color.FromArgb(0, 0xcc, 0xcc, 0xcc);
            this.BtnOk.DefaultScheme = true;
            this.BtnOk.DialogResult = DialogResult.OK;
            this.BtnOk.Image = null;
            this.BtnOk.Location = new Point(0xc4, 0xd0);
            this.BtnOk.Name = "BtnOk";
            this.BtnOk.Scheme = ButtonXP.Schemes.Blue;
            this.BtnOk.Size = new Size(70, 0x18);
            this.BtnOk.TabIndex = 8;
            this.BtnOk.Text = "确 定";
            this.BtnOk.Click += new EventHandler(this.BtnOk_Click);
            this.BtnCancle._Image = null;
            this.BtnCancle.BackColor = Color.FromArgb(0, 0xcc, 0xcc, 0xcc);
            this.BtnCancle.DefaultScheme = true;
            this.BtnCancle.DialogResult = DialogResult.Cancel;
            this.BtnCancle.Image = null;
            this.BtnCancle.Location = new Point(0x124, 0xd0);
            this.BtnCancle.Name = "BtnCancle";
            this.BtnCancle.Scheme = ButtonXP.Schemes.Blue;
            this.BtnCancle.Size = new Size(70, 0x18);
            this.BtnCancle.TabIndex = 9;
            this.BtnCancle.Text = "取 消";
            this.BtnCancle.Click += new EventHandler(this.BtnCancle_Click);
            this.chk_Simple.AutoSize = true;
            this.chk_Simple.Checked = true;
            this.chk_Simple.CheckState = CheckState.Checked;
            this.chk_Simple.Location = new Point(0x120, 0xad);
            this.chk_Simple.Name = "chk_Simple";
            this.chk_Simple.Size = new Size(0x60, 0x10);
            this.chk_Simple.TabIndex = 0x25;
            this.chk_Simple.Text = "高效连接模式";
            this.chk_Simple.UseVisualStyleBackColor = true;
            base.AcceptButton = this.BtnOk;
            this.AutoScaleBaseSize = new Size(6, 14);
            this.BackColor = Color.FromArgb(0xcc, 0xcc, 0xcc);
            base.ClientSize = new Size(480, 0x111);
            base.Controls.Add(this.chk_Simple);
            base.Controls.Add(this.BtnCancle);
            base.Controls.Add(this.BtnOk);
            base.Controls.Add(this.txtUser);
            base.Controls.Add(this.label6);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.pictureBox1);
            base.Controls.Add(this.txtPass);
            base.Controls.Add(this.txtServer);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "LoginOra";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "登录";
            base.Load += new EventHandler(this.FormLogin_Load);
            ((ISupportInitialize) this.pictureBox1).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -