public ActionResult Upload(CounsellingViewModel counsellingViewModel) { var organisationId = UserOrganisationId; counsellingViewModel.DocumentTypes = new SelectList(NidanBusinessService.RetrieveDocumentTypes(organisationId), "DocumentTypeId", "Name"); if (counsellingViewModel.Files != null) { if (counsellingViewModel.Files != null && counsellingViewModel.Files[0].ContentLength > 0) { var enquiryData = _nidanBusinessService.RetrieveEnquiry(organisationId, counsellingViewModel.EnquiryId); if (counsellingViewModel.Files[0].FileName.EndsWith(".pdf")) { _documentService.Create(organisationId, UserCentreId, counsellingViewModel.Document.DocumentTypeId, enquiryData.StudentCode, enquiryData.FirstName, "Counselling Document", counsellingViewModel.Files[0].FileName, counsellingViewModel.Files[0].InputStream.ToBytes()); } else { ModelState.AddModelError("FileFormat", "This file format is not supported"); return(View(counsellingViewModel)); } return(RedirectToAction("Edit", new { id = enquiryData.Counsellings.FirstOrDefault().CounsellingId })); } ModelState.AddModelError("", "Please Upload Your file"); } return(View(counsellingViewModel)); }
public ActionResult Upload(int id) { var viewModel = new CounsellingViewModel { CounsellingId = Convert.ToInt32(TempData["CounsellingId"]), EnquiryId = id, Files = new List <HttpPostedFileBase>(), DocumentTypes = new SelectList(NidanBusinessService.RetrieveDocumentTypes(UserOrganisationId), "DocumentTypeId", "Name") }; return(View(viewModel)); }
public ActionResult Create(int?id) { var organisationId = UserOrganisationId; var centreId = UserCentreId; id = id ?? 0; var sectors = NidanBusinessService.RetrieveSectors(organisationId, e => true); var enquiry = NidanBusinessService.RetrieveEnquiry(organisationId, id.Value); var enquiryDataGrid = NidanBusinessService.RetrieveEnquiryDataGrid(organisationId, e => e.EnquiryId == id.Value).Items.FirstOrDefault(); var interestedCourseIds = enquiry.EnquiryCourses.Select(e => e.CourseId).ToList(); var courses = NidanBusinessService.RetrieveCentreCourses(organisationId, UserCentreId, e => e.CentreId == UserCentreId); var enquiryCourses = NidanBusinessService.RetrieveCentreCourses(organisationId, UserCentreId, e => e.CentreId == UserCentreId).Where(e => interestedCourseIds.Contains(e.CourseId)); var occupations = NidanBusinessService.RetrieveOccupations(organisationId, e => true); var schemes = NidanBusinessService.RetrieveCentreSchemes(organisationId, centreId, e => e.CentreId == centreId); var batchTimePrefers = NidanBusinessService.RetrieveBatchTimePrefers(organisationId, e => true); var educationalQualifications = NidanBusinessService.RetrieveQualifications(organisationId, e => true); var viewModel = new CounsellingViewModel { Enquiry = enquiry, EnquiryDataGrid = enquiryDataGrid, EnquiryId = id.Value, Sectors = new SelectList(sectors, "SectorId", "Name"), Courses = new SelectList(courses, "CourseId", "Name"), EnquiryCourses = new SelectList(enquiryCourses, "CourseId", "Name"), Occupations = new SelectList(occupations, "OccupationId", "Name"), Schemes = new SelectList(schemes, "SchemeId", "Name"), BatchTimePrefers = new SelectList(batchTimePrefers, "BatchTimePreferId", "Name"), EducationalQualifications = new SelectList(educationalQualifications, "QualificationId", "Name"), Counselling = new Counselling() { Title = enquiry.Title, FirstName = enquiry.FirstName, MiddleName = enquiry.MiddleName, LastName = enquiry.LastName, EnquiryId = enquiry.EnquiryId, Enquiry = enquiry } }; viewModel.ConversionProspectList = new SelectList(viewModel.ConversionProspectType, "Id", "Name"); viewModel.TitleList = new SelectList(viewModel.TitleType, "Value", "Name"); viewModel.PreferredMonthForJoiningList = new SelectList(viewModel.PreferredMonthForJoiningType, "Id", "Name"); return(View(viewModel)); }
// GET: Counselling/Edit/{id} public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TempData["CounsellingId"] = id; var organisationId = UserOrganisationId; var centreId = UserCentreId; var counselling = NidanBusinessService.RetrieveCounselling(organisationId, id.Value); if (counselling == null) { return(HttpNotFound()); } var enquiry = NidanBusinessService.RetrieveEnquiry(organisationId, counselling.EnquiryId); var enquiryCourseIds = counselling.Enquiry.EnquiryCourses.Select(e => e.CourseId); var enquiryCourses = NidanBusinessService.RetrieveCentreCourses(organisationId, UserCentreId, e => e.CentreId == UserCentreId).Where(e => enquiryCourseIds.Contains(e.CourseId)); var courses = NidanBusinessService.RetrieveCentreCourses(organisationId, centreId, e => e.CentreId == centreId); var occupations = NidanBusinessService.RetrieveOccupations(organisationId, e => true); var schemes = NidanBusinessService.RetrieveCentreSchemes(organisationId, centreId, e => e.CentreId == centreId); var batchTimePrefers = NidanBusinessService.RetrieveBatchTimePrefers(organisationId, e => true); var educationalQualifications = NidanBusinessService.RetrieveQualifications(organisationId, e => true); var viewModel = new CounsellingViewModel { Counselling = counselling, Courses = new SelectList(courses, "CourseId", "Name"), EnquiryCourses = new SelectList(enquiryCourses, "CourseId", "Name"), Sectors = new SelectList(NidanBusinessService.RetrieveSectors(organisationId, e => true).ToList(), "SectorId", "Name"), Occupations = new SelectList(occupations, "OccupationId", "Name"), Schemes = new SelectList(schemes, "SchemeId", "Name"), BatchTimePrefers = new SelectList(batchTimePrefers, "BatchTimePreferId", "Name"), EducationalQualifications = new SelectList(educationalQualifications, "QualificationId", "Name"), Enquiry = enquiry, }; viewModel.ConversionProspectList = new SelectList(viewModel.ConversionProspectType, "Id", "Name"); viewModel.TitleList = new SelectList(viewModel.TitleType, "Value", "Name"); viewModel.PreferredMonthForJoiningList = new SelectList(viewModel.PreferredMonthForJoiningType, "Id", "Name"); return(View(viewModel)); }
// GET: Counselling/View/{id} public ActionResult View(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var organisationId = UserOrganisationId; var counselling = NidanBusinessService.RetrieveCounselling(organisationId, id.Value); var counsellingDataGrid = NidanBusinessService.RetrieveCounsellingDataGrid(organisationId, e => e.CounsellingId == id.Value).Items.FirstOrDefault(); if (counsellingDataGrid == null) { return(HttpNotFound()); } var viewModel = new CounsellingViewModel { CounsellingDataGrid = counsellingDataGrid, Counselling = counselling }; return(View(viewModel)); }
public ActionResult Create(CounsellingViewModel counsellingViewModel) { var organisationId = UserOrganisationId; var personnelId = UserPersonnelId; if (ModelState.IsValid) { counsellingViewModel.Counselling.OrganisationId = organisationId; counsellingViewModel.Counselling.PersonnelId = personnelId; counsellingViewModel.Counselling.CreatedBy = UserPersonnelId; counsellingViewModel.Counselling.CentreId = UserCentreId; counsellingViewModel.Counselling.CreatedBy = personnelId; counsellingViewModel.Counselling = NidanBusinessService.CreateCounselling(organisationId, counsellingViewModel.Counselling); return(RedirectToAction("Index")); } counsellingViewModel.Courses = new SelectList(NidanBusinessService.RetrieveCourses(organisationId, e => true).ToList(), "CourseId", "Name"); counsellingViewModel.Sectors = new SelectList(NidanBusinessService.RetrieveSectors(organisationId, e => true).ToList(), "SectorId", "Name"); counsellingViewModel.Occupations = new SelectList(NidanBusinessService.RetrieveOccupations(organisationId, e => true).ToList()); counsellingViewModel.Schemes = new SelectList(NidanBusinessService.RetrieveSchemes(organisationId, e => true).ToList()); counsellingViewModel.BatchTimePrefers = new SelectList(NidanBusinessService.RetrieveBatchTimePrefers(organisationId, e => true).ToList()); counsellingViewModel.EducationalQualifications = new SelectList(NidanBusinessService.RetrieveQualifications(organisationId, e => true).ToList()); return(View(counsellingViewModel)); }
public ActionResult Edit(CounsellingViewModel counsellingViewModel) { var organisationId = UserOrganisationId; var personnelId = UserPersonnelId; if (ModelState.IsValid) { counsellingViewModel.Counselling.OrganisationId = organisationId; counsellingViewModel.Counselling.PersonnelId = personnelId; counsellingViewModel.Counselling.CentreId = UserCentreId; counsellingViewModel.Counselling.CreatedBy = personnelId; counsellingViewModel.Counselling.FollowUpDate = DateTime.UtcNow.AddDays(2); counsellingViewModel.Counselling = NidanBusinessService.UpdateCounselling(organisationId, counsellingViewModel.Counselling); return(RedirectToAction("Index")); } var viewModel = new CounsellingViewModel { Courses = new SelectList(NidanBusinessService.RetrieveCourses(organisationId, e => true).ToList(), "CourseId", "Name"), Sectors = new SelectList(NidanBusinessService.RetrieveSectors(organisationId, e => true).ToList(), "SectorId", "Name"), Counselling = counsellingViewModel.Counselling }; return(View(viewModel)); }