Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                sponsorUsed = new Sponsor();
                oldSponsorUsed = new Sponsor();
                using (var db = new ClubSiteContext())
                {
                    sponsorUsed = (from sponsors in db.Sponsors
                                   orderby sponsors.Nombre
                                   select sponsors).FirstOrDefault();

                    if (sponsorUsed == null)
                    {
                        sponsorUsed = new Sponsor();
                        Response.Write("<script>alert('No hay ningĂșn Sponsor registrado en la Base de datos.')</script>");
                    }
                    oldSponsorUsed.CopySponsor(sponsorUsed);
                    LoadSponsorInForm(sponsorUsed);
                }
            }
        }
Example #2
0
        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);
        }