-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsersController.cs
More file actions
174 lines (145 loc) · 4.05 KB
/
UsersController.cs
File metadata and controls
174 lines (145 loc) · 4.05 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Users.Servies;
using Users.Models;
using Users;
namespace BankSystem.Controllers
{
public class UsersController : Controller
{
S_DataAccesss Access = new S_DataAccesss();
UserInfo uInfo = new UserInfo();
// GET: Users
/// <summary>
/// 登录
/// </summary>
/// <returns>接受数据并返回加验证</returns>
#region 登录
public ActionResult Index()
{
return View(uInfo);
}
public ActionResult CheckCode()
{
return File(Core.CheckCode.Code.CheckCode.RndCodeImg(), "image/gif");
}
[HttpPost]
public ActionResult Index(UserInfo sk, FormCollection fc)
{
string UserInput = fc["CheckCode"] ?? string.Empty;
string SavedCode = (string)Session["rndcode"];
if (!UserInput.ToLower().Equals(SavedCode))
{
return Content("验证码输入错误!");
}
if (!ModelState.IsValid)
{
return View(sk);
}
//sk.LOGINPASS = ReUse.BllUtility.MD5AndSHA1.MD5Encode(sk.LOGINPASS, "32");
if (Access.Login(sk.ACCOUNT,sk.LOGINPASS))
{
UserState.SaveUserState(sk);
return RedirectToAction("MenuView", "Menu");
}
else
{
return Content("登录失败,如有疑问请联系管理员");
}
}
#endregion
public ActionResult AdminView()
{
return View(uInfo);
}
[HttpPost]
public ActionResult AdminView(UserInfo sk,FormCollection sd)
{
if (!ModelState.IsValid)
{
return View(sk);
}
else
{
if (sd["ACCOUNT"] =="00000000"&&sd["LOGINPASS"] =="123456")
{
Session["Login"] = sk.LOGINPASS;
return RedirectToAction("AdmiaView","deleat");
}
else
{
return Content("管理员如忘记密码,请联系制作人员!!!!!");
}
}
}
public ActionResult RegView()
{
return View();
}
// GET: Users/Details/5
public ActionResult Details(int id)
{
return View();
}
// GET: Users/Create
public ActionResult Create()
{
return View();
}
// POST: Users/Create
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
// GET: Users/Edit/5
public ActionResult Edit(int id)
{
return View();
}
// POST: Users/Edit/5
[HttpPost]
public ActionResult Edit(int id, FormCollection collection)
{
try
{
// TODO: Add update logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
// GET: Users/Delete/5
public ActionResult Delete(int id)
{
return View();
}
// POST: Users/Delete/5
[HttpPost]
public ActionResult Delete(int id, FormCollection collection)
{
try
{
// TODO: Add delete logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
}
}