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));
        }
        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 tableName = App.Current.Properties[Constants.ApplicationProperties.SelectedTable].ToString();
            var columns = snc.GetColumns(tableName); 
            var documents = (List<string>)App.Current.Properties[Constants.ApplicationProperties.SelectedDocs];

            foreach (var document in documents)
            {
                List<Parameters> parameters = new List<Parameters>();
                foreach (var column in columns)
                    if (column != "sys_id")
                        parameters.Add(new Models.Parameters { name = column, value = "test" });
                var UID = snc.CreateSNCObject(tableName, parameters);
                attach.AttachFile(UID, document);
            }
            NavigationService.Navigate(new FinishedView());
        }