Exemple #1
0
        //专业库
        public ActionResult MajorLibrary2(HelperParameterM para)
        {
            ViewData["para"] = para;

            using (var yunEntity = new IYunEntities())
            {
                if (string.IsNullOrWhiteSpace(para.whereSql))
                {
                    var list = yunEntity.YD_Edu_MajorLibrary.OrderBy(u => u.y_name).ToList();
                    ViewData["data"] = list;
                    //if (HttpRuntime.Cache["MajorLibrary"] == null) //如果缓冲不存在
                    //{
                    //    var list = yunEntity.YD_Edu_MajorLibrary.ToList();
                    //    ViewData["data"] = list;
                    //    HttpRuntime.Cache.Insert("MajorLibrary", list, null, DateTime.Now.AddHours(1)
                    //        , Cache.NoSlidingExpiration);
                    //}
                    //else
                    //{
                    //    ViewData["data"] = HttpRuntime.Cache["MajorLibrary"] as List<YD_Edu_MajorLibrary>;
                    //}
                }
                else
                {
                    var list = yunEntity.Database.SqlQuery <YD_Edu_MajorLibrary>(para.whereSql).ToList();
                    ViewData["data"] = list;
                }
            }

            return(PartialView());
        }
Exemple #2
0
        //入学年份
        public ActionResult EnrollYear(HelperParameterM para)
        {
            ViewData["para"] = para;
            int yearnow  = DateTime.Now.Year;
            var yearlist = new List <int>();

            for (int i = 2009; i < yearnow + 6; i++)
            {
                yearlist.Add(i);
            }
            ViewData["data"] = yearlist;

            return(PartialView());
        }
Exemple #3
0
        //入学年份--在校生入学年份
        public ActionResult EnrollYearOld(HelperParameterM para)
        {
            ViewData["para"] = para;
            int yearnow     = DateTime.Now.Year;
            var xinshenyear = Convert.ToInt32(ConfigurationManager.AppSettings["xinsheng"]);
            var yearlist    = new List <int>();

            for (int i = 2012; i <= xinshenyear; i++)
            {
                yearlist.Add(i);
            }
            ViewData["data"] = yearlist;

            return(PartialView());
        }
Exemple #4
0
 //学籍状态
 public ActionResult StuState(HelperParameterM para)
 {
     ViewData["para"] = para;
     using (var yunEntity = new IYunEntities())
     {
         if (!string.IsNullOrWhiteSpace(para.whereSql))
         {
             ViewData["data"] = yunEntity.Database.SqlQuery <YD_Edu_StuState>(para.whereSql).ToList();
         }
         else
         {
             ViewData["data"] = yunEntity.YD_Edu_StuState.ToList();
         }
     }
     return(PartialView());
 }
Exemple #5
0
        //函授站转函授站操作
        public ActionResult SubSchool2(HelperParameterM para)
        {
            ViewData["para"] = para;

            if (string.IsNullOrWhiteSpace(para.whereSql) && CurrentAdmin.y_roleID != 5 && CurrentAdmin.y_roleID != 4)
            {
                if (HttpRuntime.Cache["SubSchool"] == null)   //如果缓存不存在了
                {
                    using (var yunEntity = new IYunEntities())
                    {
                        var sqlWhere = "SELECT * FROM YD_Sys_SubSchool order by y_name ";

                        var list = yunEntity.Database.SqlQuery <YD_Sys_SubSchool>(sqlWhere).ToList();


                        ViewData["data"] = list;

                        HttpRuntime.Cache.Insert("SubSchool", list, null, DateTime.Now.AddHours(1)
                                                 , Cache.NoSlidingExpiration);
                    }
                }
                else
                {
                    ViewData["data"] = HttpRuntime.Cache["SubSchool"] as List <YD_Sys_SubSchool>;
                }
            }
            else   //如果有SQL,就跳过缓存直接读取
            {
                using (var yunEntity = new IYunEntities())
                {
                    var sqlWhere = "SELECT * FROM YD_Sys_SubSchool WHERE 1 = 1 " + para.whereSql;
                    if (CurrentAdmin.y_roleID == 5 || CurrentAdmin.y_roleID == 4)
                    {
                        var subIds =
                            yunEntity.YD_Sys_AdminSubLink.Where(a => a.y_adminId == CurrentAdmin.id)
                            .Select(a => a.y_subSchoolId)
                            .ToArray();
                        if (subIds.Length > 0)
                        {
                            sqlWhere += " AND id in (" + string.Join(",", subIds) + ") order by y_name";
                        }
                    }
                    ViewData["data"] = yunEntity.Database.SqlQuery <YD_Sys_SubSchool>(sqlWhere).ToList();
                }
            }
            return(PartialView());
        }
Exemple #6
0
        //专业综合
        public ActionResult Major2(HelperParameterM para)
        {
            ViewData["para"] = para;

            using (var yunEntity = new IYunEntities())
            {
                ViewData["data"] = yunEntity.YD_Edu_Major.OrderBy(u => u.y_name).ThenBy(u => u.y_eduTypeId).ToList();
                if (!string.IsNullOrWhiteSpace(para.whereSql))
                {
                    ViewData["data"] = yunEntity.Database.SqlQuery <YD_Edu_Major>(para.whereSql).OrderBy(u => u.y_majorLibId).ThenBy(u => u.y_eduTypeId).ToList();
                }
                else
                {
                    ViewData["data"] = yunEntity.YD_Edu_Major.OrderBy(u => u.y_name).ThenBy(u => u.y_eduTypeId).ToList();
                }
            }

            return(PartialView());
        }
Exemple #7
0
        //专业库
        public ActionResult MajorLibrary(HelperParameterM para)
        {
            ViewData["para"] = para;

            using (var yunEntity = new IYunEntities())
            {
                if (string.IsNullOrWhiteSpace(para.whereSql))
                {
                    var list = yunEntity.YD_Edu_MajorLibrary.OrderBy(u => u.y_name).ToList();
                    ViewData["data"] = list;
                }
                else
                {
                    var list = yunEntity.Database.SqlQuery <YD_Edu_MajorLibrary>(para.whereSql).ToList();
                    ViewData["data"] = list;
                }
            }
            return(PartialView());
        }