public void Delete() { try { if (CheckCodeEmpty()) { using (VisitMgtDataContext vmdc = new VisitMgtDataContext()) { cert_type ct = vmdc.cert_type.Single(q => q.cert_type_code == this.TypeCode); vmdc.cert_type.DeleteOnSubmit(ct); vmdc.SubmitChanges(); } } } catch (Exception ex) { throw new Exception("删除证件类型失败", ex); } }
public void Create() { try { if (CheckCodeEmpty() && CheckDescEmpty()) { using (VisitMgtDataContext vmdc = new VisitMgtDataContext()) { cert_type ct = new cert_type { cert_type_code = this.TypeCode, cert_type_desc = this.TypeDesc }; vmdc.cert_type.InsertOnSubmit(ct); vmdc.SubmitChanges(); } } } catch (Exception ex) { throw new Exception("创建证件更新失败", ex); } }