Exemplo n.º 1
0
        protected void btnAddFavorite_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                    ILinkService     linkService     = container.Resolve <ILinkService>();
                    IFavoriteService favoriteService = container.Resolve <IFavoriteService>();

                    UserSession userSession = (UserSession)this.Context.Session["userSession"];
                    long        userId      = userSession.UserProfileId;

                    LinkDetails link = linkService.GetLink(LinkId);

                    favoriteService.AddToFavorites(userId, LinkId, txtName.Text, txtDescription.Text);

                    Response.Redirect(Response.ApplyAppPathModifier("~/Pages/Favorite/ListFavorites.aspx"));
                }
                catch (DuplicateInstanceException <FavoriteDetails> )
                {
                    pError.Visible = true;
                    return;
                }
            }
        }
Exemplo n.º 2
0
        public static MvcHtmlString SiteMenu(this HtmlHelper helper, Tenant currentTenant)
        {
            ILinkService linkService = DependencyResolver.Current.GetService <ILinkService>();

            if (currentTenant == null || linkService == null)
            {
                return(null);
            }

            TagBuilder   itemTag;
            IList <Link> menuItems = linkService.GetMenuLinks(currentTenant.Id.ToString());
            TagBuilder   menu      = new TagBuilder("ul");

            menu.MergeAttribute("id", "menu");
            foreach (Link item in menuItems)
            {
                itemTag = new TagBuilder("li");
                if (String.IsNullOrWhiteSpace(item.Area))
                {
                    itemTag.InnerHtml = helper.ActionLink(item.Name, item.Action, new { area = "", controller = item.Controller }).ToString();
                }
                else
                {
                    itemTag.InnerHtml = helper.ActionLink(item.Name, item.Action, new { area = item.Area, controller = item.Controller }).ToString();
                }
                menu.InnerHtml += itemTag;
            }
            return(MvcHtmlString.Create(menu.ToString()));
        }
Exemplo n.º 3
0
        protected void BtnAddLink_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                IUnityContainer container    = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                ILinkService    linkService  = container.Resolve <ILinkService>();
                ILabelService   labelService = container.Resolve <ILabelService>();

                UserSession userSession = (UserSession)this.Context.Session["userSession"];
                long        userId      = userSession.UserProfileId;

                long linkId;
                try
                {
                    linkId = linkService.AddLink(userId, MovieId, txtName.Text, txtDescription.Text, txtUrl.Text);
                }
                catch (DuplicateInstanceException <LinkDetails> ex)
                {
                    if (ex.Properties[1].Name == "url")
                    {
                        atvUrl.Visible = true;
                    }
                    else if (ex.Properties[1].Name == "name")
                    {
                        atvName.Visible = true;
                    }
                    return;
                }
                labelService.SetLabelsForLink(userId, linkId, new List <string>(txtLabels.Text.Split(' ')));

                Response.Redirect(Response.ApplyAppPathModifier("~/Pages/Link/Link.aspx?linkId=" + linkId));
            }
        }
Exemplo n.º 4
0
 public ExtendLinkController(IBaseApiManager BaseApiManager, IHttpContextAccessor Accessor, ILinkGroupService LinkGroupService, ILinkService LinkService) : base(BaseApiManager)
 {
     this.BaseApiManager   = BaseApiManager;
     this.Accessor         = Accessor;
     this.LinkGroupService = LinkGroupService;
     this.LinkService      = LinkService;
 }
Exemplo n.º 5
0
 public CommitsService(
     IMessage message,
     IRepositoryCommands repositoryCommands,
     Func <SetBranchPromptDialog> setBranchPromptDialogProvider,
     IGitCommitBranchNameService gitCommitBranchNameService,
     IDiffService diffService,
     ILinkService linkService,
     IRepositoryMgr repositoryMgr,
     IProgressService progressService,
     IStatusService statusService,
     IGitCommitService gitCommitService,
     IGitStatusService gitStatusService,
     Func <
         BranchName,
         IEnumerable <CommitFile>,
         string,
         bool,
         CommitDialog> commitDialogProvider)
 {
     this.commitDialogProvider = commitDialogProvider;
     this.gitCommitService     = gitCommitService;
     this.gitStatusService     = gitStatusService;
     this.message                       = message;
     this.repositoryCommands            = repositoryCommands;
     this.setBranchPromptDialogProvider = setBranchPromptDialogProvider;
     this.gitCommitBranchNameService    = gitCommitBranchNameService;
     this.diffService                   = diffService;
     this.linkService                   = linkService;
     this.repositoryMgr                 = repositoryMgr;
     this.progress                      = progressService;
     this.statusService                 = statusService;
 }
Exemplo n.º 6
0
 public PageViewService(ILinkService linkService, IDownloadUtil downloadUtil, IStreamUtil streamUtil, IPrintService printService)
 {
     _linkService  = linkService;
     _downloadUtil = downloadUtil;
     _streamUtil   = streamUtil;
     _printService = printService;
 }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long commentId = Int64.Parse(Request.Params.Get("commentId"));

            IUnityContainer container      = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            ICommentService commentService = container.Resolve <ICommentService>();
            ILinkService    linkService    = container.Resolve <ILinkService>();

            CommentDetails comment = commentService.GetComment(commentId);
            LinkDetails    link    = linkService.GetLink(comment.LinkId);

            lblLink.Text        = link.Name;
            lnkLink.NavigateUrl = Response.ApplyAppPathModifier("~/Pages/Link/Link.aspx?linkId=" + link.LinkId);

            lblAuthor.Text        = comment.AuthorName;
            lnkAuthor.NavigateUrl = Response.ApplyAppPathModifier("~/Pages/Comment/ListComments.aspx?userId=" + comment.AuthorId);
            lblDate.Text          = comment.Date.ToString();
            lblText.Text          = comment.Text;

            if (SessionManager.IsUserAuthenticated(Context))
            {
                long userId = SessionManager.GetUserSession(Context).UserProfileId;

                if ((userId == comment.AuthorId) || (userId == link.UserId))
                {
                    pControl.Visible = true;

                    lnkEditComment.NavigateUrl   = Response.ApplyAppPathModifier("~/Pages/Comment/EditComment.aspx?commentId=" + commentId);
                    lnkEditComment.Visible       = (userId == comment.AuthorId);
                    lnkRemoveComment.NavigateUrl = Response.ApplyAppPathModifier("~/Pages/Comment/RemoveComment.aspx?commentId=" + commentId);
                }
            }
        }
Exemplo n.º 8
0
        public App(
            string connectionString,
            IAttributeService attributeService,
            IDatabaseService databaseService,
            ITableService tableService,
            ILinkService linkService,
            IDeployService deployService,
            IDatabaseValidator databaseValidator,
            ITableValidator tableValidator,
            IAttributeValidator attributeValidator,
            ICRUD crudService)
        {
            _defaultConnectionString = connectionString;
            // sorry for this
            _serverName = new Regex("(?:[Dd]ata\\s+[Ss]ource\\s*=\\s*)(?<server>.*?);")
                          .Match(input: _defaultConnectionString)
                          .Groups["server"]
                          .Value;

            _attributeService   = attributeService;
            _databaseService    = databaseService;
            _tableService       = tableService;
            _linkService        = linkService;
            _deployService      = deployService;
            _databaseValidator  = databaseValidator;
            _tableValidator     = tableValidator;
            _attributeValidator = attributeValidator;
            _crudService        = crudService;
        }
Exemplo n.º 9
0
 public HomeController(ILogger <HomeController> logger, IArticleService articleService, ILinkService linkService, ICusLinkService cusLinkService)
 {
     _articleService = articleService;
     _linkService    = linkService;
     _cusLinkService = cusLinkService;
     _logger         = logger;
 }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LinkId = Int64.Parse(Request.Params.Get("linkId"));

            if (!IsPostBack)
            {
                UserSession userSession = (UserSession)this.Context.Session["userSession"];
                long        userId      = userSession.UserProfileId;

                IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                IFavoriteService favoriteService = container.Resolve <IFavoriteService>();
                ILinkService     linkService     = container.Resolve <ILinkService>();

                LinkDetails     link     = linkService.GetLink(LinkId);
                FavoriteDetails favorite = favoriteService.GetFavorite(userId, LinkId);

                lblLink.Text        = "'" + link.Name + "'";
                lblName.Text        = favorite.Name;
                lblDescription.Text = favorite.Description;

                if (Request.UrlReferrer != null)
                {
                    lnkReturn.NavigateUrl = Response.ApplyAppPathModifier(Request.UrlReferrer.AbsoluteUri);
                }
                else
                {
                    lnkReturn.NavigateUrl = Response.ApplyAppPathModifier("~/Pages/Favorite/ListFavorites.aspx");
                }
            }
        }
Exemplo n.º 11
0
        public string Remove(long linkId)
        {
            IUnityContainer container   = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            ILinkService    linkService = container.Resolve <ILinkService>();
            long            linkUserId  = linkService.GetLink(linkId).UserId;

            if (SessionManager.IsUserAuthenticated(Context))
            {
                UserSession userSession = (UserSession)this.Context.Session["userSession"];
                long        userId      = userSession.UserProfileId;

                if (linkUserId == userId)
                {
                    return("<a href=\"/Pages/Link/RemoveLink.aspx?linkId=" + linkId + "\"><img src=\"" + GetLocalResourceObject("lnkRemoveLink.ImageUrl") + "\" alt=\"" + GetLocalResourceObject("lnkRemoveLink.AlternateText") + "\" /></a>");
                }
                else
                {
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 12
0
        public bool RateEnabled(long linkId)
        {
            if (SessionManager.IsUserAuthenticated(Context))
            {
                UserSession userSession = (UserSession)this.Context.Session["userSession"];
                long        userId      = userSession.UserProfileId;

                IUnityContainer container   = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                ILinkService    linkService = container.Resolve <ILinkService>();

                LinkDetails link = linkService.GetLink(linkId);

                if (link.UserId == userId)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 13
0
        public void Remove(object sender, EventArgs e)
        {
            IUnityContainer container    = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            ILinkService    linkService  = container.Resolve <ILinkService>();
            ILabelService   labelService = container.Resolve <ILabelService>();

            UserSession userSession = (UserSession)this.Context.Session["userSession"];
            long        userId      = userSession.UserProfileId;

            try
            {
                labelService.RemoveLabelsForLink(userId, LinkId);
                linkService.RemoveLink(userId, LinkId);
            }
            catch (UserNotAuthorizedException <LinkDetails> )
            {
                pError.Visible = true;
            }

            if (CookiesManager.GetPreferredSearchEngine(Context) == "webshop")
            {
                Response.Redirect(Response.ApplyAppPathModifier("~/Pages/Movie/Movie.aspx?movieId=" + MovieId));
            }
            else
            {
                Response.Redirect(Response.ApplyAppPathModifier("~/Pages/Movie/MovieXml.aspx?movieId=" + MovieId));
            }
        }
Exemplo n.º 14
0
        public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ILinkService service = testServer.Host.Services.GetService(typeof(ILinkService)) as ILinkService;
            var          model   = new ApiLinkServerRequestModel();

            model.SetProperties(1, 1, DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), 1, "B", 2, "B", "B", 2);
            CreateResponse <ApiLinkServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.LinkDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiLinkServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LinkId = Int64.Parse(Request.Params.Get("linkId"));

            IUnityContainer container   = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            ILinkService    linkService = container.Resolve <ILinkService>();

            LinkDetails link = linkService.GetLink(LinkId);

            MovieId = link.MovieId;

            if (!IsPostBack)
            {
                lblLinkName.Text        = link.Name;
                lnkLinkName.NavigateUrl = Response.ApplyAppPathModifier("~/Pages/Link/Link.aspx?linkId=" + LinkId);

                if (Request.UrlReferrer != null)
                {
                    lnkReturn.NavigateUrl = Response.ApplyAppPathModifier(Request.UrlReferrer.AbsoluteUri);
                }
                else
                {
                    lnkReturn.NavigateUrl = Response.ApplyAppPathModifier("~/Pages/Link/Link.aspx?linkId=" + LinkId);
                }

                if (link.Rating <= Settings.Default.WebMovies_demotedThreshold)
                {
                    pRemoveLink.CssClass += " demoted";
                }
                else if (link.Rating >= Settings.Default.WebMovies_promotedThreshold)
                {
                    pRemoveLink.CssClass += " promoted";
                }
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CommentId = Int64.Parse(Request.Params.Get("commentId"));

            IUnityContainer container      = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            ICommentService commentService = container.Resolve <ICommentService>();
            ILinkService    linkService    = container.Resolve <ILinkService>();

            CommentDetails comment = commentService.GetComment(CommentId);

            LinkId = comment.LinkId;
            LinkDetails link = linkService.GetLink(LinkId);

            lnkLink.NavigateUrl = Response.ApplyAppPathModifier("/Pages/Link/Link.aspx?linkId=" + LinkId);
            if (!IsPostBack)
            {
                txtText.Text = comment.Text;

                lblLink.Text  = link.Name;
                lblMovie.Text = ApplicationManager.GetMovieTitle(link.MovieId);
                if (CookiesManager.GetPreferredSearchEngine(Context) == "webshop")
                {
                    lnkMovie.NavigateUrl = Response.ApplyAppPathModifier("/Pages/Movie/Movie.aspx?movieId=" + link.MovieId);
                }
                else
                {
                    lnkMovie.NavigateUrl = Response.ApplyAppPathModifier("/Pages/Movie/MovieXml.aspx?movieId=" + link.MovieId);
                }
            }
        }
 public MoleculeService(IMoleculeRepository moleculeRepository, ILogRepository logRepository, ILinkService linkService, IAtomService atomService)
     : base(moleculeRepository)
 {
     this._moleculeRepository = moleculeRepository;
     this._logRepository      = logRepository;
     this._linkService        = linkService;
     this._atomService        = atomService;
 }
Exemplo n.º 18
0
 public ArtistController(IArtistRepo artistRepo,
                         IMapper mapper,
                         ILinkService <ArtistDto, ArtistResourceParameters> linkService)
 {
     _artistRepo  = artistRepo;
     _mapper      = mapper;
     _linkService = linkService;
 }
Exemplo n.º 19
0
 public LinksController(ILinkService linkService, ITagService tagService, IUserLinkService userLinkService, UserManager <User> userManager, IMapper mapper)
 {
     this._mapper          = mapper;
     this._linkService     = linkService;
     this._tagService      = tagService;
     this._userLinkService = userLinkService;
     this._userManager     = userManager;
 }
Exemplo n.º 20
0
 public LinksV1Controller(ILinkService linksService,
                          IMapper mapper,
                          IBackgroundJobClient backgroundJob)
 {
     this.linksService  = linksService;
     this.mapper        = mapper;
     this.backgroundJob = backgroundJob;
 }
Exemplo n.º 21
0
 public AffiliateController(IReferralRepository referralRepository, IMapper mapper, ILinkService linkService, IClientAccountService clientAccountService, IAccrualService accrualService)
 {
     _referralRepository   = referralRepository;
     _mapper               = mapper;
     _linkService          = linkService;
     _clientAccountService = clientAccountService;
     _accrualService       = accrualService;
 }
Exemplo n.º 22
0
 public HomeController(IConfigService config, ILogService logger,
                       SignInManager <User> signInManager,
                       ILinkService link)
 {
     _link   = link;
     _logger = logger;
     _config = config;
 }
Exemplo n.º 23
0
 public PageService(IUnitOfWork work,
                    ILogService logger,
                    ILinkService link,
                    IMapper mapper) : base(work, mapper)
 {
     _link   = link;
     _logger = logger;
 }
Exemplo n.º 24
0
 public MainController(ILogger <HomeController> logger, IWebHostEnvironment env, IArticleService articleService, ILinkService linkService, IAccountService accountService)
 {
     _articleService = articleService;
     _linkService    = linkService;
     _accountService = accountService;
     _logger         = logger;
     _env            = env;
 }
 public UsersProjectController(ITaskService tservice, IRoleService rservice, IProjectService service, ILinkService lservice, IUserService uservice)
 {
     this._service  = service;
     this._lservice = lservice;
     this._rservise = rservice;
     this._uservice = uservice;
     this._tservice = tservice;
 }
Exemplo n.º 26
0
 public MallController(IObjectService objectService, IHotareaService HotareaService, ILinkService ilinkService, ICartGoodsService cartGoodsService, ICartService cartService)
 {
     _objectService     = objectService;
     _HotareaService    = HotareaService;
     _ilinkService      = ilinkService;
     _icartGoodsService = cartGoodsService;
     _icartService      = cartService;
 }
Exemplo n.º 27
0
 public AlbumController(IAlbmRepo albumRepo,
                        IMapper mapper,
                        ILinkService <AlbumDto, AlbumResourceParameters> albumLinkService)
 {
     _albumRepo        = albumRepo;
     _mapper           = mapper;
     _albumLinkService = albumLinkService;
 }
Exemplo n.º 28
0
 public LinksController(IGroupService groupService,
                        IUserService userService,
                        ILinkService linkService)
 {
     this.groupService = groupService;
     this.userService  = userService;
     this.linkService  = linkService;
 }
Exemplo n.º 29
0
        public PostsController(ILinkService linkService, IPostService postService)
        {
            Ensure.That(() => linkService).IsNotNull();
            Ensure.That(() => postService).IsNotNull();

            this.linkService = linkService;
            this.postService = postService;
        }
Exemplo n.º 30
0
        public TrackController(ITrackRepo trackRepo,
                               IMapper mapper,
                               ILinkService <TrackDto, TrackResourceParameters> linkService)
        {
            _trackRepo = trackRepo;
            _mapper    = mapper;

            _linkService = linkService;
        }
Exemplo n.º 31
0
 public RequestController(
     IRequestRepo requestRepo,
     ILinkService <RequestDto, RequestResourceParameters> linkService,
     IMapper mapper)
 {
     _requestRepo = requestRepo;
     _mapper      = mapper;
     _linkService = linkService;
 }
Exemplo n.º 32
0
        public PostService(IPostRepository postRepository, ICommentService commentService, ILinkService linkService, ISmileyService smileyService, TextHelper textHelper)
        {
            Ensure.That(() => postRepository).IsNotNull();
            Ensure.That(() => commentService).IsNotNull();
            Ensure.That(() => linkService).IsNotNull();
            Ensure.That(() => smileyService).IsNotNull();
            Ensure.That(() => textHelper).IsNotNull();

            this.postRepository = postRepository;
            this.commentService = commentService;
            this.linkService = linkService;
            this.smileyService = smileyService;
            this.textHelper = textHelper;
        }
Exemplo n.º 33
0
 public ScheduleControllerOld(IActivityService activityService,
                           ILinkService linkService)
 {
     _activityService = activityService;
     _linkService = linkService;
 }
Exemplo n.º 34
0
 public HomeController(ILinkService links)
 {
     _links = links;
 }
Exemplo n.º 35
0
 public LinkController(ILinkService linkService, IUnitOfWork unitOfWork)
 {
     this.linkService = linkService;
     this.unitOfWork = unitOfWork;
 }
Exemplo n.º 36
0
 public void TestInit()
 {
     linkService = MockHelpers.FakeLinkService();
 }