private void InitPage() { BusyIndicator = busyIndicator; layoutControl = layoutItems; if (LoadedRow == null) { frmRibbon.DisableButtons(new string[] { "Delete" }); if (!isCopiedRow) { _bankImportFormatClient = CreateNew() as BankImportFormatClient; _bankImportFormatClient.Seperator = UtilFunctions.GetDefaultDeLimiter(); _bankImportFormatClient.CountryId = api.CompanyEntity._CountryId; } } else if (LoadedRow.CompanyId == -1) { isReadOnly = true; _bankImportFormatClient = CreateNew() as BankImportFormatClient; StreamingManager.Copy(LoadedRow, _bankImportFormatClient); _bankImportFormatClient.ClearCompany(); } cmbFormat.ItemsSource = Enum.GetValues(typeof(Uniconta.DataModel.BankImportFormatType)); layoutItems.DataContext = _bankImportFormatClient; frmRibbon.OnItemClicked += frmRibbon_OnItemClicked; }
void ImportCsv() { #if !SILVERLIGHT var openFileDailog = UtilDisplay.LoadOpenFileDialog; openFileDailog.Filter = "CSV Files |*.csv"; openFileDailog.Multiselect = false; bool?userClickedOK = openFileDailog.ShowDialog(); if (userClickedOK != true) { return; } try { using (var sr = new StreamReader(File.OpenRead(openFileDailog.FileName), Encoding.Default)) { dgInvStockStatus.ItemsSource = null; var delim = UtilFunctions.GetDefaultDeLimiter(); dgInvStockStatus.CopyFromExcel(sr, delim, true, true, false); } } catch (Exception ex) { UnicontaMessageBox.Show(ex); return; } #endif }
void SetBanks() { string[] arryOption = new string[] { Uniconta.ClientTools.Localization.lookup("CSVFile"), Uniconta.ClientTools.Localization.lookup("Bank1"), Uniconta.ClientTools.Localization.lookup("Bank2") }; cbImportOption.ItemsSource = arryOption; FileOption = arryOption[0]; Seperator = UtilFunctions.GetDefaultDeLimiter().ToString(); }