//批量导入(新) private void barBtnImportNew_ItemClick(object sender, ItemClickEventArgs e) { this.folderBrowserDialog.Description = "批量导入新能源填报数据"; string msg = string.Empty; if (folderBrowserDialog.ShowDialog(this) != DialogResult.OK) { return; } try { LoadingHandler.Show(this, args => { var utils = new ImportNewInfoUtils(); msg = utils.ImportNewTemplate(folderBrowserDialog.SelectedPath); }); } catch (System.Exception ex) { msg += String.Format("异常,操作出现错误:{0}", ex.Message); } using (var mf = new MessageForm(msg) { Text = "导入操作结果" }) { mf.ShowDialog(); if (mf.DialogResult == DialogResult.Cancel) { this.SearchLocal(1); } } }
//记录删除 private void barBtnDelete_ItemClick(object sender, ItemClickEventArgs e) { var dtExport = (DataTable)this.gcDataInfo.DataSource; string msg = string.Empty; if (dtExport == null || dtExport.Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (GridControlHelper.SelectedItems(this.gvDataInfo).Rows.Count < 1) { MessageBox.Show("请选择您要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("确定要删除吗?", "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.OK) { return; } try { SplashScreenManager.ShowForm(typeof(DevWaitForm)); var utils = new ImportNewInfoUtils(); var selDataTable = GridControlHelper.SelectedItems(this.gvDataInfo); msg = utils.deleteDataInfo(selDataTable); } catch (Exception ex) { MessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { SplashScreenManager.CloseForm(); } using (var mf = new MessageForm(msg) { Text = "删除操作结果" }) { mf.ShowDialog(); if (mf.DialogResult == DialogResult.Cancel) { this.refrashCurrentPage(); } } }