Ejemplo n.º 1
0
        private void btn_forward_Click(object sender, RoutedEventArgs e)
        {
            App.Current.Properties[Constants.ApplicationProperties.CurrentStep] = Constants.ApplicationProperties.Steps.step4;
            App.Current.Properties[Constants.ApplicationProperties.NextStep] = Constants.ApplicationProperties.Steps.step5;

            var snc = new SNC_DataAccess();
            var attach = new SNC_AttachmentDataAccess();
            var fileDataAccess = new FileDataAccess();
            var tableName = App.Current.Properties[Constants.ApplicationProperties.SelectedTable].ToString();

            var fileUploadOption = (bool)App.Current.Properties[Constants.ApplicationProperties.CSVFileUpload];
            var csvUploadColumn = (string)App.Current.Properties[Constants.ApplicationProperties.CSVUploadColumn];
            var dsFile = fileDataAccess.GetCSVFile(viewModel.CSVFilePath, viewModel.CSVFileName);

            foreach (DataRow row in dsFile.Tables[0].Rows)
            {
                var parameters = GetParameters(row);              
                var UID = snc.CreateSNCObject(tableName, parameters);
                try
                {
                    if (fileUploadOption)
                        attach.AttachFile(UID, row[csvUploadColumn].ToString());
                }
                catch { }
            }
            NavigationService.Navigate(new FinishedView(dsFile.Tables[0].Rows.Count, dsFile.Tables[0].Rows.Count));
        }
Ejemplo n.º 2
0
        public CSVMatchViewModel()
        {
            CurrentTable = App.Current.Properties[Constants.ApplicationProperties.SelectedTable].ToString();
            var snc = new SNC_DataAccess();
            var columns = snc.GetColumns(CurrentTable);

            if (columns == null)
                columns = new List<string>();
            var fm = new FileDataAccess();
            var csvColumns = fm.GetCSVColumns(App.Current.Properties[Constants.ApplicationProperties.CSVFileLocation].ToString());

            this.ColumnSet = MatchLists(csvColumns, columns);
            this.CSVFileName = GetCSVFileName();
            this.CSVFilePath = GetCSVFilePath();

            string test = string.Empty;
            foreach (var column in columns)
                test += (column + ",");
        }