public JsonResult GetGeneralD() { using (ReportKATEKEntities db = new ReportKATEKEntities()) { db.Configuration.ProxyCreationEnabled = false; db.Configuration.LazyLoadingEnabled = false; var query = db.DashboardDH .AsNoTracking() .Where(a => a.Year <= DateTime.Now.Year) .OrderBy(d => d.Month) .ToList(); int maxCounterValue = query.Count(); GeneralID[] data = new GeneralID[maxCounterValue]; for (int i = 0; i < maxCounterValue; i++) { data[i] = new GeneralID(); } for (int i = 0; i < maxCounterValue; i++) { data[i].Month = query[i].Month; data[i].Year = query[i].Year; data[i].Rate = query[i].Rate; data[i].SSM = query[i].SSMR; data[i].SSW = query[i].SSW; data[i].IK = query[i].IK; data[i].PK = query[i].PK; data[i].PI = query[i].PI; data[i].Profit = query[i].Profit; data[i].MonthNum = GetMonthNum(query[i].Month); data[i].Quart = query[i].Year.ToString() + "." + ((data[i].MonthNum + 2) / 3); } return(Json(data, JsonRequestBehavior.AllowGet)); } }
//更新计划任务 public void UpdateSched(int gid, M_Content_ScheTask.TaskTypeEnum type, string datetext) { M_Content_ScheTask taskmod = taskBll.SelByGid(GeneralID, type); if (!string.IsNullOrEmpty(datetext)) { if (taskmod == null) { taskmod = new M_Content_ScheTask(); } taskmod.TaskType = (int)type; taskmod.TaskContent = GeneralID.ToString(); taskmod.ExecuteTime = datetext; taskmod.LastTime = DateTime.Parse(datetext); taskmod.Status = 0; if (taskmod.ID > 0) { taskBll.Update(taskmod); } else { taskBll.Add(taskmod); } } else if (taskmod != null) { taskBll.Delete(taskmod.ID); } }