添加消息发送界面
This commit is contained in:
@@ -234,8 +234,59 @@ namespace 软件系统浏览器模版.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//GET
|
||||||
|
/// <summary>
|
||||||
|
/// 获取发送消息的界面
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
[AuthorizeUser]
|
||||||
|
public ActionResult SendMessage()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//POST
|
||||||
|
/// <summary>
|
||||||
|
/// 设置新的消息发送的界面
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
39
软件系统浏览器模版/Views/Home/SendMessage.cshtml
Normal file
39
软件系统浏览器模版/Views/Home/SendMessage.cshtml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "消息发送";
|
||||||
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@section scripts
|
||||||
|
{
|
||||||
|
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
|
||||||
|
}
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
@{ string updateId = Guid.NewGuid().ToString();}
|
||||||
|
@using (Ajax.BeginForm("SetManagementAccount", null, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = updateId, InsertionMode = InsertionMode.Replace },
|
||||||
|
new { @class = "form-horizontal" }))
|
||||||
|
{
|
||||||
|
<fieldset>
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
<legend style="font-family:'Microsoft YaHei UI',Arial, Helvetica, sans-serif">账户管理</legend>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="NewAccounts" class="col-lg-2 control-label">账户json数据:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea class="form-control" id="NewAccounts" name="NewAccounts" placeholder="json数据" required rows="25">@ViewData["accounts"].ToString()</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
|
<button type="submit" class="btn btn-primary">提交新数据</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div id="@updateId">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -230,6 +230,7 @@
|
|||||||
<Content Include="Views\Home\ManagementAccount.cshtml" />
|
<Content Include="Views\Home\ManagementAccount.cshtml" />
|
||||||
<Content Include="Views\Home\LackOfAuthority.cshtml" />
|
<Content Include="Views\Home\LackOfAuthority.cshtml" />
|
||||||
<Content Include="Views\Account\RegisterAccount.cshtml" />
|
<Content Include="Views\Account\RegisterAccount.cshtml" />
|
||||||
|
<Content Include="Views\Home\SendMessage.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
|||||||
Reference in New Issue
Block a user