public void GetAlert(HttpContext context)
        {
            JObject returnobj = new JObject();

            try
            {
                //先只考虑整体情况
                //int ClassType = Convert.ToInt32(context.Request["classtype"]);
                int TableColumnID = Convert.ToInt32(context.Request["tablecolumn"]);

                DateTime BeginDate = new BaseUtils().GetSelectDate(string.IsNullOrEmpty(context.Request["begin"].ToString()) ? DateTime.MinValue : Convert.ToDateTime(context.Request["begin"]), true);
                DateTime EndDate   = new BaseUtils().GetSelectDate(string.IsNullOrEmpty(context.Request["end"].ToString()) ? DateTime.MaxValue : Convert.ToDateTime(context.Request["end"]), false);
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    List <TableData> TableDataList = db.TableData.Where(t => (TableColumnID == 0 || t.TableColumnID == TableColumnID) &&
                                                                        t.CreateDate >= BeginDate && t.CreateDate <= EndDate
                                                                        ).OrderBy(t => t.CreateDate).ToList();
                    JArray jarray = new JArray();
                    if (TableDataList.Count > 0)
                    {
                        if (BeginDate.Date < TableDataList.FirstOrDefault().CreateDate.Value.Date)
                        {
                            BeginDate = TableDataList[0].CreateDate.Value.Date;
                        }

                        if (EndDate.Date > TableDataList.LastOrDefault().CreateDate.Value.Date)
                        {
                            EndDate = new BaseUtils().GetSelectDate(TableDataList.LastOrDefault().CreateDate.Value.Date, false);
                        }

                        while (BeginDate < EndDate)
                        {
                            JObject jobject = new JObject();
                            jobject.Add("Date", BeginDate.ToString("yyyy-MM-dd"));
                            jobject.Add("Count", TableDataList.Count(t => t.CreateDate.Value.Date == BeginDate.Date && t.IsAlert == true));
                            jarray.Add(jobject);

                            BeginDate = BeginDate.AddDays(1);
                        }

                        returnobj.Add("List", jarray);
                        returnobj.Add("result", "success");
                    }
                }
            }
            catch
            {
                returnobj.Add("result", "failed");
            }
            context.Response.Clear();
            context.Response.Write(returnobj);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
        public void GetDateStatistics(HttpContext context)
        {
            JObject returnobj = new JObject();
            JArray  jarray    = new JArray();

            try
            {
                int ClassType     = Convert.ToInt32(context.Request["classtype"]);
                int TableColumnID = Convert.ToInt32(context.Request["tablecolumn"]);
                int TableTypeID   = Convert.ToInt32(context.Request["tabletype"]);

                DateTime BeginDate = new BaseUtils().GetSelectDate(string.IsNullOrEmpty(context.Request["begin"].ToString()) ? DateTime.MinValue : Convert.ToDateTime(context.Request["begin"]), true);
                DateTime EndDate   = new BaseUtils().GetSelectDate(string.IsNullOrEmpty(context.Request["end"].ToString()) ? DateTime.MaxValue : Convert.ToDateTime(context.Request["end"]), false);

                if (BeginDate > EndDate)
                {
                    DateTime Temp = BeginDate;
                    BeginDate = EndDate;
                    EndDate   = Temp;
                }

                if ((EndDate - BeginDate).TotalDays < 15)
                {
                    using (IFMPDBContext db = new IFMPDBContext())
                    {
                        List <TableData> TableDataList = db.TableData.Where(t => t.CreateDate >= BeginDate && t.CreateDate <= EndDate &&
                                                                            t.TableColumnID == TableColumnID &&
                                                                            db.Table.Where(m => m.TableTypeID == TableTypeID && (ClassType == 0 || db.Task.FirstOrDefault(k => k.ID == m.TaskID).ClassType == (ClassTypeEnums)ClassType)).Select(m => m.ID).Contains(t.TableID)
                                                                            ).ToList();


                        List <User> UserList = db.User.ToList();

                        List <TaskFlow> TaskFlowList = db.TaskFlow.Where(t => t.ApplyDate >= BeginDate &&
                                                                         t.ApplyDate <= EndDate &&
                                                                         db.Flow.Where(m => m.IsAudit != true).Select(m => m.ID).Contains(t.ID)
                                                                         ).ToList();

                        //这个以天为单位统计
                        while (BeginDate <= EndDate)
                        {
                            JArray           SelDataArray     = new JArray();
                            List <TableData> SelTableDataList = TableDataList.Where(t => t.CreateDate >= BeginDate && t.CreateDate <= BeginDate.AddDays(1)).ToList();

                            if (SelTableDataList.Count > 0)
                            {
                                foreach (TableData SelTableData in SelTableDataList)
                                {
                                    JObject SelJObject = new JObject();
                                    SelJObject.Add("Name", UserList.FirstOrDefault(t => t.ID == SelTableData.CreateUserID).RealName);
                                    SelJObject.Add("Count", SelTableData.Data);
                                    SelDataArray.Add(SelJObject);
                                }
                                JObject DayJObject = new JObject();
                                DayJObject.Add("Date", BeginDate.ToString("yyyy-MM-dd"));
                                DayJObject.Add("List", SelDataArray);
                                jarray.Add(DayJObject);
                            }
                            BeginDate = BeginDate.AddDays(1);
                        }

                        returnobj.Add("result", "success");
                        returnobj.Add("List", jarray);
                    }
                }
                else
                {
                    returnobj.Add("result", "failed");
                    returnobj.Add("message", "请选择最多相差14天的数据");
                }
            }
            catch
            {
                returnobj.Add("result", "failed");
            }
            context.Response.Clear();
            context.Response.Write(returnobj);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }