public bool DeleteVersion(GradeVer grade) { Console.WriteLine("GradeDAL-DeleteGrade():" + DateTime.Now.ToString()); try { db.Delete(grade); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool UpdateGrade(GradeVer grade) { Console.WriteLine("GradeDAL-UpdateGrade():" + DateTime.Now.ToString()); try { GradeVer oldGradeVer = db.Select <GradeVer>(new GradeVer { ID = grade.ID, Version = grade.Version }); oldGradeVer.ValidTODate = grade.ValidDate; db.Update(oldGradeVer); grade.Version = acQC.SelectScalar <int>("SELECT MAX([Version])+1 FROM GradeVer WHERE ID = @ID", new object[] { grade.ID }); return(db.Insert(grade)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool AddGrade(GradeVer grade, out string msg) { Console.WriteLine("GradeDAL-AddGrade():" + DateTime.Now.ToString()); msg = ""; try { int countgrade = acQC.SelectScalar <int>("SELECT COUNT(*) FROM GradeVer WHERE SampleName = @SampleName AND LOT_NO = @LOT_NO", new object[] { grade.SampleName, grade.LOT_NO }); if (countgrade > 0) { msg = string.Format("Already Exist Grade For Material: {0}, you can only add the new version!", grade.LOT_NO); return(false); } return(db.Insert(grade)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool DeleteVersion(GradeVer grade) { return(proxy.DeleteVersion(grade)); }
public bool UpdateGrade(GradeVer grade) { return(proxy.UpdateGrade(grade)); }
public bool AddGrade(GradeVer grade, out string msg) { return(proxy.AddGrade(grade, out msg)); }