Ejemplo n.º 1
0
        private void RegDB_Load(object sender, EventArgs e)
        {
            string str = Path.Combine(VMGlobal.ProfilePath, VMGlobal.ProfileFile);

            if (Directory.Exists(VMGlobal.ProfilePath))
            {
                try
                {
                    DBProfileData dBProfileDatum = (DBProfileData)FileCrypto.LoadConfig(str);
                    this.chk_LocalDB.Checked  = dBProfileDatum.IsLocalDB;
                    this.chk_Security.Checked = dBProfileDatum.PersistSecurityInfo;
                    this.DataSource.Text      = dBProfileDatum.DataSource;
                    this.Catalog.Text         = dBProfileDatum.Catalog;
                    this.UserID.Text          = dBProfileDatum.UserId;
                    vTextBox pwd1     = this.Pwd1;
                    vTextBox pwd2     = this.Pwd2;
                    string   password = dBProfileDatum.Password;
                    string   str1     = password;
                    pwd2.Text = password;
                    pwd1.Text = str1;
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 2
0
        public static void GetDBConnection()
        {
            if (!Directory.Exists(ProfilePath))
            {
                Directory.CreateDirectory(ProfilePath);
                Network.SetAcl(ProfilePath);
            }
            string str = Path.Combine(ProfilePath, ProfileFile);

            if (!File.Exists(str))
            {
                DBConnectionProfile = "C3Sentinel";
                return;
            }
            DBProfileData dBProfileDatum = (DBProfileData)FileCrypto.LoadConfig(str);

            if (dBProfileDatum.IsLocalDB)
            {
                DBConnectionProfile = "C3Sentinel";
                return;
            }
            object[] dataSource = new object[] { dBProfileDatum.DataSource, dBProfileDatum.Catalog, dBProfileDatum.PersistSecurityInfo, dBProfileDatum.UserId, dBProfileDatum.Password };
            DBConnectionProfile = string.Format("Data Source={0};Initial Catalog={1};Persist Security Info={2};User ID={3};Password={4}", dataSource);
        }
Ejemplo n.º 3
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (!this.Pwd1.Text.Equals(this.Pwd2.Text))
     {
         MessageBox.Show(this, "Passwords do not match.", "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         DBProfileData dBProfileDatum = new DBProfileData()
         {
             IsLocalDB           = this.chk_LocalDB.Checked,
             Catalog             = this.Catalog.Text,
             DataSource          = this.DataSource.Text,
             Password            = this.Pwd1.Text,
             PersistSecurityInfo = this.chk_Security.Checked,
             UserId = this.UserID.Text
         };
         string str = Path.Combine(VMGlobal.ProfilePath, VMGlobal.ProfileFile);
         if (!Directory.Exists(VMGlobal.ProfilePath))
         {
             Directory.CreateDirectory(VMGlobal.ProfilePath);
             Network.SetAcl(VMGlobal.ProfilePath);
         }
         if (Directory.Exists(VMGlobal.ProfilePath))
         {
             FileCrypto.Save(dBProfileDatum, str);
             if (File.Exists(str))
             {
                 MessageBox.Show(this, "C3 Sentinel connection profile saved.", "Profile", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 base.DialogResult = DialogResult.OK;
                 base.Close();
                 return;
             }
         }
     }
 }