-
Notifications
You must be signed in to change notification settings - Fork 1
/
WebCommon.cs
54 lines (52 loc) · 1.61 KB
/
WebCommon.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
public class WebCommon
{
public static void Show(string msg)
{
HttpContext.Current.Response.Write("<script type='text/javascript'>alert('" + msg + "')</script>");
}
public static void ShowUrl(string msg, string url)
{
HttpContext.Current.Response.Write("<script type='text/javascript'>alert('" + msg + "');window.location='" + url + "'</script>");
}
public static void ReLoad(string msg)
{
HttpContext.Current.Response.Write("<script type='text/javascript'>alert('" + msg + "');window.location.reload();</script>");
}
public static void Url(string url)
{
HttpContext.Current.Response.Write("<script type='text/javascript'>window.location='" + url + "'</script>");
}
public static string TitleLength(string strlength, int length)
{
if (strlength != null && strlength.Length > length)
{
strlength = strlength.Substring(0, length) + "......";
}
return strlength;
}
public static string ContentLength(String strlength, int length)
{
if (strlength != null && strlength.Length > length)
{
strlength = strlength.Substring(0, length) + "......";
}
return strlength;
}
public static bool CheckLogin()
{
if (HttpContext.Current.Session["admin"] == null)
{
HttpContext.Current.Response.Redirect("/ysw_admin/login.aspx");
return false;
}
else
{
return true;
}
}
}