using System; using System.Collections.Generic; using System.Text; using System.Web; using SysDataLibs.TableClass; namespace SysDataLibs { public class JSComm { public static void WebWriteScript(string pcScript) { HttpContext.Current.Response.Write(""); //System.Web.HttpContext.Current.Response.End(); } /// /// 关闭当前窗口 /// public static void CloseMe() { System.Web.HttpContext.Current.Response.Write(""); } //关闭自己 /// /// 提示操作成功,并关闭自身,用于弹出页面 /// public static void CloseSelfAndAlert() { System.Web.HttpContext.Current.Response.Write(""); } /// /// 关闭自己并且刷新父窗口 /// public static void CloseAndReloadFather() { System.Web.HttpContext.Current.Response.Write(""); } /// /// 关闭自身,并让父页面重新定向 /// /// 父页面重新定向的地址 public static void CloseAndFatherGoto(string pcOpenerUrl) { System.Web.HttpContext.Current.Response.Write(""); } /// /// 重新刷新父页面,父页面里必须定义 .f_Submit() 函数 /// public static void ReloadFather() { System.Web.HttpContext.Current.Response.Write(""); } /// /// 父页面聚焦 /// public static void FatherFocus() { System.Web.HttpContext.Current.Response.Write(""); } /// /// 让当前页面最大化 /// public static void MaxWindow() { string lStr = ""; lStr = " \r\n"; System.Web.HttpContext.Current.Response.Write(lStr); } /// /// 显示错误信息 /// 错误代码规则:第1位表示错误类型(“1”系统错误;“2”系统异常;“3”业务错误;“8”警告信息;“9”提示信息); /// 第2,3位表示模块代号;第4,5位表示模块错误序号;最后一位表示某编码人员代号(代号“2”) /// /// 错误代码,在错误代码文本文件中定义,编写规则:文件名;错误代码;错误信息;显示给用户的错误信息 /// 错误类型 public static void ShowMessage(int piErrCode, string pcReturnType) { System.Web.HttpContext.Current.Response.Redirect("../Pub/PubShowMessage.aspx?al_ErrCode=" + piErrCode + "&as_ReturnType=" + pcReturnType); } public static void ShowMessage(int piErrCode) { ShowMessage(piErrCode,"C"); } //' **********************一些客户端返回的javascript封装**************************************************** //public static void WebMessage(ByVal strMsg As String, Optional ByVal lType As String = "") '显示提示信息 // If Utils.CvStrByType(strMsg, CovType.jsStr) = "" Then Exit void // If lType = "" Then // strMsg = Utils.CvStrByType(strMsg, CovType.jsStr) // System.Web.HttpContext.Current.Response.Write("") // Else // strMsg = Utils.CvStrByType(strMsg, CovType.htmlStr) // System.Web.HttpContext.Current.Response.Redirect("../pub/msgbox.aspx?msg=" & strMsg) // End If //} /// /// 定义一个变量,并可以定义初始值 /// /// 变量名 /// 初始化变量值 public static void DimScriptVar(string pcVarName, string pcAValue) { System.Web.HttpContext.Current.Response.Write(""); } /// /// 给一个变量赋值 /// /// 变量名 /// 初始化变量值 public static void SetScriptVarValue(string pcAVarName, string pcAValue ){ System.Web.HttpContext.Current.Response.Write(""); } public static void ShowMessage(string pcStrMsg) { ShowMessage(pcStrMsg, false); } /// /// 以Alert方式 弹出页面信息 /// /// public static void ShowMessage(string pcStrMsg, bool isForm) { pcStrMsg = pcStrMsg.Replace("\r\n", "\n"); pcStrMsg = pcStrMsg.Replace("'", "\'"); if (isForm) HttpContext.Current.Response.Write("
"); else HttpContext.Current.Response.Write(""); } public static void ShowMsgByCode(string pcMsgCode) { ShowMessage(Sys_Info_Qry.GetMsgByMsgCode(pcMsgCode)); } } public enum ErrActType { Return = 0, Close = 1, Back = 2 } }