/// <summary> /// Renvoie la liste des evenements(competition ,stage) auquel un membre participe /// </summary> public static List <EvenementsModel> EvenementsAuquelIlParticipe(ClubModel club, MembreModel m) { BindingList <EvenementsModel> evenements = club.Evenements; List <EvenementsModel> participe = new List <EvenementsModel> { }; foreach (EvenementsModel e in evenements) { if (e is StageModel) { StageModel s = e as StageModel; if (StageService.ParticipeAuStage(m, s)) { participe.Add(e); } } if (e is CompetitionModel) { CompetitionModel c = e as CompetitionModel; if (c.EquipeDuClub.ListeDeJoueur.Contains(m)) { participe.Add(c); } } } return(participe); }
public HttpResponseMessage SaveClub(ClubModel club) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); ClubBLL.SaveClub(ClubModel.MapClubModelToClub(club)); return(response); }
/// <summary> /// Deprogramme le stage /// </summary> public static void SupprimerStage(ClubModel club, StageModel s) { if (club.Evenements.Contains(s)) { club.Evenements.Remove(s); } }
public ListePersonnelModelView(ClubModel club) { this.club = club; this.Staffs = club.Personnels; SupprimerPersonnelCommand = new SimpleCommand(SupprimerPersonnel); }
public IActionResult Aanmeld(ClubModel club) { iClubSaveContext context = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.ClubMySQLContext)) as iClubSaveContext; iClubRetrieveContext retcontext = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.ClubMySQLContext)) as iClubRetrieveContext; bool check = retcontext.CheckValidate(club); if ((int)club.Type == 0) { club.Test = "Demo"; } else { club.Test = "Jaarabonement"; } if (!check) { context.InsertAddress(club); context.InsertClub(club); return(RedirectToAction("Index")); } else { ModelState.AddModelError("Name", "Deze vereniging bestaat al."); return(View("Aanmeld")); } }
public AjouterMembreModelView(ClubModel club) { Membre = new MembreModel(); this.club = club; AjouterMembreCommand = new SimpleCommand(AjouterMembre); }
public void CreateClub_ThrowsException_DuplicateMembershipsInput() { // arrange var johnDoe = new User { Username = "******" }; var membershipModel = new MembershipModel { UserId = johnDoe.Id }; var membershipModels = new MembershipModel[] { membershipModel, membershipModel }; //<-- Added twice the same MembershipModel to the array of models var model = new ClubModel { Name = "C# Coding Club", MembershipModels = membershipModels }; // act var entity = new Club(model); // assert Assert.NotNull(entity); Assert.False(entity.IsValid); Assert.True(entity.ModelValidationErrors.ContainsKey(ModelValidationStatusCode.InvalidDataSupplied)); Assert.True(entity.Id != null && entity.Id != Guid.Empty); }
/// <summary> /// Ajoute un stage à la liste des evenenements /// </summary> public static void AjouterStage(ClubModel club, StageModel s) { if (!club.Evenements.Contains(s)) { club.Evenements.Add(s); } }
public ActionResult Clubs() { string query = "select clubID, userID, clubname from club order by clubname"; //+ "where userID = @userID"; ClubModel clubObj = new ClubModel(); clubObj.userID = (int)HttpContext.Session.GetInt32("UserID"); clubs = SqliteDataAccess.LoadManyObjects(clubObj, query); StringBuilder clubListHtml = new StringBuilder("<table id=\"clubTbl\">" + "<tr><th>Club</th><th>Club Id</th></tr>"); foreach (var club in clubs) { clubListHtml.Append("<tr><td>"); clubListHtml.Append(club.clubname); clubListHtml.Append("</td><td>"); clubListHtml.Append(club.clubID); clubListHtml.Append("</td></tr>"); } clubListHtml.Append("</table>"); ViewBag.Clubs = clubListHtml; TempData["Clubs"] = clubListHtml.ToString(); return(RedirectToAction("Application", "Home")); }
public GestionMatchModelView(ClubModel club, CompetitionModel competition) { this.club = club; this.matches = competition.Matches; MatchGagneCommand = new SimpleCommand(MatchGagne); MatchPerduCommand = new SimpleCommand(MatchPerdu); }
public IActionResult Login(ClubModel club) { iClubRetrieveContext context = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.ClubMySQLContext)) as iClubRetrieveContext; iUserRetrieveContext ucontext = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.UserMySQLContext)) as iUserRetrieveContext; UserTest user = new UserTest(); user.UEmail = club.ClubNumber; user.Password = club.Postcode; bool check = context.Inloggen(club); bool ucheck = ucontext.Inloggen(user); if (check) { return(View("Confirm")); } else { if (ucheck) { int?test = HttpContext.Session.GetInt32("loggedIn"); HttpContext.Session.SetInt32("loggedIn", 1); return(RedirectToAction("Index", "Dashboard")); } else { ModelState.AddModelError("Postcode", "Password incorrect."); return(View("Index")); } } }
public AjouterStageModelView(ClubModel club) { this.club = club; stage = new StageModel(); Entraineurs = PersonnelService.ListeEntraineur(club); AjouterStageCommand = new SimpleCommand(AjouterStage); }
public PaiementsMembreModelView(ClubModel club, int id) { this.club = club; Initialisation(id); DeclarerPayeCommand = new SimpleCommand(DeclarerPaye); }
public AjouterEquipeModelView(ClubModel club) { this.club = club; Equipe = new EquipeModel(); Initialisation(); }
public void CreateClub_FailedModelValidation_InvalidMember() { // arrange var johnDoe = new User { Username = "******" }; var membershipsModels = new MembershipModel[] { new MembershipModel { UserId = johnDoe.Id }, new MembershipModel { UserId = Guid.Empty } }; var model = new ClubModel { Name = "C# Coding Club", MembershipModels = membershipsModels }; // act var entity = new Club(model); // assert Assert.NotNull(entity); Assert.False(entity.IsValid); Assert.True(entity.ModelValidationErrors.ContainsKey(ModelValidationStatusCode.InternalMemberFailedValidation)); }
/// <summary> /// Deletes the specified model. /// </summary> /// <param name="model">The model.</param> /// <returns></returns> public JsonResult Delete(ClubModel model) { try { var dbItem = this.repository.Read(model.Id); var competiteursRepository = this.unitOfWork.Repository <Competiteur>(); var clubName = model.Nom; foreach (var comp in competiteursRepository.Read().Where(c => c.ClubId == dbItem.Id)) { competiteursRepository.Delete(comp); } this.repository.Delete(dbItem); string clubImportFile = Path.Combine(Server.MapPath("~/App_Data/Imports"), clubName); if (System.IO.File.Exists(clubImportFile)) { Directory.Delete(clubImportFile, true); } return(Json(new { success = true })); } catch { throw; } }
public async Task <ActionResult <ClubModel> > PostClub(ClubModel model) { try { var location = _linkGenerator.GetPathByAction("GetClub", "Clubs", new { clubId = model.Id }); if (String.IsNullOrWhiteSpace(location)) { return(BadRequest("Could not use current club")); } var club = _mapper.Map <Club>(model); _repository.AddClub(club); if (await _repository.SaveChangesAsync()) { return(Created(location.ToString(), _mapper.Map <ClubModel>(club))); } } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, e.Message.ToString())); } return(BadRequest()); }
/// <summary> /// Ajoute une personne au personnel du club /// </summary> public static void AjouterPersonnel(ClubModel club, PersonnelModel P) { if (!club.Personnels.Contains(P)) { club.Personnels.Add(P); } }
/// <summary> /// Supprime une personne du personnel du club /// </summary> public static void SupprimerPersonnel(ClubModel club, PersonnelModel p) { if (club.Personnels.Contains(p)) { club.Personnels.Remove(p); } }
public void cargarDatosEditar(ClubModel club) { txtNombre.Text = club.nombre; txtAltura.Text = club.numero; txtCalle.Text = club.calle; txt_id.Text = club.id_Club.ToString(); }
public int EditarClub(ClubModel club) { if (club.Operacion == "Crear") { // club.Club = db.Club.Add(club.Club); db.SaveChanges(); club.Clientes.ForEach(ee => { // db.ClubCliente.Add(new ClubCliente { IdCliente = ee.Id, IdClub = club.Club.Id}); }); db.SaveChanges(); } if (club.Operacion == "Editar") { // db.ClubCliente.RemoveRange(db.ClubCliente.Where(x => x.IdClub == club.Club.Id)); db.SaveChanges(); club.Clientes.ForEach(ee => { // db.ClubCliente.Add(new ClubCliente { IdCliente = ee.Id, IdClub = club.Club.Id }); }); db.SaveChanges(); Club auxC = db.Club.Find(club.Club.IdClub); auxC.Nombre = club.Club.Nombre; // auxC.IdNivel = club.Club.IdNivel; db.SaveChanges(); } return(0);// club.Club.Id; }
public ModifierMembreModelView(ClubModel club, MembreModel membre) { this.club = club; M = membre; ModifierMembreCommand = new SimpleCommand(ModifierMembre); }
public void CreateClub_Success_Constructor1() { // arrange var johnDoe = new User { Username = "******" }; var williamDoe = new User { Username = "******" }; var membershipModels = new MembershipModel[] { new MembershipModel { UserId = johnDoe.Id }, new MembershipModel { UserId = williamDoe.Id } }; var model = new ClubModel { Name = "C# Coding Club", MembershipModels = membershipModels }; // act var entity = new Club(model); // assert Assert.NotNull(entity); Assert.True(entity.IsValid); Assert.True(entity.ModelValidationErrors.Count == 0); Assert.True(entity.Id != null && entity.Id != Guid.Empty); }
public async Task <IActionResult> Edit(ClubModel Club, int Id) { var club = await _db.Clubs.SingleOrDefaultAsync(m => m.Id == Id); club.Name = Club.Name; if (Club.Category != "Empty") { club.Category = Club.Category; } club.Description = Club.Description; club.Contact = Club.Contact; club.Adress = Club.Adress; if (Club.Website != "") { club.Website = Club.Website; } if (Club.Email != "") { club.Email = Club.Email; } club.Phone = Club.Phone; club.Founded = Club.Founded; _db.Clubs.Update(club); _db.SaveChanges(); return(RedirectToAction("Club", new{ ID = club.Id })); }
public ModifierParticipantModelView(ClubModel club, StageModel s) { this.club = club; stage = s; MiseAJourDesListe(); AjouterParticipantCommand = new SimpleCommand(AjouterParticipant); SupprimerParticipantCommand = new SimpleCommand(SupprimerParticpant); }
/// <summary> /// Ajoute un paiement en attente /// </summary> public static void AjouterPaiement(ClubModel club,PaiementModel p) { if(!club.Paiements.Contains(p)) // On regarde si le paiement n'est pas déja present { club.Paiements.Add(p); } }
public int Post(ClubModel club) // List<MonitorTitulo> titulos { var body = Request.Body; Token token = new Token(); // club.Club.IdEscuela = token.IdEscuela; return(clubService.EditarClub(club)); }
// GET: Tenant/MyCommunity public ActionResult Index() { ViewBag.ActiveMenu = "mycommunity"; ClubModel Model = new ClubModel(); ViewBag.CallenderHidden = ""; return(View(Model)); }
/// <summary> /// Supprimer un paiement en attente /// </summary> public static void SupprimerPaiement(ClubModel club,PaiementModel p) { if(club.Paiements.Contains(p)) // On regarde si le paiement est present { club.Paiements.Remove(p); } }
public override void SetController(BaseController c) { base.SetController(c); if (Inst == null) { Inst = this; } }
public AthleteModel(string firstName, string lastName, int? birthday, ClubModel club, AthleteClassModel athleteClass, int? startNumber, int id = EMPTY_ID) { SetDefaultId(); FirstName = firstName; LastName = lastName; Birthday = birthday; Club = club; AthleteClass = athleteClass; StartNumber = startNumber; }
public ActionResult Edit(ClubModel club) { if (club.Update()) { ViewData.ModelState.Clear(); ViewBag.Success = "Klubb lagret!"; } else ViewBag.Error = "Det skjedde en feil under oppdatering av klubb."; return View("Edit"); }
public ActionResult Create(ClubModel model) { var club = new ClubModel(model.Name); try { club.SaveToDb(); ViewData.ModelState.Clear(); ViewBag.Success = "Klubb lagret"; } catch (Exception) { ViewBag.Error = "Det skjedde en feil under lagring"; } return View("Create"); }
public void TestSetup() { club = new ClubModel("Test IK"); eventModel = new EventModel("TestEvent", DateTime.Today); eventModel.Save(); athlete = new AthleteModel("Tester", "Test"); athlete.StartNumber = 1; athlete.Club = club; athlete.SaveToDb(); race = new RaceModel("TestRace", DateTime.Today); race.EventId = eventModel.EventId; race.Save(); checkpointOrder = null; intermediate = null; checkpoint = null; }
public AthleteModel(string firstName, string lastName, string email, string address, string postalcode, string city, string gender, int? birthday, string phonenumber, int? startNumber, ClubModel club, AthleteClassModel athleteClass) { SetDefaultId(); FirstName = firstName; LastName = lastName; Birthday = birthday; Club = club; AthleteClass = athleteClass; StartNumber = startNumber; PostalAddress = address; PostalCode = postalcode; City = city; Gender = gender; PhoneNumber = phonenumber; Email = email; }
public void It_Should_Be_Possible_To_Save_A_Club_To_The_Database() { int initialclubcount = ClubModel.GetAll().Count; club = null; Given("we want to create a club", () => { club = new ClubModel("Test"); }); When("we want to save it to the database", () => { club.Save(); }); Then("the number of clubs should be increased with one", () => { ClubModel.GetAll().Count.ShouldBe(initialclubcount + 1); }); }
public void When_Fetching_A_Club_That_Does_Not_Exists_In_The_Db_We_Should_Create_That_Club() { club = null; int previousCount = -1; Given("we want to fetch a spesific club called Byåsen"); When("we fetch a club that does not exists (Byåsen)", () => { ClubModel.DeleteIfExists("Byåsen"); previousCount = ClubModel.GetAll().Count; club = ClubModel.GetOrCreate(CLUB_BYAASEN); }); Then("we shold get a club and a new DB rows should have been added", () => { club.Name.ShouldBe(CLUB_BYAASEN); ClubModel.GetAll().Count.ShouldBe(previousCount + 1); }); }
public void TestSetup() { club = null; }
public void TestStartup() { club = new ClubModel("Testklubb"); club.Save(); }
public void When_Fetching_A_Club_That_Exists_In_The_Db_We_Should_Get_That_Club() { When_Fetching_A_Club_That_Does_Not_Exists_In_The_Db_We_Should_Create_That_Club(); club = null; int previousCount = 0; Given("we want to fetch a spesific club called Byåsen"); When("we fetch an existing club Byåsen", () => { previousCount = ClubModel.GetAll().Count; club = ClubModel.GetOrCreate(CLUB_BYAASEN); }); Then("we shold get a club and no new DB rows should have been added", () => { club.Name.ShouldBe(CLUB_BYAASEN); ClubModel.GetAll().Count.ShouldBe(previousCount); }); }
/// <summary> /// Creates the specified TXT first name. /// </summary> /// <param name="txtFirstName">First name.</param> /// <param name="txtLastName">Last name.</param> /// <param name="txtEmail">The email.</param> /// <param name="txtPostalAddress">Postal address.</param> /// <param name="txtPostalCode">The postal code.</param> /// <param name="txtCity">The city.</param> /// <param name="txtPhoneNumber">The phone number.</param> /// <param name="genderId">The gender id.</param> /// <param name="birthdateId">The birthdate id.</param> /// <param name="txtStartNumber">The start number.</param> /// <param name="clubId">The club id.</param> /// <param name="classId">The class id.</param> /// <returns></returns> public ActionResult Create(string txtFirstName, string txtLastName, string txtEmail, string txtPostalAddress, string txtPostalCode, string txtCity, string txtPhoneNumber, string genderId, string birthdateId, string txtStartNumber, string clubId, string classId) { int startnum = 0; int.TryParse(txtStartNumber, out startnum); if (!IsValidInput(txtFirstName,txtLastName,txtEmail,txtStartNumber,clubId) || AthleteModel.StartnumberExistsInDb(startnum)) { ViewBag.IsValidInput = false; ViewBag.IsAthleteCreated = false; setViewData(); return View("Index", ClubModel.GetAll()); } else { int birthdate = 0; int gender = 0, athleteclubid = 0, athleteclassid = 0; int.TryParse(genderId, out gender); int.TryParse(birthdateId, out birthdate); int.TryParse(clubId, out athleteclubid); int.TryParse(classId, out athleteclassid); Gender getGender = getGenderNameById(gender); string gendername = ""; if (getGender != null) { gendername = getGender.Name; } BirthDate getBirthday = getBirthDateById(birthdate); int birthyear = 0; if (getBirthday != null) { birthyear = getBirthday.BirthYear; } ClubModel athclubobj = null; if (athleteclubid != 0) { athclubobj = new ClubModel(athleteclubid); } AthleteClassModel athclassobj = null; if (athleteclassid != 0) { athclassobj = new AthleteClassModel(athleteclassid); } AthleteModel athlete = new AthleteModel(txtFirstName, txtLastName, txtEmail, txtPostalAddress, txtPostalCode, txtCity, gendername, birthyear, txtPhoneNumber, startnum, athclubobj, athclassobj); athlete.SaveToDb(); return RedirectToAction("ResetFormField"); } }