public static Color HexToColor(string hexString) { Color colorDefault = Color.White; try { // REPLACE # OCCURENCES if (hexString.IndexOf('#') != -1) { hexString = hexString.Replace("#", ""); } int RED, GREEN, BLUE = 0; RED = int.Parse(hexString.Substring(0, 2), NumberStyles.AllowHexSpecifier); GREEN = int.Parse(hexString.Substring(2, 2), NumberStyles.AllowHexSpecifier); BLUE = int.Parse(hexString.Substring(4, 2), NumberStyles.AllowHexSpecifier); colorDefault = Color.FromArgb(RED, GREEN, BLUE); } catch (Exception ex) { HelpLogging.Write(TraceLevel.Error, string.Concat("HelpColor.", MethodBase.GetCurrentMethod().Name), ex, "USERerror", "0"); } return(colorDefault); }
public static ReturnValor mTraerMensaje(Exception ex, bool indServicio = false, string pOrigen = "", string pUser = "******", string pEmpresa = "Empresa") { HelpLogging.Write(TraceLevel.Error, pOrigen, ex, string.Concat("Empresa: ", pEmpresa, " - User: "******"System.Data.SqlClient.SqlException": oReturn = mSqlException(ex); break; case "System.IO.DirectoryNotFoundException": oReturn = mDirectoryNotFoundException(ex); break; case "System.ApplicationException": oReturn = mApplicationException(ex); break; default: oReturn = mException(ex, indServicio); break; } oReturn.Exitosa = false; return(oReturn); }