/// <summary> /// 新增 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Insert(TestMasterInfo entity) { var result = 0; try { //int x = 1; //int y = 0; //using(TransactionS) var dbMaster = new TestMasterDB(); int rMaster = dbMaster.Insert(entity); var dbDetail = new TestDetailDB(); int rDetail = dbDetail.Insert(new TestDetailInfo { ID = Guid.NewGuid().ToString(), MasterID = entity.ID, A = "asdfad" }); result = rMaster + rDetail; } catch (Exception ex) { var dbExpLog = new ExpLogDB(); dbExpLog.Insert(new ExpLogInfo { ClassName = "TestBiz.Master", MethodName = "Insert", ErrMsg = ex.Message }); } return(result); }
/// <summary> /// 取一筆資料 /// <returns></returns> public TestDetailInfo Load(int?SID, string MasterID, string ID) { TestDetailInfo result = null; try { var db = new TestDetailDB(); result = db.Load(SID, ID, MasterID); } catch (Exception ex) { var dbExpLog = new ExpLogDB(); dbExpLog.Insert(new ExpLogInfo { ClassName = "TestBiz.Detail", MethodName = "Load", ErrMsg = ex.Message }); } return(result); }
/// <summary> /// 刪除 /// </summary> /// <param name="SID"></param> /// <param name="ID"></param> /// <param name="NO"></param> /// <returns></returns> public int Delete(int?SID, string MasterID, string ID) { var result = 0; try { var db = new TestDetailDB(); result = db.Delete(SID, ID, MasterID); } catch (Exception ex) { var dbExpLog = new ExpLogDB(); dbExpLog.Insert(new ExpLogInfo { ClassName = "TestBiz.Detail", MethodName = "Delete", ErrMsg = ex.Message }); } return(result); }
/// <summary> /// 新增 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Insert(TestDetailInfo entity) { var result = 0; try { var db = new TestDetailDB(); result = db.Insert(entity); } catch (Exception ex) { var dbExpLog = new ExpLogDB(); dbExpLog.Insert(new ExpLogInfo { ClassName = "TestBiz.Detail", MethodName = "Insert", ErrMsg = ex.Message }); } return(result); }
/// <summary> /// 依條件取多筆資料 /// </summary> /// <returns></returns> public DataTable Load(int?SID = null, string MasterID = null, string ID = null, string A = null, string B = null, string C = null, string D = null, string E = null, string F = null, string G = null) { DataTable result = new DataTable(); try { var db = new TestDetailDB(); result = db.Load(SID, ID: ID, MasterID: MasterID, A: A, B: B, C: C, D: D, E: E, F: F, G: G); } catch (Exception ex) { var dbExpLog = new ExpLogDB(); dbExpLog.Insert(new ExpLogInfo { ClassName = "TestBiz.Detail", MethodName = "Load", ErrMsg = ex.Message }); } return(result); }