• 页面跳转类 使用框架集 必备类库


    using System;
    using System.Data; 
    
    namespace Dachie.Common
    {
        /// <summary>
        /// 页面跳转类
        /// </summary>
        public abstract class Message
        {
            public Message()
            {
                //
                // TODO: 在此处添加构造函数逻辑
                //
            }
            /// <summary>
            /// 提示信息并返回
            /// </summary>
            /// <param name="word">提示信息</param>
            public static void back(string word)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("alert('" + word + "');");
                System.Web.HttpContext.Current.Response.Write("history.back();");
                System.Web.HttpContext.Current.Response.Write("</script>");
            } 
    
            /// <summary>
            /// 刷新左则框架
            /// </summary>
            /// <param name="word">框架名</param>
            public static void ShowAndReLoad(string word, string rurl)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("alert('" + word + "');");
                System.Web.HttpContext.Current.Response.Write("self.location='" + System.Web.HttpContext.Current.Request.UrlReferrer.ToString() + "';parent.leftFrame.location.href='" + rurl + "';");
                System.Web.HttpContext.Current.Response.Write("</script>");
            }
            /// <summary>
            /// 刷新左则框架
            /// </summary>
            /// <param name="word">框架名</param>
            public static void ShowAndReLoad(string word, string url, string rurl)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("alert('" + word + "');");
                System.Web.HttpContext.Current.Response.Write("self.location='" + url + "';parent.leftFrame.location.href='" + rurl + "';");
                System.Web.HttpContext.Current.Response.Write("</script>");
            }
            /// <summary>
            /// 提示信息并跳转
            /// </summary>
            /// <param name="word">提示信息</param>
            /// <param name="url">跳转页面</param>
            public static void Show(string word, string url)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("alert('" + word + "');");
                System.Web.HttpContext.Current.Response.Write("self.location='" + url + "';");
                System.Web.HttpContext.Current.Response.Write("</script>");
            }
            /// <summary>
            /// 提示信息并跳转至上次请求页面
            /// </summary>
            /// <param name="word">提示信息</param>
            public static void Show(string word)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("alert('" + word + "');");
                System.Web.HttpContext.Current.Response.Write("self.location='" + System.Web.HttpContext.Current.Request.UrlReferrer.ToString() + "';");
                System.Web.HttpContext.Current.Response.Write("</script>");
            } 
    
            /// <summary>
            /// 提示信息并从父窗口跳转
            /// </summary>
            /// <param name="word">提示信息</param>
            /// <param name="url">跳转页面</param>
            public static void to_parent(string word, string url)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("alert('" + word + "');");
                System.Web.HttpContext.Current.Response.Write("parent.location='" + url + "';");
                System.Web.HttpContext.Current.Response.Write("</script>");
            } 
    
            /// <summary>
            /// 从父窗口跳转
            /// <param name="url">跳转页面</param>
            public static void to_parent(string url)
            {
                System.Web.HttpContext.Current.Response.Write("<script language='javascript'>");
                System.Web.HttpContext.Current.Response.Write("parent.location='" + url + "';");
                System.Web.HttpContext.Current.Response.Write("</script>");
            } 
    
            /******************取字符串**************************/ 
    
            /// <summary>
            /// 截断字符串
            /// </summary>
            /// <param name="str">字符串</param>
            /// <param name="num">长度</param>
            /// <returns>结果</returns>
            public static string getNumstring(string str, int num)
            {
                string nstr = "";
                //byte[] mybyte = System.Text.Encoding.Default.GetBytes(str);   //认为中文长度为2
                int len = str.Length;
                if (len > num)
                {
                    nstr = str.Substring(0, num);
                }
                else
                {
                    nstr = str;
                }
                return nstr; 
    
            }
        }
    }
  • 相关阅读:
    推荐体系算法总结
    Springboot 多模块调用,找不到注入的类
    LRU算法
    在SQLServer中连接另一个SQLServer库数据,在Oracle中连接另一个Oracle库数据,在SQL Server中连接Oracle数据,在Oracle中连接SQL Server数据
    用C#实现木马程序
    CSS filter 滤镜可视化配置
    微信小程序农历日期选择器 lunarpicker
    ms Sql 数据库出现 “提供的统计信息流已损坏”的解决办法。
    自制《要塞:十字军东征》无限金钱修改器
    c#+Winform实现自定义的“复制、粘贴”右键快捷菜单,多个控件共享使用一个右键菜单。
  • 原文地址:https://www.cnblogs.com/dachie/p/1734400.html
Copyright © 2020-2023  润新知