public ActionResult Delete(int id, int entityId, LogicaName logicalName) { notesRep.DeleteMessage(id); notesRep.Save(); return(RedirectToAction("List", new { entityId, logicalName })); }
private Workers GetWorkerVMByRelevantEntity(int id, LogicaName logicalName, int seasonId, int?leagueId) { var frm = new Workers { RelevantEntityId = id, RelevantEntityLogicalName = logicalName, SeasonId = seasonId, LeagueId = (leagueId == null ? 0 : (int)leagueId) }; switch (logicalName) { case LogicaName.Union: frm.UsersList = base.jobsRepo.GetUnionUsersJobs(id); frm.JobsList = new SelectList(base.jobsRepo.GetByUnion(id), "JobId", "JobName"); break; case LogicaName.League: frm.UsersList = base.jobsRepo.GetLeagueUsersJobs(id); frm.JobsList = new SelectList(base.jobsRepo.GetByLeague(id), "JobId", "JobName"); break; case LogicaName.Team: frm.UsersList = base.jobsRepo.GetTeamUsersJobs(id); frm.JobsList = new SelectList(base.jobsRepo.GetByTeam(id), "JobId", "JobName"); break; case LogicaName.Club: frm.UsersList = base.jobsRepo.GetClubOfficials(id); frm.JobsList = new SelectList(base.jobsRepo.GetClubJobs(id), "JobId", "JobName"); break; } return(frm); }
public ActionResult Search(string term, int id, LogicaName logicalName) { int sectionId = -1; IEnumerable <ListItemDto> resList; switch (logicalName) { case LogicaName.Union: sectionId = secRepo.GetByUnionId(id).SectionId; break; case LogicaName.League: sectionId = secRepo.GetByLeagueId(id).SectionId; break; case LogicaName.Team: sectionId = secRepo.GetSectionByTeamId(id).SectionId; break; case LogicaName.Club: sectionId = secRepo.GetByClubId(id).SectionId; break; } resList = usersRepo.SearchSectionUser(sectionId, AppRole.Workers, term, 999); return(Json(resList)); }
public ActionResult CreateWorker(int relevantEntityId, LogicaName logicalName, int seasonId) { var frm = new CreateWorkerForm { RelevantEntityId = relevantEntityId, RelevantEntityLogicalName = logicalName, SeasonId = seasonId }; switch (frm.RelevantEntityLogicalName) { case LogicaName.Union: frm.JobsList = new SelectList(jobsRepo.GetByUnion(frm.RelevantEntityId), "JobId", "JobName"); break; case LogicaName.League: frm.JobsList = new SelectList(jobsRepo.GetByLeague(frm.RelevantEntityId), "JobId", "JobName"); break; case LogicaName.Team: frm.JobsList = new SelectList(jobsRepo.GetByTeam(frm.RelevantEntityId), "JobId", "JobName"); break; case LogicaName.Club: frm.JobsList = new SelectList(jobsRepo.GetClubJobs(frm.RelevantEntityId), "JobId", "JobName"); break; default: frm.JobsList = new List <SelectListItem>(); break; } frm.IsActive = true; return(PartialView("_CreateWorker", frm)); }
//Worker List public ActionResult WorkerList(int id, LogicaName logicalName, int seasonId, int?leagueId) { var vm = GetWorkerVMByRelevantEntity(id, logicalName, seasonId, leagueId); ViewBag.SeasonId = seasonId; return(PartialView("_WorkerList", vm)); }
public ActionResult Create(int entityId, LogicaName logicalName, int?seasonId) { ViewBag.Leagues = logicalName == LogicaName.Union && seasonId.HasValue ? _leagueRepo.GetLeaguesBySesonUnion(entityId, seasonId.Value) : null; var model = new CreateSeason { EntityId = entityId, RelevantEntityLogicalName = logicalName }; return(PartialView("_CreateSeason", model)); }
public bool IsUserInJob(LogicaName logicaName, int relevantEntityId, int jobId, int userId) { switch (logicaName) { case LogicaName.Union: return(db.UsersJobs.Any(uj => uj.JobId == jobId && uj.UserId == userId && uj.UnionId == relevantEntityId)); case LogicaName.League: return(db.UsersJobs.Any(uj => uj.JobId == jobId && uj.UserId == userId && uj.LeagueId == relevantEntityId)); case LogicaName.Team: return(db.UsersJobs.Any(uj => uj.JobId == jobId && uj.UserId == userId && uj.TeamId == relevantEntityId)); } return(false); }
public ActionResult Add(int entityId, LogicaName logicalName, int?unionId, int?clubId) { int currentUnionIdFromSession = GetCurrentUnionFromSession(); int?currentSeasonIdFromSession = GetUnionCurrentSeasonFromSession(); int?currentSeasonId = seasonsRepo.GetLasSeasonByUnionId(currentUnionIdFromSession); var vm = new NotificationsForm { SeasonId = currentSeasonIdFromSession, RelevantEntityLogicalName = logicalName, EntityId = entityId, NeedHideTextField = currentSeasonIdFromSession != currentSeasonId }; return(PartialView("_AddNew", vm)); }
// CRUD Worker public ActionResult EditWorker(int id, int relevantEntityId, LogicaName logicalName, int seasonId, int?leagueId) { var frm = new CreateWorkerForm { RelevantEntityId = relevantEntityId, RelevantEntityLogicalName = logicalName, }; switch (frm.RelevantEntityLogicalName) { case LogicaName.Union: frm.JobsList = new SelectList(jobsRepo.GetByUnion(frm.RelevantEntityId), "JobId", "JobName"); break; case LogicaName.League: frm.JobsList = new SelectList(jobsRepo.GetByLeague(frm.RelevantEntityId), "JobId", "JobName"); break; case LogicaName.Team: frm.JobsList = new SelectList(jobsRepo.GetByTeam(frm.RelevantEntityId), "JobId", "JobName"); break; case LogicaName.Club: frm.JobsList = new SelectList(jobsRepo.GetClubJobs(frm.RelevantEntityId), "JobId", "JobName"); break; default: frm.JobsList = new List <SelectListItem>(); break; } UsersJob userJob = jobsRepo.GetUsersJobById(id); frm.InjectFrom(userJob.User); frm.JobId = userJob.JobId; frm.UserJobId = userJob.Id; frm.SeasonId = seasonId; if (!string.IsNullOrEmpty(userJob.User.Password)) { frm.Password = Protector.Decrypt(userJob.User.Password); } return(PartialView("_EditWorker", frm)); }
public ActionResult List(int entityId, LogicaName logicalName, int?seasonId) { var viewModel = new SeasonViewModel() { LogicalName = logicalName, EntityId = entityId, SeasonId = seasonId }; switch (logicalName) { case LogicaName.Union: viewModel.Seasons = _seasonsRepository.GetSeasonsByUnion(entityId); break; case LogicaName.Club: viewModel.Seasons = _seasonsRepository.GetClubsSeasons(entityId); break; } return(PartialView("_List", viewModel)); }
public ActionResult List(int entityId, LogicaName logicalName) { int?seasonId = GetUnionCurrentSeasonFromSession(); var nvm = new NotificationsViewModel { EntityId = entityId, RelevantEntityLogicalName = logicalName }; if (seasonId.HasValue) { switch (logicalName) { case LogicaName.Team: nvm.Notifications = notesRep.GetLeagueTeamMessages(seasonId.Value, entityId); break; case LogicaName.League: nvm.Notifications = notesRep.GetLeagueMessages(seasonId.Value, entityId); break; case LogicaName.Union: nvm.Notifications = notesRep.GetUnionMessages(seasonId.Value, entityId); break; case LogicaName.Club: //notiticationsViewModel.Notifications = notesRep.GetClubMessages(entityId); break; } } if (nvm.Notifications != null) { nvm.Notifications = nvm.Notifications.FindAll(n => ((n.TypeId & MessageTypeEnum.NoPushNotify) == 0)); } return(PartialView("_List", nvm)); }
public ActionResult DeleteWorker(int id, int relevantEntityId, LogicaName logicalName, int seasonId) { jobsRepo.RemoveUsersJob(id); return(RedirectToAction("WorkerList", new { id = relevantEntityId, logicalName = logicalName, seasonId = seasonId })); }