コード例 #1
0
        public IActionResult Edit(CollegeViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            if (ConfigurationManager.AppSettings.IsTrialVersion)
            {
                response.SetIsTrial();
                return(Ok(response));
            }
            using (_dbContext)
            {
                var entity = _dbContext.Village.FirstOrDefault(x => x.VillageUuid == model.VillageUuid);
                entity.Towns    = model.Towns;
                entity.Vname    = model.Vname;
                entity.Exchange = model.Exchange;
                entity.DisNum   = model.DisNum;
                //entity.Address = model.Address;
                //垃圾箱房
                // var rubbish = _dbContext.GrabageRoom.FirstOrDefault(x => x.VillageId == entity.VillageUuid).Ljname;
                //督导员
                //var dudao = _dbContext.Supervisor.FirstOrDefault(x => x.VillageId == entity.VillageUuid).Sname;
                _dbContext.SaveChanges();
                return(Ok(response));
            }
        }
コード例 #2
0
        public JsonResult getColleges()
        {
            CollegeViewModel collegeModel = new CollegeViewModel();

            collegeModel.CollegeResults = Mapper.Map <IEnumerable <College> >(_CollegeService.getAllCollegeActive(HCRGCLIENT.ClientID));
            return(Json(collegeModel.CollegeResults, GlobalConst.Message.text_html, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public CollegeViewModel Add(Guid idEnvironment, CollegeViewModel collegeViewModel)
        {
            var college     = _mapper.Map <College>(collegeViewModel);
            var environment = _mapper.Map <SystemEnvironment>(_environmentService.GetById(idEnvironment));

            return(_mapper.Map <CollegeViewModel>(_collegeService.Add(environment, college)));
        }
コード例 #4
0
        public async Task <IActionResult> Create(CollegeViewModel collegeViewModel)
        {
            if (ModelState.IsValid)
            {
                string path = string.Empty;
                if (collegeViewModel.ImageFile != null && collegeViewModel.ImageFile.Length > 0)
                {
                    var guid = Guid.NewGuid().ToString();
                    var file = $"{guid}.jpg";


                    path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\images\\College", file);



                    using (FileStream stream = new FileStream(path, FileMode.Create))
                    {
                        await collegeViewModel.ImageFile.CopyToAsync(stream);
                    }

                    path = $"~/images/College/{file}";
                }

                var college = this.tocollege(collegeViewModel, path);
                _context.Add(college);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["UniversityId"] = new SelectList(_context.Universities, "UniversityId", "Name", collegeViewModel.UniversityId);
            return(View(collegeViewModel));
        }
コード例 #5
0
        public ActionResult Edit(string code)
        {
            College          college          = collegeBL.GetCollegeByCode(code);
            CollegeViewModel collegeViewModel = AutoMapper.Mapper.Map <College, CollegeViewModel>(college);

            return(View(collegeViewModel));
        }
コード例 #6
0
        public IActionResult Create(CollegeViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = new HaikanRefuseClassification.Api.Entities.Village();
                entity.VillageUuid = Guid.NewGuid();
                if (_dbContext.Village.Where(x => x.IsDelete == "0").Count(x => x.Vname == model.Vname) > 0)
                {
                    response.SetFailed("社区名已存在");
                    return(Ok(response));
                }
                entity.Vname    = model.Vname; //社区
                entity.Towns    = model.Towns; //乡镇
                entity.Exchange = model.Exchange;
                entity.DisNum   = model.DisNum;
                //entity.Address = model.Address;//街道
                entity.AddTime   = DateTime.Now.ToString("yyyy-MM-dd");
                entity.Addpeople = AuthContextService.CurrentUser.DisplayName;
                entity.IsDelete  = "0"; //默认未删除
                _dbContext.Village.Add(entity);
                _dbContext.SaveChanges();
                response.SetSuccess("添加成功");
                return(Ok(response));
            }
        }
コード例 #7
0
        public async Task <IActionResult> Create(CollegeViewModel collegeViewModel)
        {
            if (ModelState.IsValid)
            {
                var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var user   = _applicationUserAppService.GetById(userId);
                //var user = await GetUser(_userManager);

                if (user == null)
                {
                    return(NotFound());
                }

                collegeViewModel = _collegeAppService.Add(user.EnvironmentId, collegeViewModel);

                if (!collegeViewModel.ValidationResult.Any())
                {
                    return(Json(new { collegeName = collegeViewModel.Name, statusCode = HttpStatusCode.OK }));
                }

                return(Json(Conflict(collegeViewModel.ValidationResult)));
            }

            return(View(collegeViewModel));
        }
コード例 #8
0
        public async Task <ActionResult <CollegeModel> > Get([FromBody] CollegeDataRequestDto request, CancellationToken ct = default)
        {
            if (string.IsNullOrEmpty(request.collegeName))
            {
                return(BadRequest("Error: College name is required"));
            }
            try
            {
                var college = await this._collegeSupervisor.GetCollegeByNameAsync(request.collegeName, ct);

                if (college == null)
                {
                    return(NotFound("Error: College not found"));
                }

                var collegeResponse = new CollegeViewModel
                {
                    Cost = request.roomAndBoard ?
                           college.RoomAndBoard + college.InStateTuition ?? college.RoomAndBoard
                        : college.InStateTuition
                };
                // TODO: Implement data shaping

                return(Ok(collegeResponse));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
コード例 #9
0
        public async Task <IActionResult> CostSharingReport()
        {
            CollegeViewModel viewModel = await getCollegeViewModelAsync();

            ViewData["file"] = _context.CostSharingReportFiles.FirstOrDefault(c => c.CollegeId == viewModel.College.CollegeId)?.FilePath;
            return(View(viewModel));
        }
コード例 #10
0
        public JsonResult getColleges()
        {
            var _organizationID           = HCRGUser != null ? HCRGUser.OrganizationID : (Convert.ToInt32(_encryptionService.DecryptString2(System.Configuration.ConfigurationManager.AppSettings["OrganizationID"])));
            var colleges                  = Mapper.Map <IEnumerable <College> >(_collegeService.GetAllCollegeWeb(_organizationID));
            CollegeViewModel collegeModel = new CollegeViewModel();

            collegeModel.CollegeResults = Mapper.Map <IEnumerable <College> >(colleges);
            return(Json(collegeModel.CollegeResults, GlobalConst.Message.text_html, JsonRequestBehavior.AllowGet));
        }
コード例 #11
0
        public async Task <IActionResult> Edit(CollegeViewModel collegeViewModel)
        {
            if (ModelState.IsValid)
            {
                _collegeAppService.Update(collegeViewModel);

                return(RedirectToAction("Index", "College"));
            }
            return(View(collegeViewModel));
        }
コード例 #12
0
 public ActionResult Edit(CollegeViewModel collegeViewModel)
 {
     if (ModelState.IsValid)
     {
         College college = AutoMapper.Mapper.Map <CollegeViewModel, College>(collegeViewModel);
         collegeBL.UpdateCollege(college);
         TempData["CollegeCode"] = college.CollegeCode;
         return(RedirectToAction("DisplayDepartmentByCollege", "Department"));
     }
     return(View(collegeViewModel));
 }
コード例 #13
0
 private College tocollege(CollegeViewModel collegeViewModel, string path)
 {
     return(new College()
     {
         CollegeId = collegeViewModel.CollegeId,
         Name = collegeViewModel.Name,
         ImageUrl = path,
         UniversityId = collegeViewModel.UniversityId,
         University = collegeViewModel.University
     });
 }
コード例 #14
0
        public ActionResult List()
        {
            IEnumerable <CollegeInfo> infos     = _repository.GetAllList();
            IEnumerable <Town>        towns     = _townRepository.GetAllList();
            CollegeViewModel          viewModel = new CollegeViewModel
            {
                Colleges = infos.Select(x => new CollegeDto(x, towns))
            };

            return(View(viewModel));
        }
コード例 #15
0
        public ActionResult DisplayCollege()
        {
            IEnumerable <College>   collegesList     = collegeBL.GetColleges();
            List <CollegeViewModel> collegeModelList = new List <CollegeViewModel>();

            foreach (College college in collegesList)
            {
                CollegeViewModel collegeViewModel = AutoMapper.Mapper.Map <College, CollegeViewModel>(college);
                collegeModelList.Add(collegeViewModel);
            }
            return(View(collegeModelList));
        }
コード例 #16
0
 public ActionResult Create(CollegeViewModel collegeViewModel)
 {
     if (ModelState.IsValid)
     {
         College college = AutoMapper.Mapper.Map <CollegeViewModel, College>(collegeViewModel);
         if (collegeBL.AddCollege(college))
         {
             TempData["CollegeCode"] = college.CollegeCode;
             return(RedirectToAction("AddDepartment", "Department"));
         }
         ViewData["Message"] = Message.CollegeExists;
     }
     return(View(collegeViewModel));
 }
コード例 #17
0
        public ActionResult Index()
        {
            // return View();
            CollegeViewModel collegeModel = new CollegeViewModel();

            collegeModel.CollegeResults = Mapper.Map <IEnumerable <College> >(_CollegeService.getAllCollege(HCRGCLIENT.ClientID));
            if (HCRGCLIENT.ClientTypeID == 1)
            {
                collegeModel.IsHCRGAdmin = true;
            }
            else
            {
                collegeModel.IsHCRGAdmin = false;
            }
            return(View(collegeModel));
        }
コード例 #18
0
        private async Task <CollegeViewModel> getCollegeViewModelAsync()
        {
            CollegeViewModel viewModel       = new CollegeViewModel();
            ApplicationUser  applicationUser = await _userManager.GetUserAsync(HttpContext.User);

            College college = GetCollegeByUserId(applicationUser.Id);

            viewModel.College = college;
            ICollection <Department> departments = GetDepartmentsByCollegeId(college.CollegeId);

            viewModel.Departments = departments;
            ICollection <BudgetDescription> budgetDescription = _context.BudgetDescription.ToList();

            viewModel.BudgetDescription = budgetDescription;
            return(viewModel);
        }
コード例 #19
0
        public MainViewModel()
        {
            HomeVm        = new HomeViewModel();
            CollegesVm    = new CollegeViewModel();
            DepartementVm = new DepartementViewModel();
            EnseignantVm  = new EnseignantViewModel();
            EtudiantVm    = new EtudiantViewModel();
            MatiereVm     = new MatiereViewModel();
            NoteVm        = new NoteViewModel();
            SalleVm       = new SalleViewModel();
            CurrentView   = HomeVm;

            HomeViewCommand        = new RelayCommand(o => { CurrentView = HomeVm; });
            CollegeViewCommand     = new RelayCommand(o => { CurrentView = CollegesVm; });
            DepartemnetViewCommand = new RelayCommand(o => { CurrentView = DepartementVm; });
            EnseignantViewCommand  = new RelayCommand(o => { CurrentView = EnseignantVm; });
            EtudiantViewCommand    = new RelayCommand(o => { CurrentView = EtudiantVm; });
            MatiereViewCommand     = new RelayCommand(o => { CurrentView = MatiereVm; });
            NoteViewCommand        = new RelayCommand(o => { CurrentView = NoteVm; });
            SalleViewCommand       = new RelayCommand(o => { CurrentView = SalleVm; });
        }
コード例 #20
0
        public ApplicationViewModel(MainWindow mainWindow, IEventAggregator eventAggregator, ISettingsService settingsService,
            CollegeViewModel collegeVM, StudentViewModel studentVM,
           Func<IndividualCollegeViewModel> individualCollegeVM, Func<IndividualStudentViewModel> individualStudentVM)
        {
            this.CurrentView = mainWindow;
            this.CurrentView.DataContext = this;
            this._eventAggregator = eventAggregator;
            this._settingsService = settingsService;
            this._collegeVM = collegeVM;
            this._studentVM = studentVM;
            this._individualCollegeVMFactory = individualCollegeVM;
            this._individualStudentVMFactory = individualStudentVM;

            AddColleges();
            AddStudentsToColleges();

            UserControl ucStudentDetails = this.CurrentView.FindName("ucStudentDetails") as UserControl;
            _studentGridView = ucStudentDetails.FindName("rgvStudentList") as RadGridView;

            this.CurrentView.Show();
        }
コード例 #21
0
        public IActionResult Edit(int id, CollegeViewModel collegeVM)
        {
            // id value is not hidden in form
            collegeVM.Id = id;

            bool isValid = TryValidateModel(collegeVM);

            if (isValid)
            {
                try
                {
                    _collegeFormService.Save(id, collegeVM);

                    return(RedirectToAction("Details", new { id = id }));
                }
                catch
                {
                    throw new Exception("Save failed.");
                }
            }
            var vm = _collegeEditService.Build(id);

            return(View(vm));
        }
コード例 #22
0
 public CollegeViewModel GetCollegeForDetailsById(short CollegeRowID)
 {
     try
     { CollegeViewModel model = new CollegeViewModel();
       var entity             = db.MasterColleges.Find(CollegeRowID);
       if (entity != null)
       {
           model.CollegeRowID       = entity.CollegeRowID;
           model.UniversityName     = entity.MasterUniversity.UniversityName;
           model.CollegeName        = entity.CollegeName;
           model.CountryName        = entity.MasterCountry.CountryName;
           model.StateName          = entity.MasterState.StateName;
           model.DistrictName       = entity.MasterDistrict.DistrictName;
           model.LocationName       = entity.MasterLocation.LocationName;
           model.AdditionalComments = entity.AdditionalComments;
           model.AdditionalCost     = entity.AdditionalCost;
           //if (model.AdditionalCost == 1)
           //    model.AdditionalCostYN = "Yes";
           //else model.AdditionalCostYN = "No";
           model.AdditionalCosting      = entity.AdditionalCosting;
           model.ConcernPersonName      = entity.ConcernPersonName;
           model.DegreeCertificate      = entity.DegreeCertificate;
           model.DesigConcernPerson     = entity.DesigConcernPerson;
           model.FinalYearMarksSheet    = entity.FinalYearMarksSheet;
           model.ProvisionalCertificate = entity.ProvisionalCertificate;
           model.Website               = entity.Website;
           model.CollegeStatus         = entity.CollegeStatus;
           model.CollegeAddress        = entity.CollegeAddress;
           model.SpecialInstruction    = entity.SpecialInstruction;
           model.PassingCertificate    = entity.PassingCertificate;
           model.ModeOfInitiation      = entity.ModeOfInitiation;
           model.ModeOfPayment         = entity.ModeOfPayment;
           model.OfficialEmailId       = entity.OfficialEmailId;
           model.OfficialLandlineNo    = entity.OfficialLandlineNo;
           model.MobileNo              = entity.MobileNo;
           model.OtherDocument         = entity.OtherDocument;
           model.Other1                = entity.Other1;
           model.Other2                = entity.Other2;
           model.Other3                = entity.Other3;
           model.Other4                = entity.Other4;
           model.Other5                = entity.Other5;
           model.Status                = entity.Status;
           model.FavourOf              = entity.FavourOf;
           model.ResultLink            = entity.ResultLink;
           model.OtherDocumentDetail   = entity.OtherDocumentDetail;
           model.OtherInitiation       = entity.OtherInitiation;
           model.OtherStatus           = entity.OtherStatus;
           model.PayableAT             = entity.PayableAT;
           model.AccountNumber         = entity.AccountNumber;
           model.IFSCCode              = entity.IFSCCode;
           model.Snapshot              = entity.Snapshot;
           model.VerificationTATLevel1 = entity.VerificationTATLevel1;
           model.VerificationTATLevel2 = entity.VerificationTATLevel2;
           model.Status                = entity.Status;
       }
       else
       {
           throw new Exception("Invalid Id!");
       }
       return(model); }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #23
0
        public async Task <IActionResult> StaffTrainings()
        {
            CollegeViewModel viewModel = await getCollegeViewModelAsync();

            return(View(viewModel));
        }
コード例 #24
0
        public async Task <IActionResult> SupportiveStaff()
        {
            CollegeViewModel viewModel = await getCollegeViewModelAsync();

            return(View(viewModel));
        }
コード例 #25
0
        public async Task <IActionResult> Investment()
        {
            CollegeViewModel viewModel = await getCollegeViewModelAsync();

            return(View(viewModel));
        }
コード例 #26
0
        public async Task <IActionResult> InternalRevenue()
        {
            CollegeViewModel viewModel = await getCollegeViewModelAsync();

            return(View(viewModel));
        }
コード例 #27
0
        public CollegeViewModel Update(CollegeViewModel collegeViewModel)
        {
            var college = _mapper.Map <College>(collegeViewModel);

            return(_mapper.Map <CollegeViewModel>(_collegeService.Update(college)));
        }
コード例 #28
0
 public ActionResult Delete(CollegeViewModel collegeViewModel)
 {
     collegeBL.DeleteCollege(collegeViewModel.CollegeCode);
     TempData["Message"] = Message.Deleted;
     return(RedirectToAction("DisplayCollege"));
 }