@@ -9,6 +9,7 @@
|
||||
<strong>@Html.DisplayFor(model => Model.Errmsg)</strong>
|
||||
</h5>
|
||||
<h3><strong>发送短信</strong></h3>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" asp-for="pageid" />
|
||||
<input type="submit" value="拉取5天内的回复短信" class="btn btn-primary" asp-page-handler="Pull" />
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace _2021_backend.Pages.Message
|
||||
Context = context;
|
||||
}
|
||||
|
||||
public IActionResult Construct(int PageId)
|
||||
public IActionResult Construct(int PageId, string emsg)
|
||||
{
|
||||
List<int> stus;
|
||||
IQueryable<int> q;
|
||||
@@ -62,101 +62,149 @@ namespace _2021_backend.Pages.Message
|
||||
int count = (PageId + 1) * pageSize > cnt ? (cnt - PageId * pageSize) : pageSize;
|
||||
Messages = Messages.GetRange(PageId * pageSize, count);
|
||||
|
||||
Errmsg = emsg;
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetAsync(int PageId)
|
||||
{
|
||||
return Construct(PageId);
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostAsync(int PageId)
|
||||
{
|
||||
return Construct(PageId);
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
|
||||
public async void OnPostPullAsync(int PageId)
|
||||
{
|
||||
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
await Utils.TencentSMS.Pull(Context, e, true);
|
||||
}
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
{
|
||||
await Utils.TencentSMS.Pull(Context, e, true);
|
||||
}
|
||||
|
||||
Construct(PageId);
|
||||
Construct(PageId, "");
|
||||
}
|
||||
else Construct(PageId, "您无权进行此操作");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostSignAsync(int PageId)
|
||||
{
|
||||
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if (e.Status == status.刚报名)
|
||||
await Utils.TencentSMS.Send(Context, SMSType.Signed, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
}
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
{
|
||||
if (e.Status == status.刚报名)
|
||||
await Utils.TencentSMS.Send(Context, SMSType.Signed, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
}
|
||||
|
||||
return Construct(PageId);
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
else return Construct(PageId, "您无权进行此操作");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostResultRejectAsync(int PageId)
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if (e.Status == status.不通过)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
{
|
||||
if (!Context.SMS.Any(it => it.Host == e.Id && it.Type == SMSType.Reject))
|
||||
await Utils.TencentSMS.Send(Context, SMSType.Reject, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
if (e.Status == status.不通过)
|
||||
{
|
||||
if (!Context.SMS.Any(it => it.Host == e.Id && it.Type == SMSType.Reject))
|
||||
await Utils.TencentSMS.Send(Context, SMSType.Reject, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
}
|
||||
}
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
return Construct(PageId);
|
||||
else return Construct(PageId, "您无权进行此操作");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostTimeSelectAsync(int PageId)
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if (e.Status != status.不通过 && e.Status != status.已选时间)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
{
|
||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSelect, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
if (e.Status != status.不通过 && e.Status != status.已选时间)
|
||||
{
|
||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSelect, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
}
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct(PageId);
|
||||
else return Construct(PageId, "您无权进行此操作");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostResultAccpetAsync(int PageId)
|
||||
public async Task<IActionResult> OnPostResultAcceptAsync(int PageId)
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if (e.Status == status.通过)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
{
|
||||
if (!Context.SMS.Any(it => it.Host == e.Id && it.Type == SMSType.Accept))
|
||||
await Utils.TencentSMS.Send(Context, SMSType.Accept, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
}
|
||||
if (e.Status == status.通过)
|
||||
{
|
||||
if (!Context.SMS.Any(it => it.Host == e.Id && it.Type == SMSType.Accept))
|
||||
await Utils.TencentSMS.Send(Context, SMSType.Accept, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
}
|
||||
|
||||
}
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
return Construct(PageId);
|
||||
else return Construct(PageId, "您无权进行此操作");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostTimeSetAsync(int PageId)
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach(var e in stu)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
var t = Context.Sessions.Find(e.InterviewTime);
|
||||
if(t != null && t.Students.Find(s => s==e.Id)!= 0 && e.Status == status.已选时间)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stu = Context.Students.ToList();
|
||||
foreach (var e in stu)
|
||||
{
|
||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSet, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
e.Status = status.已确认时间;
|
||||
var t = Context.Sessions.Find(e.InterviewTime);
|
||||
if (t != null && t.Students.Find(s => s == e.Id) != 0 && e.Status == status.已选时间)
|
||||
{
|
||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSet, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||
e.Status = status.已确认时间;
|
||||
}
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct(PageId, "");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct(PageId);
|
||||
else return Construct(PageId, "您无权进行此操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+175
-106
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json;
|
||||
using System.IO;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace _2021_backend.Pages.Sessions
|
||||
{
|
||||
@@ -124,159 +125,227 @@ namespace _2021_backend.Pages.Sessions
|
||||
|
||||
public async Task<IActionResult> OnPostArrangeAsync()
|
||||
{
|
||||
if (Utils.Arranger.Arrange(Context)) return Construct("");
|
||||
else return Construct("排班失败,无法满足条件");
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
return c.Type == ClaimTypes.Role&& (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
})){
|
||||
if (Utils.Arranger.Arrange(Context)) return Construct("");
|
||||
else return Construct("排班失败,无法满足条件");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct("您无权进行此操作");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostClearAllAsync()
|
||||
{
|
||||
foreach(var s in Context.Students)
|
||||
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
s.InterviewTime = 0;
|
||||
s.Status = status.需调整时间;
|
||||
s.Timelist.Clear();
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach(var s in Context.Sessions)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
Context.Sessions.Remove(s);
|
||||
foreach (var s in Context.Students)
|
||||
{
|
||||
s.InterviewTime = 0;
|
||||
s.Status = status.需调整时间;
|
||||
s.Timelist.Clear();
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach (var s in Context.Sessions)
|
||||
{
|
||||
Context.Sessions.Remove(s);
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct("您无权进行此操作");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostResetAllAsync()
|
||||
{
|
||||
var stus = Context.Students.ToList();
|
||||
foreach (var s in stus)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if(s.Status == status.已选时间)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
|
||||
|
||||
var stus = Context.Students.ToList();
|
||||
foreach (var s in stus)
|
||||
{
|
||||
s.InterviewTime = 0;
|
||||
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Id == it));
|
||||
s.Timelist.Sort((int a, int b) =>
|
||||
if (s.Status == status.已选时间)
|
||||
{
|
||||
var x = Context.Sessions.Find(a);
|
||||
var y = Context.Sessions.Find(b);
|
||||
var k1 = x.Day.CompareTo(y.Day);
|
||||
var k2 = x.BeginTime.CompareTo(y.BeginTime);
|
||||
return k1 != 0 ? k1 : k2;
|
||||
});
|
||||
s.InterviewTime = 0;
|
||||
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Id == it));
|
||||
s.Timelist.Sort((int a, int b) =>
|
||||
{
|
||||
var x = Context.Sessions.Find(a);
|
||||
var y = Context.Sessions.Find(b);
|
||||
var k1 = x.Day.CompareTo(y.Day);
|
||||
var k2 = x.BeginTime.CompareTo(y.BeginTime);
|
||||
return k1 != 0 ? k1 : k2;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context.SaveChanges();
|
||||
foreach (var s in Context.Sessions)
|
||||
{
|
||||
s.Students.Clear();
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach (var s in Context.Sessions)
|
||||
else
|
||||
{
|
||||
s.Students.Clear();
|
||||
return Construct("您无权进行此操作");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostSaveAsync()
|
||||
{
|
||||
var lst = Context.Sessions.ToList();
|
||||
var str = JsonSerializer.Serialize(lst);
|
||||
Console.WriteLine("Saving arrangement: " + str);
|
||||
if(!Directory.Exists("./saves")) Directory.CreateDirectory("./saves/");
|
||||
System.IO.File.WriteAllText($"./saves/{DateTime.Now.ToString("MM-dd-hh-mm-ss")}.txt", str);
|
||||
return Construct("");
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var lst = Context.Sessions.ToList();
|
||||
var str = JsonSerializer.Serialize(lst);
|
||||
Console.WriteLine("Saving arrangement: " + str);
|
||||
if (!Directory.Exists("./saves")) Directory.CreateDirectory("./saves/");
|
||||
System.IO.File.WriteAllText($"./saves/{DateTime.Now.ToString("MM-dd-hh-mm-ss")}.txt", str);
|
||||
return Construct("");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct("您无权进行此操作");
|
||||
}
|
||||
}
|
||||
public async Task<IActionResult> OnPostTidyAsync()
|
||||
{
|
||||
var stus = Context.Students.ToList();
|
||||
var sess = Context.Sessions.ToList();
|
||||
foreach(var i in stus)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
var tm = i.Timelist;
|
||||
var ntm = new List<Session>();
|
||||
foreach(var j in tm)
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var stus = Context.Students.ToList();
|
||||
var sess = Context.Sessions.ToList();
|
||||
foreach (var i in stus)
|
||||
{
|
||||
var k = sess.Find(it => it.Id == j);
|
||||
ntm.Add(k);
|
||||
}
|
||||
ntm.Sort((Session a,Session b) =>
|
||||
{
|
||||
var x = a.Day.CompareTo(b.Day);
|
||||
var y = a.BeginTime.CompareTo(b.BeginTime);
|
||||
return x != 0 ? x : y;
|
||||
});
|
||||
List<int> nl = new List<int>();
|
||||
foreach(var j in ntm)
|
||||
{
|
||||
if(i.Status != status.不通过 && i.Status != status.通过 && i.Status != status.已确认时间)
|
||||
var tm = i.Timelist;
|
||||
var ntm = new List<Session>();
|
||||
foreach (var j in tm)
|
||||
{
|
||||
if (j.Day.Date.Add(j.BeginTime.TimeOfDay).CompareTo(DateTime.Now) < 0 || (j.Students.Count >= j.Capacity && !j.Students.Any(k => k ==i.Id) )) continue;
|
||||
nl.Add(j.Id);
|
||||
var k = sess.Find(it => it.Id == j);
|
||||
ntm.Add(k);
|
||||
}
|
||||
else
|
||||
ntm.Sort((Session a, Session b) =>
|
||||
{
|
||||
nl.Add(j.Id);
|
||||
var x = a.Day.CompareTo(b.Day);
|
||||
var y = a.BeginTime.CompareTo(b.BeginTime);
|
||||
return x != 0 ? x : y;
|
||||
});
|
||||
List<int> nl = new List<int>();
|
||||
foreach (var j in ntm)
|
||||
{
|
||||
if (i.Status != status.不通过 && i.Status != status.通过 && i.Status != status.已确认时间)
|
||||
{
|
||||
if (j.Day.Date.Add(j.BeginTime.TimeOfDay).CompareTo(DateTime.Now) < 0 || (j.Students.Count >= j.Capacity && !j.Students.Any(k => k == i.Id))) continue;
|
||||
nl.Add(j.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
nl.Add(j.Id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
i.Timelist = nl;
|
||||
}
|
||||
i.Timelist = nl;
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct("您无权进行此操作");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> OnPostLoadAsync()
|
||||
{
|
||||
var str = "";
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
var str = "";
|
||||
|
||||
List<Session> loads = new List<Session>();
|
||||
if (!string.IsNullOrEmpty(savename)) str = System.IO.File.ReadAllText(savename);
|
||||
loads = JsonSerializer.Deserialize<List<Session>>(str);
|
||||
List<Session> loads = new List<Session>();
|
||||
if (!string.IsNullOrEmpty(savename)) str = System.IO.File.ReadAllText(savename);
|
||||
loads = JsonSerializer.Deserialize<List<Session>>(str);
|
||||
|
||||
var stus = Context.Students.ToList();
|
||||
foreach (var s in stus)
|
||||
{
|
||||
if (s.Status == status.已选时间)
|
||||
var stus = Context.Students.ToList();
|
||||
foreach (var s in stus)
|
||||
{
|
||||
s.InterviewTime = 0;
|
||||
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Id == it));
|
||||
s.Timelist.Sort((int a, int b) =>
|
||||
if (s.Status == status.已选时间)
|
||||
{
|
||||
var x = Context.Sessions.Find(a);
|
||||
var y = Context.Sessions.Find(b);
|
||||
var k1 = x.Day.CompareTo(y.Day);
|
||||
var k2 = x.BeginTime.CompareTo(y.BeginTime);
|
||||
return k1 != 0 ? k1 : k2;
|
||||
});
|
||||
}
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach (var s in Context.Sessions)
|
||||
{
|
||||
s.Students.Clear();
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach(var item in loads)
|
||||
{
|
||||
Session s = Context.Sessions.Find(item.Id);
|
||||
if(s != null)
|
||||
{
|
||||
s.BeginTime = item.BeginTime;
|
||||
s.Day = item.Day;
|
||||
s.Capacity = item.Capacity;
|
||||
s.SendSMS = item.SendSMS;
|
||||
s.Chiefs = item.Chiefs;
|
||||
s.Students = new List<int>();
|
||||
foreach(var s2 in item.Students)
|
||||
{
|
||||
if (Context.Students.Any(k => k.Id == s2))
|
||||
s.InterviewTime = 0;
|
||||
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Id == it));
|
||||
s.Timelist.Sort((int a, int b) =>
|
||||
{
|
||||
Context.Students.Find(s2).InterviewTime = item.Id;
|
||||
s.Students.Add(s2);
|
||||
var x = Context.Sessions.Find(a);
|
||||
var y = Context.Sessions.Find(b);
|
||||
var k1 = x.Day.CompareTo(y.Day);
|
||||
var k2 = x.BeginTime.CompareTo(y.BeginTime);
|
||||
return k1 != 0 ? k1 : k2;
|
||||
});
|
||||
}
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach (var s in Context.Sessions)
|
||||
{
|
||||
s.Students.Clear();
|
||||
}
|
||||
Context.SaveChanges();
|
||||
foreach (var item in loads)
|
||||
{
|
||||
Session s = Context.Sessions.Find(item.Id);
|
||||
if (s != null)
|
||||
{
|
||||
s.BeginTime = item.BeginTime;
|
||||
s.Day = item.Day;
|
||||
s.Capacity = item.Capacity;
|
||||
s.SendSMS = item.SendSMS;
|
||||
s.Chiefs = item.Chiefs;
|
||||
s.Students = new List<int>();
|
||||
foreach (var s2 in item.Students)
|
||||
{
|
||||
if (Context.Students.Any(k => k.Id == s2))
|
||||
{
|
||||
Context.Students.Find(s2).InterviewTime = item.Id;
|
||||
s.Students.Add(s2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct("您无权进行此操作");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,35 @@
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
给他打分
|
||||
<input asp-for="score" class="form-control"/>
|
||||
<input type="submit" value="打" class="btn btn-warning" style="margin:5px" asp-page-handler="Rank" />
|
||||
<input asp-for="score" class="form-control" />
|
||||
<input type="submit" value="打分" class="btn btn-warning" style="margin:5px" asp-page-handler="Rank" />
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
作品链接:
|
||||
@{
|
||||
if(Model.Student.Uploads == null)
|
||||
{
|
||||
<div>尚未提交作品</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
var fd = Model.Context.FileDesc.Find(Model.Student.Uploads.Last());
|
||||
if (fd == null)
|
||||
{
|
||||
<div>尚未提交作品</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a href="https://@Html.DisplayFor(model => fd.Path)">点我</a>
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<br />
|
||||
|
||||
@@ -161,7 +187,7 @@
|
||||
</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr >
|
||||
<tr>
|
||||
<th>地点</th>
|
||||
<th>日期</th>
|
||||
<th>时间</th>
|
||||
@@ -293,7 +319,7 @@
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.SubmissionSample.Sex)
|
||||
</th>
|
||||
<th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.SubmissionSample.Yard)
|
||||
</th>
|
||||
<th>
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _2021_backend.Utils;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace _2021_backend.Pages.Students
|
||||
{
|
||||
@@ -96,26 +97,48 @@ namespace _2021_backend.Pages.Students
|
||||
|
||||
public async Task<IActionResult> OnPostFinalizeAsync(int? pageId, string errInfo)
|
||||
{
|
||||
if (pageId == null) pageId = 0;
|
||||
|
||||
foreach(var s in Context.Students)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if (s.RegisterTime.CompareTo(new DateTime(2021, 11, 11)) > 0) s.Status = status.不通过;
|
||||
else if (s.Timelist.Count == 0 && s.Status != status.不通过) s.Status = status.需调整时间;
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
if (pageId == null) pageId = 0;
|
||||
|
||||
foreach (var s in Context.Students)
|
||||
{
|
||||
if (s.RegisterTime.CompareTo(new DateTime(2021, 11, 11)) > 0) s.Status = status.不通过;
|
||||
else if (s.Timelist.Count == 0 && s.Status != status.不通过) s.Status = status.需调整时间;
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct((int)pageId, errInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct(pageId??0, "您无权进行此操作");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct((int)pageId, errInfo);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostReselectAllAsync(int? pageId,string errInfo)
|
||||
{
|
||||
if (pageId == null) pageId = 0;
|
||||
foreach (var s in Context.Students)
|
||||
if (HttpContext.User.HasClaim((c) =>
|
||||
{
|
||||
if (s.Status != status.不通过) s.Status = status.需调整时间;
|
||||
return c.Type == ClaimTypes.Role && (
|
||||
c.Value == "admin" || c.Value == "manager");
|
||||
}))
|
||||
{
|
||||
if (pageId == null) pageId = 0;
|
||||
foreach (var s in Context.Students)
|
||||
{
|
||||
if (s.Status != status.不通过) s.Status = status.需调整时间;
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct((int)pageId, errInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Construct(pageId ?? 0, "您无权进行此操作");
|
||||
}
|
||||
Context.SaveChanges();
|
||||
return Construct((int)pageId,errInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user