示例#1
0
 public void AddAdvertiser() {
     using (var session = NewSession()) {
         var advertiser = new Advertiser {AdvertiserName = "Fulano-" + Guid.NewGuid()};
         session.AddAdvertiser(advertiser);
         Console.WriteLine(advertiser.Id);
     }
 }
        public ActionResult AdvertiserCreate(Advertiser advertiser)
        {
            if (ModelState.IsValid) {
                int id = _repository.CreateAdvertiser(advertiser);
                return AdvertiserDetails(id);
            }

            SetAdvertiserLookups(advertiser);

            return View(advertiser);
        }
        public Advertiser AddNewAdvertiser(SaveAdvertiserMessage message)
        {
            var newAdvertiser = new Advertiser();
            newAdvertiser.Name = message.Name;
            newAdvertiser.Password = _cryptographyService.Encrypt(message.Password);
            newAdvertiser.Email = message.Email;

            _advertiserRepository.Add(newAdvertiser);
            _advertiserRepository.SaveChanges();

            return newAdvertiser;
        }
        public Advertiser AddNewAdvertiser(SaveAdvertiserMessage message)
        {
            var newAdvertiser = new Advertiser();

            newAdvertiser.Name     = message.Name;
            newAdvertiser.Password = _cryptographyService.Encrypt(message.Password);
            newAdvertiser.Email    = message.Email;

            _advertiserRepository.Add(newAdvertiser);
            _advertiserRepository.SaveChanges();

            return(newAdvertiser);
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("AdvertiserID,FirstName,LastName,PhoneNumber,EmailAddress,CompanyID")] Advertiser advertiser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(advertiser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            // ViewData["CompanyID"] = new SelectList(_context.Companies, "CompanyID", "CompanyID", advertiser.CompanyID);
            PopulateCompanyDropDownList(advertiser.CompanyID);
            return(View(advertiser));
        }
示例#6
0
        public Account(string email, string password, Advertiser advertiser)
        {
            Email           = email;
            NormalizedEmail = email;
            Advertiser      = advertiser;
            Password        = password;

            Id = advertiser.Id;

            _claims = new HashSet <AccountClaim>();
            _logins = new HashSet <AccountLogin>();
            _roles  = new HashSet <AccountRole>();
        }
 public ActionResult advertiserEdit([Bind(Include = "AdvertiserID,AccountStatus,SevenDayEpc,ThreeMonthEpc,LanguageID,Name,Url,RelationshipStatus,MobileTracking,NetworkRank,ParentCategoryID,ChildCategoryID,PerformanceIncentive,CreateDate,ModifyDate")] Advertiser advertiser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(advertiser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("viewAdvertiserDetail"));
     }
     ViewBag.ParentCategoryID = new SelectList(db.Categories, "CategoryID", "Category1", advertiser.ParentCategoryID);
     ViewBag.ChildCategoryID  = new SelectList(db.Categories, "CategoryID", "Category1", advertiser.ChildCategoryID);
     ViewBag.LanguageID       = new SelectList(db.Languages, "LanguageID", "Languages", advertiser.LanguageID);
     return(View(advertiser));
 }
示例#8
0
        // GET: Advertisers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Advertiser advertiser = db.Advertisers.Find(id);

            if (advertiser == null)
            {
                return(HttpNotFound());
            }
            return(View(advertiser));
        }
示例#9
0
        public void Delete(Advertiser __obj)
        {
            using (var _context = new Context())
            {
                Advertiser _objToDelete = _context.Advertisers.Find(__obj.Id);

                if (_objToDelete != null)
                {
                    _context.Advertisers.Remove(_objToDelete);

                    _context.SaveChanges();
                }
            }
        }
示例#10
0
        // GET: Advertisers/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Advertiser advertiser = await db.Advertisers.FindAsync(id);

            if (advertiser == null)
            {
                return(HttpNotFound());
            }
            return(View(advertiser));
        }
示例#11
0
        public IHttpActionResult DeleteAdvertiser(int id)
        {
            Advertiser advertiser = db.Advertiser.Find(id);

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

            db.Advertiser.Remove(advertiser);
            db.SaveChanges();

            return(Ok(advertiser));
        }
示例#12
0
    public void AdvertiseButton()
    {
        if (authUI.MenOrWomen == 1)
        {
            Advertiser advertiser = new Advertiser(authUI.comName_InputField.text, authUI.productName_InputField.text, authUI.productDes_InputField.text, authUI.comNumber_InputField.text, authUI.celNumber_InputField.text, System.DateTime.Now.ToString());
            DatabaseManager.CreateNewAdverTiser(advertiser, user.UserId);
        }

        else
        {
            Advertiser advertiser = new Advertiser(authUI.comName_InputField.text, authUI.productName_InputField.text, authUI.productDes_InputField.text, authUI.comNumber_InputField.text, authUI.celNumber_InputField.text, System.DateTime.Now.ToString());
            DatabaseManager.CreateNewAdverTiser(advertiser, user.UserId);
        }
    }
示例#13
0
        public async Task <IActionResult> Login(Advertiser _advertiser)
        {
            var vHangiKullanici = _db.Advertisers.FirstOrDefault(w => w.Mail == _advertiser.Mail && w.Password == _advertiser.Password);

            if (vHangiKullanici != null)
            {
                var claims = new List <Claim>
                {
                    new Claim("kullanici_id", vHangiKullanici.Id.ToString()),
                    new Claim("kullanici_adi", vHangiKullanici.OfficalName),
                    new Claim("kullanici_mail", vHangiKullanici.Mail),
                    new Claim("kullanici_avatar", vHangiKullanici.Avatar),
                };
                var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
                var principal      = new ClaimsPrincipal(claimsIdentity);
                var authProperties = new AuthenticationProperties
                {
                    //AllowRefresh = <bool>,
                    // Refreshing the authentication session should be allowed.

                    ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(1440),
                    // The time at which the authentication ticket expires. A
                    // value set here overrides the ExpireTimeSpan option of
                    // CookieAuthenticationOptions set with AddCookie.

                    IsPersistent = true,
                    // Whether the authentication session is persisted across
                    // multiple requests. When used with cookies, controls
                    // whether the cookie's lifetime is absolute (matching the
                    // lifetime of the authentication ticket) or session-based.

                    //IssuedUtc = <DateTimeOffset>,
                    // The time at which the authentication ticket was issued.

                    //RedirectUri = <string>
                    // The full path or absolute URI to be used as an http
                    // redirect response value.
                };
                await HttpContext.SignInAsync(principal, authProperties);

                //var vGirisYapanKullanici = claimsIdentity.FindFirst("kullanici_mail").Value.ToString(); Claim Okuma İşlemi
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                TempData["rejection"] = "Kullanıcı Adı veya Parolanız Yanlış.";
                return(View());//Giriş Başarısız ise Yönlendir.
            }
        }
示例#14
0
        public Paged <Advertiser> GetAll(int pageIndex, int pageSize)
        {
            Paged <Advertiser> pagedResult = null;

            List <Advertiser> result = null;

            int totalCount = 0;

            _data.ExecuteCmd(
                "dbo.Advertisers_SelectandPaginate",
                inputParamMapper : delegate(SqlParameterCollection parameterCollection)
            {
                parameterCollection.AddWithValue("@PageIndex", pageIndex);
                parameterCollection.AddWithValue("@PageSize", pageSize);
            },
                singleRecordMapper : delegate(IDataReader reader, short set)
            {
                Advertiser model       = new Advertiser();
                int index              = 0;
                model.Id               = reader.GetSafeInt32(index++);
                model.ShortTitle       = reader.GetSafeString(index++);
                model.Title            = reader.GetSafeString(index++);
                model.ShortDescription = reader.GetSafeString(index++);
                model.Content          = reader.GetSafeString(index++);
                model.CreatedBy        = reader.GetSafeInt32(index++);
                model.Slug             = reader.GetSafeString(index++);
                model.EntityTypeId     = reader.GetSafeInt32(index++);
                model.StatusId         = reader.GetSafeInt32(index++);
                model.DateCreated      = reader.GetDateTime(index++);
                model.DateModified     = reader.GetDateTime(index++);
                model.BaseMetaData     = reader.GetSafeInt32(index++);
                //totalCount = reader.GetSafeInt32(index++);

                if (result == null)
                {
                    result = new List <Advertiser>();
                }

                result.Add(model);
            }

                );
            if (result != null)
            {
                pagedResult = new Paged <Advertiser>(result, pageIndex, pageSize, totalCount);
            }

            return(pagedResult);
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      String advertiserName = _T("INSERT_ADVERTISER_NAME_HERE");

      // Create the advertiser structure.
      Advertiser advertiser = new Advertiser();
      advertiser.Name = advertiserName;
      advertiser.Status = "APPROVED";

      // Create the advertiser.
      Advertiser result = service.Advertisers.Insert(advertiser, profileId).Execute();

      // Display the advertiser ID.
      Console.WriteLine("Advertiser with ID {0} was created.", result.Id);
    }
        protected override string Serialize()
        {
            var result = new StringBuilder();

            result.AppendLine(base.Serialize());
            result.AppendLine(@"<AddAsPageOne>" + AddAsPageOne + @"</AddAsPageOne>");
            result.AppendLine(@"<UseGenericCover>" + UseGenericCover + @"</UseGenericCover>");
            result.AppendLine(@"<ShowPresentationDate>" + ShowPresentationDate + @"</ShowPresentationDate>");
            result.AppendLine(@"<SlideHeader>" + SlideHeader.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</SlideHeader>");
            result.AppendLine(@"<Advertiser>" + Advertiser.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</Advertiser>");
            result.AppendLine(@"<DecisionMaker>" + DecisionMaker.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</DecisionMaker>");
            result.AppendLine(@"<PresentationDate>" + PresentationDate + @"</PresentationDate>");
            result.AppendLine(@"<Quote>" + Quote.Serialize() + @"</Quote>");

            return(result.ToString());
        }
示例#17
0
        public Advertiser Save(Advertiser __obj)
        {
            Fix(__obj);

            if (__obj.Id == 0) // se não tem id é pq é um registro novo
            {
                __obj = Add(__obj);
            }

            else
            {
                __obj = Update(__obj);
            }

            return(__obj);
        }
        public async Task <IActionResult> Register(RegisterViewModel model, UserViewModel userViewModel, AdvertiserViewModel advertiserViewModel, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var user = new Data.Entities.User
                {
                    UserName     = model.Email,
                    Email        = model.Email,
                    FullName     = userViewModel.FullName,
                    Address      = userViewModel.Address,
                    DateCreated  = DateTime.Now,
                    DateModified = DateTime.Now,
                    PhoneNumber  = userViewModel.PhoneNumber,
                    Gender       = Data.Enums.Gender.Other,
                    Status       = Data.Enums.Status.InActive,
                    UserTypeFK   = Const_UserType.Advertiser,
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme, nameof(AccountController.ConfirmEmail), "Advertiser");

                    var content = "Hãy nhấp vào link này để xác nhận tài khoản quảng cáo Bé Yêu Bookstore: " + callbackUrl;

                    SendConfirmEmail(model.Email, content);
                    //await _signInManager.SignInAsync(user, isPersistent: false);
                    //await _userManager.AddToRoleAsync(user, "Quảng cáo"); // add vao role
                    var advertiser = new Advertiser();
                    advertiser.UserFK     = user.Id;
                    advertiser.BrandName  = advertiserViewModel.BrandName;
                    advertiser.UrlToBrand = advertiserViewModel.UrlToBrand;
                    await _userManager.AddToRoleAsync(user, "Quảng cáo"); // add vao role

                    _context.Advertisers.Add(advertiser);
                    _context.SaveChanges();

                    return(new RedirectResult(Url.Action("WaitingConfirmation", "BeyeuBookstore")));
                }
            }

            // If we got this far, something failed, redisplay form
            return(new RedirectResult(Url.Action("SignUp", "BeyeuBookstore")));
        }
示例#19
0
 public override void StopAdvertising()
 {
     if (!Initialized)
     {
         return;
     }
     try
     {
         _logger.LogDebug("Advertiser - Stopping.");
         Advertiser.StopAdvertisingSet(_callback);
         Covi.Features.BluetoothTracing.TracingState.Instance.SetAdvertisingState(false);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "Advertiser - Stopping failed.");
     }
 }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
      long advertiserGroupId = long.Parse(_T("INSERT_ADVERTISER_GROUP_ID_HERE"));
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      // Create the Advertiser and populate with the group ID to patch.
      Advertiser advertiser = new Advertiser();
      advertiser.AdvertiserGroupId = advertiserGroupId;

      // Patch the existing advertiser.
      Advertiser result =
        service.Advertisers.Patch(advertiser, profileId, advertiserId).Execute();

      // Print out the advertiser and advertiser group ID.
      Console.WriteLine("Advertiser with ID {0} was assigned to advertiser" +
          " group \"{1}\".", result.Id, result.AdvertiserGroupId);
    }
        public ActionResult advertiserEdit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Advertiser advertiser = db.Advertisers.Find(id);

            if (advertiser == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ParentCategoryID = new SelectList(db.Categories, "CategoryID", "Category1", advertiser.ParentCategoryID);
            ViewBag.ChildCategoryID  = new SelectList(db.Categories, "CategoryID", "Category1", advertiser.ChildCategoryID);
            ViewBag.LanguageID       = new SelectList(db.Languages, "LanguageID", "Languages", advertiser.LanguageID);
            return(View(advertiser));
        }
示例#22
0
        public Advertiser Update(Advertiser __objUpdate)
        {
            using (var _context = new Context())
            {
                //fonte: http://stackoverflow.com/questions/15336248/entity-framework-5-updating-a-record

                Advertiser _objOriginal = _context.Advertisers.Find(__objUpdate.Id);

                if (_objOriginal != null)
                {
                    _context.Entry(_objOriginal).CurrentValues.SetValues(__objUpdate);
                    _context.SaveChanges();
                }
            }

            return(__objUpdate);
        }
示例#23
0
        protected override void Seed(MMHContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.

            context.DocumentTypes.AddOrUpdate(dt => dt.DocumentTypeId, new DocumentType {
                DocumentTypeId = 1, Name = "NIF"
            });

            context.Documents.AddOrUpdate(dc => dc.DocumentId, new Document {
                DocumentId = 1, DocumentTypeId = 1, Number = "40987527"
            });

            context.States.AddOrUpdate(st => st.StateId, new State {
                StateId = 1, Name = "São Paulo"
            });

            context.Citys.AddOrUpdate(ct => ct.StateId, new City {
                CityId = 1, Name = "Capital", StateId = 1
            });

            context.Addresses.AddOrUpdate(ad => ad.AddressId, new Address {
                AddressId = 1, CityId = 1, Neighborhood = "marajoara", PostalCode = "098312", StateId = 1, Street = "minha rua aqui"
            });

            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                var store   = new UserStore <Advertiser>(context);
                var manager = new UserManager <Advertiser>(store);
                var user    = new Advertiser()
                {
                    Name           = "Edward Carvalho",
                    BirthDate      = new DateTime(1984, 10, 25),
                    Email          = "*****@*****.**",
                    UserName       = "******",
                    EmailConfirmed = true,
                    DocumentId     = 1,
                    AddressId      = 1
                };

                manager.Create(user, "#Teste1234");
            }
        }
示例#24
0
 public ActionResult Create(Advertiser newAdvertiser, FormCollection formCollection)
 {
     try
     {
         using (new SessionScope())
         {
             AddCategories(newAdvertiser, formCollection);
             LocationService.SetGeographicalLocation(newAdvertiser.GeographicalLocation);
             newAdvertiser.CreateAndFlush();
         }
         return RedirectToAction("Index");
     }
     catch (Exception ex)
     {
         var x = ex.ToString();
         return View();
     }
 }
示例#25
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            String advertiserName = _T("INSERT_ADVERTISER_NAME_HERE");

            // Create the advertiser structure.
            Advertiser advertiser = new Advertiser();

            advertiser.Name   = advertiserName;
            advertiser.Status = "APPROVED";

            // Create the advertiser.
            Advertiser result = service.Advertisers.Insert(advertiser, profileId).Execute();

            // Display the advertiser ID.
            Console.WriteLine("Advertiser with ID {0} was created.", result.Id);
        }
示例#26
0
 public ActionResult <User> GetAdvertiserBalance(Advertiser user)
 {
     try
     {
         foreach (var u in unitOfWork.AdvertiserRepository.Get())
         {
             if (u.UserId == user.UserId)
             {
                 return(u);
             }
         }
         return(StatusCode(500, "Something went wrong!"));
     }
     catch (Exception)
     {
         return(StatusCode(500, "Something went wrong!"));
     }
 }
示例#27
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long advertiserId      = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
            long advertiserGroupId = long.Parse(_T("INSERT_ADVERTISER_GROUP_ID_HERE"));
            long profileId         = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            // Create the Advertiser and populate with the group ID to patch.
            Advertiser advertiser = new Advertiser();

            advertiser.AdvertiserGroupId = advertiserGroupId;

            // Patch the existing advertiser.
            Advertiser result =
                service.Advertisers.Patch(advertiser, profileId, advertiserId).Execute();

            // Print out the advertiser and advertiser group ID.
            Console.WriteLine("Advertiser with ID {0} was assigned to advertiser" +
                              " group \"{1}\".", result.Id, result.AdvertiserGroupId);
        }
        protected override string Serialize()
        {
            var result = new StringBuilder();

            result.AppendLine(base.Serialize());
            result.AppendLine(@"<ShowAdvertiser>" + ShowAdvertiser + @"</ShowAdvertiser>");
            result.AppendLine(@"<ShowDecisionMaker>" + ShowDecisionMaker + @"</ShowDecisionMaker>");
            result.AppendLine(@"<ShowPresentationDate>" + ShowPresentationDate + @"</ShowPresentationDate>");
            result.AppendLine(@"<ShowFlightDates>" + ShowFlightDates + @"</ShowFlightDates>");
            result.AppendLine(@"<ShowMonthly>" + ShowMonthly + @"</ShowMonthly>");
            result.AppendLine(@"<ShowTotal>" + ShowTotal + @"</ShowTotal>");
            result.AppendLine(@"<TableOutput>" + TableOutput + @"</TableOutput>");

            result.AppendLine(@"<SlideHeader>" + SlideHeader.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</SlideHeader>");
            result.AppendLine(@"<Advertiser>" + Advertiser.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</Advertiser>");
            result.AppendLine(@"<DecisionMaker>" + DecisionMaker.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</DecisionMaker>");
            result.AppendLine(@"<PresentationDate>" + PresentationDate + @"</PresentationDate>");
            result.AppendLine(@"<FlightDatesStart>" + FlightDatesStart + @"</FlightDatesStart>");
            result.AppendLine(@"<FlightDatesEnd>" + FlightDatesEnd + @"</FlightDatesEnd>");
            if (MonthlyValue.HasValue)
            {
                result.AppendLine(@"<MonthlyValue>" + MonthlyValue + @"</MonthlyValue>");
            }
            if (TotalValue.HasValue)
            {
                result.AppendLine(@"<TotalValue>" + TotalValue + @"</TotalValue>");
            }

            result.AppendLine(@"<Items>");
            foreach (SimpleSummaryItemState item in ItemsState)
            {
                result.AppendLine(@"<Item>" + item.Serialize() + @"</Item>");
            }
            result.AppendLine(@"</Items>");

            if (ContractSettings.IsConfigured)
            {
                result.AppendLine(String.Format("<ContractSettings>{0}</ContractSettings>", ContractSettings.Serialize()));
            }

            return(result.ToString());
        }
        public async Task <IActionResult> PutAdvertiser(int id, Advertiser advertiser)
        {
            if (id != advertiser.Id)
            {
                return(BadRequest());
            }

            _context.Entry(advertiser).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }

            return(NoContent());
        }
        public async Task GetAdvertiserReport_ShouldReturnReport()
        {
            // Arrange
            var scopeId    = Guid.NewGuid();
            var advertiser = new Advertiser {
                AdvertiserUuid = scopeId
            };
            var model = new ReportCriteriaViewModel
            {
                ReportLevel   = ReportLevelEnum.Daily,
                ReportScope   = ReportScopeEnum.Advertiser,
                ReportScopeId = scopeId,
                StartDate     = DateTime.Now
            };
            var report = new Report <object>(new List <PerformanceData <object> >
            {
                new PerformanceData <object>(),
                new PerformanceData <object>()
            });

            MockUnitOfWorkRepository <Advertiser>().Setup(x => x.Queryable())
            .Returns(new[] { advertiser }.AsQueryable());
            Mock.Mock <IReportService>().Setup(x => x.GetAdvertiserReport(It.Is((ReportCriteria criteria) =>
                                                                                criteria.Level == model.ReportLevel &&
                                                                                criteria.Advertiser == advertiser &&
                                                                                criteria.LocalFromDateTime == model.StartDate &&
                                                                                !criteria.LocalToDateTime.HasValue)))
            .Returns(Task.FromResult((IReport)report));

            // Act
            var result = await Controller.GetAdvertiserReport(model);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.TotalItemCount, Is.EqualTo(2));
            var resultData   = result.Data.ToList();
            var expectedData = report.Data.ToList();

            Assert.That(resultData[0], Is.EqualTo(expectedData[0]));
            Assert.That(resultData[1], Is.EqualTo(expectedData[1]));
        }
示例#31
0
        public ActionResult <string> AddingBalance(Advertiser user, float balance)
        {
            try
            {
                var result = from item in unitOfWork.AdvertiserRepository.Get()
                             where user.UserId == item.UserId
                             select item;

                foreach (var item in result)
                {
                    item.Balance += balance;
                }

                unitOfWork.Save();
                return(StatusCode(200, "Ok"));
            }
            catch (Exception)
            {
                return(StatusCode(500, "Something went wrong!"));
            }
        }
示例#32
0
    protected void CreateAdButton_Click(object sender, EventArgs e)
    {
        ErrorMessagePanel.Visible = false;
        SuccMessagePanel.Visible  = false;

        if (Page.IsValid)
        {
            try
            {
                AppSettings.DemoCheck();
                Member User = Member.Current;

                NewBannerAdvert.Advertiser = Advertiser.AsMember(User.Name);
                NewBannerAdvert.Status     = AdvertStatusExtensions.GetStartingStatus();
                NewBannerAdvert.TargetUrl  = URL.Text;
                NewBannerAdvert.Pack       = new BannerAdvertPack();
                NewBannerAdvert.Price      = new Money(0);
                NewBannerAdvert.Dimensions = new BannerAdvertDimensions(Convert.ToInt32(BannerTypeRadioButtonList.SelectedValue));
                NewBannerAdvert.Save();

                //Referesh notifications
                SuccMessagePanel.Visible = true;
                SuccMessage.Text         = U3501.ADCREATED;

                Response.Redirect("bannersb.aspx?red=camp");

                Session["YourCampaigns_NewBannerAdvert"] = null;
            }
            catch (MsgException ex)
            {
                ErrorMessagePanel.Visible = true;
                ErrorMessage.Text         = ex.Message;
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
                throw ex;
            }
        }
    }
示例#33
0
        public ActionResult <List <Advert> > AdFrontPage(Advertiser user)
        {
            try
            {
                CheckDeadlineDate();
                List <Advert> advertList = new List <Advert>();

                foreach (var item in unitOfWork.AdvertRepository.Get())
                {
                    if (item.UserId == user.UserId)
                    {
                        advertList.Add(item);
                    }
                }

                return(advertList);
            }
            catch (Exception)
            {
                return(StatusCode(500, "Something went wrong!"));
            }
        }
        public override void StartAdvertising(TracingInformation tracingInformation)
        {
            if (!Initialized)
            {
                _logger.LogError("Advertiser - Starting failed - not initialized.");
                return;
            }

            try
            {
                _logger.LogDebug($"Advertiser - Starting. ServiceId: {tracingInformation.ServiceId}.");
                AdvertiseSettings parameters = AdvertisingParameters();
                AdvertiseData     data       = BuildAdvertiseData(tracingInformation);
                _callback = new BtAdvertisingCallback();
                Advertiser.StartAdvertising(parameters, data, _callback);
                Covi.Features.BluetoothTracing.TracingState.Instance.SetAdvertisingState(true);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Advertiser - Starting failed.");
            }
        }
示例#35
0
        public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Manage"));
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();

                if (info == null)
                {
                    return(View("ExternalLoginFailure"));
                }
                var user = new Advertiser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await _userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    result = await _userManager.AddLoginAsync(user.Id, info.Login);

                    if (result.Succeeded)
                    {
                        await _signInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        return(RedirectToLocal(returnUrl));
                    }
                }
                AddErrors(result);
            }

            ViewBag.ReturnUrl = returnUrl;
            return(View(model));
        }
    /// <summary>
    /// Displays a rewarded video based on advertiser sent as parameter, if the requested advertiser is not available selected mediation settings are used
    /// </summary>
    /// <param name="advertiser">the advertiser from which you want to display the rewarded video</param>
    /// <param name="CompleteMethod">callback triggered when video reward finished - if bool param is true => video was not skipped</param>
    public void ShowRewardedVideo(SupportedAdvertisers advertiser, UnityAction <bool> CompleteMethod)
    {
        Advertiser selected = GetRewardedAdvertisers().First(cond => cond.advertiser == advertiser);

        if (selected.advertiserScript.IsRewardVideoAvailable())
        {
            if (debug)
            {
                Debug.Log("Rewarded Video from " + advertiser + " is available");
                ScreenWriter.Write("Rewarded Video from " + advertiser + " is available");
            }
            selected.advertiserScript.ShowRewardVideo(CompleteMethod);
        }
        else
        {
            if (debug)
            {
                Debug.Log("Rewarded Video from " + advertiser + " is NOT available");
                ScreenWriter.Write("Rewarded Video from " + advertiser + " is NOT available");
            }
            ShowRewardedVideo(CompleteMethod);
        }
    }
示例#37
0
 /// <summary>
 /// Create a new Advertiser object.
 /// </summary>
 /// <param name="id">Initial value of ID.</param>
 /// <param name="advertiserID">Initial value of AdvertiserID.</param>
 /// <param name="advertiserName">Initial value of AdvertiserName.</param>
 /// <param name="program">Initial value of Program.</param>
 /// <param name="status">Initial value of Status.</param>
 public static Advertiser CreateAdvertiser(int id, string advertiserID, string advertiserName, string program, int status)
 {
     Advertiser advertiser = new Advertiser();
     advertiser.ID = id;
     advertiser.AdvertiserID = advertiserID;
     advertiser.AdvertiserName = advertiserName;
     advertiser.Program = program;
     advertiser.Status = status;
     return advertiser;
 }
 public ActionResult AdvertiserDelete(Advertiser model)
 {
     return View(model);
 }
 public ActionResult AdvertiserEdit(Advertiser model)
 {
     return View(model);
 }
 private void SetAdvertiserLookups(Advertiser advertiser)
 {
     //ViewBag.BuildId = new SelectList(_repository.GetBuilds(), "Id", "Description", advertiser.Build);
     ViewBag.CategoryId = new SelectList(_repository.GetActiveCategories(), "CategoryId", "CategoryName", advertiser.CategoryId);
     //ViewBag.CallTypeId = new SelectList(_repository.GetCallTypes(), "Id", "Description", advertiser.CallTypeId);
     //ViewBag.HeightId = new SelectList(_repository.GetHeights(), "Id", "Description", advertiser.Height);
     ViewBag.TownId = new SelectList(_repository.GetTowns(), "Id", "TownName", advertiser.TownId);
 }
示例#41
0
 /// <summary>
 /// There are no comments for AdvertiserSet in the schema.
 /// </summary>
 public void AddToAdvertiserSet(Advertiser advertiser)
 {
     base.AddObject("AdvertiserSet", advertiser);
 }
示例#42
0
 private static void AddCategories(Advertiser newAdvertiser, FormCollection formCollection)
 {
     var categoryIds = formCollection["Categories"].ToString().Split(',');
     foreach (var categoryId in categoryIds)
     {
         var category = Category.Find(int.Parse(categoryId));
         newAdvertiser.Categories.Add(category);
     }
 }
示例#43
0
        public int CreateAdvertiser(Advertiser advertiser)
        {
            //var n = ctx.Advertisers.Count(x => x.Name == advertiser.Name);
            //if (n == 0)
            //{
            //    advertiser.Slug = advertiser.Name.Replace(" ", "").ToLowerInvariant();
            //}
            //else
            //{
            //    advertiser.Slug = string.Concat(advertiser.Name.Replace(" ", "").ToLowerInvariant(), (n + 1));
            //}

            //var a = ctx.Advertisers.Add(advertiser);
            //ctx.SaveChanges();

            //return a.Id;
            return 0;
        }