2017-07-31 15:57:45 +08:00
|
|
|
|
using ClientsLibrary;
|
|
|
|
|
|
using CommonLibrary;
|
2017-08-05 21:14:26 +08:00
|
|
|
|
using HslCommunication;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2017-07-31 15:57:45 +08:00
|
|
|
|
using System;
|
2017-07-21 16:41:18 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.Mvc;
|
2017-08-05 21:14:26 +08:00
|
|
|
|
using 软件系统浏览器模版.Models;
|
2017-07-23 20:06:17 +08:00
|
|
|
|
using 软件系统浏览器模版.Models.Account;
|
2017-07-21 16:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
namespace 软件系统浏览器模版.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
|
{
|
2017-07-23 20:06:17 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 网站的主界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
2017-07-21 16:41:18 +08:00
|
|
|
|
public ActionResult Index()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-23 20:06:17 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 网站的关于界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
2017-07-21 16:41:18 +08:00
|
|
|
|
public ActionResult About()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-06 20:36:28 +08:00
|
|
|
|
//Get
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 权限不足时显示的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult LackOfAuthority()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-23 20:06:17 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 网站的联系人界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
2017-07-21 16:41:18 +08:00
|
|
|
|
public ActionResult Contact()
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewBag.Message = "Your contact page.";
|
|
|
|
|
|
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
2017-07-21 21:11:16 +08:00
|
|
|
|
|
2017-07-25 20:45:44 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 系统更新日志
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult UpdateLog()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
2017-07-30 22:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 版本号说明
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult VersionInformation()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//GET
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取意见反馈的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult AdviceFeedback()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-31 15:57:45 +08:00
|
|
|
|
|
|
|
|
|
|
//POST
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取意见反馈的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
|
|
public ActionResult AdviceFeedback(string advice)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.IsAjaxRequest())
|
|
|
|
|
|
{
|
|
|
|
|
|
//对建议进行保存
|
|
|
|
|
|
HslCommunication.OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.意见反馈, UserClient.UserAccount.UserName + ":" + advice);
|
|
|
|
|
|
if (result.IsSuccess)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Content("<div class=\"alert alert-success\" role=\"alert\">成功提交数据</div><script>alert('建议提交成功!')</script>", "text/html");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return Content("<div class=\"alert alert-danger\" role=\"alert\">建议提交失败,请稍后再试!错误信息:" + result.Message + "</div>", "text/html");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return Content("<div class=\"alert alert-danger\" role=\"alert\">这是一个错误的请求!</div>", "text/html");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-08-05 21:14:26 +08:00
|
|
|
|
|
|
|
|
|
|
//GET
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置新的公告的页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult ChangeAnnouncement()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//POST
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置新的公告内容的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
|
|
public ActionResult SetAnnouncement(FormCollection fc)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.IsAjaxRequest())
|
|
|
|
|
|
{
|
|
|
|
|
|
string announcement = fc["Announcement"];
|
|
|
|
|
|
UserAccount account = Session[SessionItemsDescription.UserAccount] as UserAccount;
|
|
|
|
|
|
|
|
|
|
|
|
if (announcement.Length > 1000)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "公告的字数超过了1000字!";
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.更新公告, announcement);
|
|
|
|
|
|
if (result.IsSuccess)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "公告更改成功!";
|
|
|
|
|
|
UserClient.Announcement = announcement;
|
|
|
|
|
|
return PartialView("_MessageSuccessPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = result.Message;
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "请求无效!";
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//GET
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取账号管理的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult ManagementAccount()
|
|
|
|
|
|
{
|
|
|
|
|
|
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.获取账户);
|
|
|
|
|
|
if(result.IsSuccess)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["accounts"] = result.Content;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["accounts"] = "数据获取失败:" + result.ToMessageShowString();
|
|
|
|
|
|
}
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
2017-08-06 20:36:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//POST
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置新的账户的请求
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
|
|
public ActionResult SetManagementAccount(FormCollection fc)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.IsAjaxRequest())
|
|
|
|
|
|
{
|
|
|
|
|
|
string Accounts = fc["NewAccounts"];
|
|
|
|
|
|
UserAccount account = Session[SessionItemsDescription.UserAccount] as UserAccount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.更细账户, Accounts);
|
|
|
|
|
|
if (result.IsSuccess)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "账户更改成功!";
|
|
|
|
|
|
return PartialView("_MessageSuccessPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = result.Message;
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "请求无效!";
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-10 22:20:32 +08:00
|
|
|
|
//GET
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取发送消息的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
public ActionResult SendMessage()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-06 20:36:28 +08:00
|
|
|
|
|
2017-08-10 22:20:32 +08:00
|
|
|
|
//POST
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置新的消息发送的界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AuthorizeUser]
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
|
|
public ActionResult SendMessage(FormCollection fc)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.IsAjaxRequest())
|
|
|
|
|
|
{
|
2017-08-12 18:00:27 +08:00
|
|
|
|
string SendMessage = fc["SendMessage"];
|
2017-08-10 22:20:32 +08:00
|
|
|
|
UserAccount account = Session[SessionItemsDescription.UserAccount] as UserAccount;
|
2017-08-06 20:36:28 +08:00
|
|
|
|
|
2017-08-12 18:00:27 +08:00
|
|
|
|
if (SendMessage.Length > 1000)
|
2017-08-10 22:20:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "需要发送的字数超过了1000字!";
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-12 18:00:27 +08:00
|
|
|
|
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.群发消息, SendMessage);
|
2017-08-10 22:20:32 +08:00
|
|
|
|
if (result.IsSuccess)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "消息群发成功!";
|
2017-08-12 18:00:27 +08:00
|
|
|
|
UserClient.Announcement = SendMessage;
|
2017-08-10 22:20:32 +08:00
|
|
|
|
return PartialView("_MessageSuccessPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = result.Message;
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewData["alertMessage"] = "请求无效!";
|
|
|
|
|
|
return PartialView("_MessageDangerPartial");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-08-06 20:36:28 +08:00
|
|
|
|
|
2017-08-12 18:00:27 +08:00
|
|
|
|
|
|
|
|
|
|
|
2017-07-21 16:41:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|