/// <summary>
        /// 创建年级
        /// </summary>
        /// <param name="GradeName">年级名</param>
        /// <param name="SchoolName">学校名</param>
        /// <returns></returns>
        public static async Task CreatGrade(string GradeName, int SchoolID)
        {
            //根据学校名获取学校对象
            var School = SchoolManager.QuerySchool(SchoolID);

            if (School == null)
            {
                throw new Exception("没有这个学校");
            }
            using (DAL.GradeService graSvc = new DAL.GradeService()) {
                await graSvc.CreatAsync(new Models.Grade()
                {
                    Name = GradeName
                }, true);
            }
        }
 /// <summary>
 /// 分页查询进出记录
 /// </summary>
 /// <param name="PageSize"></param>
 /// <param name="PageIndex"></param>
 /// <param name="SchoolID"></param>
 /// <returns></returns>
 public static List <Models.EnterAndLeave> GetNotifyBySchoolName(string SchoolName, string PageIndex = null, string PageSize = null)
 {
     try {
         using (var notifyService = new NotifyService()) {
             var SchoolResult = SchoolManager.QuerySchool(SchoolName);
             if (SchoolResult == null)
             {
                 throw new Exception("不存在此学校");
             }
             if (PageIndex == null)
             {
                 return(notifyService.GetAll(m => m.SchoolID == SchoolResult.Id).ToList());
             }
             return(notifyService.GetAll(m => m.SchoolID == SchoolResult.Id, false, Convert.ToInt32(PageSize), Convert.ToInt32(PageIndex)).ToList());
         };
     }
     catch (Exception ex) {
         throw new Exception(ex.Message);
     }
 }
예제 #3
0
        public static string GetOrganizationNameAsync(User user)
        {
            string organizationName = "";

            switch (user.Level)
            {
            case 1:
                var school = SchoolManager.QuerySchool(user.organizationID);
                organizationName = school.Name;
                break;

            case 2:
                var district = DistrictManager.QueryDistrict(user.organizationID);
                organizationName = district.Name;
                break;

            case 3:
                var city = CityManager.QueryCity(user.organizationID);
                organizationName = city.Name;
                break;
            }
            return(organizationName);
        }