Пример #1
0
        public ActionResult Delete(IEnumerable <graphic_type> models)
        {
            foreach (var source in models)
            {
                // Create a new Product entity and set its properties from productViewModel
                graphic_type s = db.graphic_type.Find(source.id);
                db.graphic_type.Remove(s);
                db.SaveChanges();
            }

            return(Json(null));
        }
Пример #2
0
        public ActionResult Edit(IEnumerable <graphic_type> models)
        {
            foreach (var source in models)
            {
                // Create a new Product entity and set its properties from productViewModel
                graphic_type s = db.graphic_type.Find(source.id);
                s.name            = source.name;
                s.peraturan       = source.peraturan;
                db.Entry(s).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(null));
        }
Пример #3
0
        public JsonResult Binding()
        {
            List <GraphicLokasiSamplingWrapper> list = db.lokasi_sampling.Select(p => new GraphicLokasiSamplingWrapper {
                id = p.id, lokasi_sampling1 = p.lokasi_sampling1, type = p.type
            }).OrderByDescending(p => p.id).ToList();

            foreach (GraphicLokasiSamplingWrapper ls in list)
            {
                graphic_type       gts = db.graphic_type.Find(ls.type);
                GraphicTypeWrapper gt  = new GraphicTypeWrapper
                {
                    id   = gts.id,
                    name = gts.name
                };
                ls.graphic_type = gt;
            }
            return(Json(list));
        }
Пример #4
0
        public JsonResult Binding()
        {
            List <GraphicParameterWrapper> list = db.graphic_parameter.Select(p => new GraphicParameterWrapper {
                id = p.id, parameter = p.parameter, type = p.type
            }).OrderByDescending(p => p.id).ToList();

            foreach (GraphicParameterWrapper ls in list)
            {
                graphic_type       gts = db.graphic_type.Find(ls.type);
                GraphicTypeWrapper gt  = new GraphicTypeWrapper
                {
                    id   = gts.id,
                    name = gts.name
                };
                ls.graphic_type = gt;
            }
            return(Json(list));
        }
Пример #5
0
        public ActionResult ExportData(int id)
        {
            List <GraphicReportWrapper> result  = new List <GraphicReportWrapper>();
            List <GraphicDataWrapper>   results = GraphicWrapper.All(p => p.date, id).OrderBy(p => p.date).ThenBy(p => p.lokasi_sampling.id).ToList();
            graphic_type gt = db.graphic_type.Find(id);

            foreach (GraphicDataWrapper gdw in results)
            {
                GraphicReportWrapper rep = new GraphicReportWrapper
                {
                    date = gdw.date != null?gdw.date.Value.ToShortDateString() : "",
                               lokasi_sampling   = gdw.lokasi_sampling.name,
                               graphic_parameter = gdw.graphic_parameter.name,
                               hasil_analisis    = (gdw.is_galat == 1 ? "< " : "") + gdw.hasil_analisis
                };
                result.Add(rep);
            }
            GridView gv = new GridView();

            gv.Caption    = "" + gt.name;
            gv.DataSource = result;
            if (result.Count == 0)
            {
                return(new JavaScriptResult());
            }
            gv.DataBind();
            gv.HeaderRow.Cells[0].Text = "Date";
            gv.HeaderRow.Cells[1].Text = "Lokasi Sampling";
            gv.HeaderRow.Cells[2].Text = "Parameter";
            gv.HeaderRow.Cells[3].Text = "Hasil Analisis";
            if (gv != null)
            {
                return(new DownloadFileActionResult(gv, "Environmental Monitoring for " + gt.name + ".xls"));
            }
            else
            {
                return(new JavaScriptResult());
            }
        }
Пример #6
0
        public ActionResult Create(IEnumerable <graphic_type> models)
        {
            List <GraphicTypeWrapper> ss = new List <GraphicTypeWrapper>();

            //Iterate all created products which are posted by the Kendo Grid
            foreach (var source in models)
            {
                // Create a new Product entity and set its properties from productViewModel
                var s = new graphic_type
                {
                    name      = source.name,
                    peraturan = source.peraturan
                };

                db.graphic_type.Add(s);
                db.SaveChanges();
                // store the product in the result
                ss.Add(new GraphicTypeWrapper {
                    id = s.id, name = s.name, peraturan = s.peraturan
                });
            }
            return(Json(ss.ToList()));
        }