fix auto save bug

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

@ -282,6 +282,8 @@ public class GradingResultVM : BaseViewModel
} }
[Log] [Log]
private void SaveToCsv() private void SaveToCsv()
{
try
{ {
string strBaseUrl = AppDomain.CurrentDomain.BaseDirectory; 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");
@ -304,7 +306,8 @@ public class GradingResultVM : BaseViewModel
$"," + $"," +
$"," + $"," +
$"{GetGradeEnName(GetGradeOrder(CutLevelTotal))}"; $"{GetGradeEnName(GetGradeOrder(CutLevelTotal))}";
if (File.Exists(filePath)) { if (File.Exists(filePath))
{
using (var writer = new StreamWriter(filePath, true)) using (var writer = new StreamWriter(filePath, true))
{ {
@ -314,7 +317,8 @@ public class GradingResultVM : BaseViewModel
else else
{ {
File.Create(filePath).Close(); 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)) using (var writer = new StreamWriter(filePath, true))
{ {
writer.WriteLine(header); 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) private void saveTempDS(string selValue)
{ {

Loading…
Cancel
Save