完善通知管理客户端脚本,实现全部功能
This commit is contained in:
parent
ea2d644988
commit
03ce600d15
|
@ -190,7 +190,7 @@
|
|||
<Content Include="Scripts\Login.js" />
|
||||
<Content Include="Scripts\Logs.js" />
|
||||
<Content Include="Scripts\Menus.js" />
|
||||
<Content Include="Scripts\News.js" />
|
||||
<Content Include="Scripts\noti.js" />
|
||||
<Content Include="Scripts\Profiles.js" />
|
||||
<Content Include="Scripts\register.js" />
|
||||
<Content Include="Scripts\Roles.js" />
|
||||
|
@ -230,6 +230,7 @@
|
|||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\LogsController.cs" />
|
||||
<Compile Include="Controllers\MenusController.cs" />
|
||||
<Compile Include="Controllers\NotificationsController.cs" />
|
||||
<Compile Include="Controllers\ProfilesController.cs" />
|
||||
<Compile Include="Controllers\RolesController.cs" />
|
||||
<Compile Include="Controllers\UsersController.cs" />
|
||||
|
|
|
@ -214,11 +214,6 @@ ul.sidebar-menu {
|
|||
font-size: 15px;
|
||||
}
|
||||
|
||||
.panel a.fa-refresh:hover {
|
||||
-webkit-animation: fa-spin 2s infinite linear;
|
||||
animation: fa-spin 2s infinite linear;
|
||||
}
|
||||
|
||||
.bootstrap-select .dropdown-menu {
|
||||
padding: 0px;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
|
||||
.tasks-widget .task-list li > .task-title {
|
||||
overflow: hidden;
|
||||
margin-right: 10px;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
|
@ -82,11 +81,17 @@
|
|||
|
||||
.tasks-widget .task-list li > .task-title .hidden-phone {
|
||||
padding-top: 14px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.tasks-widget .task-list li > .task-title .hidden-phone button.btn-xs {
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.tasks-widget .task-list li > .task-title .hidden-phone a.btn-xs {
|
||||
padding: 4px 5px;
|
||||
}
|
||||
|
||||
.tasks-widget .task-list li > .task-config {
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
public class NotificationsController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Notifications Get()
|
||||
{
|
||||
var ret = new Notifications();
|
||||
NotificationHelper.RetrieveNotifications().AsParallel().ForAll(n =>
|
||||
{
|
||||
if (n.Category == "0") ret.Users.Add(n);
|
||||
else if (n.Category == "1") ret.Apps.Add(n);
|
||||
else if (n.Category == "2") ret.Dbs.Add(n);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Notifications Get(string id)
|
||||
{
|
||||
var ret = new Notifications();
|
||||
NotificationHelper.RetrieveNotifications().AsParallel().ForAll(n =>
|
||||
{
|
||||
if (id != n.Category) return;
|
||||
if (n.Category == "0") ret.Users.Add(n);
|
||||
else if (n.Category == "1") ret.Apps.Add(n);
|
||||
else if (n.Category == "2") ret.Dbs.Add(n);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
public class Notifications
|
||||
{
|
||||
public Notifications()
|
||||
{
|
||||
Users = new List<Notification>();
|
||||
Apps = new List<Notification>();
|
||||
Dbs = new List<Notification>();
|
||||
}
|
||||
public List<Notification> Users { get; set; }
|
||||
|
||||
public List<Notification> Apps { get; set; }
|
||||
|
||||
public List<Notification> Dbs { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -84,6 +84,20 @@ namespace Bootstrap.Admin.Controllers
|
|||
case "group":
|
||||
ret = UserHelper.SaveUsersByGroupId(id, userIds);
|
||||
break;
|
||||
case "user":
|
||||
// 此时 userIds 存储的信息是操作结果 1 标示同意 0 标示拒绝
|
||||
var user = new User() { ID = id, UserStatus = 2 };
|
||||
if (userIds == "1")
|
||||
{
|
||||
user.ApprovedBy = User.Identity.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
user.RejectedReason = "无原因";
|
||||
user.RejectedBy = User.Identity.Name;
|
||||
}
|
||||
ret = UserHelper.SaveUser(user);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
|
@ -17,7 +18,9 @@ namespace Bootstrap.Admin.Models
|
|||
UserID = user.ID;
|
||||
HomeUrl = "~/";
|
||||
Menus = MenuHelper.RetrieveLinksByUserName(UserName);
|
||||
Notifications = NotificationHelper.RetrieveNotifications();
|
||||
var notis = NotificationHelper.RetrieveNotifications();
|
||||
NotifiCount = notis.Count();
|
||||
Notifications = notis.Take(6);
|
||||
}
|
||||
public string UserName { get; protected set; }
|
||||
/// <summary>
|
||||
|
@ -41,8 +44,12 @@ namespace Bootstrap.Admin.Models
|
|||
/// </summary>
|
||||
public IEnumerable<Menu> Menus { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// 获得/设置 通知内容集合
|
||||
/// </summary>
|
||||
public IEnumerable<Notification> Notifications { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 通知数量
|
||||
/// </summary>
|
||||
public int NotifiCount { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
$(function () {
|
||||
$('.tooltips').tooltip();
|
||||
});
|
Binary file not shown.
|
@ -0,0 +1,72 @@
|
|||
$(function () {
|
||||
var url = '../api/Notifications/';
|
||||
|
||||
var htmlNewUsers = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" data-id="{3}" data-result="1"></button><button class="btn btn-danger btn-xs fa fa-remove" data-id="{3}" data-result="0" data-placement="left" data-original-title="拒绝授权"></button></div></div></li>';
|
||||
var htmlApp = '<li class="list-warning"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><a href="../Admin/Exceptions/{3}" class="btn btn-success btn-xs fa fa-reorder"></a></div></div></li>';
|
||||
var htmlDb = '<li class="list-danger"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><a href="../Admin/Exceptions/{3}" class="btn btn-success btn-xs fa fa-reorder"></a></div></div></li>';
|
||||
|
||||
function listData(options) {
|
||||
options = $.extend({ url: url, animation: true, ctl: $('a.fa-refresh') }, options);
|
||||
var category = options.ctl.length == 1 ? options.ctl.attr('data-category') : "";
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
$.ajax({
|
||||
url: options.url + category,
|
||||
type: 'GET',
|
||||
success: function (result) {
|
||||
if (result) {
|
||||
if (category == '0' || category == '') {
|
||||
var content = result.Users.map(function (noti) {
|
||||
var t = new Date(noti.RegisterTime).format('yyyy-MM-dd HH:mm:ss');
|
||||
return $.format(htmlNewUsers, noti.Title, noti.Content, t, noti.ID);
|
||||
}).join('');
|
||||
$('#tasks-users').html(content);
|
||||
}
|
||||
if (category == '1' || category == '') {
|
||||
var content = result.Apps.map(function (noti) {
|
||||
var t = new Date(noti.RegisterTime).format('yyyy-MM-dd HH:mm:ss');
|
||||
return $.format(htmlApp, noti.Title, noti.Content, t, noti.ID);
|
||||
}).join('');
|
||||
$('#tasks-app').html(content);
|
||||
}
|
||||
if (category == '2' || category == '') {
|
||||
var content = result.Dbs.map(function (noti) {
|
||||
var t = new Date(noti.RegisterTime).format('yyyy-MM-dd HH:mm:ss');
|
||||
return $.format(htmlDb, noti.Title, noti.Content, t, noti.ID);
|
||||
}).join('');
|
||||
$('#tasks-db').html(content);
|
||||
}
|
||||
}
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
}
|
||||
});
|
||||
}
|
||||
listData();
|
||||
|
||||
$('a.fa-refresh').on('click', function () {
|
||||
listData({ ctl: $(this) });
|
||||
});
|
||||
|
||||
$('#tasks-users').on('click', 'button', function () {
|
||||
var id = $(this).attr('data-id');
|
||||
var result = $(this).attr('data-result');
|
||||
var data = { type: "user", userIds: result };
|
||||
var title = result == "1" ? "授权用户" : "拒绝用户";
|
||||
$.ajax({
|
||||
url: '../api/Users/' + id,
|
||||
data: data,
|
||||
type: 'PUT',
|
||||
success: function (result) {
|
||||
if (result) swal("成功!", title, "success");
|
||||
else swal("失败", title, "error");
|
||||
var refresh = $('#tasks-users').parentsUntil('div.panel').last().prev().find('a.fa-refresh');
|
||||
listData(refresh);
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
swal("失败", title, "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -5,9 +5,10 @@
|
|||
}
|
||||
@section Javascript {
|
||||
<script src="~/Content/js/sweetalert.js"></script>
|
||||
<script src="~/Scripts/News.js"></script>
|
||||
<script src="~/Scripts/noti.js"></script>
|
||||
}
|
||||
@section css {
|
||||
<link href="~/Content/css/sweetalert.css" rel="stylesheet" />
|
||||
<link href="~/Content/css/tasks.css" rel="stylesheet" />
|
||||
}
|
||||
@section header {
|
||||
|
@ -17,73 +18,63 @@
|
|||
@Html.Partial("Navigator", Model)
|
||||
}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">用户注册<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></span></div>
|
||||
<div class="panel-heading">用户注册<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-category="0" data-placement="left" data-original-title="点击刷新"></a></span></div>
|
||||
<div class="panel-body">
|
||||
<div class="tasks-widget">
|
||||
<ul id="tasks-users" class="task-list ui-sortable" data-category="0">
|
||||
@foreach (var noti in Model.Notifications.Where(n => n.Category == "0"))
|
||||
{
|
||||
<li class="list-primary">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
<span class="task-title-sp">@noti.Title</span>
|
||||
<span class="task-value">@noti.Content</span>
|
||||
<span class="task-time">@noti.RegisterTime.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||
</div>
|
||||
<ul id="tasks-users" class="task-list ui-sortable">
|
||||
<li class="list-primary">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
<span class="task-title-sp">Title</span>
|
||||
<span class="task-value">Content</span>
|
||||
<span class="task-time">@System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">程序错误<a href="javascript:;" class="pull-right tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></div>
|
||||
<div class="panel-heading">程序错误<a href="javascript:;" class="pull-right tooltips fa fa-refresh" data-category="1" data-placement="left" data-original-title="点击刷新"></a></div>
|
||||
<div class="panel-body">
|
||||
<div class="tasks-widget">
|
||||
<ul id="tasks-app" class="task-list ui-sortable" data-category="1">
|
||||
@foreach (var nofi in Model.Notifications.Where(n => n.Category == "1"))
|
||||
{
|
||||
<li class="list-warning">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
<span class="task-title-sp">@nofi.Title</span>
|
||||
<span class="task-value">@nofi.Content</span>
|
||||
<span class="task-time">@nofi.RegisterTime.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||
</div>
|
||||
<ul id="tasks-app" class="task-list ui-sortable">
|
||||
<li class="list-warning">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
<span class="task-title-sp">Title</span>
|
||||
<span class="task-value">Content</span>
|
||||
<span class="task-time">@System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-reorder tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">数据库报警<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></span></div>
|
||||
<div class="panel-heading">数据库异常<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-category="2" data-placement="left" data-original-title="点击刷新"></a></span></div>
|
||||
<div class="panel-body">
|
||||
<div class="tasks-widget">
|
||||
<ul id="tasks-db" class="task-list ui-sortable" data-category="2">
|
||||
@foreach (var nofi in Model.Notifications.Where(n => n.Category == "2"))
|
||||
{
|
||||
<li class="list-danger">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
<span class="task-title-sp">@nofi.Title</span>
|
||||
<span class="task-time">@nofi.RegisterTime.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<span class="task-value">@nofi.Content</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||
</div>
|
||||
<ul id="tasks-db" class="task-list ui-sortable">
|
||||
<li class="list-danger">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
<span class="task-title-sp">Title</span>
|
||||
<span class="task-value">Content</span>
|
||||
<span class="task-time">@System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -165,22 +165,22 @@
|
|||
</li>
|
||||
<!-- inbox dropdown end -->
|
||||
<!-- notification dropdown start-->
|
||||
@if (Model.Notifications.Count() > 0)
|
||||
@if (Model.NotifiCount > 0)
|
||||
{
|
||||
<li id="header_notification_bar" class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="badge bg-warning">@Model.Notifications.Count()</span>
|
||||
<span class="badge bg-warning">@Model.NotifiCount</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu notification">
|
||||
<div class="notify-arrow notify-arrow-yellow"></div>
|
||||
<li>
|
||||
<p>您有 @Model.Notifications.Count() 条新通知</p>
|
||||
<p>您有 @Model.NotifiCount 条新通知</p>
|
||||
</li>
|
||||
@foreach (var noti in Model.Notifications.Take(6))
|
||||
@foreach (var noti in Model.Notifications)
|
||||
{
|
||||
<li>
|
||||
<a href="~/Admin/Notifications/@noti.ID?category=@noti.Category">
|
||||
<a href="~/Admin/Notifications?id=@noti.ID&category=@noti.Category">
|
||||
@if (noti.Category == "0")
|
||||
{
|
||||
<span class="label label-success"><i class="fa fa-plus"></i></span><div>@noti.Content</div><span class="small italic">@noti.Period</span>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<div class="arrow-up"></div>
|
||||
<li><a href="~/Admin/Infos"><i class=" fa fa-suitcase"></i>个人中心</a></li>
|
||||
<li><a href="~/Admin/Index"><i class="fa fa-cog"></i>设置</a></li>
|
||||
<li><a href="~/Admin/Notifications"><i class="fa fa-bell-o"></i>通知<span class="badge bg-success">@Model.Notifications.Count()</span></a></li>
|
||||
<li><a href="~/Admin/Notifications"><i class="fa fa-bell-o"></i>通知<span class="badge bg-success">@Model.NotifiCount</span></a></li>
|
||||
<li><a href="~/Home/Logout"><i class="fa fa-key"></i>注销</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -47,5 +47,17 @@ namespace Bootstrap.DataAccess
|
|||
/// 获得/设置 通知描述 2分钟内为刚刚
|
||||
/// </summary>
|
||||
public string Period { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 拒绝人
|
||||
/// </summary>
|
||||
public string RejectedBy { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 拒绝原因
|
||||
/// </summary>
|
||||
public string RejectedReason { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 拒绝时刻
|
||||
/// </summary>
|
||||
public string RejectedTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace Bootstrap.DataAccess
|
|||
{
|
||||
var ret = CacheManager.GetOrAdd(RetrieveNewUsersDataKey, CacheSection.RetrieveIntervalByKey(RetrieveNewUsersDataKey), key =>
|
||||
{
|
||||
string sql = "select ID, UserName, DisplayName, RegisterTime, [Description] from Users Where ApprovedTime is null";
|
||||
string sql = "select ID, UserName, DisplayName, RegisterTime, [Description] from Users Where ApprovedTime is null and RejectedTime is null";
|
||||
List<User> Users = new List<User>();
|
||||
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
|
||||
try
|
||||
|
@ -161,22 +161,27 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static bool SaveUser(User p)
|
||||
{
|
||||
if (p.UserName.Length > 50) p.UserName.Substring(0, 50);
|
||||
p.PassSalt = LgbCryptography.GenerateSalt();
|
||||
p.Password = LgbCryptography.ComputeHash(p.Password, p.PassSalt);
|
||||
if (p.ID == 0 && p.Description.Length > 500) p.Description.Substring(0, 500);
|
||||
if (p.UserStatus != 2)
|
||||
{
|
||||
if (p.UserName.Length > 50) p.UserName.Substring(0, 50);
|
||||
p.PassSalt = LgbCryptography.GenerateSalt();
|
||||
p.Password = LgbCryptography.ComputeHash(p.Password, p.PassSalt);
|
||||
}
|
||||
bool ret = false;
|
||||
try
|
||||
{
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.StoredProcedure, "Proc_SaveUsers"))
|
||||
{
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@id", p.ID, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@userName", p.UserName, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@password", p.Password, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@passSalt", p.PassSalt, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@displayName", p.DisplayName, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@userName", DBAccess.ToDBValue(p.UserName), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@password", DBAccess.ToDBValue(p.Password), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@passSalt", DBAccess.ToDBValue(p.PassSalt), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@displayName", DBAccess.ToDBValue(p.DisplayName), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@description", DBAccess.ToDBValue(p.Description), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@approvedBy", DBAccess.ToDBValue(p.ApprovedBy), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@rejectedBy", DBAccess.ToDBValue(p.RejectedBy), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@rejectedReason", DBAccess.ToDBValue(p.RejectedReason), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@userStatus", p.UserStatus, ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
|
|
@ -175,10 +175,12 @@ CREATE PROCEDURE [dbo].[Proc_SaveUsers]
|
|||
@userName varchar(50),
|
||||
@password varchar(50),
|
||||
@passSalt varchar(50),
|
||||
@displayName nvarchar(50),
|
||||
@displayName nvarchar(50),
|
||||
@approvedBy varchar(50),
|
||||
@description nvarchar(500),
|
||||
@userStatus int = 0 --0表示管理员创建 1标示用户注册 2标示管理员批复
|
||||
@description nvarchar(500),
|
||||
@rejectedBy varchar(50),
|
||||
@rejectedReason nvarchar(500),
|
||||
@userStatus int = 0 --0表示管理员创建 1标示用户注册 2标示管理员批复
|
||||
WITH ENCRYPTION
|
||||
AS
|
||||
BEGIN
|
||||
|
@ -189,7 +191,10 @@ BEGIN
|
|||
-- Insert statements for procedure here
|
||||
if @userStatus = 2
|
||||
begin
|
||||
update Users set ApprovedTime = GETDATE(), ApprovedBy = @approvedBy where ID = @id
|
||||
if @approvedBy is not null
|
||||
update Users set ApprovedTime = GETDATE(), ApprovedBy = @approvedBy where ID = @id
|
||||
else
|
||||
update Users set RejectedTime = GETDATE(), RejectedBy = @rejectedBy, RejectedReason = @rejectedReason where ID = @id
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue