protected void OK_Click(object sender, EventArgs e)
 {
     WebUtils.HROneDBConfigUIInterface ui;
     if (true)   //MSSQL
     {
         ui = DBConfig_SQLServer1;
     }
     if (ui != null)
     {
         try
         {
             HROneConfig    config   = HROneConfig.GetCurrentHROneConfig();
             DatabaseConfig dbConfig = ui.GenerateDBType();
             dbConfig.name = txtName.Text.Trim();
             config.DatabaseConfigList.Add(dbConfig);
             config.Save();
             //HROne.DataAccess.DatabaseConnection.SetDefaultDatabaseConnection(WebUtils.GetDatabaseConnection());
             Session.Abandon();
             HttpRuntime.UnloadAppDomain();
             HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx");
         }
         catch (Exception ex)
         {
             Message.Text      = ex.Message;
             Message.ForeColor = System.Drawing.Color.Red;
         }
     }
     else
     {
     }
 }
示例#2
0
    protected void OK_Click(object sender, EventArgs e)
    {
        WebUtils.HROneDBConfigUIInterface ui;
        if (true)   //MSSQL
        {
            ui = DBConfig_SQLServer1;
        }
        if (ui != null)
        {
            try
            {
                HROneConfig HROneConfig = new HROneConfig(config.HROneConfigFullPath);

                DatabaseConfig dbConfig = ui.GenerateDBType();
                dbConfig.name = string.Empty;
                HROneConfig.MasterDatabaseConfig = dbConfig;
                HROneConfig.Save();
                //HROne.DataAccess.DatabaseConnection.SetDefaultDatabaseConnection(WebUtils.GetDatabaseConnection());
                //Session.Abandon();
                //HttpRuntime.UnloadAppDomain();
                WebUtils.Logout(Session);
                Response.Redirect("~/Default.aspx");
            }
            catch (Exception ex)
            {
                Message.Text      = ex.Message;
                Message.ForeColor = System.Drawing.Color.Red;
            }
        }
        else
        {
        }
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        HROne.CommonLib.RSACrypto rsa = null;
        if (cbxEncryptedDataBy.SelectedValue.Equals("buildin", StringComparison.CurrentCultureIgnoreCase))
        {
            rsa = new HROne.CommonLib.RSACrypto("HROneSaaS");
        }
        //else
        //{
        //    rsa = new HROne.CommonLib.RSACrypto();
        //    rsa.FromXMLString(txtPublicKeyXMLString.Text);
        //}
        string          encryptedString = rsa.Encrypting(txtPasspharse.Text);
        HROneSaaSConfig SaaSconfig      = HROneSaaSConfig.GetCurrentConfig();
        HROneConfig     config          = new HROneConfig(SaaSconfig.HROneConfigFullPath);

        config.databaseEncryptKey = encryptedString;
        config.Save();
    }