示例#1
0
        public static void ShowSqlException(SqlException ex)
        {
            FrmMessageError FrmError = new FrmMessageError();
            String          Message  = "";
            String          Details  = "";
            Bitmap          Icon     = null;

            switch (ex.Number)
            {
            case 547:
                Int32    StartIndex = ex.Message.IndexOf("FK_");
                Int32    EndIndex   = ex.Message.IndexOf(".");
                String   Me         = ex.Message.Substring(StartIndex, EndIndex - StartIndex - 1);
                String[] Tables     = Me.Split('_');
                Message = "No es posible la eliminación.";
                Details = String.Format("La entidad {0} se encuentra relacionada con 1 o más {1}(s)", Tables[2], Tables[1]);
                Icon    = SystemIcons.Warning.ToBitmap();
                break;

            default:
                Message = ex.Message;
                Icon    = SystemIcons.Warning.ToBitmap();
                break;
            }
            FrmError.ShowError(Message, Details, Icon);
        }
示例#2
0
        public static void ShowException(Exception ex)
        {
            FrmMessageError FrmError = new FrmMessageError();
            Exception       exFinal  = ex;

            while (exFinal.InnerException != null)
            {
                exFinal = ex.InnerException;
            }
            FrmError.ShowError(exFinal.Message, exFinal.Source, SystemIcons.Warning.ToBitmap());
        }
示例#3
0
 public static void ShowSqlException(SqlException ex) {
     FrmMessageError FrmError = new FrmMessageError();
     String Message = "";
     String Details = "";
     Bitmap Icon = null;
     switch (ex.Number)
     {
         case 547:
             Int32 StartIndex = ex.Message.IndexOf("FK_");
             Int32 EndIndex = ex.Message.IndexOf(".");
             String Me = ex.Message.Substring(StartIndex, EndIndex - StartIndex - 1);
             String[] Tables = Me.Split('_');
             Message = "No es posible la eliminación.";
             Details = String.Format("La entidad {0} se encuentra relacionada con 1 o más {1}(s)", Tables[2], Tables[1]);
             Icon = SystemIcons.Warning.ToBitmap();
             break;
         default:
             Message = ex.Message;
             Icon = SystemIcons.Warning.ToBitmap();
             break;
     }
     FrmError.ShowError(Message, Details, Icon);
 }
示例#4
0
        public static void Control(Exception ex, Bitmap Icon)
        {
            FrmMessageError FrmError = new FrmMessageError();

            FrmError.ShowError(ex.Message.ToString(), "", Icon);
        }
示例#5
0
 public static void Control(Exception ex, Bitmap Icon)
 {
     FrmMessageError FrmError = new FrmMessageError();
     FrmError.ShowError(ex.Message.ToString(), "" , Icon);
 }
示例#6
0
 public static void ShowException(Exception ex) {
     FrmMessageError FrmError = new FrmMessageError();
     Exception exFinal = ex;
     while (exFinal.InnerException != null) { exFinal = ex.InnerException; }
     FrmError.ShowError(exFinal.Message, exFinal.Source, SystemIcons.Warning.ToBitmap());
 }