示例#1
0
        public static List <GraphicDataWrapper> All(Func <graphic_data, object> orderBy, int type)
        {
            List <GraphicDataWrapper> lcg = new List <GraphicDataWrapper>();
            var lc = db.graphic_data.Include(p => p.lokasi_sampling).Include(p => p.graphic_parameter).Where(x => x.type == type).OrderByDescending(orderBy);

            foreach (graphic_data c in lc)
            {
                GraphicDataWrapper gdw = new GraphicDataWrapper
                {
                    id              = c.id,
                    date            = c.date,
                    id_lokasi       = c.id_lokasi,
                    lokasi_sampling = new GraphicLokasiSamplingSelect {
                        id = c.lokasi_sampling.id, name = c.lokasi_sampling.lokasi_sampling1
                    },
                    id_parameter      = c.id_parameter,
                    graphic_parameter = new GraphicParameterSelect {
                        id = c.graphic_parameter.id, name = c.graphic_parameter.parameter
                    },
                    hasil_analisis = c.hasil_analisis,
                    type           = c.type,
                    is_galat       = c.is_galat
                };
                lcg.Add(gdw);
            }

            return(lcg);
        }
示例#2
0
        public static void Update(GraphicDataWrapper gdw, int type)
        {
            graphic_data target = db.graphic_data.Where(p => p.id == gdw.id && p.type == type).FirstOrDefault();

            if (target != null)
            {
                target.date            = gdw.date;
                target.id_lokasi       = gdw.id_lokasi;
                target.id_parameter    = gdw.id_parameter;
                target.hasil_analisis  = gdw.hasil_analisis;
                target.is_galat        = gdw.is_galat;
                db.Entry(target).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
示例#3
0
        public static int Insert(GraphicDataWrapper gdw)
        {
            graphic_data gd = new graphic_data
            {
                id_lokasi      = gdw.id_lokasi,
                id_parameter   = gdw.id_parameter,
                date           = gdw.date,
                hasil_analisis = gdw.hasil_analisis,
                type           = gdw.type,
                is_galat       = gdw.is_galat
            };

            db.graphic_data.Add(gd);
            db.SaveChanges();

            return(gd.id);
        }