Esempio n. 1
0
        /// <summary>
        /// Save User specific API Info to Database.
        /// </summary>
        /// <param name="isNew">Is New User's API info?</param>
        /// <param name="PartnerCode">Backlot Partner Code</param>
        /// <param name="SecretKey">Backlot Secret Key</param>
        /// <param name="APIKey">Backlot API Key</param>
        /// <param name="UserID">Logged in User</param>
        /// <returns>API Info are properly saved in DB or not. </returns>
        public static bool SaveConfiguration(string PartnerCode, string SecretKey, string APIKey, string UserID)
        {
            string queryString = "CreateOrModifyAPISettings";

            string ConnectionString = OoyalaConnectStringBuilder.BuildConnectionString();

            SqlConnection con = new SqlConnection(ConnectionString);
            SqlCommand    cmd = new SqlCommand(queryString, con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            if (APIKey.IndexOf(".") > 0)
            {
                PartnerCode = APIKey.Substring(0, APIKey.IndexOf("."));
            }
            cmd.Parameters.AddWithValue("PartnerCode", PartnerCode);
            cmd.Parameters.AddWithValue("SecretKey", SecretKey);
            cmd.Parameters.AddWithValue("APIKey", APIKey);
            cmd.Parameters.AddWithValue("UserID", UserID);
            using (con)
            {
                con.Open();
                return(cmd.ExecuteNonQuery() == 1);
            }
        }
        public static void EnsureChildNode(SPWebApplication webApp)
        {
            string connectionStringKey   = "OoyalaConnectionString";
            string connectionStringvalue = OoyalaConnectStringBuilder.BuildConnectionString();

            string fileTypeKey   = "OoyalaFileType";
            string fileTypeValue = InstallConfiguration.OoyalaFileType;

            string fileUploadLimitKey   = "OoyalaFileUploadLimitInMB";
            string fileUploadLimitValue = InstallConfiguration.OoyalaFileUploadLimitInMB;

            Configuration config = WebConfigurationManager.OpenWebConfiguration("/", webApp.Name);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(config.FilePath);

            xmlDoc = AddOrModifyAppSettings(xmlDoc, connectionStringKey, connectionStringvalue);
            xmlDoc = AddOrModifyAppSettings(xmlDoc, fileTypeKey, fileTypeValue);
            xmlDoc = AddOrModifyAppSettings(xmlDoc, fileUploadLimitKey, fileUploadLimitValue);

            xmlDoc.Save(config.FilePath);
        }