示例#1
0
        public JsonResult Examine(string Action)
        {
            using (var db = SugarDao.GetInstance())
                try
                {
                    List <Examine> List = new List <Examine>();

                    List <Examine> list = new List <Examine>();
                    switch (Action)
                    {
                    case "XF_SY_NAN":
                        List <XF_SY_NAN_CodeSize> qudate = db.Queryable <XF_SY_NAN_CodeSize>().Where(c => c.Status == 1).GroupBy(it => it.Size_Code).Select <XF_SY_NAN_CodeSize>("Size_Code, MAX(CreateDateTime) as   CreateDateTime").ToList();

                        foreach (XF_SY_NAN_CodeSize item in qudate)
                        {
                            Examine ex = new Examine();

                            ex.CreateTime = item.CreateDateTime.ToString("yyyy-MM-dd");
                            ex.Code       = item.Size_Code;
                            list.Add(ex);
                        }

                        return(Json(new { state = 1, msg = list }, JsonRequestBehavior.AllowGet));

                    case "XF_SY_NU":
                        List <XF_SY_NU_CodeSize> XF_SY_NU = db.Queryable <XF_SY_NU_CodeSize>().Where(c => c.Status == 1).GroupBy(it => it.Size_Code).Select <XF_SY_NU_CodeSize>("Size_Code, MAX(CreateDateTime) as   CreateDateTime").ToList();

                        foreach (XF_SY_NU_CodeSize item in XF_SY_NU)
                        {
                            Examine ex = new Examine();

                            ex.CreateTime = item.CreateDateTime.ToString("yyyy-MM-dd");
                            ex.Code       = item.Size_Code;
                            list.Add(ex);
                        }

                        return(Json(new { state = 1, msg = list }, JsonRequestBehavior.AllowGet));

                    case "XF_KZ_NAN":
                        throw new Exception("正在开发");

                    case "XF_KZ_NU":
                        throw new Exception("正在开发");

                    default:
                        throw new Exception("系统出错:没有对应的Action");
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { state = -1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                }
        }
示例#2
0
        public JsonResult Examine(string Action)
        {
            using (var db = new MySqlServer())
                try
                {
                    List <Examine> list = new List <Examine>();
                    switch (Action)
                    {
                    case "XF_SY_NAN":

                        var qudate = XF_SY_NAN_ChiMa.Query(c => c.Status == 1, o => o.Id, false);


                        foreach (var item in qudate.GroupBy(it => it.Size_Code).Select(s => new { CreateDateTime = s.Max(l => l.CreateDateTime), Size_Code = s.Key }))
                        {
                            Examine ex = new Examine();

                            ex.CreateTime = item.CreateDateTime.ToString("yyyy-MM-dd");
                            ex.Code       = item.Size_Code;
                            list.Add(ex);
                        }

                        return(Json(new { state = 1, msg = list }, JsonRequestBehavior.AllowGet));

                    case "XF_SY_NU":

                        var qudatenu = XF_SY_NU_ChiMa.Query(c => c.Status == 1, o => o.Id, false);

                        foreach (var item in qudatenu.GroupBy(it => it.Size_Code).Select(s => new { CreateDateTime = s.Max(l => l.CreateDateTime), Size_Code = s.Key }))
                        {
                            Examine ex = new Examine();

                            ex.CreateTime = item.CreateDateTime.ToString("yyyy-MM-dd");
                            ex.Code       = item.Size_Code;
                            list.Add(ex);
                        }

                        return(Json(new { state = 1, msg = list }, JsonRequestBehavior.AllowGet));

                    case "XF_KZ_NAN":

                        var qudatekznan = XF_KZ_Service.Query(c => c.Status == 1, o => o.Id, false);

                        foreach (var item in qudatekznan.GroupBy(it => it.Size_Code).Select(s => new { CreateDateTime = s.Max(l => l.CreateDateTime), Size_Code = s.Key }))
                        {
                            Examine ex = new Examine();

                            ex.CreateTime = item.CreateDateTime.ToString("yyyy-MM-dd");
                            ex.Code       = item.Size_Code;
                            list.Add(ex);
                        }

                        return(Json(new { state = 1, msg = list }, JsonRequestBehavior.AllowGet));

                    case "XF_KZ_NU":

                        var qudatekznu = XF_KZ_Service.Query(c => c.Status == 1, o => o.Id, false);

                        foreach (var item in qudatekznu.GroupBy(it => it.Size_Code).Select(s => new { CreateDateTime = s.Max(l => l.CreateDateTime), Size_Code = s.Key }))
                        {
                            Examine ex = new Examine();

                            ex.CreateTime = item.CreateDateTime.ToString("yyyy-MM-dd");
                            ex.Code       = item.Size_Code;
                            list.Add(ex);
                        }

                        return(Json(new { state = 1, msg = list }, JsonRequestBehavior.AllowGet));

                    default:
                        throw new Exception("系统出错:没有对应的Action");
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { state = -1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                }
        }