diff --git a/软件系统浏览器模版/Controllers/HomeController.cs b/软件系统浏览器模版/Controllers/HomeController.cs index 5df8f46..68db7d2 100644 --- a/软件系统浏览器模版/Controllers/HomeController.cs +++ b/软件系统浏览器模版/Controllers/HomeController.cs @@ -234,8 +234,59 @@ namespace 软件系统浏览器模版.Controllers } + //GET + /// + /// 获取发送消息的界面 + /// + [HttpGet] + [AuthorizeUser] + public ActionResult SendMessage() + { + return View(); + } + //POST + /// + /// 设置新的消息发送的界面 + /// + /// + [HttpPost] + [AuthorizeUser] + [ValidateAntiForgeryToken] + public ActionResult SendMessage(FormCollection fc) + { + if (Request.IsAjaxRequest()) + { + string announcement = fc["SendMessage"]; + 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"); + } + } } } \ No newline at end of file diff --git a/软件系统浏览器模版/Views/Home/SendMessage.cshtml b/软件系统浏览器模版/Views/Home/SendMessage.cshtml new file mode 100644 index 0000000..330cabc --- /dev/null +++ b/软件系统浏览器模版/Views/Home/SendMessage.cshtml @@ -0,0 +1,39 @@ + +@{ + ViewBag.Title = "消息发送"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + +@section scripts +{ + +} + +
+ +
+ @{ string updateId = Guid.NewGuid().ToString();} + @using (Ajax.BeginForm("SetManagementAccount", null, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = updateId, InsertionMode = InsertionMode.Replace }, + new { @class = "form-horizontal" })) + { +
+ @Html.AntiForgeryToken() + 账户管理 +
+ +
+ +
+
+
+
+ +
+
+
+ } +
+
+ +
+ diff --git a/软件系统浏览器模版/软件系统浏览器模版.csproj b/软件系统浏览器模版/软件系统浏览器模版.csproj index 6dd9788..baaebd4 100644 --- a/软件系统浏览器模版/软件系统浏览器模版.csproj +++ b/软件系统浏览器模版/软件系统浏览器模版.csproj @@ -230,6 +230,7 @@ +