2023-11-11

This commit is contained in:
2023-11-11 16:02:42 +08:00
parent b2ffd4b8d0
commit 48dd589a7f
66 changed files with 2334 additions and 1232 deletions
@@ -81,60 +81,65 @@ namespace BLL
public static void AddHJGLData_Defect(Model.HJGLData_Defect newtable)
{
Model.HJGLData_Defect table = new Model.HJGLData_Defect
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum,
};
db.HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
Model.HJGLData_Defect table = new Model.HJGLData_Defect
{
Id = newtable.Id,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum,
};
db.HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateHJGLData_Defect(Model.HJGLData_Defect newtable)
{
Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.DefectName = newtable.DefectName;
table.DefectNum = newtable.DefectNum;
db.SubmitChanges();
Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.DefectName = newtable.DefectName;
table.DefectNum = newtable.DefectNum;
db.SubmitChanges();
}
}
}
public static void DeleteHJGLData_DefectById(string Id)
{
Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.HJGLData_Defect.DeleteOnSubmit(table);
db.SubmitChanges();
Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.HJGLData_Defect.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
public static void DeleteHJGLData_DefectByDate(DateTime? reportDate)
{
var table = db.HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
var table = db.HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}