select case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
static internal ProtoTestRES doHello(ProtoTestASK r_ask) { try { var res = new ProtoTestRES(); var dataContext = new NamuDataClassesDataContext(); var listMember = from itemMember in dataContext.tb_Member where itemMember.fd_Member_nID == 1 select itemMember; foreach(var itemMember in listMember) { res.m_Member_nID = itemMember.fd_Member_nID; res.m_Member_strEmail = itemMember.fd_Member_strEmail; } return res; } catch (Exception ex) { throw new Exception(ex.Message); } } |
insert case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
static internal ProtoTestRES doHello_Insert(ProtoTestASK r_ask) { using(var tran = new TransactionScope()) { try { var res = new ProtoTestRES(); var dataContext = new NamuDataClassesDataContext(); var itemMember = new tb_Member { fd_Member_strEmail = r_ask.m_Member_strEmail, fd_Member_strPW = r_ask.m_Member_strPW }; dataContext.tb_Member.InsertOnSubmit(itemMember); dataContext.SubmitChanges(); tran.Complete(); return res; } catch (Exception ex) { Transaction.Current.Rollback(); throw new Exception(ex.Message); } } } |
update case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
static internal ProtoTestRES doHello_Update(ProtoTestASK r_ask) { using(var tran = new TransactionScope()) { try { var res = new ProtoTestRES(); var dataContext = new NamuDataClassesDataContext(); var itemMember = dataContext.tb_Member.SingleOrDefault(r_p => r_p.fd_Member_nID == 1); if (itemMember != null) itemMember.fd_Member_nID = 3; dataContext.SubmitChanges(); tran.Complete(); return res; } catch (Exception ex) { Transaction.Current.Rollback(); throw new Exception(ex.Message); } } } |
delete single case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
static internal ProtoTestRES doHello_Delete_Single(ProtoTestASK r_ask) { using(var tran = new TransactionScope()) { try { var res = new ProtoTestRES(); var dataContext = new NamuDataClassesDataContext(); var itemMember = dataContext.tb_Member.SingleOrDefault(r_p => r_p.fd_Member_nID == 1); if (itemMember != null) dataContext.tb_Member.DeleteOnSubmit(itemMember); dataContext.SubmitChanges(); tran.Complete(); return res; } catch (Exception ex) { Transaction.Current.Rollback(); throw new Exception(ex.Message); } } } |
delete multi case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
static internal ProtoTestRES doHello_Delete_Multi(ProtoTestASK r_ask) { using(var tran = new TransactionScope()) { try { var res = new ProtoTestRES(); var dataContext = new NamuDataClassesDataContext(); var itemMember = dataContext.tb_Member.Where(r_p => r_p.fd_Member_nID > 1); dataContext.tb_Member.DeleteAllOnSubmit(itemMember); dataContext.SubmitChanges(); tran.Complete(); return res; } catch (Exception ex) { Transaction.Current.Rollback(); throw new Exception(ex.Message); } } } |