Ejemplo n.º 1
0
        public static CPreviousData selectPreviousByIdChild(string id)
        {
            PreviousData p = new PreviousData();

            using (NDBEntities db = new NDBEntities())
            {
                p = (from x in db.PreviousData
                     where x.IdChild.Equals(id)
                     select x).FirstOrDefault();
            }
            return(Mapper.converToCPreviousData(p));
        }
Ejemplo n.º 2
0
        public static PreviousData converCLiveToPreviousData(CLiveData cl)
        {
            PreviousData p = new PreviousData();

            p.IdChild          = cl.IdChild;
            p.KindergardenCode = cl.KinderGardenCode;
            p.Date             = cl.Date;
            p.Status           = StatusEnumToInt(cl.Status);
            p.UpdateDate       = cl.UpdateDate;
            p.UpdateBy         = cl.UpdateBy;
            p.Alarm            = cl.Alarm;
            p.Comments         = cl.Comments;
            return(p);
        }
Ejemplo n.º 3
0
        public static CPreviousData converToCPreviousData(PreviousData p)
        {
            CPreviousData cp = new CPreviousData();

            cp.IdChild          = p.IdChild;
            cp.KinderGardenCode = p.KindergardenCode;
            cp.Date             = p.Date;
            cp.Status           = StatusIntToEnum(p.Status);
            cp.UpdateDate       = p.UpdateDate;
            cp.UpdateBy         = p.UpdateBy;
            cp.Alarm            = p.Alarm;
            cp.Comments         = p.Comments;
            return(cp);
        }
Ejemplo n.º 4
0
        public static void removePreviousByDate()
        {
            List <PreviousData> listPrevious = new List <PreviousData>();
            PreviousData        previusData  = new PreviousData();

            using (NDBEntities db = new NDBEntities())
            {
                listPrevious = (from x in db.PreviousData
                                where x.Date.Day.Equals(DateTime.Now.Day) && x.Date.Month.Equals(DateTime.Now.Month) && x.Date.Year.Equals(DateTime.Now.Year)
                                select x).ToList();
                foreach (var item in listPrevious)
                {
                    item.IdChild          = null;
                    item.KindergardenCode = 0;
                    db.PreviousData.Remove(item);
                    db.SaveChanges();
                }
            }
        }