Esempio n. 1
0
 /// <inheritdoc />
 public override string ToString()
 {
     return(Index + ", r=" + RowSpan.ToString() + ", c=" + ColumnSpan.ToString());
 }
Esempio n. 2
0
        public void Render(HtmlTextWriter writer, int level, int inLevel, int maxRowSpan, Dictionary <string, BaseColumn> columnsDic, BaseJournalControl journalControl, List <RowProperties> rowsPropertieses)
        {
            if (level == 0 && !HideInHeader)
            {
                int height = 0;
                for (int i = inLevel; i < inLevel + RowSpan; i++)
                {
                    if (rowsPropertieses.Count <= i || rowsPropertieses[i].Height == null || rowsPropertieses[i].Height == 0)
                    {
                        height = 0;
                        break;
                    }
                    height += rowsPropertieses[i].Height.Value;
                    if (i > inLevel)
                    {
                        height += 11;
                    }
                }
                writer.WriteLine();
                writer.AddAttribute("onmousemove", "changeWidthOnCellMouseMove(event, this);");
                writer.AddAttribute("onmousedown", "changeWidthCellMouseDown(event, this);");
                writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, RowSpan.ToString());
                writer.AddAttribute(HtmlTextWriterAttribute.Colspan, ColSpan.ToString());
                //writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
                if (Width > 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Width + "px");
                }
                if (height > 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Height, height + "px");
                }
                if (!string.IsNullOrEmpty(BColor))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, BColor);
                }
                if (!string.IsNullOrEmpty(PColor))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, PColor);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Th);//th

                var isIE = "IE".Equals(HttpContext.Current.Request.Browser.Browser, StringComparison.OrdinalIgnoreCase) &&
                           string.Compare("9.0", HttpContext.Current.Request.Browser.Version, StringComparison.OrdinalIgnoreCase) > 0;

                if (IsVerticalHeader && !isIE)
                {
                    if (Width > 0)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Height, Width + "px");
                    }
                    if (height > 0)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Width, height + "px");
                    }
                    if (Width > 0 && height > 0)
                    {
                        writer.AddStyleAttribute("margin-top", (height - Width) / 2 + "px");
                        writer.AddStyleAttribute("margin-bottom", (height - Width) / 2 + "px");
                        writer.AddStyleAttribute("margin-left", (Width - height) / 2 + "px");
                        writer.AddStyleAttribute("margin-right", (Width - height) / 2 + "px");
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "DefaultRotate270Deg");
                    }

                    writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left");
                }
                else
                {
                    if (Width > 0)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Width + "px");
                    }
                    if (height > 0)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Height, height + "px");
                    }
                    if (IsVerticalHeader)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "IE8Rotate270Deg");
                    }
                }

                if (Width > 0 || height > 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "hidden");
                }
                if (!string.IsNullOrEmpty(ToolTipRu) && !LocalizationHelper.IsCultureKZ)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTipRu);
                }
                else if (!string.IsNullOrEmpty(ToolTipKz) && LocalizationHelper.IsCultureKZ)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTipKz);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Div);                                           //div

                if (BaseColumn == null && CrossColumnIDObject != null && IsTreeColumn && !HideTreeLink) //если это иерархичная кросс колонка
                {
                    var postBack = journalControl.Page.ClientScript.GetPostBackClientHyperlink(
                        journalControl,
                        string.Format("FilterBy:{0}:Equals:{1}:{2}",
                                      BaseFilterParameter.TreeStartLevelFilterName + CrossColumnHeaderRow.GetType().Name,
                                      CrossColumnIDObject,
                                      Header));
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, postBack);
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, Resources.SFilterHeader);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    RenderHeaderText(writer);
                    writer.RenderEndTag();
                }
                else if (!string.IsNullOrEmpty(HyperLinkUrl) || !string.IsNullOrEmpty(HyperLinkOnClick))
                {
                    var url    = string.IsNullOrEmpty(HyperLinkUrl) ? "javascript:void(0);" : HyperLinkUrl;
                    var target = string.IsNullOrEmpty(HyperLinkTarget) ? "_blank" : HyperLinkTarget;
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, url);
                    writer.AddAttribute(HtmlTextWriterAttribute.Target, target);
                    if (!string.IsNullOrEmpty(HyperLinkOnClick))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, HyperLinkOnClick);
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    RenderHeaderText(writer);
                    writer.RenderEndTag();//A
                }
                else
                {
                    RenderHeaderText(writer);
                }

                writer.RenderEndTag();//div

                /*var column = string.IsNullOrEmpty(ColumnName) ? null : columnsDic[ColumnName];
                 * if (column != null && false)
                 * {
                 *  if (column.OrderColumnNameRu != null && !LocalizationHelper.IsCultureKZ)
                 *      RenderHeaderOrder(writer, column.OrderColumnNameRu, journalControl);
                 *  else if (column.OrderColumnNameKz != null && LocalizationHelper.IsCultureKZ)
                 *      RenderHeaderOrder(writer, column.OrderColumnNameKz, journalControl);
                 *  if (column.OrderColumnName != null)
                 *      RenderHeaderOrder(writer, column.OrderColumnName, journalControl);
                 * }*/

                writer.RenderEndTag();//Th
            }
            foreach (var child in GetChilds().Where(r => r.IsVisibleColumn(columnsDic)))
            {
                child.Render(writer, level - RowSpan, inLevel + RowSpan, maxRowSpan - RowSpan, columnsDic, journalControl, rowsPropertieses);
            }
        }