fix auto save bug

master
Tongg 9 months ago
parent 66e5acb593
commit 2fc4606c01
  1. 17
      ViewModel/Grading/GradingResultVM.cs

@ -282,9 +282,11 @@ public class GradingResultVM : BaseViewModel
}
[Log]
private void SaveToCsv()
{
try
{
string strBaseUrl = AppDomain.CurrentDomain.BaseDirectory;
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"csv", "histroy.csv");
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "csv", "histroy.csv");
Measurements info = algorithmResult.measurements;
string line =
$"{DiamondCode}," +
@ -304,8 +306,9 @@ public class GradingResultVM : BaseViewModel
$"," +
$"," +
$"{GetGradeEnName(GetGradeOrder(CutLevelTotal))}";
if (File.Exists(filePath)) {
using (var writer = new StreamWriter(filePath,true))
if (File.Exists(filePath))
{
using (var writer = new StreamWriter(filePath, true))
{
writer.WriteLine(line);
@ -314,7 +317,8 @@ public class GradingResultVM : BaseViewModel
else
{
File.Create(filePath).Close();
string header = "Diamond Code,Wight,Measurement1, Measurement2, Measurement3, Table, Crown Height,Pavilion Depth, Total Depth,Crown Angle, Pavilion Angle,Culet Size, Girdle Percent,Girdle Name, POL or Pol/ Sym,SYM,CUT - PROP";
string header =
"Diamond Code,Wight,Measurement1, Measurement2, Measurement3, Table, Crown Height,Pavilion Depth, Total Depth,Crown Angle, Pavilion Angle,Culet Size, Girdle Percent,Girdle Name, POL or Pol/ Sym,SYM,CUT - PROP";
using (var writer = new StreamWriter(filePath, true))
{
writer.WriteLine(header);
@ -322,6 +326,11 @@ public class GradingResultVM : BaseViewModel
}
}
}
catch (Exception ex)
{
Logger.Error($"Auto Save Error: {ex.Message}");
}
}
private void saveTempDS(string selValue)
{

Loading…
Cancel
Save