개정판 1d82d5d2
issue #000:
Change-Id: I78c1908241517f7f7834ead87391053dae04f012
DTI_PID/ID2PSN/Form/MainForm.cs | ||
---|---|---|
490 | 490 |
PSNPageDT.Columns.Add("Status", typeof(string)); |
491 | 491 |
PSNPageDT.Columns.Add("IncludingVirtualData", typeof(string)); |
492 | 492 |
PSNPageDT.Columns.Add("PSNAccuracy", typeof(string)); |
493 |
PSNPageDT.Columns.Add("AFC", typeof(string)); |
|
493 |
//PSNPageDT.Columns.Add("AFC", typeof(string));
|
|
494 | 494 |
PSNPageDT.Columns.Add("Show", typeof(string)); |
495 | 495 |
|
496 | 496 |
|
... | ... | |
630 | 630 |
newRow["Pocket"] = row["Pocket"].ToString(); |
631 | 631 |
newRow["EGTag"] = row["EGTag"].ToString(); |
632 | 632 |
newRow["HasMLTags"] = row["HasMLTags"].ToString(); |
633 |
if(row.Table.Columns["AFC"] != null) |
|
634 |
newRow["AFC"] = row["AFC"].ToString(); |
|
633 |
//if(row.Table.Columns["AFC"] != null)
|
|
634 |
// newRow["AFC"] = row["AFC"].ToString();
|
|
635 | 635 |
|
636 | 636 |
PSNPageDT.Rows.Add(newRow); |
637 | 637 |
} |
... | ... | |
906 | 906 |
|
907 | 907 |
private void btnExportPSN_Click(object sender, EventArgs e) |
908 | 908 |
{ |
909 |
if (currentPSN == null) |
|
910 |
{ |
|
911 |
MessageBox.Show("There is no data!", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
912 |
return; |
|
913 |
} |
|
914 |
|
|
915 |
SaveFileDialog dia = new SaveFileDialog(); |
|
916 |
dia.Filter = "excel file (*.Xls)|*.Xls"; |
|
917 |
if (dia.ShowDialog() == DialogResult.OK) |
|
909 |
try |
|
918 | 910 |
{ |
919 |
DevExpress.Spreadsheet.Workbook workbook = new DevExpress.Spreadsheet.Workbook(); |
|
920 |
workbook.CreateNewDocument(); |
|
911 |
if (currentPSN == null) |
|
912 |
{ |
|
913 |
MessageBox.Show("There is no data!", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
914 |
return; |
|
915 |
} |
|
921 | 916 |
|
922 |
DevExpress.Spreadsheet.Worksheet sheet = workbook.Worksheets.Add(ID2Info.ProgramName); |
|
923 |
DataTable psnDT = currentPSN.PipeSystemNetwork; |
|
924 |
int index = 0; |
|
925 |
while (true) |
|
917 |
SaveFileDialog dia = new SaveFileDialog(); |
|
918 |
dia.Filter = "excel file (*.Xls)|*.Xls"; |
|
919 |
if (dia.ShowDialog() == DialogResult.OK) |
|
926 | 920 |
{ |
927 |
DevExpress.Spreadsheet.Row row = sheet.Rows[index]; |
|
928 |
if (index == 0) |
|
921 |
DevExpress.Spreadsheet.Workbook workbook = new DevExpress.Spreadsheet.Workbook(); |
|
922 |
workbook.CreateNewDocument(); |
|
923 |
|
|
924 |
DevExpress.Spreadsheet.Worksheet sheet = workbook.Worksheets.Add(ID2Info.ProgramName); |
|
925 |
DataTable psnDT = currentPSN.PipeSystemNetwork; |
|
926 |
int index = 0; |
|
927 |
while (true) |
|
929 | 928 |
{ |
930 |
for (int i = 0; i < psnDT.Columns.Count; i++) |
|
929 |
DevExpress.Spreadsheet.Row row = sheet.Rows[index]; |
|
930 |
if (index == 0) |
|
931 | 931 |
{ |
932 |
if(ID2Info.ProgramName != "PSN" && psnDT.Columns[i].ColumnName.Contains("PSN")) |
|
933 |
row[i].Value = psnDT.Columns[i].ColumnName.Replace("PSN", ID2Info.ProgramName); |
|
934 |
else |
|
935 |
row[i].Value = psnDT.Columns[i].ColumnName; |
|
932 |
for (int i = 0; i < psnDT.Columns.Count; i++) |
|
933 |
{ |
|
934 |
if (ID2Info.ProgramName != "PSN" && psnDT.Columns[i].ColumnName.Contains("PSN")) |
|
935 |
row[i].Value = psnDT.Columns[i].ColumnName.Replace("PSN", ID2Info.ProgramName); |
|
936 |
else |
|
937 |
row[i].Value = psnDT.Columns[i].ColumnName; |
|
938 |
} |
|
939 |
} |
|
940 |
else |
|
941 |
{ |
|
942 |
for (int i = 0; i < psnDT.Columns.Count; i++) |
|
943 |
row[i].Value = psnDT.Rows[index - 1][i].ToString(); |
|
944 |
|
|
936 | 945 |
} |
937 |
} |
|
938 |
else |
|
939 |
{ |
|
940 |
for (int i = 0; i < psnDT.Columns.Count; i++) |
|
941 |
row[i].Value = psnDT.Rows[index - 1][i].ToString(); |
|
942 | 946 |
|
947 |
if (psnDT.Rows.Count == index) |
|
948 |
break; |
|
949 |
index++; |
|
943 | 950 |
} |
951 |
for (int i = 0; i < psnDT.Columns.Count; i++) |
|
952 |
sheet.Columns[i].AutoFit(); |
|
944 | 953 |
|
945 |
if (psnDT.Rows.Count == index) |
|
946 |
break; |
|
947 |
index++; |
|
948 |
} |
|
949 |
for (int i = 0; i < psnDT.Columns.Count; i++) |
|
950 |
sheet.Columns[i].AutoFit(); |
|
954 |
workbook.Worksheets.RemoveAt(0); |
|
951 | 955 |
|
952 |
workbook.Worksheets.RemoveAt(0); |
|
956 |
workbook.SaveDocument(dia.FileName); |
|
957 |
workbook.Dispose(); |
|
958 |
} |
|
959 |
} |
|
960 |
catch |
|
961 |
{ |
|
953 | 962 |
|
954 |
workbook.SaveDocument(dia.FileName); |
|
955 |
workbook.Dispose(); |
|
956 | 963 |
} |
964 |
finally |
|
965 |
{ |
|
966 |
MessageBox.Show("Export PSN was successful.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
967 |
} |
|
968 |
|
|
957 | 969 |
} |
958 | 970 |
|
959 | 971 |
private void btnVentDrainSetting_Click(object sender, EventArgs e) |
내보내기 Unified diff