コード例 #1
0
 public SchoolsController(ILogger <SchoolsController> logger,
                          ServiceFacade.Controller context,
                          SchoolImportService schoolImportService,
                          SchoolService schoolService)
     : base(context)
 {
     _logger = Require.IsNotNull(logger, nameof(logger));
     _schoolImportService = Require.IsNotNull(schoolImportService,
                                              nameof(schoolImportService));
     _schoolService = Require.IsNotNull(schoolService, nameof(schoolService));
     PageTitle      = "School management";
 }
コード例 #2
0
        public async Task <int> MappingTests(BasePagedRequest request)
        {
            var unitUnderTest = new SchoolService(SchoolServiceTestData.Schools);
            var result        = await unitUnderTest.GetPagedMapped <SchoolViewModel>(request);

            Type type = result.Results.GetType().GetGenericArguments()[0];

            Assert.IsTrue(type == typeof(SchoolViewModel));
            //Assert.IsTrue(result.Results.TrueForAll(s => s.Name == $"{s.FirstName} {s.LastName}"));

            return(result.RowCount);
        }
コード例 #3
0
        public ActionResult Edit(SchoolView school)
        {
            if (!ModelState.IsValid)
            {
                return(View(school));
            }
            var response = SchoolService.Save(new SchoolSaveRequest
            {
                School = school
            });

            if (response.Result == Result.Success)
            {
                InfoMessage = response.Message;
            }
            else
            {
                ErrorMessage = response.Message;
            }

            var schoolTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.SchoolTypes>();

            ViewBag.SchoolTypes = schoolTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.SchoolType)
            }).ToList();

            var foodServiceTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.FoodServiceType>();

            ViewBag.FoodServiceTypes = foodServiceTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.FoodServiceType)
            }).ToList();

            var breakfastovsTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.BreakfastOVSType>();

            ViewBag.BreakfastovsTypes = breakfastovsTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.BreakfastOVSType)
            }).ToList();

            var lunchovsTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.LunchOVSType>();

            ViewBag.LunchOVSTypes = lunchovsTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.LunchOVSType)
            }).ToList();

            var recordStatuses = SysMngConfig.Lookups.GetItems <SysMngConfig.RecordStatuses>();

            ViewBag.RecordStatuses = recordStatuses.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.RecordStatus)
            }).ToList();

            return(View(response.School));
        }
コード例 #4
0
        public void school_to_string_overriddent()
        {
            //arrange
            var service = new SchoolService(new FakeSchoolRepository());

            //act
            var ts = service.School.ToString();

            Debug.Print(ts);

            //assert
            Assert.IsTrue(ts.Length > 25);
        }
コード例 #5
0
 public LookupController(ILogger <LookupController> logger,
                         ServiceFacade.Controller context,
                         AvatarService avatarService,
                         SchoolService schoolService,
                         SiteService siteService,
                         UserService userService) : base(context)
 {
     _logger        = Require.IsNotNull(logger, nameof(logger));
     _avatarService = Require.IsNotNull(avatarService, nameof(avatarService));
     _schoolService = Require.IsNotNull(schoolService, nameof(schoolService));
     _siteService   = Require.IsNotNull(siteService, nameof(siteService));
     _userService   = Require.IsNotNull(userService, nameof(userService));
 }
コード例 #6
0
        public async Task DeleteSchool(int ID)
        {
            bool confirmed = await JsRuntime.InvokeAsync <bool>("confirm", "Are you sure ?");

            if (confirmed)
            {
                if (ID > 0)
                {
                    SchoolService.DeleteSchool(ID);
                    _Schools = SchoolService.GetShools().ToList();
                }
            }
        }
コード例 #7
0
        public async Task MappingTestsStringSearchInherited()
        {
            var request = new BasePagedRequest {
                PageIndex = 0, PageSize = 10, SearchQuery = "10"
            };
            var unitUnderTest = new SchoolService(SchoolServiceTestData.Schools);
            var result        = await unitUnderTest.GetCollegePagedSearchQuery <CollegeViewModel>(request);

            Type type = result.Results.GetType().GetGenericArguments()[0];

            Assert.IsTrue(type == typeof(CollegeViewModel));
            Assert.IsTrue(result.Results.Count == 4);
        }
コード例 #8
0
        public async Task MappingTests_Empty()
        {
            var request = new BasePagedRequest {
                PageIndex = 0, PageSize = 10, SearchQuery = "10"
            };
            var unitUnderTest = new SchoolService(new List <School>());
            var result        = await unitUnderTest.GetPagedMapped <SchoolViewModel>(request);

            Type type = result.Results.GetType().GetGenericArguments()[0];

            Assert.IsTrue(type == typeof(SchoolViewModel));
            Assert.IsTrue(result.Results.Count == 0);
            //Assert.IsTrue(result.Results.TrueForAll(s => s.Name == $"{s.FirstName} {s.LastName}"));
        }
コード例 #9
0
        // CREATE

        // GET : Assignment/Create
        public ActionResult Create()
        {
            //Select School DDL
            var db = new SchoolService();

            ViewBag.SchoolID = new SelectList(db.GetAllSchools().OrderBy(e => e.SchoolName), "SchoolID", "SchoolName");

            //Select Scout DDL
            var dbTwo = new ScoutService();

            ViewBag.ScoutID = new SelectList(dbTwo.GetAllScouts().OrderBy(m => m.LastName), "ScoutID", "FullName");

            return(View());
        }
コード例 #10
0
        //
        // GET: /School/
        public ActionResult Index()
        {
            var schoolTypeId = (long)SysMngConfig.SchoolTypes.None;

            if (!string.IsNullOrWhiteSpace(Request["SchoolTypeId"]))
            {
                schoolTypeId = long.Parse(Request["SchoolTypeId"]);
            }
            var schoolTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.SchoolTypes>();

            ViewBag.SchoolTypes = schoolTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == schoolTypeId)
            }).ToList();


            var recordStatusId = (long)SysMngConfig.RecordStatuses.None;

            if (!string.IsNullOrWhiteSpace(Request["RecordStatusId"]))
            {
                recordStatusId = long.Parse(Request["RecordStatusId"]);
            }
            var recordStatuses = SysMngConfig.Lookups.GetItems <SysMngConfig.RecordStatuses>();

            ViewBag.RecordStatuses = recordStatuses.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == recordStatusId)
            }).ToList();


            //var MenuiId = (long)SysMngConfig.Menus.None;
            //if (!string.IsNullOrWhiteSpace(Request["menuiId"]))
            //    MenuiId = long.Parse(Request["menuiId"]);
            //var Menus = SysMngConfig.Lookups.GetItems<SysMngConfig.Menus>();
            //ViewBag.Menus = Menus.Select(d => new SelectListItem { Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == MenuiId) }).ToList();

            var request = new SchoolGetAllRequest
            {
                //Filter = new SchoolFilterView { RecordStatusId = recordStatusId ,SchoolTypeId = schoolTypeId},
                Filter       = new SchoolFilterView(),
                OrderByAsc   = true,
                OrderByField = "Name",
                PageIndex    = 1,
                PageSize     = 2000
            };

            TryUpdateModel(request.Filter);

            var result = SchoolService.GetAllByFilter(request);

            return(View(result.Schools));
        }
コード例 #11
0
        public void AddTeacherTest()
        {
            ISchoolService service  = new SchoolService();
            List <Teacher> teachers = service.GetAllTeachers();
            int            count    = teachers.Count;

            service.AddTeacher(new Teacher {
                Id = 123, Name = "Zimba"
            });
            teachers = service.GetAllTeachers();
            int newCount = teachers.Count;

            Assert.AreEqual(count + 1, newCount);
        }
コード例 #12
0
        public static void Start()
        {
            _server = new Server
            {
                Services = { SchoolService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort("localhost", 40001, ServerCredentials.Insecure) }
            };
            _server.Start();

            Console.WriteLine("grpc ServerListening On Port 40001");
            Console.WriteLine("任意键退出...");
            Console.ReadKey();

            _server?.ShutdownAsync().Wait();
        }
コード例 #13
0
        public ActionResult Edit(int?id)
        {
            var school = id.HasValue
                ? SchoolService.Get(new SchoolGetRequest {
                Id = id.Value
            }).School
                : new SchoolView {
                SchoolType = (long)SysMngConfig.SchoolTypes.None, RecordStatus = (long)SysMngConfig.RecordStatuses.Active
            };


            var schoolTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.SchoolTypes>();

            ViewBag.SchoolTypes = schoolTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.SchoolType)
            }).ToList();

            var foodServiceTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.FoodServiceType>();

            ViewBag.FoodServiceTypes = foodServiceTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.FoodServiceType)
            }).ToList();

            var breakfastovsTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.BreakfastOVSType>();

            ViewBag.BreakfastOVSTypes = breakfastovsTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.BreakfastOVSType)
            }).ToList();
            var lunchovsTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.LunchOVSType>();

            ViewBag.lunchovsTypes = lunchovsTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.LunchOVSType)
            }).ToList();

            var recordStatuses = SysMngConfig.Lookups.GetItems <SysMngConfig.RecordStatuses>();

            ViewBag.RecordStatuses = recordStatuses.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.RecordStatus)
            }).ToList();

            var menu = Lookups.MenusNameList;

            ViewBag.menu = menu.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == school.Menu)
            }).ToList();

            return(View(school));
        }
コード例 #14
0
        private void PopulateViewData(tblClass tblclass, ClassWizardSteps?defaultWizardStep, bool?showTeachersForDistrict, bool?showStudentsForDistrict)
        {
            ViewBag.DefaultWizardStep       = defaultWizardStep;
            ViewBag.ShowTeachersForDistrict = !showTeachersForDistrict.GetValueOrDefault();
            ViewBag.ShowStudentsForDistrict = !showStudentsForDistrict.GetValueOrDefault();

            var           db            = new dbTIREntities();
            SiteUser      siteUser      = (SiteUser)Session["SiteUser"];
            SchoolService schoolService = new SchoolService(siteUser, db);
            ClassService  classService  = new ClassService(siteUser, db);
            ModelServices modelService  = new ModelServices();

            int  userAssignedDistrict     = siteUser.Districts[0].Id;
            bool filterTeachersByDistrict = showTeachersForDistrict.GetValueOrDefault();
            int  districtId = userAssignedDistrict;
            // Get teachers for this class
            var teachersForThisClass = classService.GetTeachersForThisClass(tblclass);

            // Get teachers not in this class
            var teachersNotForThisClass = classService.GetTeachersNotForThisClass(tblclass, filterTeachersByDistrict, districtId);

            //Get students for this class
            var studentsForThisClass = classService.GetStudentForThisClass(tblclass);

            // Get students not for this class
            var availableStudents = classService.GetStudentNotForThisClass(tblclass, districtId);

            var availableStudentsForSchool = classService.GetStudentForSchool(tblclass, districtId);

            // Add data to ViewBag for form
            ViewBag.TeachersForThisClass = new MultiSelectList(teachersForThisClass, "TeacherId", "FullName", null);
            ViewBag.AvailableTeachers    = new MultiSelectList(teachersNotForThisClass, "TeacherId", "FullName", null);
            if (showStudentsForDistrict.GetValueOrDefault())
            {
                ViewBag.AvailableStudents = new MultiSelectList(availableStudents, "StudentId", "FullName", null);
            }
            else
            {
                ViewBag.AvailableStudents = new MultiSelectList(availableStudentsForSchool, "StudentId", "FullName", null);
            }
            ViewBag.StudentsForThisClass      = new MultiSelectList(studentsForThisClass, "StudentId", "FullName", null);
            ViewBag.StudentsForThisClassCount = studentsForThisClass.Count();
            ViewBag.SchoolId     = modelService.DropDownDataSchool(Convert.ToString(tblclass.SchoolId), siteUser.EdsUserId, tblclass.SchoolYearId, false);
            ViewBag.SchoolYearId = modelService.GetUserSchoolYear(siteUser.EdsUserId, siteUser.Districts[0].Id, tblclass.SchoolYearId);
            ViewBag.ClassDesc    = db.tblClasses.Where(x => x.ClassId == tblclass.ClassId).Select(x => x.ClassDesc).SingleOrDefault();
            ViewBag.SubjectId    = new SelectList(db.tblSubjects.OrderBy(x => x.SubjectDesc), "SubjectId", "SubjectDesc", tblclass.SubjectId);
            ViewBag.AllowEdit    = HelperService.AllowUiEdits(siteUser.RoleDesc, "CLASS");
        }
コード例 #15
0
        public ActionResult Schools_Update([DataSourceRequest] DataSourceRequest request,
                                           [Bind(Prefix = "models")] IEnumerable <SchoolModel> schools)
        {
            if (schools != null && ModelState.IsValid)
            {
                SchoolService schoolService = new SchoolService(context);
                var           userId        = User.Identity.GetUserId();

                foreach (var school in schools)
                {
                    schoolService.Update(school, userId);
                }
            }

            return(Json(schools.ToDataSourceResult(request, ModelState)));
        }
コード例 #16
0
        public void UpdateTeacherTest()
        {
            ISchoolService service  = new SchoolService();
            Teacher        teacher1 = service.GetTeacherById("1");

            Teacher newInfo = new Teacher {
                Salary = 123456
            };

            service.UpdateTeacher("1", newInfo);
            Teacher teacher1b = service.GetTeacherById("1");

            Assert.AreEqual(teacher1.Id, teacher1b.Id);
            Assert.AreEqual(teacher1.Name, teacher1b.Name);
            Assert.AreEqual(teacher1.MobileNo, teacher1b.MobileNo);
            Assert.AreEqual(123456, teacher1b.Salary);
        }
コード例 #17
0
 public JoinController(ILogger <JoinController> logger,
                       ServiceFacade.Controller context,
                       AuthenticationService authenticationService,
                       SchoolService schoolService,
                       SiteService siteService,
                       UserService userService)
     : base(context)
 {
     _logger = Require.IsNotNull(logger, nameof(logger));
     _mapper = context.Mapper;
     _authenticationService = Require.IsNotNull(authenticationService,
                                                nameof(authenticationService));
     _schoolService = Require.IsNotNull(schoolService, nameof(schoolService));
     _siteService   = Require.IsNotNull(siteService, nameof(siteService));
     _userService   = Require.IsNotNull(userService, nameof(userService));
     PageTitle      = "Join";
 }
コード例 #18
0
 public LookupController(ILogger <LookupController> logger,
                         ServiceFacade.Controller context,
                         AvatarService avatarService,
                         SchoolService schoolService,
                         SiteService siteService,
                         UserService userService) : base(context)
 {
     _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     _avatarService = avatarService
                      ?? throw new ArgumentNullException(nameof(avatarService));
     _schoolService = schoolService
                      ?? throw new ArgumentNullException(nameof(schoolService));
     _siteService = siteService
                    ?? throw new ArgumentNullException(nameof(siteService));
     _userService = userService
                    ?? throw new ArgumentNullException(nameof(userService));
 }
コード例 #19
0
 public ReportingController(ILogger <ReportingController> logger,
                            ServiceFacade.Controller context,
                            ReportService reportService,
                            SchoolService schoolService,
                            SiteService siteService,
                            UserService userService,
                            VendorCodeService vendorCodeService) : base(context)
 {
     _logger            = Require.IsNotNull(logger, nameof(logger));
     _reportService     = Require.IsNotNull(reportService, nameof(reportService));
     _schoolService     = Require.IsNotNull(schoolService, nameof(schoolService));
     _siteService       = Require.IsNotNull(siteService, nameof(siteService));
     _userService       = Require.IsNotNull(userService, nameof(userService));
     _vendorCodeService = vendorCodeService
                          ?? throw new ArgumentNullException(nameof(vendorCodeService));
     PageTitle = "Reporting";
 }
コード例 #20
0
 public ProfileController(ILogger <ProfileController> logger,
                          ServiceFacade.Controller context,
                          Abstract.IPasswordValidator passwordValidator,
                          AuthenticationService authenticationService,
                          SchoolService schoolService,
                          SiteService siteService,
                          UserService userService) : base(context)
 {
     _logger = Require.IsNotNull(logger, nameof(logger));
     _mapper = context.Mapper;
     _authenticationService = Require.IsNotNull(authenticationService,
                                                nameof(authenticationService));
     _schoolService = Require.IsNotNull(schoolService, nameof(schoolService));
     _siteService   = Require.IsNotNull(siteService, nameof(siteService));
     _userService   = Require.IsNotNull(userService, nameof(userService));
     PageTitle      = "My Profile";
 }
コード例 #21
0
        public static void AddElasticsearch(
            this IServiceCollection services, IConfiguration configuration)
        {
            var url          = configuration["elasticsearch:url"];
            var defaultIndex = configuration["elasticsearch:index"];

            var settings = new ConnectionSettings(new Uri(url))
                           .DefaultIndex(defaultIndex)
                           .DefaultMappingFor <Schools>(m => m.PropertyName(p => p.unitid, "unitid"));

            var client = new ElasticClient(settings);

            services.AddSingleton <IElasticClient>(client);

            var schoolService = new SchoolService(client);

            services.AddSingleton <ISchoolService>(schoolService);
        }
コード例 #22
0
        public ActionResult Edit(int id)
        {
            SchoolModel        objModel   = new SchoolModel();
            SchoolService      objService = new SchoolService();
            List <SchoolModel> lstComp    = new List <SchoolModel>();
            int uid = 0;
            int rid = 0;
            int did = 0;

            if (Session["UID"] != null)
            {
                uid = Convert.ToInt32(Session["UID"].ToString());
                rid = Convert.ToInt32(Session["RoleID"].ToString());
                did = Convert.ToInt32(Session["DID"].ToString());
            }
            objModel = objService.getByID(id);


            lstComp             = objService.getSchool(did);
            objModel.ListSchool = new List <SchoolModel>();
            objModel.ListSchool.AddRange(lstComp);

            CommonService    objCService = new CommonService();
            List <CityModel> lstCity     = new List <CityModel>();

            lstCity           = objCService.getActiveCity(did);
            objModel.ListCity = new List <CityModel>();
            objModel.ListCity.AddRange(lstCity);

            List <ZoneModel> lstZone = new List <ZoneModel>();

            lstZone           = objCService.getActiveZone(did);
            objModel.ListZone = new List <ZoneModel>();
            objModel.ListZone.AddRange(lstZone);


            //List<AccountingYearModel> lstAcYr = new List<AccountingYearModel>();
            //lstAcYr = objService.getAcYr();
            //objModel.ListAcYr = new List<AccountingYearModel>();
            //objModel.ListAcYr.AddRange(lstAcYr);

            ViewBag.Action = "Edit";
            return(View("Index", objModel));
        }
コード例 #23
0
ファイル: SchoolTest.cs プロジェクト: ChameeraD/webOfFriends
        public async Task CreateSchool()
        {
            // Arrange
            var(db, configuration, mockLogger) = PrepareCommonServiceDependancies <SchoolService>();

            // Act
            var schoolService = new SchoolService(db, configuration, mockLogger);
            var schoolAdmin   = new School
            {
                Email       = "*****@*****.**",
                Name        = "ABC School",
                Address     = "96  Balsham Road, HASLAND",
                PhoneNumber = "07926059561"
            };
            var result = await schoolService.AddAsync(schoolAdmin);

            // Assert
            Assert.Equal(schoolAdmin, result);
        }
コード例 #24
0
        public async Task IsSchoolNameAvailableShouldReturnFalseIfNameIsNotAvailable()
        {
            var dbOptions = new DbContextOptionsBuilder <ApplicationDbContext>()
                            .UseInMemoryDatabase("test");
            var context = new ApplicationDbContext(dbOptions.Options);

            var school = new School()
            {
                Name = "taken"
            };
            await context.Schools.AddAsync(school);

            await context.SaveChangesAsync();

            var schoolService = new SchoolService(context, null);
            var result        = schoolService.IsSchoolNameAvailable("taken");

            Assert.False(result);
        }
コード例 #25
0
        public async Task <int> MappingTestsSort(BasePagedRequest request)
        {
            var unitUnderTest = new SchoolService(SchoolServiceTestData.Schools);
            var result        = await unitUnderTest.GetPagedMapped <SchoolViewModel>(request);

            Type type = result.Results.GetType().GetGenericArguments()[0];

            Assert.IsTrue(type == typeof(SchoolViewModel));
            if (request.PropertyFilterConfigs.Any(pfc => pfc.SortDirection == SortDirection.DESC))
            {
                Assert.IsTrue(result.Results.First().Name.Contains("99"));
            }
            else
            {
                Assert.IsTrue(result.Results.First().Name.Contains("1"));
            }

            return(result.RowCount);
        }
コード例 #26
0
ファイル: SchoolEditModel.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 转化为school用于数据库存储
        /// </summary>
        /// <returns>school</returns>
        public School AsSchool()
        {
            School school = null;

            if (this.Id.HasValue && this.Id > 0)
            {
                school = new SchoolService().Get(this.Id.Value);
            }
            else
            {
                school = School.New();
            }


            school.Name       = this.SchoolName;
            school.AreaCode   = this.AreaCode;
            school.SchoolType = this.SchoolType;

            return(school);
        }
コード例 #27
0
        public ActionResult Index()
        {
            // Arguably, the Controller/Action should be able to have its dependencies injected instead of being
            // decided at request time. There's some space here to work out how that works
            // TODO Investigate default dependency creation on app startup? Use a Builder project of some sort?

            // Silly example, but proves a point.
            // You can have 2 IPersistable<School> defined in totally different ways, but
            // they are interchangable in execution. The site would load will either
            // "persistance" or "interfaceExample" passed into "SchoolService"s constructor.
            IDbContext <School>   dbContext        = new MyDbContext();
            IPersistable <School> interfaceExample = new SchoolDbPersistance(dbContext);
            IPersistable <School> persistance      = new SchoolPersistance();

            ISchoolService service = new SchoolService(persistance); // persistance or interfaceExample

            Student student = service.GetTopStudent();

            return(View(student));
        }
コード例 #28
0
 /// <summary>
 /// 查询某个市的所有学校
 /// </summary>
 /// <param name="organizationID"></param>
 /// <returns></returns>
 public static Array GetSchoolsByC(int organizationID)
 {
     //得到城市ID,首先获取这个城市所有的区的ID,遍历区获取所有的学校
     using (SchoolService school = new SchoolService()) {
         var district = DistrictManager.QueryDistrictByCity(organizationID);
         List <OptionDTO> optionDTOs = new List <OptionDTO>();
         foreach (var item in district)
         {
             OptionDTO o      = new OptionDTO();
             var       result = school.GetAll(m => m.IsDelete == false && m.DistrictID == item.Id).ToArray();
             if (result.Length == 0)
             {
                 continue;
             }
             o.label   = item.Name;
             o.options = result;
             optionDTOs.Add(o);
         }
         return(optionDTOs.ToArray());
     }
 }
コード例 #29
0
        public JsonResult List()
        {
            var schoolTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.SchoolTypes>();

            ViewBag.SchoolTypes = schoolTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == 0)
            }).ToList();
            var request = new SchoolGetAllRequest
            {
                Filter       = new SchoolFilterView(),
                OrderByField = "Name",
                PageIndex    = 1,
                PageSize     = 2000,
                OrderByAsc   = true,
            };

            TryUpdateModel(request.Filter);
            var result = SchoolService.GetAllByFilter(request);

            return(Json(result, JsonRequestBehavior.DenyGet));
        }
コード例 #30
0
 public ActionResult UpdateGrid(string hiddenSchoolFilter, string schoolYearFilter)
 {
     try
     {
         db                     = new dbTIREntities();
         siteUser               = ((SiteUser)Session["SiteUser"]);
         userService            = new UserService(siteUser, db);
         schoolService          = new SchoolService(siteUser, db);
         modelService           = new ModelServices();
         ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(schoolYearFilter);
         int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(schoolYearFilter));
         FillViewBagValues(siteUser.Districts[0].Name, hiddenSchoolFilter, siteUser.RoleDesc, schoolYearId);
         return(View("Index", userService.GetViewData(schoolYearFilter, hiddenSchoolFilter, "")));
     }
     catch (Exception ex)
     {
         Logging log = new Logging();
         log.LogException(ex);
         return(View("GeneralError"));
     }
 }
コード例 #31
0
 protected override void ExecuteTest()
 {
     service = new SchoolService(schoolInformationRepository);
     actualModel = service.Get(new SchoolRequest() { SchoolId = schoolId0 });
 }
コード例 #32
0
 public ActionResult Index()
 {
     SchoolService schoolService = new SchoolService();
     var result = schoolService.GetSchools();
     return View();
 }