public void Update(DS_Members Members) { using (var ct = new DS_MembersDataContext(DbHelperSQL.Connection)) { ct.DS_Members.Attach(Members, true); ct.SubmitChanges(); } }
public void Add(DS_Members Members) { using (var ct = new DS_MembersDataContext(DbHelperSQL.Connection)) { ct.DS_Members.InsertOnSubmit(Members); ct.SubmitChanges(); } }
public void Delete(int ID) { using (var ct = new DS_MembersDataContext(DbHelperSQL.Connection)) { DS_Members st = ct.DS_Members.Single(a => a.ID == ID); ct.DS_Members.DeleteOnSubmit(st); ct.SubmitChanges(); } }
public bool Login(ref DS_Members Member) { using (var ct = new DS_MembersDataContext(DbHelperSQL.Connection)) { string uid = Member.UserID.Trim(), pwd = Member.Password.Trim(); Member = ct.DS_Members.SingleOrDefault(a => a.UserID == uid && a.Password == pwd); return(!object.Equals(Member, null)); } }
/// <summary> /// 注册 /// </summary> /// <param name="Member"></param> /// <param name="Company"></param> public void Register(DS_Members Member, DS_CompanyInfo Company) { using (DbConnection con = DbHelperSQL.GetConnection()) { var tran = con.BeginTransaction(); var mbct = new DS_MembersDataContext(con); mbct.Transaction = tran; mbct.DS_Members.InsertOnSubmit(Member); mbct.SubmitChanges(); var comct = new DS_CompanyInfoDataContext(con); comct.Transaction = tran; Company.MenberID = Member.ID; comct.DS_CompanyInfo.InsertOnSubmit(Company); comct.SubmitChanges(); tran.Commit(); } }