private void ExportRecord() { try { List <IAzManExport> objectsToExport = new List <IAzManExport>(); object selectedObject = Session["selectedObject"]; switch (_Type) { case AzManItemType.Storage: objectsToExport.AddRange(_Storage.GetStores()); break; case AzManItemType.ItemDefinitions: objectsToExport.AddRange(((IAzManApplication)selectedObject).GetItems()); break; default: objectsToExport.Add((IAzManExport)selectedObject); break; } byte[] result = this.doExport(objectsToExport.ToArray(), chkWindowsUser.Checked, chkDbUser.Checked, chkAuthorization.Checked); DownloadFile(result); } catch (Exception ex) { throw ex; } }