eea88e0b2b
SVN-Revision: r485
162 lines
7.0 KiB
C#
162 lines
7.0 KiB
C#
/******************************
|
|
* 说明:弹出框
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-08-09
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using DevExpress.XtraEditors;
|
|
using Lskj.Data;
|
|
using System.Windows.Forms;
|
|
using System.Diagnostics;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Business;
|
|
|
|
namespace Lskj.Control
|
|
{
|
|
/// <summary>
|
|
/// 系统消息框
|
|
/// </summary>
|
|
public sealed class MessageUtil
|
|
{
|
|
/// <summary>
|
|
/// <para>说明:弹出Ok对话框</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="msg"></param>
|
|
public static DialogResult Show(string msg)
|
|
{
|
|
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在"))
|
|
msg = "网络连接超时,请稍候再试!";
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
|
}
|
|
return XtraMessageBox.Show(msg, ResourceKeys.SystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:弹出报错信息提示框</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2021-09-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="msg"></param>
|
|
public static DialogResult Show(string msg, string errorMessage )
|
|
{
|
|
if (!string.IsNullOrEmpty(errorMessage) && errorMessage.Contains("与另一个进程被死锁在"))
|
|
{
|
|
errorMessage = "网络连接超时,请稍候再试!";
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
errorMessage = Business.Impl.LanguageTranslation.GetTranslatedText(errorMessage);
|
|
}
|
|
return XtraMessageBox.Show(errorMessage, ResourceKeys.SystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(errorMessage) && errorMessage.Contains("事务在触发器中结束。批处理已中止"))
|
|
{
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
errorMessage = Business.Impl.LanguageTranslation.GetTranslatedText(errorMessage);
|
|
}
|
|
return XtraMessageBox.Show(errorMessage, ResourceKeys.SystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
DevExpress.XtraEditors.Controls.Localizer.Active = new MessboxClass();
|
|
MessageBoxButtons msgButton = MessageBoxButtons.YesNo;
|
|
DialogResult dr = new DialogResult();
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
|
}
|
|
dr = XtraMessageBox.Show(msg, ResourceKeys.SystemTip, msgButton, MessageBoxIcon.Information);
|
|
if (dr != DialogResult.Yes && !string.IsNullOrWhiteSpace(errorMessage))
|
|
{
|
|
errorMessage = ErrorMessage.StackTrace;
|
|
if (SystemInfo.Instance.HideErrorSQL)
|
|
{
|
|
errorMessage= errorMessage.Split(new string[] { "SQL=[" }, StringSplitOptions.None)[0];
|
|
}
|
|
XtraMessageBox.Show(errorMessage, ResourceKeys.SystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
DevExpress.XtraEditors.Controls.Localizer.Active = null;
|
|
return DialogResult.OK;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:弹出Ok对话框</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="ex">The ex.</param>
|
|
/// <returns>DialogResult.</returns>
|
|
public static DialogResult Show(Exception ex)
|
|
{
|
|
if (Debugger.IsAttached)
|
|
{
|
|
string msg = ex == null ? ResourceKeys.UnKownErrorTip : ex.StackTrace;
|
|
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在"))
|
|
msg = "网络连接超时,请稍候再试!";
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
|
}
|
|
return XtraMessageBox.Show(ex.Message, ResourceKeys.SystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
else
|
|
{
|
|
string msg = ex == null ? ResourceKeys.UnKownErrorTip : ex.Message; //ResourceKeys.SystemErrorTip + "\r\n" + ex.Message + "\r\n" + ex.StackTrace;
|
|
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在"))
|
|
msg = "网络连接超时,请稍候再试!";
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
|
}
|
|
//DialogResult result = Show(ex.Message, MessageBoxButtons.OKCancel);
|
|
//if (result == DialogResult.OK)
|
|
//{
|
|
// // 写入数据到lscrm
|
|
// bool isSuccess = BaseImpl.AddExceptionToLsCrm(msg);
|
|
|
|
// Show(isSuccess ? ResourceKeys.ExceptionSaveSuccess : ResourceKeys.ExceptionSaveFault);
|
|
//}
|
|
return Show(msg);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:弹出是否对话框</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="msg">The MSG.</param>
|
|
/// <param name="buttons">The buttons.</param>
|
|
public static DialogResult Show(string msg, MessageBoxButtons buttons)
|
|
{
|
|
if (Business.Impl.LanguageTranslation.Translatable)
|
|
{
|
|
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
|
}
|
|
return XtraMessageBox.Show(msg, ResourceKeys.SystemTip, buttons, M |