コード例 #1
0
        private void ContinueButton_OnClick(object sender, RoutedEventArgs e)
        {
            uploadDictionary.Clear();
            foreach (Control c in assignmentGrid.Children)
            {
                if (c is ComboBox)
                {
                    string value;
                    if ((c as ComboBox).SelectedValue == null)
                        value = "";
                    else
                        value = (c as ComboBox).Text;

                    string context = (c as ComboBox).DataContext.ToString();
                    string index = (c as ComboBox).SelectedIndex.ToString();
                    string[,] dbArray = new[,] { { value, index } };
                    uploadDictionary.Add(context, dbArray);

                }
            }

            ImportGrid importGrid = new ImportGrid(server, database, table, user, password);
            importGrid.Show();
            Close();
        }
コード例 #2
0
        private void ButtonNext_OnClick(object sender, RoutedEventArgs e)
        {
            using (var sr = new StreamReader(pathLabel.Content.ToString(), System.Text.Encoding.Default))
            {

                var reader = new CsvReader(sr);
                reader.Configuration.Delimiter = ";";
                reader.Configuration.WillThrowOnMissingField = false;
                reader.Configuration.Encoding = Encoding.UTF8;
                IEnumerable<AddAddressData> records = reader.GetRecords<AddAddressData>();

                List<AddAddressData> newList = records.ToList();

                ImportGrid ig = new ImportGrid(newList);
                ig.Show();
                Close();

                //foreach (AddAddressData record in records.Take(5))
                //{
                //    MessageBox.Show(record.addrnr + " " + record.addrname1 + " " + record.addrname2 + " " + record.addrcity);
                //}
            }
        }