Esempio n. 1
0
        protected void bindBatchList()
        {
            ListToDataTable lsttodt = new ListToDataTable();
            BatchService    service = new BatchService();
            var             lst     = service.GetBatchList().Select(x => new { x.BatchName, x.ID }).ToList();
            DataTable       dt      = lsttodt.ToDataTable(lst);

            if (dt != null && dt.Rows.Count > 0)
            {
                ddlBatchID.DataSource     = dt;
                ddlBatchID.DataTextField  = "BatchName";
                ddlBatchID.DataValueField = "ID";
                ddlBatchID.DataBind();
            }
            else
            {
                ddlBatchID.DataBind();
            }
        }
Esempio n. 2
0
        public ActionResult BatchData()
        {
            try
            {
                int    uID       = int.Parse(Request.Params.Get("UID"));
                string stationID = Request.Params.Get("stationID");
                bool   rtype     = Request.Params.Get("ReportType") == "Rain" ? true : false;
                bool   trans     = Request.Params.Get("TransType") == "ByDay" ? true : false;
                string stime     = Request.Params.Get("startTime");
                string etime     = Request.Params.Get("endTime");
                //bool isset = Request.Params.Get("SetOrNot") == "Set" ? true : false;

                var ret = JsonConvert.SerializeObject(BatchService.GetBatchList(uID, stationID, rtype, trans, stime, etime));
                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                QueryResult error = new QueryResult();
                var         ret   = JsonConvert.SerializeObject(error);
                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }