SVN r675
SVN-Revision: r675
This commit is contained in:
@@ -259,6 +259,36 @@ namespace Lskj.PubBomImport
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
if (Model.ShowType.Equals("000"))//单选文件并返回到表中
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Multiselect = false;
|
||||
dialog.InitialDirectory = Properties.Settings.Default.LastSelectFolder;
|
||||
dialog.Title = "选择导入文件";
|
||||
//dialog.Filter = "Excel文件(*.xlsx)|*.xlsx|Excel文件(*.xls)|*.xls";
|
||||
DialogResult dialogResult = dialog.ShowDialog();
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
Properties.Settings.Default.LastSelectFolder = Path.GetDirectoryName(dialog.FileName);
|
||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||
{
|
||||
ShowType = Model.ShowType,
|
||||
AfterBomFieldName = Model.AfterBomFieldName,
|
||||
FileNames = dialog.FileNames
|
||||
};
|
||||
FormDialogModel dialogModel = new FormDialogModel()
|
||||
{
|
||||
DialogDllName = "Lskj.PubBomImport.dll",
|
||||
PubDialogType = DialogType.PubAddRecord,
|
||||
ReturnTag = bomImpRtnModel
|
||||
};
|
||||
this.Tag = dialogModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
else if (Model.ShowType.Equals("1"))//新增多个其它文件
|
||||
{
|
||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||
@@ -623,6 +653,66 @@ namespace Lskj.PubBomImport
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
else if (Model.ShowType.Equals("7"))//修改单个其它文件
|
||||
{
|
||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||
{
|
||||
ShowType = Model.ShowType,
|
||||
AfterBomFieldName = Model.AfterBomFieldName,
|
||||
CanSave = true
|
||||
};
|
||||
FormDialogModel dialogModel = new FormDialogModel()
|
||||
{
|
||||
DialogDllName = "Lskj.PubBomImport.dll",
|
||||
PubDialogType = DialogType.PubAddRecord,
|
||||
ReturnTag = bomImpRtnModel
|
||||
};
|
||||
this.Tag = dialogModel;
|
||||
DataTable sourceTable = StaticControl.RightMenuGridView.GridControl.DataSourceTable();
|
||||
if (sourceTable.Columns.Contains("BomFieldNameDir"))
|
||||
{
|
||||
List<DataRow> selectRows = new List<DataRow>();
|
||||
foreach (DataRow sourceRow in sourceTable.Rows)
|
||||
{
|
||||
if (sourceRow.RowState == DataRowState.Deleted)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string fileName = sourceRow[Model.AfterBomFieldName] + "";
|
||||
string dirPath = sourceRow["BomFieldNameDir"] + "";
|
||||
FileInfo parentInfo = null;
|
||||
if (string.IsNullOrEmpty(dirPath))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
parentInfo = new FileInfo(dirPath);
|
||||
selectRows.Add(sourceRow);
|
||||
}
|
||||
if (selectRows.Count > 0)
|
||||
{
|
||||
FrmProgress frmProgress = new FrmProgress();
|
||||
frmProgress.frmMain = this;
|
||||
frmProgress.Model = Model;
|
||||
frmProgress.ImportTimer.Tick += (ts, te) =>
|
||||
{
|
||||
frmProgress.ImportTimer.Enabled = false;
|
||||
frmProgress.StartUpdateInOtherFile(selectRows);
|
||||
};
|
||||
frmProgress.ImportTimer.Enabled = true;
|
||||
DialogResult dialogResult = frmProgress.ShowDialog();
|
||||
bomImpRtnModel.CanSave = dialogResult == DialogResult.OK;
|
||||
frmProgress.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user