예제 #1
0
        public ActionResult GetIndexClass(string classid)
        {
            try
            {
                List <tempclass> returnlist = new List <tempclass>();

                List <parminfo> tempclasslist = new List <parminfo>();
                tempclasslist = cbll.listparminfo(classid, "", "1");
                if (tempclasslist.Count > 0)
                {
                    for (int i = 0; i < tempclasslist.Count; i++)
                    {
                        string    tname    = tempclasslist[i].Name;
                        tempclass templist = new tempclass();
                        templist.MiddleName     = tname;
                        templist.childclasslist = cbll.listparminfo("", tname, "2");
                        returnlist.Add(templist);
                    }
                }
                return(Json(Common.ToJsonResult("Success", "获取成功", returnlist), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(Common.ToJsonResult("Fail", "获取失败", ex.Message), JsonRequestBehavior.AllowGet));
            }
        }
예제 #2
0
        public List <tempclass> TempTableToList(DataTable table)
        {
            //table to List object
            tempclass temp = new tempclass();

            var convertedList = (from rw in table.AsEnumerable()
                                 select new tempclass()
            {
                sindex = Convert.ToInt32(rw["sindex"]),
                date = Convert.ToString(rw["year"]) + "-" + Convert.ToString(rw["month"]) + "-" + chekdate(Convert.ToString(rw["num_of_month"])),
                lat = strtofloat(Convert.ToString(rw["lat"])),
                lon = strtofloat(Convert.ToString(rw["lon"])),
                ttt_aver = strtoint(Convert.ToString(rw["ttt_aver"])),
                ttt_max = strtoint(Convert.ToString(rw["ttt_max"])),
                ttt_min = strtoint(Convert.ToString(rw["ttt_min"])),
                num_of_tmin = strtoint(Convert.ToString(rw["num_of_tmin"])),
                num_of_tmax = strtoint(Convert.ToString(rw["num_of_tmax"])),
            }).ToList();

            return(convertedList);
        }