Пример #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string t  = this.TextBox1.Text;
            string ss = ConnectionStringUtil.Decrypt(t);

            this.lblMsg1.Text = ss;
            string s = ConnectionStringUtil.Encrypt(ss.Replace("45.32.99.34", "34.87.33.152").Replace("sa", "ugame").Replace("Uwin@2019", "123456"));

            this.TextBox2.Text = s;
        }
Пример #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var name = cbConnectStringName.Text;

            if (!string.IsNullOrEmpty(name))
            {
                ConnectionStringUtil.RemoveConnectionString(name);
                RefreshDatabase();
            }
        }
Пример #3
0
        private void cbConnectStringName_SelectedIndexChanged(object sender, EventArgs e)
        {
            var item          = cbConnectStringName.Text;
            var connectString = ConnectionStringUtil.GetConnectionString(item.ToString());

            txtConnectString.Text = connectString;

            var providerName = ConnectionStringUtil.GetProviderName(item.ToString());

            cbProviderName.SelectedItem = providerName;
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var connectName   = cbConnectStringName.Text.Trim();
            var providerName  = cbProviderName.Text.Trim();
            var connectString = txtConnectString.Text.Trim();

            if (string.IsNullOrEmpty(connectName))
            {
                MessageBox.Show("请选择或输入连接名称!");
                return;
            }

            if (string.IsNullOrEmpty(providerName))
            {
                MessageBox.Show("请选择Provider名称!");
                return;
            }

            if (string.IsNullOrEmpty(connectString))
            {
                MessageBox.Show("请输入ConnectString内容!");
                return;
            }

            try
            {
                ConnectionStringUtil.UpdateConnectionString(connectName, connectString, providerName);

                this.DialogResult = DialogResult.Yes;
                MessageBox.Show("保存成功,程序将重启!");
                System.Windows.Forms.Application.Restart();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.No;
            }
        }
Пример #5
0
 protected void Button4_Click(object sender, EventArgs e)
 {
     this.TextBox3.Text = ConnectionStringUtil.Encrypt(this.TextBox1.Text);
 }
        public ConnectionString EditConnectionString(ConnectionStringModel editConnectionString)
        {
            var ConnectionString = ConnectionStringUtil.CastToDbo(editConnectionString);

            return(_ConnectionStringRepository.Edit(ConnectionString));
        }
        public ConnectionString CreateConnectionString(ConnectionStringModel newConnectionString)
        {
            var ConnectionString = ConnectionStringUtil.CastToDbo(newConnectionString);

            return(_ConnectionStringRepository.Create(ConnectionString));
        }