private void btNext_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtTemplageFile.Text.Trim())) { MessageBox.Show("请选择导入文件"); return; } if (f**k.IsChecked.Value && false) { List <string> difference = new List <string>(); foreach (DataColumn column in sourceDt.Columns) { if (structures.FirstOrDefault(it => it.Comments == column.ColumnName) == null) { difference.Add(column.ColumnName); } } if (difference.Count > structures.Count(it => string.IsNullOrEmpty(it.Comments))) { MessageBox.Show("剩余空闲字段不足,无法导入全部字段,请重新选择数据文件!"); return; } Comments(); if (update.IsChecked.Value) { float newVersion = float.Parse(dataScript.MidsScriptVesion) + 0.1f; DataScriptDAL.updateLevel(dataScript.FID, newVersion.ToString()); } } dataScript = (DataScript)ScriptName.SelectedItem; ImportMapModify mapModify = new ImportMapModify(); mapModify.FID = dataScript.FID; mapModify.DataScriptRule = dataRule; mapModify.DataScript = dataScript; mapModify.sourceFile = txtTemplageFile.Text; importGrid.getHexColumn(); ImportStack.Push(this); MainWindow window = App.Current.MainWindow as MainWindow; window.StartPage(mapModify); }
private void nextButton_Click(object sender, RoutedEventArgs e) { string erromsg = ""; if (string.IsNullOrEmpty(txtTemplageFile.Text.Trim())) { erromsg += "请选择样例文件!\r\n"; } if (Des_Table.SelectedIndex == -1) { erromsg += "请选择目标数据表!\r\n"; } if (Des_Table.SelectedIndex == 0 && string.IsNullOrEmpty(txtTableName.Text)) { erromsg += "请输入数据表名称!\r\n"; } if (Des_Table.SelectedIndex == 0 && string.IsNullOrEmpty(txtTableCode.Text)) { erromsg += "请输入数据表代码!\r\n"; } if (cbSave.IsChecked.Value) { if (string.IsNullOrEmpty(MidsScriptCode.Text.Trim())) { erromsg += "请输入解析器编码!\r\n"; } else { if (!checkCode()) { erromsg += "解析器编码重复!\r\n"; } } if (string.IsNullOrEmpty(MidsScriptName.Text.Trim())) { erromsg += "请输入解析器名称!\r\n"; } } if (!string.IsNullOrEmpty(erromsg)) { MessageBox.Show(erromsg); return; } builderScript(); if (cbSave.IsChecked.Value) { insert(); } DataTable dt = new DataTable(); if (FileType.SelectedValue.ToString() == "xls/xlsx") { dt = ExcelImportHelper.GetDataTable(txtTemplageFile.Text.Trim()); } else { dt = TextImportHelper.GetDataTable(txtTemplageFile.Text.Trim(), DataScriptRule.getColSeperatorChar(GetColSperator())); } TableDAL.CreateTable(txtTableCode.Text.ToUpper(), dt); int count = ObjtableInfoDAL.Count(txtTableCode.Text.ToUpper()); if (count == 0) { ObjtableInfo oinfo = new ObjtableInfo(); oinfo.FID = Guid.NewGuid().ToString().Replace("-", ""); oinfo.CreatedBy = MainWindow.UserID; oinfo.LastUpdatedBy = MainWindow.UserID; oinfo.ObjectTableCode = txtTableCode.Text.ToUpper(); oinfo.ObjectTableName = txtTableName.Text; oinfo.Status = "02"; oinfo.Version = 1; oinfo.LastUpdateIp = "127.0.0.1"; oinfo.LastUpdateDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); oinfo.CreationDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); ObjtableInfoDAL.Insert(oinfo); } ImportMapModify mapModify = new ImportMapModify(); mapModify.FID = FID; mapModify.DataScriptRule = dRule; mapModify.DataScript = dScript; mapModify.sourceFile = txtTemplageFile.Text.Trim(); mapModify.isAutoDrawLine = true; ImportStack.Push(this); MainWindow window = App.Current.MainWindow as MainWindow; window.StartPage(mapModify); }