public static int DeleteT_ATTAINS_ASSESS_UNITS_MLOC(int aSSESS_UNIT_IDX, int mONLOC_IDX) { try { TAttainsAssessUnitsMloc r = (from c in _db.TAttainsAssessUnitsMloc where c.AttainsAssessUnitIdx == aSSESS_UNIT_IDX && c.MonlocIdx == mONLOC_IDX select c).FirstOrDefault(); _db.TAttainsAssessUnitsMloc.Remove(r); _db.SaveChanges(); return(1); } catch { return(0); } }
//***************************** ATTAINS_ASSESS_UNITS_MLOC ************************************** public static int InsertOrUpdateATTAINS_ASSESS_UNITS_MLOC(int aSSESS_UNIT_IDX, int mONLOC_IDX, String cREATE_USER = "******") { Boolean insInd = false; try { TAttainsAssessUnitsMloc a = (from c in _db.TAttainsAssessUnitsMloc where c.AttainsAssessUnitIdx == aSSESS_UNIT_IDX && c.MonlocIdx == mONLOC_IDX select c).FirstOrDefault(); if (a == null) { a = new TAttainsAssessUnitsMloc(); insInd = true; } a.AttainsAssessUnitIdx = aSSESS_UNIT_IDX; a.MonlocIdx = mONLOC_IDX; if (insInd) //insert case { a.CreateUserid = cREATE_USER.ToUpper(); a.CreateDt = System.DateTime.Now; _db.TAttainsAssessUnitsMloc.Add(a); } else { _db.TAttainsAssessUnitsMloc.Update(a); } _db.SaveChanges(); return(1); } catch (Exception ex) { return(0); } }