Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int    startIndex;
            string vendedorId = Request.Params.Get("vendedor");

            try
            {
                startIndex = Int32.Parse(Request.Params.Get("startIndex"));
            }
            catch (ArgumentNullException)
            {
                startIndex = 0;
            }

            int count = 10;
            /* Get de Service */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();
            ValoracionBlock  valoraciones    = new ValoracionBlock(null, 0, 0);

            cellLoginName.Text = vendedorId;
            try
            {
                valoraciones = opinadorService.FindValoracionesAndNoteByVendedor(vendedorId, startIndex, count);
            }
            catch (InstanceNotFoundException)
            {
                cellAverage.Visible = false;
            }

            cellAverage.Text      = valoraciones.AverageValoracion.ToString();
            cellNumerOfVotes.Text = valoraciones.NumValoraciones.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /* Hide the links */
            lnkAnterior.Visible  = false;
            lnkSiguiente.Visible = false;

            /* Get de Service */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();
            ValoracionBlock  valoracionesB   = new ValoracionBlock(null, 0, 0);


            int    startIndex;
            string vendedorId = Request.Params.Get("vendedorId");

            try
            {
                startIndex = Int32.Parse(Request.Params.Get("startIndex"));
            }
            catch (ArgumentNullException)
            {
                startIndex = 0;
            }

            Int32 count = 10;

            valoracionesB = opinadorService.FindValoracionesAndNoteByVendedor(vendedorId, startIndex, count);
            int numValor = valoracionesB.NumValoraciones;

            if (numValor == 0)
            {
                lblNoValoraciones.Visible = true;
            }
            foreach (Valoracion c in valoracionesB.Valoraciones)
            {
                c.UserProfileReference.Load();
            }

            this.gvValoraciones.DataSource = valoracionesB.Valoraciones;
            this.gvValoraciones.DataBind();

            /* "Previous" link */
            if ((startIndex - count) >= 0)
            {
                String url = "./ShowValoraciones.aspx?vendedorId=" + vendedorId + "&startIndex=" + (startIndex - count);

                this.lnkAnterior.NavigateUrl = Response.ApplyAppPathModifier(url);
                this.lnkAnterior.Visible     = true;
            }

            /* "Next" link */
            if ((startIndex + count) < numValor)
            {
                String url = "./ShowValoraciones.aspx" + "?vendedorId=" + vendedorId + "&startIndex=" + (startIndex + count);
                this.lnkSiguiente.NavigateUrl = Response.ApplyAppPathModifier(url);
                this.lnkSiguiente.Visible     = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /* Hide the links */
            lnkAnterior.Visible  = false;
            lnkSiguiente.Visible = false;

            /* Get de Service */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            int  startIndex;
            long idProducto = long.Parse(Request.Params.Get("idProducto"));

            try
            {
                startIndex = Int32.Parse(Request.Params.Get("startIndex"));
            }
            catch (ArgumentNullException)
            {
                startIndex = 0;
            }

            Int32 count = 5;

            if (opinadorService.FindComentariosByProductoId(idProducto, startIndex, count).Count == 0)
            {
                lblNoComments.Visible = true;
            }

            List <Comentario> comentarios = opinadorService.FindComentariosByProductoId(idProducto, startIndex, count);

            foreach (Comentario c in comentarios)
            {
                c.UserProfileReference.Load();
            }
            this.gvReviews.DataSource = comentarios;
            this.gvReviews.DataBind();

            int numeroDeComentarios = opinadorService.GetNumberOfComentariosByProductoId(idProducto);

            /* "Previous" link */
            if ((startIndex - count) >= 0)
            {
                String url = "./ShowComments.aspx?idProducto=" + idProducto + "&startIndex=" + (startIndex - count);

                this.lnkAnterior.NavigateUrl = Response.ApplyAppPathModifier(url);
                this.lnkAnterior.Visible     = true;
            }

            /* "Next" link */
            if ((startIndex + count) < numeroDeComentarios)
            {
                String url = "./ShowComments.aspx" + "?idProducto=" + idProducto + "&startIndex=" + (startIndex + count);
                this.lnkSiguiente.NavigateUrl = Response.ApplyAppPathModifier(url);
                this.lnkSiguiente.Visible     = true;
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SessionManager.IsUserAuthenticated(this.Context))
            {
                Response.Redirect("./User/Authentication.aspx?ReturnUrl=../ShowFavorites.aspx");
            }
            /* Hide the links */
            lnkAnterior.Visible  = false;
            lnkSiguiente.Visible = false;

            /* Get de Service */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            int         startIndex;
            UserSession userSession = (UserSession)Context.Session["userSession"];
            long        idUser      = userSession.UserProfileId;

            try
            {
                startIndex = Int32.Parse(Request.Params.Get("startIndex"));
            }
            catch (ArgumentNullException)
            {
                startIndex = 0;
            }

            Int32 count    = 10;
            int   numValor = opinadorService.FindFavoritosByUsrId(idUser, startIndex, count).Count();

            if (numValor == 0)
            {
                lblNoFavoritos.Visible = true;
            }

            this.gvFavoritos.DataSource = opinadorService.FindFavoritosByUsrId(idUser, startIndex, count);
            this.gvFavoritos.DataBind();

            /* "Previous" link */
            if ((startIndex - count) >= 0)
            {
                String url = "./ShowFavorites.aspx?" + "&startIndex=" + (startIndex - count);

                this.lnkAnterior.NavigateUrl = Response.ApplyAppPathModifier(url);
                this.lnkAnterior.Visible     = true;
            }

            /* "Next" link */
            if ((startIndex + count) < numValor)
            {
                String url = "./ShowFavorites.aspx" + "&startIndex=" + (startIndex + count);
                this.lnkSiguiente.NavigateUrl = Response.ApplyAppPathModifier(url);
                this.lnkSiguiente.Visible     = true;
            }
        }
Exemple #5
0
        public static void MyClassInitialize(TestContext testContext)
        {
            container = TestManager.ConfigureUnityContainer("unity");

            opinadorService = container.Resolve <IOpinadorService>();
            userProfileDao  = container.Resolve <IUserProfileDao>();
            valoracionDao   = container.Resolve <IValoracionDao>();
            comentarioDao   = container.Resolve <IComentarioDao>();
            etiquetaDao     = container.Resolve <IEtiquetaDao>();
            favoritoDao     = container.Resolve <IFavoritoDao>();
        }
        protected void CloudTag()
        {
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            foreach (Model.Etiqueta e in opinadorService.FindFrequentEtiquetas())
            {
                // string tagInUrl = Server.UrlEncode(s);
                HyperLink link = new HyperLink();
                link.Text        = e.tag;
                link.NavigateUrl = String.Format("./Pages/ShowCommentsByTag.aspx?tag={0}", e.tag);
                link.CssClass    = GetCssClass(e.ocurrencias);
                ContentPlaceHolder1.Controls.Add(link);
                ContentPlaceHolder1.Controls.Add(new LiteralControl("  "));
            }
        }
Exemple #7
0
        protected void gvFavoritos_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
            int index = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Remove")
            {
                UserSession      userSession     = (UserSession)Context.Session["UserSession"];
                IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
                IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

                var colsNoVisible = gvFavoritos.DataKeys[0].Values[0];

                opinadorService.RemoveFavorito(userSession.UserProfileId, Convert.ToInt32(colsNoVisible));
            }
            Response.Redirect("./ShowFavorites.aspx");
        }
Exemple #8
0
        protected void BtnVoteClick(object sender, EventArgs e)
        {
            /* Get data. */
            String comment    = this.txtComment.Text;
            Int16  vote       = Convert.ToInt16(this.ddlVote.SelectedValue);
            string vendedorId = Request.Params.Get("vendedor");

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

            /* Do action. */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            opinadorService.ValorarUsuario(vendedorId, idUsuario, vote, comment);
            Response.Redirect(Response.ApplyAppPathModifier("./Mainpage.aspx"));
        }
        protected void BtnAccept_Click(object sender, EventArgs e)
        {
            /* Get data. */
            String comment   = this.txtNewComment.Text;
            long   idComment = long.Parse(Request.Params.Get("id"));

            UserSession userSession = (UserSession)Context.Session["userSession"];

            long idUsuario = userSession.UserProfileId;

            /* Do action. */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            opinadorService.ModifyComentarioAndEtiqueta(idComment, comment, null);
            Response.Redirect(Response.ApplyAppPathModifier("./Mainpage.aspx"));
        }
Exemple #10
0
        protected void BtnAcceptClick(object sender, EventArgs e)
        {
            /* Get data. */
            String bookmark   = this.txtFavorito.Text;
            long   idProducto = long.Parse(Request.Params.Get("idProducto"));
            string comment    = this.txtComment.Text;

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


            /* Do action. */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            opinadorService.AddFavorito(idUsuario, idProducto, bookmark, comment);
            Response.Redirect(Response.ApplyAppPathModifier("./Mainpage.aspx"));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SessionManager.IsUserAuthenticated(Context))
            {
                Response.Redirect(Response.ApplyAppPathModifier("./User/Authentication.aspx?ReturnUrl=ModifyComment.aspx"));
            }
            UserSession userSession = (UserSession)Context.Session["userSession"];
            long        idUsuario   = userSession.UserProfileId;
            long        idComment   = long.Parse(Request.Params.Get("id"));

            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();
            IComentarioDao   comentarioDao   = container.Resolve <IComentarioDao>();
            long             user            = comentarioDao.Find(idComment).usrId;

            if (!user.Equals(idUsuario))
            {
                Response.Redirect(Response.ApplyAppPathModifier("./NonExistAutorization.aspx"));
            }
        }
Exemple #12
0
        protected void BtnAcceptClick(object sender, EventArgs e)
        {
            /* Get data. */
            String comment    = this.txtComment.Text;
            string tagsString = this.txtTag.Text;

            string[] tags       = tagsString.Split(',');
            long     idProducto = long.Parse(Request.Params.Get("idProducto"));

            UserSession userSession = (UserSession)Context.Session["userSession"];

            long idUsuario = userSession.UserProfileId;

            /* Do action. */
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();

            opinadorService.AddComentarioEtiqueta(idUsuario, idProducto, comment, tags.ToList());
            Response.Redirect(Response.ApplyAppPathModifier("./Mainpage.aspx"));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int    startIndex;
            String productName = Request.Params.Get("name");

            try
            {
                startIndex = Int32.Parse(Request.Params.Get("startIndex"));
            }
            catch (ArgumentNullException)
            {
                startIndex = 0;
            }
            IUnityContainer  container       = (IUnityContainer)HttpContext.Current.Application["unityContainer"];
            IOpinadorService opinadorService = container.Resolve <IOpinadorService>();
            /* Get Products*/
            XmlDocument xmlDocument = opinadorService.FindProductos(productName, startIndex);

            aspXML.XPathNavigator  = xmlDocument.CreateNavigator();
            aspXML.TransformSource = Server.MapPath("../XSLT/ShowProducts.xsl");

            XsltArgumentList argList = new XsltArgumentList();

            argList.AddParam("name", "", GetLocalResourceObject("name"));
            argList.AddParam("price", "", GetLocalResourceObject("price"));
            argList.AddParam("remainingTime", "", GetLocalResourceObject("remainingTime"));
            argList.AddParam("vendedor", "", GetLocalResourceObject("vendedor"));
            argList.AddParam("showVotes", "", GetLocalResourceObject("showVotes"));
            argList.AddParam("favorito", "", GetLocalResourceObject("favorito"));


            argList.AddParam("addComment", "", GetLocalResourceObject("addComment"));
            String urlAddComment = Response.ApplyAppPathModifier("./Comment.aspx?idProducto=");

            argList.AddParam("urlAddComment", "", urlAddComment);

            argList.AddParam("showComment", "", GetLocalResourceObject("showComment"));
            String urlShowComment = Response.ApplyAppPathModifier("./ShowComments.aspx?idProducto=");

            argList.AddParam("urlShowComment", "", urlShowComment);

            argList.AddParam("vote", "", GetLocalResourceObject("vote"));
            String urlVote = Response.ApplyAppPathModifier("./Vote.aspx?Vendedor=");

            argList.AddParam("urlVote", "", urlVote);

            argList.AddParam("showPuntuation", "", GetLocalResourceObject("showPuntuation"));
            String urlShowPuntuation = Response.ApplyAppPathModifier("./ShowPuntuations.aspx?Vendedor=");

            argList.AddParam("urlShowPuntuation", "", urlShowPuntuation);

            String urlFavorito = Response.ApplyAppPathModifier("./AddFavorito.aspx?idProducto=");

            argList.AddParam("urlFavorito", "", urlFavorito);

            aspXML.TransformArgumentList = argList;

            Boolean     existMoreProducts = true;
            int         startIndex2       = 0;
            XmlNodeList nodes             = xmlDocument.GetElementsByTagName("ExistMoreProducts");


            if (nodes[0].FirstChild.InnerText == "\nfalse\n")
            {
                existMoreProducts = false;
            }
            int count = 10;

            if (startIndex != 0)
            {
                if (startIndex - count > 0)
                {
                    startIndex = startIndex - count;
                }
                else
                {
                    startIndex = 0;
                }

                lnkAnterior.NavigateUrl = Response.ApplyAppPathModifier(lnkAnterior.NavigateUrl + productName + "&startIndex=" + startIndex);
            }
            else
            {
                lnkAnterior.Visible = false;
            }

            if (existMoreProducts)
            {
                startIndex2 = startIndex2 + count;
                lnkSiguiente.NavigateUrl = Response.ApplyAppPathModifier(lnkSiguiente.NavigateUrl + productName + "&startIndex=" + startIndex2);
            }
            else
            {
                lnkSiguiente.Visible = false;
            }
        }