Exemplo n.º 1
0
 public static string ToExport(
     this string value, Context context, Column column, ExportColumn exportColumn = null)
 {
     if (column.HasChoices())
     {
         var choiceParts = column.ChoiceParts(
             context: context,
             selectedValues: value,
             type: exportColumn?.Type ?? ExportColumn.Types.Text);
         return(!exportColumn?.ChoiceValue.IsNullOrEmpty() == true
             ? column.MultipleSelections == true
                 ? value.Deserialize <List <string> >()?.Contains(exportColumn.ChoiceValue) == true
                     ? "1"
                     : string.Empty
                 : value == exportColumn.ChoiceValue
                     ? "1"
                     : string.Empty
             : column.MultipleSelections == true
                 ? choiceParts.ToJson()
                 : choiceParts.FirstOrDefault());
     }
     else
     {
         return(value);
     }
 }
Exemplo n.º 2
0
 public string ToExport(Column column, ExportColumn exportColumn = null)
 {
     return(this.Select(o =>
                        o.CreatedTime.ToLocal().ToViewText() + " " +
                        SiteInfo.UserName(o.Creator) + "\n" +
                        o.Body).Join("\n\n"));
 }
 public static string ToExport(
     this string value, Column column, ExportColumn exportColumn = null)
 {
     return(column.HasChoices()
         ? column.ChoicePart(value, exportColumn?.Type ?? ExportColumn.Types.Text)
         : value);
 }
Exemplo n.º 4
0
 public string ToExport(Context context, Column column, ExportColumn exportColumn = null)
 {
     return(DisplayValue.Display(
                exportColumn?.Format ??
                column?.EditorFormat ??
                "Ymd"));
 }
Exemplo n.º 5
0
 public static string ToExport(
     this string value, Column column, ExportColumn exportColumn)
 {
     return(column.HasChoices()
         ? column.ChoicePart(value, exportColumn.Type)
         : value);
 }
Exemplo n.º 6
0
 public static string ToExport(
     this DateTime value, Column column, ExportColumn exportColumn)
 {
     return(value.InRange()
         ? value.ToLocal().Display(exportColumn.Format)
         : string.Empty);
 }
Exemplo n.º 7
0
 public static string ToExport(
     this bool value, Context context, Column column, ExportColumn exportColumn = null)
 {
     return(value
         ? "1"
         : string.Empty);
 }
 public static string ToExport(
     this decimal value, Context context, Column column, ExportColumn exportColumn = null)
 {
     return(column.Display(
                context: context,
                value: value,
                format: false));
 }
Exemplo n.º 9
0
 public string ToExport(IContext context, Column column, ExportColumn exportColumn = null)
 {
     return(this.Select(o =>
                        o.CreatedTime.ToLocal(context: context).ToViewText(context: context) + " " +
                        SiteInfo.UserName(
                            context: context,
                            userId: o.Creator) + "\n" +
                        o.Body).Join("\n\n"));
 }
Exemplo n.º 10
0
 public string ToExport(Context context, Column column, ExportColumn exportColumn = null)
 {
     return(!Anonymous()
         ? column.ChoicePart(
                context: context,
                selectedValue: Id.ToString(),
                type: exportColumn?.Type ?? ExportColumn.Types.Text)
         : string.Empty);
 }
 static void SetPositionAndSize(FrameworkElement element, ExportColumn column)
 {
     if (column == null)
     {
         throw new ArgumentNullException("column");
     }
     SetPosition(element, column);
     SetDimension(element, column);
 }
Exemplo n.º 12
0
 public string ToExport(Context context, Column column, ExportColumn exportColumn = null)
 {
     return Value == 0 && !column.ChoiceHash.ContainsKey(ToString())
         ? null
         : column.ChoicePart(
             context: context,
             selectedValue: ToString(),
             type: exportColumn?.Type ?? ExportColumn.Types.Text);
 }
 public static string ToExport(
     this DateTime value, Column column, ExportColumn exportColumn = null)
 {
     return(value.InRange()
         ? value.ToLocal().Display(
                exportColumn?.Format ??
                column?.EditorFormat ??
                "Ymd")
         : string.Empty);
 }
 public static string ToExport(
     this string value, Context context, Column column, ExportColumn exportColumn = null)
 {
     return(column.HasChoices()
         ? column.ChoicePart(
                context: context,
                selectedValue: value,
                type: exportColumn?.Type ?? ExportColumn.Types.Text)
         : value);
 }
Exemplo n.º 15
0
 public string ToExport(
     Context context,
     Column column,
     ExportColumn exportColumn = null)
 {
     return(column.Display(
                context: context,
                value: Value,
                format: false));
 }
Exemplo n.º 16
0
        public virtual string ToExport(Context context, Column column, ExportColumn exportColumn = null)
        {
            switch (exportColumn.Type)
            {
            case ExportColumn.Types.Value:
                return(Value);

            default:
                return(DisplayValue);
            }
        }
Exemplo n.º 17
0
 public static void ToExportItem(this ExportColumn export, PrintableItem item)
 {
     export.Name       = item.Name;
     export.Location   = item.Location;
     export.Size       = item.Size;
     export.ForeColor  = item.ForeColor;
     export.FrameColor = item.FrameColor;
     export.BackColor  = item.BackColor;
     export.CanGrow    = item.CanGrow;
     export.DrawBorder = item.DrawBorder;
 }
Exemplo n.º 18
0
        // internal for testing
        internal int GetColumnIndex(ExportColumn column)
        {
            int columnNumber = (int)column;

            if (column != ExportColumn.BlockId && !IncludeVoiceActors)
            {
                columnNumber--;
            }
            if (column == ExportColumn.VernacularTextLength)
            {
                if (!Project.ReferenceText.HasSecondaryReferenceText)
                {
                    columnNumber--;
                }
            }
            if (column > ExportColumn.CharacterId && LocalizationManager.UILanguageId != "en")
            {
                columnNumber++;
            }
            return(columnNumber);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 设置表头单元格字体是否加粗,默认加粗
        /// </summary>
        /// <param name="al"></param>
        private void SetHeadCellBold(ExportColumn al)
        {
            switch (al.fontweight)
            {
            case "bold":
                HeadFontWeight = (short)FontBoldWeight.Bold;
                break;

            case "none":
                HeadFontWeight = (short)FontBoldWeight.None;
                break;

            case "normal":
                HeadFontWeight = (short)FontBoldWeight.Normal;
                break;

            default:
                HeadFontWeight = (short)FontBoldWeight.Normal;
                break;
            }
        }
Exemplo n.º 20
0
        private void MenuCallback(object obj)
        {
            if (sideMenuIndex >= 0)
            {
                int          i       = sideMenuIndex;
                ExportColumn _column = exportColumns[i];

                switch (obj.ToString())
                {
                case "Move to top":
                    exportColumns.Remove(_column);
                    exportColumns.Insert(0, _column);
                    break;

                case "Move up":
                    exportColumns.Remove(_column);
                    exportColumns.Insert(i - 1, _column);
                    break;

                case "Move to bottom":
                    exportColumns.Remove(_column);
                    exportColumns.Insert(exportColumns.Count, _column);
                    break;

                case "Move down":
                    exportColumns.Remove(_column);
                    exportColumns.Insert(i + 1, _column);
                    break;

                case "Delete":
                    exportColumns.Remove(_column);
                    break;
                }
            }

            sideMenuIndex = -1;
        }
Exemplo n.º 21
0
 public string ToExport(Context context, Column column, ExportColumn exportColumn = null)
 {
     return(Value.ToString());
 }
Exemplo n.º 22
0
 public static string ToExport(
     this Enum value, Context context, Column column, ExportColumn exportColumn = null)
 {
     return(value.ToString());
 }
Exemplo n.º 23
0
 public static string ToExport(
     this long value, Context context, Column column, ExportColumn exportColumn = null)
 {
     return(value.ToString(column.StringFormat));
 }
Exemplo n.º 24
0
 public static string ToExport(
     this TimeZoneInfo value, Context context, Column column, ExportColumn exportColumn = null)
 {
     return(value?.StandardName);
 }
Exemplo n.º 25
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public string ToExport(Context context, Column column, ExportColumn exportColumn = null)
 {
     return(DeptName);
 }
Exemplo n.º 26
0
 public virtual string ToExport(
     Context context, Column column, ExportColumn exportColumn = null)
 {
     return(ToString());
 }
Exemplo n.º 27
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public string ToExport(Column column, ExportColumn exportColumn)
 {
     return(SiteInfo.UserName(UserId));
 }
Exemplo n.º 28
0
 public virtual string ToExport(Column column, ExportColumn exportColumn)
 {
     return(Value);
 }
Exemplo n.º 29
0
 public virtual string ToExport(
     Context context, Column column, ExportColumn exportColumn = null)
 {
     return(Title(context: context));
 }
Exemplo n.º 30
0
 public string ToExport(Column column, ExportColumn exportColumn = null)
 {
     return(Value == 0 && !column.ChoiceHash.ContainsKey(ToString())
         ? null
         : column.ChoicePart(ToString(), exportColumn?.Type ?? ExportColumn.Types.Text));
 }