/// <summary> /// Try to Import from selected File /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Import_OnClick([NotNull] object sender, [NotNull] EventArgs e) { // import selected file (if it's the proper format)... if (!this.importFile.PostedFile.ContentType.StartsWith("text")) { this.PageContext.AddLoadMessage( this.GetTextFormatted("IMPORT_FAILED", this.importFile.PostedFile.ContentType), MessageTypes.danger); return; } try { var importedCount = DataImport.BannedIpAddressesImport( this.PageContext.PageBoardID, this.PageContext.PageUserID, this.importFile.PostedFile.InputStream); this.PageContext.AddLoadMessage( importedCount > 0 ? string.Format(this.GetText("ADMIN_BANNEDIP_IMPORT", "IMPORT_SUCESS"), importedCount) : this.GetText("ADMIN_BANNEDIP_IMPORT", "IMPORT_NOTHING"), MessageTypes.success); } catch (Exception x) { this.PageContext.AddLoadMessage( string.Format(this.GetText("ADMIN_BANNEDIP_IMPORT", "IMPORT_FAILED"), x.Message), MessageTypes.danger); } }