コード例 #1
0
        /// <summary>
        /// GetTextCore
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            DataCell cell = gridElement as DataCell;

            if (cell == null)
            {
                return(null);
            }
            if (cell.Value == null)
            {
                Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow;
                if (row == null)
                {
                    return(null);
                }
                if (row.DetailGrids.Count == 0)
                {
                    return(null);
                }
                MyDetailGrid detailGrid = row.DetailGrids[0] as MyDetailGrid;
                if (detailGrid == null)
                {
                    return(null);
                }

                string functionName, fieldName, format, where;
                int    level = -1;

                MySummaryRow.ExtractParameters(m_statisticsFormat, out functionName, out fieldName, out format, ref level, out where);
                cell.Value = Feng.Utils.ConvertHelper.ChangeType(MySummaryRow.GetVariableFunctionResult(detailGrid.GetSortedDataRows(true),
                                                                                                        functionName, fieldName, format, level, where), cell.ParentColumn.DataType);
            }
            return(base.GetTextCore(value, formatInfo, gridElement));
        }
コード例 #2
0
        /// <summary>
        /// GetTextCore
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            string rawText = base.GetTextCore(value, formatInfo, gridElement);

            //bool more = false;
            //if (rawText.Length > 20)
            //{
            //    rawText = rawText.Substring(0, 20);
            //    more = true;
            //}
            //int idx = rawText.IndexOf(System.Environment.NewLine);
            //if (idx != -1)
            //{
            //    rawText = rawText.Substring(0, idx);
            //    more = true;
            //}

            //if (more)
            //{
            //    rawText += "   ...";
            //}

            rawText = rawText.Replace(System.Environment.NewLine, " ");
            return(rawText);
        }
コード例 #3
0
        /// <summary>
        /// GetTextCore
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            DataCell cell = gridElement as DataCell;
            if (cell == null)
                return null;
            if (cell.Value == null)
            {
                Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow;
                if (row == null)
                    return null;
                if (row.DetailGrids.Count == 0)
                    return null;
                MyDetailGrid detailGrid = row.DetailGrids[0] as MyDetailGrid;
                if (detailGrid == null)
                    return null;

                string functionName, fieldName, format, where;
                int level = -1;

                MySummaryRow.ExtractParameters(m_statisticsFormat, out functionName, out fieldName, out format, ref level, out where);
                cell.Value = Feng.Utils.ConvertHelper.ChangeType(MySummaryRow.GetVariableFunctionResult(detailGrid.GetSortedDataRows(true),
                                            functionName, fieldName, format, level, where), cell.ParentColumn.DataType);
            }
            return base.GetTextCore(value, formatInfo, gridElement);
        }
コード例 #4
0
 protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
 {
     string s = (string)value;
     if (string.IsNullOrEmpty(s))
         return string.Empty;
     string[] ss = s.Split(new char[] { '/', '-' }, StringSplitOptions.RemoveEmptyEntries);
     if (ss.Length < 2)
         return string.Empty;
     return ss[1];
 }
コード例 #5
0
 /// <summary>
 /// GetTextCore
 /// </summary>
 /// <param name="value"></param>
 /// <param name="formatInfo"></param>
 /// <param name="gridElement"></param>
 /// <returns></returns>
 protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
 {
     if (value == null)
     {
         return string.Empty;
         // 如果返回null会引发GetFittedWidth异常
         // return null;
     }
     else
     {
         // 不带引号
         return EntityHelper.ReplaceEntity(m_displayMember, value, null);
     }
 }
コード例 #6
0
 /// <summary>
 /// GetTextCore
 /// </summary>
 /// <param name="value"></param>
 /// <param name="formatInfo"></param>
 /// <param name="gridElement"></param>
 /// <returns></returns>
 protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
 {
     if (value == null)
     {
         return(string.Empty);
         // 如果返回null会引发GetFittedWidth异常
         // return null;
     }
     else
     {
         // 不带引号
         return(EntityHelper.ReplaceEntity(m_displayMember, value, null));
     }
 }
コード例 #7
0
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            string s = (string)value;

            if (string.IsNullOrEmpty(s))
            {
                return(string.Empty);
            }
            string[] ss = s.Split(new char[] { '/', '-' }, StringSplitOptions.RemoveEmptyEntries);
            if (ss.Length < 2)
            {
                return(string.Empty);
            }
            return(ss[1]);
        }
コード例 #8
0
 protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
 {
     bool? v = Feng.Utils.ConvertHelper.ToBoolean(value);
     if (v.HasValue)
     {
         if (v.Value)
             return m_yesText;
         else
             return m_noText;
     }
     else
     {
         return null;
     }
 }
コード例 #9
0
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            bool?v = Feng.Utils.ConvertHelper.ToBoolean(value);

            if (v.HasValue)
            {
                if (v.Value)
                {
                    return(m_yesText);
                }
                else
                {
                    return(m_noText);
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #10
0
        /// <summary>
        /// GetTextCore
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            DataCell cell = gridElement as DataCell;

            if (cell == null)
            {
                return(null);
            }
            if (cell.Value == null)
            {
                Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow;
                if (row == null)
                {
                    return(null);
                }
                if (row.DetailGrids.Count == 0)
                {
                    return(null);
                }
                IGrid grid = row.DetailGrids[0] as IGrid;
                if (grid == null)
                {
                    return(null);
                }
                SummaryRow sumRow = grid.GetSummaryRow();
                if (sumRow == null)
                {
                    return(null);
                }
                cell.Value = ConvertHelper.ChangeType(sumRow.Cells[m_detailColumnName].Value, cell.ParentColumn.DataType);
                return(sumRow.Cells[m_detailColumnName].Value == null ? null : sumRow.Cells[m_detailColumnName].Value.ToString());
            }
            else
            {
                return(base.GetTextCore(value, formatInfo, gridElement));
            }
        }
コード例 #11
0
        ///// <summary>
        ///// Consturctor
        ///// </summary>
        ///// <param name="dataSource"></param>
        ///// <param name="dataMember"></param>
        ///// <param name="valueMember"></param>
        ///// <param name="displayFormat"></param>
        //public MyComboBoxViewer(object dataSource, string dataMember, string valueMember, string displayFormat)
        //    : base(dataSource, dataMember, valueMember, displayFormat)
        //{
        //}

        /// <summary>
        /// GetTextCore
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            return(GetDisplay(value));
        }
コード例 #12
0
        /// <summary>
        /// GetTextCore
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
        {
            string rawText = base.GetTextCore(value, formatInfo, gridElement);

            //bool more = false;
            //if (rawText.Length > 20)
            //{
            //    rawText = rawText.Substring(0, 20);
            //    more = true;
            //}
            //int idx = rawText.IndexOf(System.Environment.NewLine);
            //if (idx != -1)
            //{
            //    rawText = rawText.Substring(0, idx);
            //    more = true;
            //}

            //if (more)
            //{
            //    rawText += "   ...";
            //}

            rawText = rawText.Replace(System.Environment.NewLine, " ");
            return rawText;
        }
コード例 #13
0
 protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
 {
     return null;
 }
コード例 #14
0
 protected override string GetTextCore(object value, CellTextFormatInfo formatInfo, GridElement gridElement)
 {
     return(m_text);
 }