public void renewTD(timeData td) { timeData dbTD = selectTD(td.dataId); dbTD.ymd = td.ymd; dbTD.dataId = td.dataId; dbTD.startTime = td.startTime; dbTD.endTime = td.endTime; dbTD.category = td.category; dbTD.memo = td.memo; db.SaveChanges(); }
public void add(timeData newTD, string userName, string startHour, string startMin, string endHour, string endMin) { if (getNewestTD(userName).Count == 0) { newTD.dataId = userName + "0001"; newTD.startTime = startHour + ":" + startMin; newTD.endTime = endHour + ":" + endMin; db.timeDatas.Add(newTD); db.SaveChanges(); } else { timeData qTd = getNewestTD(userName).FirstOrDefault(); int count = Convert.ToInt32(qTd.dataId.Substring(userName.Length, 4)); newTD.dataId = userName + (count + 1).ToString().PadLeft(4, '0'); newTD.startTime = startHour + ":" + startMin; newTD.endTime = endHour + ":" + endMin; db.timeDatas.Add(newTD); db.SaveChanges(); } }
public void delete(timeData td) { db.timeDatas.Remove(td); db.SaveChanges(); }