Beispiel #1
0
        public void Init()
        {
            this.ConfigureMapper();

            this._context = new FakeSchoolSystemContext();
            Subject subject = new Subject()
            {
                Name = "Математика"
            };

            _context.Subjects.Add(subject);

            Grade grade = new Grade()
            {
                Value    = 1,
                Subjects = new HashSet <Subject> {
                    subject
                }
            };
            Grade grade2 = new Grade()
            {
                Value    = 2,
                Subjects = new HashSet <Subject> {
                    subject
                }
            };

            _context.Grades.Add(grade);
            _context.Grades.Add(grade2);

            this._service    = new GradesService(this._context);
            this._controller = new GradesController(this._service);
        }
Beispiel #2
0
        public ActionResult Create(string name, decimal sale)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(name))
                {
                    return(Json(new ResultMsg()
                    {
                        Code = -1, CodeText = "请输入名称"
                    }));
                }

                var model = new Grades();
                model.name = name;
                model.sale = sale;
                if (IGradesService.Insert(model) > 0)
                {
                    return(Json(new ResultMsg()
                    {
                        Code = 0
                    }));
                }
                return(Json(new ResultMsg()
                {
                    Code = -1, CodeText = "添加失败"
                }));
            }
            catch (Exception ex)
            {
                return(Json(new ResultMsg()
                {
                    Code = -1, CodeText = "系统错误,联系管理员"
                }));
            }
        }
Beispiel #3
0
 public void Init()
 {
     this.ConfigureMapper();
     this._context    = new FakeSchoolSystemContext();
     this._service    = new GradesService(this._context);
     this._controller = new GradesController(this._service);
 }
Beispiel #4
0
        public List <ListGrade> AjaxQuery(GradesRequest request)
        {
            var data  = new List <ListGrade>();
            var query = IGradesService.Query(request);

            if (query != null)
            {
                var roles = _securityHelper.GetCurrentUser().CurrentUser.Roles.ToList();
                data = query.ModelList.Select(x => new ListGrade(x)).ToList();
                foreach (var item in data)
                {
                    if (roles[0].IsSuper || roles[0].Permissions.Contains("EditGrades"))
                    {
                        item.boor += "<a href='#' onclick=OperatorThis('Edit','/Grades/Edit/" + item.gradeId + "') class='tablelink'>编辑 &nbsp;</a> ";
                    }
                    if (roles[0].IsSuper || roles[0].Permissions.Contains("DeleteGrades"))
                    {
                        item.boor += "<a href='#' onclick=OperatorThis('Delete','/Grades/Delete/" + item.gradeId + "') class='tablelink'>删除 </a> ";
                    }
                }
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount);
            }
            else
            {
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0);
            }
            return(data);
        }
Beispiel #5
0
 public EvaluationsController(ILogger <EvaluationsController> logger, IAbsencesService absencesService, IGradesService gradesService, IStudentsService studentsService, ISubjectsService subjectsService)
 {
     _logger          = logger;
     _absencesService = absencesService;
     _gradesService   = gradesService;
     _studentsService = studentsService;
     _subjectsService = subjectsService;
 }
Beispiel #6
0
 public AscentsController(
     IAscentsService ascentsService,
     IGradesService gradesService,
     IStylesService stylesService)
 {
     this.ascentsService = ascentsService;
     this.gradesService  = gradesService;
     this.stylesService  = stylesService;
 }
Beispiel #7
0
 public PaymentsController(
     IConfiguration configuration,
     IPaymentsService paymentsService,
     IGradesService gradesService)
 {
     this.configuration   = configuration;
     this.paymentsService = paymentsService;
     this.gradesService   = gradesService;
 }
Beispiel #8
0
 public void Setup()
 {
     _gradesRepositoryMock          = new Mock <IDeletableEntityRepository <Grade> >();
     _teachersRepositoryMock        = new Mock <IRepository <Teacher> >();
     _studentSubjectsRepositoryMock = new Mock <IRepository <StudentSubject> >();
     _gradesService = new GradesService(
         _gradesRepositoryMock.Object,
         _teachersRepositoryMock.Object,
         _studentSubjectsRepositoryMock.Object);
 }
 public InitializeWithPrimaryDataController(IRegionsService regionsService,
                                            ISchoolsService schoolsService, IClassesService classesService,
                                            ISubjectsService subjectsService, IStudentsService studentsService,
                                            IStudentsSubjectsService studentsSubjectsService, IGradesService gradesService)
 {
     this.regionsService          = regionsService;
     this.schoolsService          = schoolsService;
     this.classesService          = classesService;
     this.subjectsService         = subjectsService;
     this.studentsService         = studentsService;
     this.studentsSubjectsService = studentsSubjectsService;
     this.gradesService           = gradesService;
 }
 public BouldersController(
     IBouldersService bouldersService,
     ICountriesService countriesService,
     ICitiesService citiesService,
     IGymsService gymsService,
     IGradesService gradesService,
     ICloudinaryService cloudinaryService)
 {
     this.bouldersService   = bouldersService;
     this.countriesService  = countriesService;
     this.citiesService     = citiesService;
     this.gymsService       = gymsService;
     this.gradesService     = gradesService;
     this.cloudinaryService = cloudinaryService;
 }
Beispiel #11
0
        public void Query()
        {
            var request = new GradesRequest();
            var query   = IGradesService.Query(request);

            if (query != null)
            {
                List     = query.ModelList.Select(x => new ListGrade(x)).ToList();
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount);
            }
            else
            {
                List     = new List <ListGrade>();
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0);
            }
        }
Beispiel #12
0
        public ActionResult Delete(int id)
        {
            ResultMsg result = new ResultMsg();
            var       comm   = IGradesService.GetById(id);

            if (comm != null)
            {
                IGradesService.Delete(comm);
                result.Code     = 1;
                result.CodeText = "删除成功!";
                return(Json(result));
            }
            else
            {
                result.Code     = 2;
                result.CodeText = "删除失败!";
                return(Json(result));
            }
        }
Beispiel #13
0
        public ActionResult Deletes(string strIds)
        {
            ResultMsg result = new ResultMsg();
            int       sum    = 0;

            if (!string.IsNullOrEmpty(strIds))
            {
                var commodityIds = strIds.Split(',');

                transaction.BeginTransaction();
                for (int i = 0; i < commodityIds.Length; i++)
                {
                    var comm = IGradesService.GetById(Convert.ToInt32(commodityIds[i]));
                    try
                    {
                        sum += IGradesService.Delete(comm);
                    }
                    catch (Exception)
                    {
                        result.CodeText = "不好意思,系统异常!";
                        return(Json(result));
                    }
                }
                transaction.Commit();
                if (sum == commodityIds.Length)
                {
                    result.Code     = 1;
                    result.CodeText = "删除成功!";
                }
                else
                {
                    result.Code     = 2;
                    result.CodeText = "删除失败!";
                }
                return(Json(result));
            }
            else
            {
                result.Code     = 2;
                result.CodeText = "请选中您要删除的级别!";
                return(Json(result));
            }
        }
Beispiel #14
0
 public GradesController(IGradesService gradesService)
 {
     this.gradesService = gradesService;
 }
Beispiel #15
0
 public GradesController(IGradesService service)
 {
     this.service = service;
 }
 public HomeController(IGradesService gradesService, IStylesService stylesService)
 {
     this.gradesService = gradesService;
     this.stylesService = stylesService;
 }
Beispiel #17
0
 public HomeController(ILogger <HomeController> logger, IGradesService gradesService)
 {
     _logger       = logger;
     _gradeService = gradesService;
 }