Exemplo n.º 1
0
 public ActionResult agregarHistoria(int id)
 {
     var Equipo = db.equipo.FirstOrDefault(e => e.idEquipo.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Equipo.historia));
     Equipo.historia = h.ToString();
     return View(Equipo);
 }
Exemplo n.º 2
0
 public ActionResult agregarMultimedia(int id)
 {
     var Anuncio = db.anuncio.FirstOrDefault(e => e.idAnuncio.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Anuncio.fuenteGrafica));
     Anuncio.fuenteGrafica = h.ToString();
     return View(Anuncio);
 }
Exemplo n.º 3
0
 public ActionResult agregarContenido(int id)
 {
     var Pagina = db.pagina_informativa.FirstOrDefault(e => e.idPagina_Informativa.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Pagina.contenido));
     Pagina.contenido = h.ToString();
     return View(Pagina);
 }
Exemplo n.º 4
0
 public ActionResult agregarImagenPrincipal(int id)
 {
     var Noticia = db.noticia.FirstOrDefault(e => e.idNoticia.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Noticia.contenido));
     Noticia.imagenPrincipal = h.ToString();
     return View(Noticia);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Renders an icon image using the specified metadata.
        /// </summary>
        /// <param name="title">The title to use. If NULL, defaults to the value stored on the icon.</param>
        /// <param name="alt">The alt text. If NULL, defaults to the value stored on the icon.</param>
        /// <param name="url">A URL to link to. If not NULL, a link tag to this value is wrapped around the icon.</param>
        /// <param name="onclick">The onclick handler to render.</param>
        /// <param name="cssClass">The CSS class to assign to the image.</param>
        /// <param name="attributes">A dictionary of additional html attributes to render.</param>
        public static IHtmlString Icon(this HtmlHelper html,
			IIconMetaData icon,
			string title = null,
			string alt = null,
			string url = null,
			string onclick = null,
			string cssClass = null,
			object attributes = null)
        {
            var image = new TagBuilder("img");
            image.Attributes.Add("alt", alt ?? icon.AltText);
            image.Attributes.Add("title", title ?? icon.Title);

            SetOnclickHandler(onclick, image);
            SetCssClass(cssClass, image);
            SetImageSrc(html, icon, image);
            MergeHtmlAttributes(attributes, image);

            var imageTagHtml = new HtmlString(
                image.ToString(TagRenderMode.SelfClosing)
            );

            if (url.IsNotNullOrEmpty()) {
                imageTagHtml = new HtmlString(
                    String.Format("<a href=\"{0}\">{1}</a>", url, imageTagHtml.ToString())
                );
            }

            return imageTagHtml;
        }
Exemplo n.º 6
0
    public static string GetPageHtml(int total, int pageSize, int pageIndex)
    {
        int allpage = 0;//总页数
        int next = 0;//下一页
        int prev = 0;//上一页
        string pagestr = "";
        int startCount = 0;//开始页
        int endCount = 0;//结束页
        if (pageIndex < 1) { pageIndex = 1; }
        //计算总页数
        if (pageSize != 0)
        {
            allpage = (total / pageSize);
            allpage = ((total % pageSize) != 0 ? allpage + 1 : allpage);
            allpage = (allpage == 0 ? 1 : allpage);
        }
        next = pageIndex + 1;
        prev = pageIndex - 1;
        startCount = (pageIndex + 5) > allpage ? allpage - 9 : pageIndex - 4;//中间页起始序号
        endCount = pageIndex < 5 ? 10 : pageIndex + 5;
        if (startCount < 1) { startCount = 1; }
        if (allpage < endCount) { endCount = allpage; }
        pagestr += pageIndex > 1 ? "<a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3,1)\">首页</a><a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + prev + ")\">上一页</a>" : "";
        for (int i = startCount; i <= endCount; i++)
        {
            pagestr += pageIndex == i ? "<a id=\"current\">" + i + "</a>" : "<a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + i + ")\">" + i + "</a>";
        }
        pagestr += pageIndex != allpage ? "<a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + next + ")\">下一页</a><a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + allpage + ")\">尾页</a>" : "";

        var selectHtml = "<select onchange=\"$$.listSubmit(2,this)\"><option " + (pageSize == 5 ? "selected=\"selected\"" : "") + " >5</option><option " + (pageSize == 10 ? "selected=\"selected\"" : "") + ">10</option><option " + (pageSize == 30 ? "selected=\"selected\"" : "") + ">30</option><option " + (pageSize == 50 ? "selected=\"selected\"" : "") + ">50</option><option " + (pageSize == 100 ? "selected=\"selected\"" : "") + ">100</option></select>";
        HtmlString result = new HtmlString("<div class=\"M_pagination\"><span>共" + total + "条记录" + selectHtml + "</span>" + pagestr + "</div>");
        return result.ToString();
    }
Exemplo n.º 7
0
 public ActionResult agregarMultimedia(int id)
 {
     var Patrocinador = db.patrocinador.FirstOrDefault(e => e.idPatrocinador.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Patrocinador.fuenteGrafica));
     Patrocinador.fuenteGrafica = h.ToString();
     return View(Patrocinador);
 }
Exemplo n.º 8
0
 public ActionResult agregarHistoria(int id)
 {
     var Jugadora = db.jugadora.FirstOrDefault(e => e.idJugadora.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Jugadora.historia));
     Jugadora.historia = h.ToString();
     return View(Jugadora);
 }
Exemplo n.º 9
0
        private  string LoadTemplate(string templatePath)
        {
            HtmlString html;
            using (var sr = new StreamReader("Resources/AlertNotificationTemplate.html"))
            {
                var file = sr.ReadToEnd();
                html = new HtmlString(file);
            }
           

            string rawEmail = html.ToString();
            return rawEmail;
        }
Exemplo n.º 10
0
        public HtmlString ProcessChoosenItems(string parametersId, string distMatrixId, string flowMatrixId)
        {
            Parameters parameters = _parametersRepository.Get(Convert.ToInt32(parametersId));
            DistMatrix distMatrix = _distMatricesRepository.Get(Convert.ToInt32(distMatrixId));
            FlowMatrix flowMatrix = _flowMatricesRepository.Get(Convert.ToInt32(flowMatrixId));

            Stream paramStream = new MemoryStream(Encoding.UTF8.GetBytes(parameters.StringView));
            string graph = string.Format("{0}\n{1}", distMatrix.MatrixView, flowMatrix.MatrixView);
            Stream graphStream = new MemoryStream(Encoding.UTF8.GetBytes(graph));

            _qapAntAlgorithm = _standartAlgorithmBuilder.GetAlgorithm<QapGraph>(paramStream);
            QapGraph qapGraph = new QapGraph().Load(graphStream, _qapAntAlgorithm.NAnts);
            _qapAntAlgorithm.Calculate(qapGraph);

            HtmlString result = new HtmlString(_qapAntAlgorithm.Result);
            int pathCost = _qapAntAlgorithm.BestAnt.PathCost;

            ResultInfo resultInfo = new ResultInfo
            {
                ParametersId = parameters.Id,
                DistMatrixId = distMatrix.Id,
                FlowMatrixId = flowMatrix.Id,
                Result = result.ToString(),
                PathCost = pathCost
            };

            _resultsInfoRepository.Add(resultInfo);
            return result;
        }
Exemplo n.º 11
0
    /// <summary>
    /// Creates a HTML Select Tag with options from 0 to the amount of each Product of the row
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string cssclass = "id" + Convert.ToInt16(e.Row.Cells[2].Text);
            HtmlString select = new HtmlString("<select class='span2 quantity "+ cssclass +"' name='Cantidad'>");
            HtmlString selectend = new HtmlString("</select>");

            GridViewRow gvr = (GridViewRow)e.Row.Cells[1].NamingContainer;

            string options = "";
            for (int i = 0; i <= Convert.ToInt16(e.Row.Cells[5].Text); i++)
            {
                options += "<option value='"+i.ToString()+"'>"+i.ToString()+"</option>";
            }

            gvr.Cells[1].Text = select.ToString() + options + selectend.ToString();
        }
    }
 private static Dictionary<string, string> ToAttributesDictionary(HtmlString htmlString)
 {
   return htmlString.ToString().Split(' ').Select(x => x.Split('=')).ToDictionary(x => x[0], val => val.Length == 1 ? "" : val[1].Trim('\'', '"'));
 }