/// <summary> /// 枚举描述转换成IList 将Enum的所有枚举值放到IList中,以绑定到如ComoboBox等控件 /// </summary> /// <param name="enumType"></param> /// <returns>返回的描述字符串数组 如["第一","第二","第三"]</returns> public static IList <string> ConvertEnumToList(Type enumType) { IList <string> list = new List <string>(); FieldInfo[] array = enumType.GetFields(); for (int i = 0; i < array.Length; i++) { FieldInfo fieldInfo = array[i]; object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(EnumText), false); if (customAttributes != null && customAttributes.Length > 0) { EnumText enumDescription = (EnumText)customAttributes[0]; list.Add(enumDescription.Description); } else if (fieldInfo.Name != "value__") { list.Add(fieldInfo.Name); } } return(list); }
/// <summary> /// 检查格式是否正确 /// </summary> /// <param name="input"></param> /// <param name="type"></param> /// <returns></returns> public static bool CheckIsValid(string input, EnumText type) { switch (type) { case EnumText.SpecialCharacter: return(checkIsValid(input, @"^[^'&\""]*$")); case EnumText.PasswordFormat: return(checkIsValid(input, @"^[A-Za-z0-9_\-]*$")); case EnumText.PasswordTooLong: if (input.Length > 50) { return(false); } return(true); default: break; } return(true); }
/// <summary> /// Copia los atributos del objeto /// </summary> /// <param name="source">Objeto origen</param> protected void CopyValues(FacturaProveedorInfo factura, ExpedienteInfo expediente, PResumen resumen) { if (factura == null) { return; } _n_serie = factura.NSerie; _n_factura = factura.NFactura; _fecha_fac = factura.Fecha; _fecha_prev = factura.Prevision; _fecha_pago = factura.FechaPagoFactura; _total = factura.Total; _pagado = factura.Pagado; _pendiente = factura.Pendiente; _detalles = factura.CuentaBancaria; _nombre_elemento = factura.NombreAcreedor; _tipo_elemento = EnumText <ETipoAcreedor> .GetLabel(factura.ETipoAcreedor); _efectos_negociados = factura.PendienteVencimiento; _efectos_devueltos = factura.Vencido; _efectos_pendientes_vto = factura.EfectosPendientesVto; if (expediente != null) { _contenedor = expediente.Contenedor; _codigo_expediente = expediente.Codigo; } else { _contenedor = "---"; _codigo_expediente = "No Asignado"; } if (resumen != null) { _total_estimado = resumen.TotalEstimado; } }
internal unsafe LineServicesCallbacks() { _pfnFetchRunRedefined = new FetchRunRedefined(this.FetchRunRedefined); _pfnFetchLineProps = new FetchLineProps(this.FetchLineProps); _pfnFetchPap = new FetchPap(this.FetchPap); _pfnGetRunTextMetrics = new GetRunTextMetrics(this.GetRunTextMetrics); _pfnGetRunCharWidths = new GetRunCharWidths(this.GetRunCharWidths); _pfnGetDurMaxExpandRagged = new GetDurMaxExpandRagged(this.GetDurMaxExpandRagged); _pfnDrawTextRun = new DrawTextRun(this.DrawTextRun); _pfnGetGlyphsRedefined = new GetGlyphsRedefined(this.GetGlyphsRedefined); _pfnGetGlyphPositions = new GetGlyphPositions(this.GetGlyphPositions); _pfnGetAutoNumberInfo = new GetAutoNumberInfo(this.GetAutoNumberInfo); _pfnDrawGlyphs = new DrawGlyphs(this.DrawGlyphs); _pfnGetObjectHandlerInfo = new GetObjectHandlerInfo(this.GetObjectHandlerInfo); _pfnGetRunUnderlineInfo = new GetRunUnderlineInfo(this.GetRunUnderlineInfo); _pfnGetRunStrikethroughInfo = new GetRunStrikethroughInfo(this.GetRunStrikethroughInfo); _pfnHyphenate = new Hyphenate(this.Hyphenate); _pfnGetNextHyphenOpp = new GetNextHyphenOpp(this.GetNextHyphenOpp); _pfnGetPrevHyphenOpp = new GetPrevHyphenOpp(this.GetPrevHyphenOpp); _pfnDrawUnderline = new DrawUnderline(this.DrawUnderline); _pfnDrawStrikethrough = new DrawStrikethrough(this.DrawStrikethrough); _pfnFInterruptShaping = new FInterruptShaping(this.FInterruptShaping); _pfnGetCharCompressionInfoFullMixed = new GetCharCompressionInfoFullMixed(this.GetCharCompressionInfoFullMixed); _pfnGetCharExpansionInfoFullMixed = new GetCharExpansionInfoFullMixed(this.GetCharExpansionInfoFullMixed); _pfnGetGlyphCompressionInfoFullMixed = new GetGlyphCompressionInfoFullMixed(this.GetGlyphCompressionInfoFullMixed); _pfnGetGlyphExpansionInfoFullMixed = new GetGlyphExpansionInfoFullMixed(this.GetGlyphExpansionInfoFullMixed); _pfnEnumText = new EnumText(this.EnumText); _pfnEnumTab = new EnumTab(this.EnumTab); }