public void TestPersonConstructorWithData() { string aFirstName = "FirstName"; string aSecondName = "SeconName"; string aStreet = "Street"; string aNumber = "Number"; string aCity = "City"; string aCountry = "Country"; string aPostalCode = "PostalCode"; string aTlf = "TLF"; string aMobile = "Mobile"; string anEMail = "eMail"; Address anAddress = new Address(aStreet, aNumber, aCity, aCountry, aPostalCode); Person aPerson = new Person(aFirstName,aSecondName,anAddress,aTlf,aMobile,anEMail); Assert.AreEqual(aFirstName, aPerson.FirstName); Assert.AreEqual(aSecondName, aPerson.SecondName); Assert.AreEqual(aStreet, aPerson.Address.Street); Assert.AreEqual(aNumber, aPerson.Address.Number); Assert.AreEqual(aCity, aPerson.Address.City); Assert.AreEqual(aCountry, aPerson.Address.Country); Assert.AreEqual(aPostalCode, aPerson.Address.PostalCode); Assert.AreEqual(aTlf, aPerson.Tlf); Assert.AreEqual(aMobile, aPerson.Mobile); Assert.AreEqual(anEMail, aPerson.EMail); }
public Person(string aFirstName, string aSecondName, Address anAddress, string aTlf, string aMobile, string anEMail) { this.FirstName = aFirstName; this.SecondName = aSecondName; this.Address = anAddress; this.Tlf = aTlf; this.Mobile = aMobile; this.EMail = anEMail; }
public void TestAddressConstructorWitData() { string aStreet = "Street"; string aNumber = "1a"; string aCity = "City"; string aCountry = "Country"; string aPostalCode = "18007"; Address anAddress = new Address(aStreet, aNumber, aCity, aCountry, aPostalCode); Assert.AreEqual(aStreet, anAddress.Street); Assert.AreEqual(aNumber, anAddress.Number); Assert.AreEqual(aCity, anAddress.City); Assert.AreEqual(aCountry, anAddress.Country); Assert.AreEqual(aPostalCode, anAddress.PostalCode); }
public void TestAddresConstructorWithoutData() { string aStreet = null; string aNumber = null; string aCity = null; string aCountry = null; string aPostalCode = null; Address anAddress = new Address(); Assert.AreEqual(aStreet, anAddress.Street); Assert.AreEqual(aNumber, anAddress.Number); Assert.AreEqual(aCity, anAddress.City); Assert.AreEqual(aCountry, anAddress.Country); Assert.AreEqual(aPostalCode, anAddress.PostalCode); }
public void ClearRace() { Int32 anID = 10; string aName = "Ejemplo de carrera"; DateTime aRaceDate = DateTime.Now; string aStreet = "Street"; string aNumber = "1a"; string aCity = "City"; string aCountry = "Country"; string aPostalCode = "18007"; Address anAddress = new Address(aStreet, aNumber, aCity, aCountry, aPostalCode); Int32 aRaceTypeId = 20; string aMemo = "memo"; double aLatitud = 3; double aLongitud = 36; string aImgURL = "imagen url"; int aPartMasc = 1000; int aPartFem = 100; Race aRace = new Race(anID, aName, aRaceDate, anAddress, aRaceTypeId, aMemo, aImgURL, aLongitud, aLatitud, aPartMasc, aPartFem); aRace.ClearRace(); anID = 0; aName = null; aRaceDate = DateTime.Now; anAddress = null; aRaceTypeId = 0; aMemo = null; aLatitud = 0; aLongitud = 0; aImgURL = null; aPartMasc = 0; aPartFem = 0; Assert.AreEqual(anID, aRace.Id); Assert.AreEqual(aName, aRace.Name); Assert.AreEqual(aRaceDate.ToShortDateString(), aRace.RaceDate.ToShortDateString()); Assert.AreEqual(null, aRace.Address); Assert.AreEqual(aRaceTypeId, aRace.RaceTypeID); Assert.AreEqual(aMemo, aRace.Memo); Assert.AreEqual(aImgURL, aRace.ImageURL); Assert.AreEqual(aLatitud, aRace.Latitud); Assert.AreEqual(aLongitud, aRace.Longitud); Assert.AreEqual(aPartFem, aRace.PartFem); Assert.AreEqual(aPartMasc, aRace.PartMasc); }
public void TestClearAddress() { string aStreet = "Street"; string aNumber = "1a"; string aCity = "City"; string aCountry = "Country"; string aPostalCode = "18007"; Address anAddress = new Address(); anAddress.SetAddress(aStreet, aNumber, aCity, aCountry, aPostalCode); anAddress.ClearAddress(); Assert.AreEqual(null, anAddress.Street); Assert.AreEqual(null, anAddress.Number); Assert.AreEqual(null, anAddress.City); Assert.AreEqual(null, anAddress.Country); Assert.AreEqual(null, anAddress.PostalCode); }
public Member(string anUserName, string aNumber, string aFirstName, string aSecondName, string aDNI, Address anAddress, string aTlf, string aMobile, string anEMail, bool aState, bool federated, bool visible, DateTime? aBirthDate, string aMemo, string anImageURL, string aNImageURL, string aBlogURL) { this.UserName = anUserName; this.Number = aNumber; this.FirstName = aFirstName; this.SecondName = aSecondName; this.DNI = aDNI; this.Address = anAddress; this.Tlf = aTlf; this.Mobile = aMobile; this.EMail = anEMail; this.State = aState; this.Federated = federated; this.Visible = visible; this.RegDate = DateTime.Now; this.BirthDate = aBirthDate; this.Memo = aMemo; this.ImageURL = anImageURL; this.NImageURL = aNImageURL; this.BlogURL = aBlogURL; }
public Sponsor(int aSponsorId, string aNombre, Address anAddress, string aContactPerson, string aMobile, string aTlf, DateTime aRegDate, string aCondOfertadas, decimal anAportInicial, decimal anAportRecibida, string aWebURL, string anEMail, string aLogoURL, string anImageURL, double aLongitud, double aLatitud, bool activo, string aMemo) { this.SponsorId = aSponsorId; this.Nombre = aNombre; this.Address = anAddress; this.ContactPerson= aContactPerson; this.Mobile = aMobile; this.Tlf = aTlf; this.RegDate = aRegDate; this.CondOfertadas = aCondOfertadas; this.AportInicial = anAportInicial; this.AportRecibida = anAportRecibida; this.WebURL = aWebURL; this.EMail = anEMail; this.LogoURL = aLogoURL; this.ImageURL = anImageURL; this.Longitud = aLongitud; this.Latitud = aLatitud; this.Activo = activo; this.Memo = aMemo; }
public void addMemberToRaceMembersList() { //Create a few Races Address anAdress = new Address(); var aListOfRaces = new List<Race> { new Race { Id=1, Name="Media Maratón de Almería", Address =anAdress, RaceDate=Convert.ToDateTime("12/02/2014 00:00:00"), RaceTypeID=12 }, new Race { Id=2, Name="Triatlón de Elche Arenales", Address =anAdress, RaceDate=Convert.ToDateTime("20/04/2014 00:00:00"), RaceTypeID=4 }, new Race { Id=3, Name="Triatlón Cross Tarifa XChallenge", Address =anAdress, RaceDate=Convert.ToDateTime("12/06/2014 00:00:00"), RaceTypeID=3 }, new Race { Id=4, Name="Ironman Lanzarote", Address =anAdress, RaceDate=Convert.ToDateTime("12/05/2014 00:00:00"), RaceTypeID=5 } }; //Create a few Members var aListOfMembers = new List<Member> { new Member { UserName="******", FirstName="Pepe", SecondName="López", Address=anAdress }, new Member { UserName="******", FirstName="Pepe", SecondName="López", Address=anAdress }, new Member { UserName="******", FirstName="Pepe", SecondName="López", Address=anAdress }, new Member { UserName="******", FirstName="Pepe", SecondName="López", Address=anAdress }, }; //Add Member to race aListOfRaces[0].AddMemberToRace(aListOfMembers[0]); //Verify if aMember is in Members for Race Assert.AreEqual(aListOfRaces[0].Members.Contains(aListOfMembers[0]), true); }
public void DoSave() { bool sigue = true; string messageError = null; //Save if conditions are ok. if (sigue) { using (var db = new ClubSiteContext()) { Race aRace; if (rUsed.Id == 0) { //New Race aRace = new Race(); aRace.Name = txbxName.Text; aRace.Name = txbxName.Text; aRace.RaceDate = Convert.ToDateTime(txbxDate.Text); aRace.ImageURL = rUsed.ImageURL; aRace.RaceTypeID = aRaceIdSelectedInCombo; try { aRace.PartFem = Convert.ToInt16(txbxPartGenFem.Text); } catch (Exception) { aRace.PartFem = 0; } try { aRace.PartMasc = Convert.ToInt16(txbxPartGenMasc.Text); } catch (Exception) { aRace.PartMasc = 0; } Address anAddres = new Address(txbxStreet.Text, txbxNumber.Text, txbxCity.Text, txbxCountry.Text, txbxPostalCode.Text); aRace.Address = anAddres; aRace.Memo = txbxMemo.Text; string aux = ReformatNumber(txbxLatitud.Text); if (aux == null) aRace.Latitud = 0; else { aRace.Latitud = Convert.ToDouble(aux); } aux = ReformatNumber(txbxLongitud.Text); if (aux == null) aRace.Longitud = 0; else { aRace.Longitud = Convert.ToDouble(aux); } db.Races.Add(aRace); messageError = "Nueva competición grabada"; } else { //Update actual Race aRace = (from races in db.Races where races.Id == rUsed.Id select races).FirstOrDefault(); if (aRace == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Competición con Id : {0} no encontrada", rUsed.Id)); X.Msg.Alert("Atención", "Competición no encontrada. Grabación de datos cancelada.").Show(); return; } aRace.Name = txbxName.Text; aRace.RaceDate = Convert.ToDateTime(txbxDate.Text); aRace.ImageURL = rUsed.ImageURL; aRace.RaceTypeID = aRaceIdSelectedInCombo; Address anAddres = new Address(txbxStreet.Text, txbxNumber.Text, txbxCity.Text, txbxCountry.Text, txbxPostalCode.Text); aRace.Address = anAddres; aRace.Memo = txbxMemo.Text; string aux = ReformatNumber(txbxLatitud.Text); if (aux == null) aRace.Latitud = 0; else { aRace.Latitud = Convert.ToDouble(aux); } aux = ReformatNumber(txbxLongitud.Text); if (aux == null) aRace.Longitud = 0; else { aRace.Longitud = Convert.ToDouble(aux); } messageError = "Datos de competición actualizados"; } db.SaveChanges(); LoadRaceInForm(aRace); //To update the ID (identity file) rUsed.CopyRace(aRace); oldRUsed.CopyRace(rUsed); StoreGPRaces.DataBind(); X.Msg.Alert("Atención", messageError).Show(); } btnBorrar.Enabled = true; } else { X.Msg.Alert("Atención", messageError).Show(); } }
protected void RegisterUser_CreatedUser(object sender, EventArgs e) { //save aditional DataBind of user using (var bd = new ClubSiteContext()) { try { string aUserName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).Text; string aFirstName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxName")).Text; string aSecondName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxSecondName")).Text; string aBlogURL = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxBlog")).Text; string aMemo = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxMemo")).Text; string aDNI = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxDNI")).Text; DateTime? aBirthDate = null; try { aBirthDate = Convert.ToDateTime(((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxBdate")).Text); } catch { aBirthDate = null; } DateTime aRegDate = DateTime.Now; bool aState = false; bool visible = false; bool federated = ((CheckBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("chbxFederated")).Checked; string aNImageURL = ((Image)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("imgNImageURL")).ImageUrl; string anImageURL = ((Image)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("imgImageURL")).ImageUrl; string aTlf = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxTlf")).Text; string aMobile = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxMobile")).Text; string anEMail = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Email")).Text; string aClubNumber = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxClubNumber")).Text; string aStreet = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxStreet")).Text; string aNumber = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxNumber")).Text; string aCity = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxCity")).Text; string aCountry = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxCountry")).Text; string aPostalCode = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txbxPostalCode")).Text; Address anAddress = new Address(aStreet, aNumber, aCity, aCountry, aPostalCode); Member aMember = new Member(aUserName, aClubNumber, aFirstName, aSecondName, aDNI, anAddress, aTlf, aMobile, anEMail, aState, federated, visible, aBirthDate, aMemo, anImageURL, aNImageURL, aBlogURL); bd.Members.Add(aMember); bd.SaveChanges(); } catch (Exception) { throw; } } FormsAuthentication.SetAuthCookie(RegisterUser.UserName, createPersistentCookie: false); string continueUrl = RegisterUser.ContinueDestinationPageUrl; if (!OpenAuth.IsLocalUrl(continueUrl)) { continueUrl = "~/"; } Response.Redirect(continueUrl); }
public Sponsor() { Address anAddress = new Address(); this.RegDate = DateTime.Now; this.Address = anAddress; }
public void TestCopySponsor() { int aSponsorId = 10; string aNombre = "Name"; string aContactPerson = "Contact person"; string aMobile = "999 929292"; string aTlf = "555 676767"; DateTime aRegDate = DateTime.Now; string aCondOfertadas = "Condiciones ofertadas"; decimal anAportInicial = 400; decimal anAportRecibida = 200; string aWebURL = "www.weburl.com"; string anEMail = "*****@*****.**"; string aLogoURL = "a logo URL"; string anImageURL = " An image URL"; bool activo = false; double aLatitud = 40.381090863719436; double aLongitud = -3.6222052574157715; string aMemo = "Observaciones varias"; string aStreet = "Street"; string aNumber = "1a"; string aCity = "City"; string aCountry = "Country"; string aPostalCode = "18007"; Address anAddress = new Address(aStreet, aNumber, aCity, aCountry, aPostalCode); Sponsor aSponsor1 = new Sponsor(); aSponsor1.SetSponsor(aSponsorId, aNombre, anAddress, aContactPerson, aMobile, aTlf, aRegDate, aCondOfertadas, anAportInicial, anAportRecibida, aWebURL, anEMail, aLogoURL, anImageURL, aLongitud, aLatitud, activo, aMemo); Assert.AreEqual(aSponsorId, aSponsor1.SponsorId); Assert.AreEqual(aNombre, aSponsor1.Nombre); Assert.AreEqual(aContactPerson, aSponsor1.ContactPerson); Assert.AreEqual(aMobile, aSponsor1.Mobile); Assert.AreEqual(aTlf, aSponsor1.Tlf); Assert.AreEqual(aRegDate.ToShortDateString(), aSponsor1.RegDate.ToShortDateString()); Assert.AreEqual(aCondOfertadas, aSponsor1.CondOfertadas); Assert.AreEqual(anAportInicial, aSponsor1.AportInicial); Assert.AreEqual(anAportRecibida, aSponsor1.AportRecibida); Assert.AreEqual(aWebURL, aSponsor1.WebURL); Assert.AreEqual(anEMail, aSponsor1.EMail); Assert.AreEqual(aLogoURL, aSponsor1.LogoURL); Assert.AreEqual(anImageURL, aSponsor1.ImageURL); Assert.AreEqual(activo, aSponsor1.Activo); Assert.AreEqual(aLatitud, aSponsor1.Latitud); Assert.AreEqual(aLongitud, aSponsor1.Longitud); Assert.AreEqual(aMemo, aSponsor1.Memo); Assert.AreEqual(aStreet, aSponsor1.Address.Street); Assert.AreEqual(aNumber, aSponsor1.Address.Number); Assert.AreEqual(aCity, aSponsor1.Address.City); Assert.AreEqual(aCountry, aSponsor1.Address.Country); Assert.AreEqual(aPostalCode, aSponsor1.Address.PostalCode); Sponsor aSponsor2 = new Sponsor(); aSponsor2.CopySponsor(aSponsor1); Assert.AreEqual(aSponsorId, aSponsor2.SponsorId); Assert.AreEqual(aNombre, aSponsor2.Nombre); Assert.AreEqual(aContactPerson, aSponsor2.ContactPerson); Assert.AreEqual(aMobile, aSponsor2.Mobile); Assert.AreEqual(aTlf, aSponsor2.Tlf); Assert.AreEqual(aMobile, aSponsor2.Mobile); Assert.AreEqual(aTlf, aSponsor2.Tlf); Assert.AreEqual(aRegDate.ToShortDateString(), aSponsor2.RegDate.ToShortDateString()); Assert.AreEqual(aCondOfertadas, aSponsor2.CondOfertadas); Assert.AreEqual(anAportInicial, aSponsor2.AportInicial); Assert.AreEqual(anAportRecibida, aSponsor2.AportRecibida); Assert.AreEqual(aWebURL, aSponsor2.WebURL); Assert.AreEqual(anEMail, aSponsor2.EMail); Assert.AreEqual(aLogoURL, aSponsor2.LogoURL); Assert.AreEqual(anImageURL, aSponsor2.ImageURL); Assert.AreEqual(activo, aSponsor2.Activo); Assert.AreEqual(aLatitud, aSponsor2.Latitud); Assert.AreEqual(aLongitud, aSponsor2.Longitud); Assert.AreEqual(aMemo, aSponsor2.Memo); Assert.AreEqual(aStreet, aSponsor2.Address.Street); Assert.AreEqual(aNumber, aSponsor2.Address.Number); Assert.AreEqual(aCity, aSponsor2.Address.City); Assert.AreEqual(aCountry, aSponsor2.Address.Country); Assert.AreEqual(aPostalCode, aSponsor2.Address.PostalCode); }
public void loadRaceData() { Address anAdress = new Address(); var aListOfRaces = new List<Race> { new Race { Id=1, Name="Media Maratón de Almería", Address =anAdress, RaceDate=Convert.ToDateTime("12/02/2014 00:00:00"), RaceTypeID=12, PartMasc=1000, PartFem=100 }, new Race { Id=2, Name="Triatlón de Elche Arenales", Address =anAdress, RaceDate=Convert.ToDateTime("20/04/2014 00:00:00"), RaceTypeID=4 }, new Race { Id=3, Name="Triatlón Cross Tarifa XChallenge", Address =anAdress, RaceDate=Convert.ToDateTime("12/06/2014 00:00:00"), RaceTypeID=3 }, new Race { Id=4, Name="Ironman Lanzarote", Address =anAdress, RaceDate=Convert.ToDateTime("12/05/2014 00:00:00"), RaceTypeID=5 } }; Assert.AreEqual(1, aListOfRaces[0].Id); Assert.AreEqual("12/02/2014 0:00:00", aListOfRaces[0].RaceDate.ToString()); Assert.AreEqual(12, aListOfRaces[0].RaceTypeID); }
public void TestMemberConstructorWithData() { string aUserName = "******"; string aDNI = "DNI Number"; bool aState = false; bool federated = false; bool visible = false; DateTime aRegDate = DateTime.Now; DateTime? aBirthdate = Convert.ToDateTime("12/12/2012"); string aMemo = "A Memo"; string anImageURL = "Image URL"; string aNImageURL = "Image URL"; string aBlogURL = "A Blog URL"; string aFirstName = "First name"; string aSecondName = "Second name"; string aTlf = "tlf Numbre"; string aMobile = "Mobile number"; string anEMail = "Email"; string aStreet = "Street"; string aNumber = "1a"; string aCity = "City"; string aCountry = "Country"; string aPostalCode = "18007"; string aClubNumber = "14"; Address anAddress = new Address(aStreet, aNumber, aCity, aCountry, aPostalCode); Member aMember = new Member(aUserName, aClubNumber, aFirstName, aSecondName, aDNI, anAddress, aTlf, aMobile, anEMail, aState, federated, visible, aBirthdate, aMemo, anImageURL, aNImageURL, aBlogURL); Assert.AreEqual(aUserName, aMember.UserName); Assert.AreEqual(aDNI, aMember.DNI); Assert.AreEqual(aState, aMember.State); Assert.AreEqual(federated, aMember.Federated); Assert.AreEqual(visible, aMember.Visible); Assert.AreEqual(aRegDate.ToShortDateString(), aMember.RegDate.ToShortDateString()); Assert.AreEqual(aBirthdate, aMember.BirthDate); Assert.AreEqual(aMemo, aMember.Memo); Assert.AreEqual(anImageURL, aMember.ImageURL); Assert.AreEqual(aNImageURL, aMember.NImageURL); Assert.AreEqual(aBlogURL, aMember.BlogURL); Assert.AreEqual(aFirstName, aMember.FirstName); Assert.AreEqual(aSecondName, aMember.SecondName); Assert.AreEqual(aStreet, aMember.Address.Street); Assert.AreEqual(aNumber, aMember.Address.Number); Assert.AreEqual(aCity, aMember.Address.City); Assert.AreEqual(aCountry, aMember.Address.Country); Assert.AreEqual(aPostalCode, aMember.Address.PostalCode); Assert.AreEqual(aTlf, aMember.Tlf); Assert.AreEqual(aMobile, aMember.Mobile); Assert.AreEqual(anEMail, aMember.EMail); Assert.AreEqual(aClubNumber, aMember.Number); }