public static List <General.Attendance> copyToAttendace(int idKinderGarden) { List <General.Attendance> listAttendances = new List <General.Attendance>(); List <CLiveData> listLiveData = selectLiveDataByKinderGardenCode(idKinderGarden); // List<CFutureData> listCFuture = DFutureDataManager.selectByToday(); List <CChildren> listCChildren = DChildrenManager.selectchildrenByKinderGardenCode(idKinderGarden); foreach (var item in listLiveData) { foreach (var item2 in listCChildren) { if (item.IdChild.Equals(item2.Id)) { if (item2.picture != null) { General.Attendance attendance = new General.Attendance(item2.Id, item2.FirstName, item2.LastName, Convert.ToBase64String(item2.picture), item.Status); listAttendances.Add(attendance); } else { General.Attendance attendance = new General.Attendance(item2.Id, item2.FirstName, item2.LastName, null, item.Status); listAttendances.Add(attendance); } } } } return(listAttendances); }
public static void CopyChildrenToLiveData() { List <CChildren> listCChildren = DChildrenManager.selectAllChildren(); using (NDBEntities db = new NDBEntities()) { foreach (var item in listCChildren) { TimeSpan tt = (DKinderGardenManager.selectKinderByCode(item.KinderGardenCode).BeginingHour); TimeSpan tt1; if (tt.Minutes < 30) { tt1 = new TimeSpan(tt.Hours, tt.Minutes + 30, tt.Seconds); } else { tt1 = new TimeSpan(tt.Hours + 1, tt.Minutes - 30, tt.Seconds); } CLiveData d = new CLiveData(item.Id, item.KinderGardenCode, DateTime.Now, General.Statuses.NonPresent, DateTime.Today, "fffff", tt1, null); db.LiveData.Add(Mapper.convertToLiveData(d)); db.SaveChanges(); } } }