Ejemplo n.º 1
0
        public Sponsorship ReverseMap()
        {
            var sponsorship = new Sponsorship
            {
                Name                  = this.Name,
                EducationLevel        = this.EducationLevel,
                StartingDate          = this.StartingDate,
                ClosingDate           = this.ClosingDate,
                SponsorshipValue      = this.SponsorshipValue,
                AverageMarkRequired   = this.AverageMarkRequired,
                Description           = this.Description,
                EssayRequired         = this.EssayRequired,
                ExpensesCovered       = this.ExpensesCovered,
                InstitutionPreference = this.InstitutionPreference,
                GenderPreference      = this.GenderPreference,
                RacePreference        = this.RacePreference,
                DisabilityPreference  = this.DisabilityPreference,
                Province              = this.Province,
                SponsorId             = this.SponsorId,
                SponsorshipType       = this.SponsorshipType,
                StudyFields           = this.StudyFields,
                TermsAndConditions    = this.TermsAndConditions,
                NumberOfViews         = this.NumberOfViews,
                AgeGroup              = this.AgeGroup,
                Rating                = this.Rating
            };

            return(sponsorship);
        }
Ejemplo n.º 2
0
 public void AddSponsorship(Sponsorship sponsorship)
 {
     using (IUnitOfWork uow = unitOfWorkFactory.CreateUnitOfWork())
     {
         AddSponsorship(sponsorship.ID, sponsorship.SponsorId, sponsorship.Name, sponsorship.Description, sponsorship.ClosingDate, sponsorship.EssayRequired, sponsorship.SponsorshipValue, sponsorship.StudyFields, sponsorship.Province, sponsorship.AverageMarkRequired, sponsorship.EducationLevel, sponsorship.InstitutionPreference, sponsorship.ExpensesCovered, sponsorship.TermsAndConditions);
         uow.Commit();
     }
 }
Ejemplo n.º 3
0
        protected void AddSponsorshipRestrictionsForThisTest(Sponsorship sponsorship)
        {
            using var scope = RepositoryFactory.BeginRepositoryScope();
            var repo = scope.CreateRepository <ISponsorshipRepository>();

            repo.Add(sponsorship);
            repo.SaveChanges();
        }
Ejemplo n.º 4
0
        public void Add(Sponsorship item)
        {
            var items = new List <Sponsorship>()
            {
                item
            };

            InsertItems(_folder, _type, items, items.ConvertAll(i => i.ExternalReferenceId));
        }
Ejemplo n.º 5
0
        protected Sponsorship GetTestCaseSponsorshipObject(
            string calculationType,
            string restrictionLevel,
            string sponsoredItemRestrictionType,
            string sponsoredItemRestrictionValue,
            string applicability,
            string programmeName,
            string clashExternalRef,
            string clashRestrictionType,
            string clashRestrictionValue,
            string advertiserIdentifier,
            string advertiserRestrictionType,
            string advertiserRestrictionValue,
            string salesArea,
            string startDate,
            string endDate,
            string startTime,
            string endTime,
            string daysOfWeek,
            string sponsoredProduct
            )
        {
            Sponsorship result = GetTestCaseSponsorshipObject(
                calculationType,
                restrictionLevel,
                applicability,
                programmeName,
                clashExternalRef,
                advertiserIdentifier,
                salesArea,
                startDate,
                endDate,
                startTime,
                endTime,
                daysOfWeek,
                sponsoredProduct);

            SponsoredItem sponsoredItem = result.SponsoredItems[0];

            sponsoredItem.RestrictionType  = GetRestrictionType(sponsoredItemRestrictionType);
            sponsoredItem.RestrictionValue = GetRestrictionValue(sponsoredItemRestrictionValue);

            if (sponsoredItem.ClashExclusivities != null)
            {
                sponsoredItem.ClashExclusivities[0].RestrictionType  = GetRestrictionType(clashRestrictionType);
                sponsoredItem.ClashExclusivities[0].RestrictionValue = GetRestrictionValue(clashRestrictionValue);
            }

            if (sponsoredItem.AdvertiserExclusivities != null)
            {
                sponsoredItem.AdvertiserExclusivities[0].RestrictionType  = GetRestrictionType(advertiserRestrictionType);
                sponsoredItem.AdvertiserExclusivities[0].RestrictionValue = GetRestrictionValue(advertiserRestrictionValue);
            }

            return(result);
        }
Ejemplo n.º 6
0
        public void addNew(int registerID, string Sname, decimal Amounts)
        {
            Sponsorship sp = new Sponsorship();

            sp.RegistrationId = registerID;
            sp.Amount         = Amounts;
            sp.SponsorName    = Sname;
            db.Sponsorships.InsertOnSubmit(sp);
            db.SubmitChanges();
        }
Ejemplo n.º 7
0
        public void Add(Sponsorship sponsorship)
        {
            var entity =
                _mapper.Map <SponsorshipEntity>(sponsorship, opts => opts.UseEntityCache(_salesAreaByNameCache));

            _ = _dbContext.Add(entity,
                               post =>
                               post.MapTo(sponsorship,
                                          opts => opts.UseEntityCache(_salesAreaByIdCache)), _mapper);
        }
        public async Task <IActionResult> Create([Bind("Id,Name,ConferenceVersionId,SponsorId")] Sponsorship sponsorship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sponsorship);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "ConferenceVersion", new { id = sponsorship.ConferenceVersionId.ToString() }));;
            }
            return(View(sponsorship));
        }
Ejemplo n.º 9
0
        public IActionResult Create([FromBody] Sponsorship item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            _context.SponsorshipItems.Add(item);
            _context.SaveChanges();

            return(CreatedAtRoute("GetSponsorship", new { id = item.Id }, item));
        }
Ejemplo n.º 10
0
        public void SponsorshipRestrictions_ForGivenSponsorshipReturnsNothingButDoesNotEffectSponsorshipItems()
        {
            // Arrange
            var sponsorship = new Sponsorship()
            {
                RestrictionLevel = SponsorshipRestrictionLevel.Programme,
                SponsoredItems   = new List <SponsoredItem>()
                {
                    new SponsoredItem()
                    {
                        SponsorshipItems = new List <SponsorshipItem>()
                        {
                            new SponsorshipItem()
                            {
                                SalesAreas = new List <string> {
                                    "FindThisSalesArea"
                                },
                                ProgrammeName = "Don't find this programme"
                            },
                            new SponsorshipItem()
                            {
                                SalesAreas = new List <string> {
                                    "Don't find this sales area"
                                },
                                ProgrammeName = "Pokémon"
                            }
                        }
                    }
                }
            };

            var listToFilter = new List <Sponsorship>
            {
                sponsorship
            };

            var filter = new SponsorshipRestrictionFilterService(listToFilter.ToImmutableList());

            Programme programme = CreateProgramme();

            // Act
            var result = filter.Filter(programme);

            // Assert
            _ = result.Should().BeEmpty(becauseArgs: null);
            _ = listToFilter.Should().ContainSingle(becauseArgs: null);
            _ = listToFilter[0].SponsoredItems.Should().ContainSingle(becauseArgs: null);
            _ = listToFilter[0].SponsoredItems[0].SponsorshipItems.Should().HaveCount(2, becauseArgs: null);
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(await OnGetAsync());
            }

            var company = await _context.Companies.FindAsync(CompanyId);

            if (company == null)
            {
                return(BadRequest());
            }

            var project = await _context.Projects.FindAsync(ProjectId);

            if (project == null)
            {
                return(BadRequest());
            }

            AppUser volunteer = null;

            if (!string.IsNullOrEmpty(VolunteerId))
            {
                volunteer = await _context.Users.FindAsync(VolunteerId);

                if (volunteer == null)
                {
                    return(BadRequest());
                }
            }

            var sponsorship = new Sponsorship
            {
                Id          = Id ?? 0,
                Company     = company,
                Project     = project,
                SigningDate = SigningDate,
                Volunteer   = volunteer,
            };

            _context.Update(sponsorship);
            await _context.SaveChangesAsync();

            return(RedirectToPagePermanent("Index"));
        }
Ejemplo n.º 12
0
        CreateAfterMidnightSponsorshipForDurationsWithProgrammeRestrictionLevel(
            TimeSpan dayPartStartTime,
            TimeSpan dayPartEndTime)
        {
            var sponsorshipRestrictions = new Sponsorship
            {
                RestrictionLevel = SponsorshipRestrictionLevel.TimeBand
            };

            IEnumerable <SponsoredDayPart> dayPart = new List <SponsoredDayPart>()
            {
                new SponsoredDayPart()
                {
                    DaysOfWeek = new string[] { "Tue" },
                    StartTime  = dayPartStartTime,
                    EndTime    = dayPartEndTime
                },
            };

            _fixture.Customize <SponsorshipItem>(
                obj => obj
                .With(p => p.SalesAreas, new List <string> {
                "FindThisSalesArea"
            })
                .With(p => p.ProgrammeName, "Transformers: Dark of the Moon")
                .With(p => p.StartDate, new DateTime(2020, 4, 21))
                .With(p => p.EndDate, new DateTime(2020, 4, 21))
                .With(p => p.DayParts, dayPart)
                );

            sponsorshipRestrictions.SponsoredItems = new List <SponsoredItem>()
            {
                new SponsoredItem()
                {
                    SponsorshipItems = new List <SponsorshipItem>()
                    {
                        _fixture.Create <SponsorshipItem>()
                    }
                }
            };

            return(new List <Sponsorship>()
            {
                sponsorshipRestrictions
            }.ToImmutableList());
        }
Ejemplo n.º 13
0
        public void Update(Sponsorship sponsorship)
        {
            var entity = SponsorshipQuery()
                         .FirstOrDefault(x => x.Id == sponsorship.Id);

            if (entity != null)
            {
                _ = _mapper.Map(sponsorship,
                                entity,
                                opts => opts.UseEntityCache(_salesAreaByNameCache));

                _ = _dbContext.Update(entity,
                                      post =>
                                      post.MapTo(sponsorship,
                                                 opts => opts.UseEntityCache(_salesAreaByIdCache)), _mapper);
            }
        }
Ejemplo n.º 14
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!parent.ValidationNotNull(this))
            {
                MessageBox.Show("All data must be filled");
                return;
            }
            if (txtCreditCard.Text.Length < 16)
            {
                MessageBox.Show("Credit card has to be 16 digits");
                return;
            }
            int year  = int.Parse(txtYear.Text);
            int month = int.Parse(txtMonth.Text);

            if (year == DateTime.Now.Year)
            {
                if (month <= DateTime.Now.Month)
                {
                    MessageBox.Show("Expiry date must be a valid month and year that is after today’s date.");
                    return;
                }
            }
            else if (year < DateTime.Now.Year)
            {
                MessageBox.Show("Expiry date must be a valid month and year that is after today’s date.");
                return;
            }
            if (txtCVC.Text.Length != 3)
            {
                MessageBox.Show("CVC is a security code that has to be 3 digits.");
                return;
            }

            Sponsorship s = new Sponsorship();

            s.SponsorName    = txtName.Text;
            s.RegistrationId = int.Parse(comboBox2.SelectedValue.ToString());
            s.Amount         = int.Parse(textBox6.Text);
            db.Sponsorships.InsertOnSubmit(s);
            db.SubmitChanges();

            core.sponsorshipid = s.SponsorshipId.ToString();

            parent.LoadForm("SPONSORSHIPCONFIRMATION");
        }
Ejemplo n.º 15
0
        public async Task <Sponsorship> AddSponsorship(Sponsorship sponsorship)
        {
            var invoicesDates = GenerateDates(sponsorship.StartDate, sponsorship.EndDate, sponsorship.PaymentFrequency);

            foreach (var date in invoicesDates)
            {
                sponsorship.Invoices.Add(new Invoice
                {
                    IssueDate   = date,
                    DueDate     = date.AddDays(1),
                    TotalAmount = sponsorship.Amount
                });
            }
            _db.Attach(sponsorship.Orphan);
            _db.Attach(sponsorship.Sponsor);
            _db.Sponsorships.Add(sponsorship);
            await _db.SaveChangesAsync();

            return(sponsorship);
        }
Ejemplo n.º 16
0
        public IHttpActionResult Put([FromBody] UpdateSponsorshipModel updateSponsorshipModel)
        {
            if (updateSponsorshipModel == null || !ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!_updateSponsorshipValidator.IsValid(updateSponsorshipModel))
            {
                return(_updateSponsorshipValidator.BadRequest());
            }

            Sponsorship existingsponsorshipitem = _sponsorshipRepository.Get(updateSponsorshipModel.ExternalReferenceId);

            if (existingsponsorshipitem == null)
            {
                return(NotFound());
            }

            UpdateSingleSponsorship(updateSponsorshipModel, existingsponsorshipitem);

            return(Ok());
        }
Ejemplo n.º 17
0
        private void UpdateSingleSponsorship(CreateSponsorshipModel modifiedsponsorshipitem, Sponsorship existingsponsorshipitem)
        {
            existingsponsorshipitem.DateModified     = DateTime.UtcNow;
            existingsponsorshipitem.RestrictionLevel = modifiedsponsorshipitem.RestrictionLevel;

            existingsponsorshipitem.SponsoredItems.Clear();

            foreach (CreateSponsoredItemModel item in modifiedsponsorshipitem.SponsoredItems)
            {
                existingsponsorshipitem.SponsoredItems.Add(_mapper.Map <SponsoredItem>(item));
            }

            _sponsorshipRepository.Update(existingsponsorshipitem);

            _sponsorshipRepository.SaveChanges();
        }
Ejemplo n.º 18
0
        /// Initializes the database with mock data.
        public void Seed()
        {
            var volunteers = _context.Users.ToList();

            var companies = new Company[]
            {
                new Company {
                    Name = "Autodesk", Site = "https://www.autodesk.eu/"
                },
                new Company {
                    Name = "Mindit", Site = "https://www.mindit.io/"
                },
                new Company {
                    Name = "Softbinator", Site = "https://www.softbinator.com/"
                },
                new Company {
                    Name = "Fitbit", Site = "https://www.fitbit.com/global/eu/home"
                },
                new Company {
                    Name = "Luxoft", Site = "https://www.luxoft.com/"
                },
                new Company {
                    Name = "Ubisoft", Site = "https://www.ubisoft.com/en-us/"
                },
                new Company
                {
                    Name = "Accenture",
                    Site = "https://www.accenture.com/ro-en",
                    Logo = LoadLogo("accenture.png")
                },
                new Company {
                    Name = "Adobe", Site = "https://www.adobe.com/ro/"
                },
                new Company
                {
                    Name = "Microsoft",
                    Site = "https://www.microsoft.com/ro-ro",
                    Logo = LoadLogo("microsoft.png")
                },
            };

            companies[0].Contacts = new List <Contact>
            {
                new Contact
                {
                    Name  = "Ion Popescu",
                    Email = "*****@*****.**"
                },
                new Contact
                {
                    Name      = "Ioana Exemplu",
                    Email     = "*****@*****.**",
                    Telephone = "0123456780"
                }
            };
            companies[1].Contacts = new List <Contact>
            {
                new Contact
                {
                    Name      = "Test Xulescu",
                    Telephone = "0700111222"
                }
            };

            _context.Companies.AddRange(companies);

            var projects = new Project[]
            {
                new Project {
                    Name = "Cariere", Edition = "2020"
                },
                new Project {
                    Name = "SmartHack", Edition = "2020"
                },
                new Project
                {
                    Name    = "Artă'n Dar",
                    Edition = "2020",
                    Logo    = LoadLogo("artandar.png")
                },
                new Project {
                    Name = "Cariere", Edition = "2021"
                }
            };

            _context.Projects.AddRange(projects);

            var sponsorships = new Sponsorship[]
            {
                new Sponsorship
                {
                    Company     = companies[0],
                    Project     = projects[1],
                    SigningDate = DateTime.Today
                },
                new Sponsorship
                {
                    Company     = companies[2],
                    Project     = projects[0],
                    SigningDate = DateTime.Today.AddDays(-7),
                    Volunteer   = volunteers[0]
                }
            };

            _context.Sponsorships.AddRange(sponsorships);

            _context.SaveChanges();
        }
        public ActionResult Edit(Sponsorship sponsorship)
        {
            if (!this.CanViewPage())
            {
                return RedirectToAction("Login", "User");
            }

            if (ModelState.IsValid)
            {
                Sponsorship sponsorship1 = db.Sponsorship.Where(s => s.idSponsorship.Equals(sponsorship.idSponsorship)).FirstOrDefault();
                sponsorship1.ReductionFilleul = sponsorship.ReductionFilleul;
                sponsorship1.ReductionParrain = sponsorship.ReductionParrain;

                db.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(sponsorship);
        }
Ejemplo n.º 20
0
 public SponsorshipViewModel(Sponsorship s)
 {
     SingleSponsorshipMap(s);
 }
Ejemplo n.º 21
0
 protected void AssumeSponsorshipRepositoryGetReturnsAMatchingSponsoship(Sponsorship sponsorship)
 {
     _ = SponsorshipRepository.Setup(a => a.Get(It.IsAny <string>())).Returns(sponsorship);
 }
        /// <summary>
        /// Send mail to filleul
        /// </summary>
        /// <param name="pSponsorship"></param>
        private void SendMailToFilleul(Sponsorship pSponsorship)
        {
            try
            {
                var languageData = PageLanguageHelper.GetLanguageContent("User", "Parrainage/Controller");

                string subscriptionURL = string.Format("{0}/Souscrire/UnLogiciel/{1}", Upsilab.Business.Utility.UrlHelper.GetHost().Replace("https", "http"), pSponsorship.Code); //Site public
                string upsideoEmail = "*****@*****.**"; //should be not constant
                string upsideoMobile = "01 44 69 59 82"; //TODO => should be not constant


                var template = EmailManager.GetEmailTemplateContentByName(EmailManager.SponsorshipInformFilleul);
                string subject = languageData.GetContent("vous_etes_parrainé");//LanguageData.GetContent("p_ctrl_sujet_mail_fil");

                string message = string.Format(template

                    , pSponsorship.CivilityFilleul
                    , pSponsorship.NameFilleul
                    , ""
                    , currentUser.UserFirstName
                    , currentUser.UserName
                    , currentFirmInstitution.FirmInstitutionName
                    , subscriptionURL
                    , pSponsorship.Code
                    , upsideoEmail
                    , upsideoMobile);

                //TODO : FirmInstitutionName : institution of parent selected in combo (if upsideo admin) ?

                string from = System.Configuration.ConfigurationManager.AppSettings["EmailFrom"].ToString();

                EmailManager.SendEmail(from, pSponsorship.EmailFilleul, string.Empty, subject, message, true);

                //Log mail
                EmailLogBL.Log(null, from, null, pSponsorship.EmailFilleul, EmailLogBL.TypeDestinataire.ProspectedAdviser, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            catch
            {
                //Exception
            }

        }
Ejemplo n.º 23
0
 public static SponsorshipModel MapToSponsorshipModel(Sponsorship sponsorship, IMapper mapper) => mapper.Map <SponsorshipModel>(sponsorship);
Ejemplo n.º 24
0
        public static bool SendEmailToFilleul(Sponsorship pSponsorship)
        {
            bool isSent = true;
            try
            {
                Data.Model.User userParrain = null;
                Data.Model.FirmInstitution firmParrain = null;
                string webHost = string.Empty;

                if (ConfigurationManager.ExtranetType.ToLower() == "exe")
                {                    
                    firmParrain = Configuration.FirmInstitutionBL.GetFirmInstitutionByIdFirmInstitution(pSponsorship.idCustomerParrain);
                    userParrain = firmParrain.User;
                    webHost = ConfigurationManager.WebHostAddress;
                }
                else
                {
                    userParrain = SessionManager.GetUserSession();
                    firmParrain = SessionManager.GetFirmInstitutionSession();
                    webHost = Upsilab.Business.Utility.UrlHelper.GetHost();
                }
                
                var languageData = Upsilab.Business.Utility.PageLanguageHelper.GetLanguageContent("User", "Parrainage/Controller");

                string subscriptionURL = string.Format("{0}/Souscrire/UnLogiciel/{1}", webHost.Replace("https", "http"), pSponsorship.Code); //Site public
                string upsideoEmail = "*****@*****.**"; //should be not constant
                string upsideoMobile = "01 44 69 59 82"; //TODO => should be not constant

                var template = Upsilab.Business.Utility.EmailManager.GetEmailTemplateContentByName(Upsilab.Business.Utility.EmailManager.SponsorshipInformFilleul);
                string subject = languageData.GetContent("vous_etes_parrainé");//LanguageData.GetContent("p_ctrl_sujet_mail_fil");

                bool bProdServer = (Upsilab.Business.Utility.ConfigurationManager.ServerType == Upsilab.Business.Utility.ConfigurationManager.EnumServerType.PROD.ToString()) ? true : false;               
                string to = pSponsorship.EmailFilleul;
                
                if (!bProdServer) //preprod
                {
                    subject = "TEST - " + subject;
                    to = ConfigurationManager.EmailTo;
                }

                string message = string.Format(template

                    , pSponsorship.CivilityFilleul
                    , pSponsorship.NameFilleul
                    , ""
                    , userParrain.UserFirstName
                    , userParrain.UserName
                    , firmParrain.FirmInstitutionName
                    , subscriptionURL
                    , pSponsorship.Code
                    , upsideoEmail
                    , upsideoMobile);

                string from = ConfigurationManager.EmailFrom;

                EmailManager.SendEmail(from, to, string.Empty, subject, message, true);

                //Log mail
                Upsilab.Business.Log.EmailLogBL.Log(null, from, null, to, Upsilab.Business.Log.EmailLogBL.TypeDestinataire.ProspectedAdviser, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            catch
            {
                isSent = false;
                //Exception
            }

            return isSent;
        }
        public ActionResult Index(Sponsorship pSponsorship)
        {
            try
            {
                var LanguageData = PageLanguageHelper.GetLanguageContent("User", "Parrainage/Controller");

                if (!this.CanViewPage())
                {
                    return RedirectToAction("Login", "User");
                }

                if (ModelState.IsValid)
                {
                    Sponsorship objSponsorship = new Sponsorship()
                    {
                        idSponsorship = Guid.NewGuid(),
                        Assests = false,
                        Code = pSponsorship.Code,
                        CreatedDate = DateTime.Now,
                        ExpirationDate = DateTime.Now.AddYears(1), //Expired after one year
                        EmailFilleul = pSponsorship.EmailFilleul,
                        NameFilleul = pSponsorship.NameFilleul,
                        FirstnameFilleul = pSponsorship.FirstnameFilleul,
                        CivilityFilleul = pSponsorship.CivilityFilleul,
                        idCustomerParrain = (currentUserProfile.UserProfileName == UserProfileBL.UpsideoAdministrator) ? pSponsorship.idCustomerParrain : currentFirmInstitution.idFirmInstitution, //IF Admin ? Take the current firm : take value selected from dropdown parrain
                        ReabonParrain = false,
                        ReductionFilleul = (currentUserProfile.UserProfileName == UserProfileBL.UpsideoAdministrator) ? pSponsorship.ReductionFilleul : 10, //TODO : Default value  10
                        //ReductionParrain = (currentUserProfile.UserProfileName == UserProfileBL.UpsideoAdministrator) ? pSponsorship.ReductionParrain : 10, //TODO : Default value  10 ?
                        
                        // Suite au http://redmine.wylog.com/issues/8126
                        UseGiftAmountParrain = true,
                        GiftAmountParrain = 100,
                        ReductionParrain = 0, //Lorsque Typeparainage=2, ne pas insérer 10 dans la colonne "ReductionParrain"  (http://redmine.wylog.com/issues/8126)
                        idSponsorShipType = pSponsorship.idSponsorShipType,
                        SendReminderEmail = true,
                    };

                    if (Upsilab.Business.Souscription.SponsorshipBL.HasMaxSponsorshipCodeCount(objSponsorship.idCustomerParrain))
                    {
                        ModelState.AddModelError("", LanguageData.GetContent("p_ctrl_ne_peut")); //TODO
                    }
                    else
                    {

                        db.Sponsorship.AddObject(objSponsorship);

                        if (db.SaveChanges() > 0)
                        {
                            //Send mail to filleul if email is not empty
                            if (!string.IsNullOrEmpty(pSponsorship.EmailFilleul))
                            {
                                this.SendMailToFilleul(pSponsorship);
                            }
                        }

                        return RedirectToAction("Index");
                    }
                }
            }
            catch
            {
                //Error
            }

            //Get sponsorship codes
            bool hasMaxSponsorshipCodeCount = false;
            IList<Sponsorship> lstSponsorships = this.GetSponsorshipCodes(out hasMaxSponsorshipCodeCount);

            ViewBag.HasMaxSponsorshipCodeCount = hasMaxSponsorshipCodeCount;
            ViewBag.AutoOpenDialog = true;
            var tuple = new Tuple<IEnumerable<Sponsorship>, Sponsorship>(lstSponsorships.ToList(), pSponsorship);

            return View(tuple);
        }
Ejemplo n.º 26
0
 public void AddToSponsorships(Sponsorship sponsorship)
 {
     base.AddObject("Sponsorships", sponsorship);
 }
Ejemplo n.º 27
0
 public static Sponsorship CreateSponsorship(int ID, byte[] rowVersion, int client_Sponsorship, int sponsor_Sponsorship)
 {
     Sponsorship sponsorship = new Sponsorship();
     sponsorship.Id = ID;
     sponsorship.RowVersion = rowVersion;
     sponsorship.Client_Sponsorship = client_Sponsorship;
     sponsorship.Sponsor_Sponsorship = sponsor_Sponsorship;
     return sponsorship;
 }
Ejemplo n.º 28
0
 public void Update(Sponsorship item)
 {
     UpdateOrInsertItem(_folder, _type, item, item.ExternalReferenceId);
 }
Ejemplo n.º 29
0
        internal static Sponsor GetSponsorFromString(string[] sponsorstring)
        {
            Sponsor            newsponsor = new Sponsor();
            Sponsorship        s          = new Sponsorship();
            Contract           c          = new Contract();
            ContactInformation ci         = new ContactInformation();

            newsponsor._id           = Guid.NewGuid().ToString();
            newsponsor.NameOfSponsor = sponsorstring[0];

            try
            {
                s.Date = Convert.ToDateTime(sponsorstring[1]);
            }
            catch
            {
                Console.WriteLine("Invalid Date, defaulting to min value!");
                s.Date = DateTime.MinValue;
            }

            s.MoneyAmount = sponsorstring[2];
            s.WhatGoods   = sponsorstring[3];
            s.GoodsAmount = sponsorstring[4];

            newsponsor.Sponsorship = s;
            if (sponsorstring[5] == "True" || sponsorstring[5] == "true")
            {
                c.HasContract = true;
            }
            else
            {
                c.HasContract = false;
            }
            c.HasContract          = Convert.ToBoolean(sponsorstring[5]);
            c.NumberOfRegistration = sponsorstring[6];

            try
            {
                c.RegistrationDate = Convert.ToDateTime(sponsorstring[7]);
            }
            catch
            {
                Console.WriteLine("Invalid Date, defaulting to min value!");
                c.RegistrationDate = DateTime.MinValue;
            }
            try
            {
                c.ExpirationDate = Convert.ToDateTime(sponsorstring[8]);
            }
            catch
            {
                Console.WriteLine("Invalid Date, defaulting to min value!");
                c.ExpirationDate = DateTime.MinValue;
            }
            newsponsor.Contract = c;

            ci.PhoneNumber = sponsorstring[9];
            ci.MailAdress  = sponsorstring[10];
            newsponsor.ContactInformation = ci;
            return(newsponsor);
        }