forked from feidu/XSEMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx.cs
executable file
·97 lines (94 loc) · 3.23 KB
/
Default.aspx.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Backend.Models;
using Backend.BAL;
using Backend.Utilities;
using Backend.Authorization;
using System.Collections.Generic;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected string address = "";
protected string phoneNumber = "";
protected string faxNumber = "";
protected string msnAccount = "";
protected string postalcode = "";
protected string aboutFeidu = "";
protected void Page_Load(object sender, EventArgs e)
{
Setting setting = CacheHelper.GetSetting();
phoneNumber = setting.Phone;
faxNumber = setting.Fax;
msnAccount = setting.Msn;
address = setting.Address;
postalcode = setting.Postalcode;
News news = NewsOperation.GetNewsById(9);
if (news != null)
{
aboutFeidu = StringHelper.CnCutString(news.Content, 380)+"……";
}
}
protected void btnLogin_Click(object sender, ImageClickEventArgs e)
{
string username = Request.Form["tbxUsername"].Trim();
string password = Request.Form["tbxPassword"];
if (string.IsNullOrEmpty(username))
{
Response.Write("<script language='javascript'>alert('请输入用户名!');location.href='/';</script>");
return;
}
if (string.IsNullOrEmpty(password))
{
Response.Write("<script language='javascript'>alert('请输入密码!');location.href='/';</script>");
return;
}
Client client = new Client();
client.Username = username;
client.Password = password;
string msg = "";
if (ClientOperation.ClientLogin(client, out msg))
{
ClientSession cs = new ClientSession();
Client newClient = ClientOperation.GetClientByUsername(client.Username);
cs.Id = newClient.Id;
cs.Username = newClient.Username;
cs.RealName = newClient.RealName;
AuthorizationManager.Authorize(cs);
Response.Redirect("Client/Default.aspx");
}
else
{
Response.Write("<script language='javascript'>alert('" + msg + "');location.href='/';</script>");
return;
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Server.Transfer("PostCosts.aspx", true);
}
protected void btnSearch_Click(object sender, EventArgs e)
{
HttpContext.Current.Session["TRACKNUMS"] = null;
string trackNums = Request.Form["txtTrackNum"];
if (!string.IsNullOrEmpty(trackNums.Trim()))
{
if (trackNums.IndexOf('\r') != -1)
{
trackNums = trackNums.Replace("\n", "");
}
HttpContext.Current.Session["TRACKNUMS"] = trackNums;
Response.Write("<script language='javascript'>window.open('Track.aspx');</script>");
}
else
{
Response.Write("<script language='javascript'>alert('请输入追踪号!');</script>");
}
}
}