public static CFutureData convertToCFuteureData(FutureData f) { CFutureData cf = new CFutureData(); cf.IdChild = f.IdChild; cf.KinderGardenCode = f.KindergardenCode; cf.Date = f.Date; cf.Status = StatusIntToEnum(f.Status); cf.UpdateDate = f.UpdateDate; cf.UpdateBy = f.UpdateBy; cf.Alarm = f.Alarm; cf.Comments = f.Comments; return(cf); }
public static FutureData convertToFutureData(CFutureData cf) { FutureData f = new FutureData(); f.IdChild = cf.IdChild; f.KindergardenCode = cf.KinderGardenCode; f.Date = cf.Date; f.Status = StatusEnumToInt(cf.Status); f.UpdateDate = cf.UpdateDate; f.UpdateBy = cf.UpdateBy; f.Alarm = cf.Alarm; f.Comments = cf.Comments; return(f); }
public static void updateFutureData(CFutureData CFutureData) { FutureData futureData = Mapper.convertToFutureData(selectFutureByIdChildAndDate(CFutureData.IdChild, CFutureData.Date)); using (NDBEntities db = new NDBEntities()) { futureData = db.FutureData.First(d => d.IdChild == CFutureData.IdChild); futureData.Alarm = CFutureData.Alarm; futureData.UpdateBy = CFutureData.UpdateBy; futureData.Comments = CFutureData.Comments; futureData.Status = Mapper.StatusEnumToInt(CFutureData.Status); db.SaveChanges(); } }
public static CFutureData selectFutureByIdChildAndDate(string idChild, DateTime date) { FutureData futureData = new FutureData(); using (NDBEntities db = new NDBEntities()) { futureData = (from x in db.FutureData where x.Date.Equals(date) && x.IdChild.Equals(idChild) select x).FirstOrDefault(); if (futureData != null) { return(Mapper.convertToCFuteureData(futureData)); } return(null); } }
public static void addFutureData(CFutureData cf) { FutureData f = Mapper.convertToFutureData(cf); using (NDBEntities db = new NDBEntities()) { try { db.FutureData.Add(f); db.SaveChanges(); } catch (Exception) { throw; } } }
public static void removeFutureData(string id) { using (NDBEntities db = new NDBEntities()) { FutureData f = (from x in db.FutureData where x.IdChild.Equals(id) select x).FirstOrDefault(); try { //f.IdChild = null; //f.KindergardenCode = 0; db.FutureData.Remove(f); db.SaveChanges(); } catch (Exception) { throw; //new allreadyExist(); } } }