Exemple #1
0
        public ActionResult Delete(IEnumerable <GraphicDataWrapper> models, int type)
        {
            foreach (var source in models)
            {
                GraphicWrapper.Delete(source.id, type);
            }

            return(Json(null));
        }
Exemple #2
0
        public ActionResult Create(IEnumerable <GraphicDataWrapper> models)
        {
            List <GraphicDataWrapper> ss = new List <GraphicDataWrapper>();

            foreach (var source in models)
            {
                int id = GraphicWrapper.Insert(source);

                GraphicLokasiSamplingSelect ls = db.lokasi_sampling.Select(p => new GraphicLokasiSamplingSelect {
                    id = p.id, name = p.lokasi_sampling1
                }).Where(p => p.id == source.id_lokasi).FirstOrDefault();
                GraphicParameterSelect pr = db.graphic_parameter.Select(p => new GraphicParameterSelect {
                    id = p.id, name = p.parameter
                }).Where(p => p.id == source.id_parameter).FirstOrDefault();

                // store the product in the result
                ss.Add(new GraphicDataWrapper {
                    id = id, lokasi_sampling = ls, id_lokasi = source.id_lokasi, id_parameter = source.id_parameter, date = source.date, hasil_analisis = source.hasil_analisis
                });
            }
            return(Json(ss.ToList()));
        }
Exemple #3
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());
            }
        }
Exemple #4
0
        public JsonResult Binding(int type)
        {
            List <GraphicDataWrapper> result = GraphicWrapper.All(p => p.date, type);

            return(Json(result));
        }