public void Update(DS_Certificate Certificate) { using (var ct = new DS_CertificateDataContext(DbHelperSQL.Connection)) { ct.DS_Certificate.Attach(Certificate, true); ct.SubmitChanges(); } }
public void Add(DS_Certificate Certificate) { using (var ct = new DS_CertificateDataContext(DbHelperSQL.Connection)) { ct.DS_Certificate.InsertOnSubmit(Certificate); ct.SubmitChanges(); } }
public void Delete(int ID) { using (var ct = new DS_CertificateDataContext(DbHelperSQL.Connection)) { DS_Certificate st = ct.DS_Certificate.Single(a => a.ID == ID); string imgpath = System.Web.HttpContext.Current.Server.MapPath(Common.Constant.WebConfig("AlbumRootPath") + DS_Members_Br.GetMemberDir(st.MemberID) + "/Certificate/"); if (File.Exists(imgpath += st.CtfImg)) { File.Delete(imgpath); } ct.DS_Certificate.DeleteOnSubmit(st); ct.SubmitChanges(); } }