public async Task <IActionResult> Index(int id) { SchedulesViewModel model = new SchedulesViewModel(); List <ApplicationUser> allusers = new List <ApplicationUser>(); try { //setting foreign key in schedule model.candidateId = id; //getting candidate name and position for readonly in view model.candidate_name = _dbContext.Candidate.Where(x => x.ID == id).FirstOrDefault().name; var job_ID = _dbContext.JobPostCandidate.Where(x => x.candidate_Id == id).FirstOrDefault().job_Id; model.position = _dbContext.JobPost.AsNoTracking().FirstOrDefault(x => x.ID == job_ID).job_title; //getting dropdown of AspNetUsers from DB allusers = (from element in _dbContext.Users select element).ToList(); ViewBag.users = allusers; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(model)); }
public IActionResult ScheduleDetails(int?id1, int?id2) { var model = new SchedulesViewModel(); model.Schedules = _scheduleData.GetAll(id1, id2); return(View(model)); }
public ActionResult ViewSchedules() { var viewModel = new SchedulesViewModel() { Schedules = _context.OneWeekSchedules.ToList() }; return(View("ViewSchedules", viewModel)); }
public async Task <SchedulesViewModel> AddNewSchedules(SchedulesViewModel model) { var mapped = _mapper.Map <Schedules>(model); var result = await _schedulesRepository.Add(mapped); var data = _mapper.Map <SchedulesViewModel>(result); return(data); }
public override void CreateViewModels() { _soundsViewModel = new SoundsViewModel(); _opcServersViewModel = new OPCServersViewModel(); _proceduresViewModel = new ProceduresViewModel(); _schedulesViewModel = new SchedulesViewModel(); _globalVariablesViewModel = new GlobalVariablesViewModel(); _planExtension = new AutomationPlanExtension(_proceduresViewModel); _opcTechnosoftwareViewModel = new OpcTechnosoftwareViewModel(); _opcDaClientViewModel = new OpcDaClientViewModel(); _opcDaTagFiltersViewModel = new OpcDaTagFiltersViewModel(); }
public async Task <IActionResult> IndexPost(SchedulesViewModel model) { List <Schedules> allschedules = new List <Schedules>(); JobApplications jobAppModel = new JobApplications(); Candidate candidateModel = new Candidate(); SchedulesViewModel latestRecord = new SchedulesViewModel(); try { //for getting the job application of candidate in current scenario (we are in schedules so for getting //job Application ID, need to go through candidate) candidateModel = _dbContext.Candidate.Where(x => x.ID == model.candidateId).FirstOrDefault(); jobAppModel = _dbContext.jobApplications.Where(x => x.candidateId == model.candidateId).FirstOrDefault(); //checking for already existing round allschedules = _dbContext.Schedules.Where(x => x.candidateId == model.candidateId).ToList(); foreach (var item in allschedules) { if (item.round == model.round) { TempData["msg"] = model.round; return(RedirectToAction("Details", "JobApplication", new { id = jobAppModel.ID, conflict = TempData["msg"] })); } } //for new schedule Proceed //converting enum values to int model.status = Convert.ToInt32(model.statusvalue); //saving all the interviewers List <string> interviewers = new List <string>(); interviewers = model.Multiinterviewer; //fetch schedule from db for this candidate , getting schedule id for composite key use. latestRecord = await _schedulesPage.AddNewSchedules(model); //insert Composite keys to SchedulesUsers (interviewers to schedules mapping) foreach (var item in interviewers) { SchedulesUsersViewModel newModel = new SchedulesUsersViewModel() { scheduleId = latestRecord.ID, UserId = item }; await _schedulesUsersPage.AddNewSchedulesUsers(newModel); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Details", "JobApplication", new { id = jobAppModel.ID })); }
public async Task <IActionResult> Update_Schedule_GET(int id) { SchedulesViewModel model = new SchedulesViewModel(); try { model = await _schedulesPage.GetSchedulesById(id); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(model)); }
public async Task <IActionResult> Update_Schedule_POST(SchedulesViewModel model) { try { //converting enum values to int model.status = Convert.ToInt32(model.statusvalue); await _schedulesPage.UpdateSchedule(model); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("ScheduleDetails", new { scheduleId = model.ID })); }
/// <summary> /// ENLIST ALL THE DETAILS OF PARTICULAR SCHEDULE FOR CANDIDATE TO INTERVIEWER /// </summary> /// <param name="Sid"></param> /// <returns></returns> public async Task <IActionResult> ScheduleDetails(int scheduleId) { //getting schedule by ID SchedulesViewModel model = await _schedulesPage.GetSchedulesById(scheduleId); try { //assigning values to some fields model.time = model.datetime.ToString(time_format); model.statusName = Enum.GetName(typeof(StatusType), model.status); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(model)); }
public async Task <IActionResult> UpdateScheduleOfJobApplication(int JobApplicationId, int scheduleId, bool delete = false) { JobApplicationViewModel jobApplicationModel = new JobApplicationViewModel(); CandidateViewModel model = new CandidateViewModel(); //checking for deleting schedule action try { if (delete == true) { await _schedulesPage.DeleteSchedule(scheduleId); return(RedirectToAction("Details", "JobApplication", new { id = JobApplicationId })); } //for updating schedules jobApplicationModel = await _jobApplicationPage.getJobApplicationById(JobApplicationId); //getting candidate model = await _candidatePage.getCandidateByIdWithSchedules(jobApplicationModel.candidateId); } catch (Exception ex) { Console.WriteLine(ex.Message); } //finding schedule to be edited SchedulesViewModel scheduleModel = new SchedulesViewModel(); foreach (var item in model.Schedules) { if (item.ID == scheduleId) { scheduleModel = item; } } //getting dropdown of AspNetUsers from DB var allusers = (from element in _dbContext.Users select element).ToList(); ViewBag.users = allusers; return(View(scheduleModel)); }
public async Task <IActionResult> UpdateScheduleOfJobApplicationPost(SchedulesViewModel model) { List <SchedulesUsers> collection = new List <SchedulesUsers>(); List <string> interviewers = new List <string>(); JobApplications jobApplication = new JobApplications(); try { //converting enum values to int model.status = Convert.ToInt32(model.statusvalue); //saving all the interviewers interviewers = model.Multiinterviewer; //all data of ScheduleUser composite table collection = _dbContext.SchedulesUsers.Where(x => x.scheduleId == model.ID).ToList(); //removing the existing pairs of old schedules interviewers _dbContext.SchedulesUsers.RemoveRange(collection); _dbContext.SaveChanges(); //adding new records of composite key into schedule users for new userschedule pairs foreach (var item in interviewers) { SchedulesUsersViewModel newModel = new SchedulesUsersViewModel() { scheduleId = model.ID, UserId = item }; await _schedulesUsersPage.AddNewSchedulesUsers(newModel); } await _schedulesPage.UpdateSchedule(model); //redirecting to details of job Application jobApplication = _dbContext.jobApplications.Where(x => x.candidateId == model.candidateId).FirstOrDefault(); }catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Details", "JobApplication", new { id = jobApplication.ID })); }
public TimeTrackingTabsViewModel(SKDTabItems skdTabItems) { SKDTabItems = skdTabItems; EditFilterCommand = new RelayCommand(OnEditFilter, CanEditFilter); DayIntervalsViewModel = new DayIntervalsViewModel(); ScheduleSchemesViewModel = new ScheduleSchemesViewModel(); HolidaysViewModel = new HolidaysViewModel(); SchedulesViewModel = new SchedulesViewModel(); TimeTrackingViewModel = new TimeTrackingViewModel(); if (CanSelectDayIntervals) IsDayIntervalsSelected = true; else if (CanSelectScheduleSchemes) IsScheduleSchemesSelected = true; else if (CanSelectHolidays) IsHolidaysSelected = true; else if (CanSelectSchedules) IsSchedulesSelected = true; else if (CanSelectTimeTracking) IsTimeTrackingSelected = true; }
public async Task <IActionResult> Index(string fromCode = null, string toCode = null) { if (!string.IsNullOrWhiteSpace(fromCode) && !string.IsNullOrWhiteSpace(toCode)) { _scheduleApi.From = fromCode; _scheduleApi.To = toCode; var request = RequestApiFactory.Create(_scheduleApi); var response = await request.GetResponseAsync() .ConfigureAwait(continueOnCapturedContext: false); var result = RequestApiFactory.RequestJsonDesirialize <ScheduleResponse>(response); if (result != null && result.Error == null) { var filter = new StarredThreadFilter(x => User.FindFirstValue(Services.Identity.User.IdClaimType).Equals(x.UserReference.UserId)); var sttaredThreads = await ThreadsRepository .FetchAsync(filter, RequestWindow.All) .ConfigureAwait(continueOnCapturedContext: false); var model = new SchedulesViewModel { Segments = result.Segments, SttaredThreadKeys = sttaredThreads.Select(x => x.ThreadKey).ToArray(), FromCode = fromCode, ToCode = toCode, }; return(View(model)); } } return(View(new SchedulesViewModel { From = string.Empty, To = string.Empty, })); }
public SchedulesMenuViewModel(SchedulesViewModel context) { Context = context; }
public async Task UpdateSchedule(SchedulesViewModel model) { await _schedulesRepository.Update(_mapper.Map <Schedules>(model)); }
public SchedulesPage() { InitializeComponent(); BindingContext = viewModel = new SchedulesViewModel(SchedulesGrid); }
public async Task <IActionResult> Index(SchedulesViewModel model) { try { if (model == null) { return(View(new SchedulesViewModel { From = string.Empty, To = string.Empty, })); } if (!ModelState.IsValid) { return(View(model)); } if (model.FromCode == null || model.ToCode == null) { var fromCityTask = _cities.GetCityKeyAsync(model.From); var toCityTask = _cities.GetCityKeyAsync(model.To); await Task.WhenAll(fromCityTask, toCityTask) .ConfigureAwait(continueOnCapturedContext: false); if (fromCityTask.Result == null || toCityTask.Result == null) { return(View(model)); } model.FromCode = fromCityTask.Result.Code; model.ToCode = toCityTask.Result.Code; } _scheduleApi.From = model.FromCode; _scheduleApi.To = model.ToCode; var request = RequestApiFactory.Create(_scheduleApi); var response = await request.GetResponseAsync() .ConfigureAwait(continueOnCapturedContext: false); var result = RequestApiFactory.RequestJsonDesirialize <ScheduleResponse>(response); if (result != null && result.Error == null) { var filter = new StarredThreadFilter(x => User.FindFirstValue(Services.Identity.User.IdClaimType).Equals(x.UserReference.UserId)); var sttaredThreads = await ThreadsRepository .FetchAsync(filter, RequestWindow.All) .ConfigureAwait(continueOnCapturedContext: false); var filtredSegments = result.Segments.AsEnumerable(); if (model.StartDate.HasValue) { filtredSegments = filtredSegments.Where(x => x.StartDate >= model.StartDate.Value); } if (model.EndDate.HasValue) { filtredSegments = filtredSegments.Where(x => x.StartDate <= model.EndDate.Value); } model.Segments = filtredSegments.ToArray(); model.SttaredThreadKeys = sttaredThreads.Select(x => x.ThreadKey).ToArray(); return(View(model)); } } catch (Exception exc) { return(RedirectToAction("Error", new ErrorViewModel { Exception = exc })); } return(View(model)); }