removed migration ,altered Guid to int
parent
166821a52e
commit
e0115e0e07
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RootNamespace>_2021_backend</RootNamespace>
|
<RootNamespace>_2021_backend</RootNamespace>
|
||||||
<UserSecretsId>2023ab1c-9547-4989-a343-cd3428e085fe</UserSecretsId>
|
<UserSecretsId>2023ab1c-9547-4989-a343-cd3428e085fe</UserSecretsId>
|
||||||
<StartupObject>_2021_backend.Program</StartupObject>
|
<StartupObject>_2021_backend.Program</StartupObject>
|
||||||
|
|
@ -19,21 +19,25 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="itext7" Version="7.1.16" />
|
<PackageReference Include="itext7" Version="7.2.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" />
|
||||||
<PackageReference Include="Nancy" Version="2.0.0" />
|
<PackageReference Include="Nancy" Version="2.0.0" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.7" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.3" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
|
||||||
<PackageReference Include="NPOI" Version="2.5.4" />
|
<PackageReference Include="NPOI" Version="2.5.5" />
|
||||||
<PackageReference Include="TencentCloudSDK" Version="3.0.362" />
|
<PackageReference Include="TencentCloudSDK" Version="3.0.464" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Migrations\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace _2021_backend.Controllers
|
||||||
{
|
{
|
||||||
if(aDto.Timelist != null)if (aDto.Timelist.Any(it => it.Day.Day == tm.Day.Day && it.BeginTime.TimeOfDay == tm.BeginTime.TimeOfDay))
|
if(aDto.Timelist != null)if (aDto.Timelist.Any(it => it.Day.Day == tm.Day.Day && it.BeginTime.TimeOfDay == tm.BeginTime.TimeOfDay))
|
||||||
{
|
{
|
||||||
sub.Timelist.Add(tm.Guid);
|
sub.Timelist.Add(tm.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var q = Context.Students.Where(stu => (stu.Name == aDto.Name || stu.Stuid == aDto.Stuid));
|
var q = Context.Students.Where(stu => (stu.Name == aDto.Name || stu.Stuid == aDto.Stuid));
|
||||||
|
|
@ -49,7 +49,7 @@ namespace _2021_backend.Controllers
|
||||||
stu = q.FirstOrDefault();
|
stu = q.FirstOrDefault();
|
||||||
stu.Update(sub);
|
stu.Update(sub);
|
||||||
}
|
}
|
||||||
sub.Host = stu.Guid;
|
sub.Host = stu.Id;
|
||||||
Context.Submissions.Add(sub);
|
Context.Submissions.Add(sub);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
await TencentSMS.Send(Context, SMSType.Signed, stu, _2021_backend.Models.User.Bot.stuID);
|
await TencentSMS.Send(Context, SMSType.Signed, stu, _2021_backend.Models.User.Bot.stuID);
|
||||||
|
|
@ -96,7 +96,7 @@ namespace _2021_backend.Controllers
|
||||||
Student stu = Context.Students.FirstOrDefault(r => r.Stuid == stuid);
|
Student stu = Context.Students.FirstOrDefault(r => r.Stuid == stuid);
|
||||||
if (stu == null)
|
if (stu == null)
|
||||||
{
|
{
|
||||||
return StatusCode(400, ApiResponse.Error("INVALID_STUDENT_GUID"));
|
return StatusCode(400, ApiResponse.Error("INVALID_STUDENT_int"));
|
||||||
}
|
}
|
||||||
SessionDto time;
|
SessionDto time;
|
||||||
try
|
try
|
||||||
|
|
@ -108,8 +108,8 @@ namespace _2021_backend.Controllers
|
||||||
Console.WriteLine(ex);
|
Console.WriteLine(ex);
|
||||||
return StatusCode(400, ApiResponse.Error("MALFORMED_DATA"));
|
return StatusCode(400, ApiResponse.Error("MALFORMED_DATA"));
|
||||||
};
|
};
|
||||||
//get the selected session guids;
|
//get the selected session ints;
|
||||||
Guid targetSession = Guid.Empty;
|
int targetSession = 0;
|
||||||
var sessions = Context.Sessions.ToList();
|
var sessions = Context.Sessions.ToList();
|
||||||
var s = sessions.Find((Session s) =>
|
var s = sessions.Find((Session s) =>
|
||||||
{
|
{
|
||||||
|
|
@ -120,15 +120,15 @@ namespace _2021_backend.Controllers
|
||||||
if (Context.Sessions.Find(stu.InterviewTime) != null)
|
if (Context.Sessions.Find(stu.InterviewTime) != null)
|
||||||
{
|
{
|
||||||
var olds = Context.Sessions.Find(stu.InterviewTime);
|
var olds = Context.Sessions.Find(stu.InterviewTime);
|
||||||
olds.Students.Remove(stu.Guid);
|
olds.Students.Remove(stu.Id);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
overwritten = true;
|
overwritten = true;
|
||||||
}
|
}
|
||||||
targetSession = s.Guid;
|
targetSession = s.Id;
|
||||||
s.Students.Add(stu.Guid);
|
s.Students.Add(stu.Id);
|
||||||
stu.Timelist = new List<Guid> { targetSession};
|
stu.Timelist = new List<int> { targetSession};
|
||||||
stu.Status = status.已选时间;
|
stu.Status = status.已选时间;
|
||||||
stu.InterviewTime = s.Guid;
|
stu.InterviewTime = s.Id;
|
||||||
await TencentSMS.Send(Context, SMSType.TimeSet, stu, "smsbot");
|
await TencentSMS.Send(Context, SMSType.TimeSet, stu, "smsbot");
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
if (overwritten) return Ok(ApiResponse.Success("overwritten"));
|
if (overwritten) return Ok(ApiResponse.Success("overwritten"));
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,15 @@ namespace _2021_backend.Data
|
||||||
protected override void OnModelCreating(ModelBuilder mb)
|
protected override void OnModelCreating(ModelBuilder mb)
|
||||||
{
|
{
|
||||||
mb.Entity<Submission>()
|
mb.Entity<Submission>()
|
||||||
.HasKey(r => r.Guid);
|
.HasKey(r => r.Id);
|
||||||
mb.Entity<User>()
|
mb.Entity<User>()
|
||||||
.HasKey(u => u.Guid);
|
.HasKey(u => u.Id);
|
||||||
mb.Entity<Comment>()
|
mb.Entity<Comment>()
|
||||||
.HasKey(u => u.Guid);
|
.HasKey(u => u.Id);
|
||||||
mb.Entity<Session>()
|
mb.Entity<Session>()
|
||||||
.HasKey(u => u.Guid);
|
.HasKey(u => u.Id);
|
||||||
mb.Entity<SMS>()
|
mb.Entity<SMS>()
|
||||||
.HasKey(u => u.Guid);
|
.HasKey(u => u.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,58 +8,100 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using _2021_backend.Data;
|
using _2021_backend.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
namespace _2021_backend.Migrations
|
namespace _2021_backend.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(BackendContext))]
|
[DbContext(typeof(BackendContext))]
|
||||||
[Migration("20211018220015_Initial")]
|
[Migration("20220222090619_initial")]
|
||||||
partial class Initial
|
partial class initial
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63)
|
.HasAnnotation("ProductVersion", "6.0.2")
|
||||||
.HasAnnotation("ProductVersion", "5.0.9")
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Comment", b =>
|
modelBuilder.Entity("_2021_backend.Models.Comment", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<DateTime>("AddTime")
|
b.Property<DateTime>("AddTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Content")
|
b.Property<string>("Content")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<Guid>("Operator")
|
b.Property<int>("Operator")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<Guid>("Student")
|
b.Property<int>("Student")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Comments");
|
b.ToTable("Comments");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("_2021_backend.Models.Session", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("BeginTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Capacity")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<List<int>>("Chiefs")
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Day")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Place")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("SendSMS")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<List<int>>("Students")
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Sessions");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.SMS", b =>
|
modelBuilder.Entity("_2021_backend.Models.SMS", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<List<string>>("Data")
|
b.Property<List<string>>("Data")
|
||||||
.HasColumnType("text[]");
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
b.Property<Guid>("Host")
|
b.Property<int>("Host")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("SendTime")
|
b.Property<DateTime>("SendTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Sender")
|
b.Property<string>("Sender")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -70,52 +112,21 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<int>("Type")
|
b.Property<int>("Type")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("SMS");
|
b.ToTable("SMS");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Session", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Guid")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("BeginTime")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<int>("Capacity")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<List<Guid>>("Chiefs")
|
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Day")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Place")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("SendSMS")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<List<Guid>>("Students")
|
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
|
||||||
b.HasKey("Guid");
|
|
||||||
|
|
||||||
b.ToTable("Sessions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Student", b =>
|
modelBuilder.Entity("_2021_backend.Models.Student", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Comments")
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
b.Property<List<int>>("Comments")
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -126,23 +137,23 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<int>("Grade")
|
b.Property<int>("Grade")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<Guid>("InterviewTime")
|
b.Property<int>("InterviewTime")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("LastSubmission")
|
b.Property<DateTime>("LastSubmission")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Major")
|
b.Property<string>("Major")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Messages")
|
b.Property<List<int>>("Messages")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("RegisterTime")
|
b.Property<DateTime>("RegisterTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<int>("Score")
|
b.Property<int>("Score")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
@ -156,28 +167,30 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<string>("Stuid")
|
b.Property<string>("Stuid")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Submissions")
|
b.Property<List<int>>("Submissions")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<string>("Tel")
|
b.Property<string>("Tel")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Timelist")
|
b.Property<List<int>>("Timelist")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<int>("Yard")
|
b.Property<int>("Yard")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Students");
|
b.ToTable("Students");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Submission", b =>
|
modelBuilder.Entity("_2021_backend.Models.Submission", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Address")
|
b.Property<string>("Address")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -191,8 +204,8 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<int>("Grade")
|
b.Property<int>("Grade")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<Guid>("Host")
|
b.Property<int>("Host")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<string>("Major")
|
b.Property<string>("Major")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -207,27 +220,29 @@ namespace _2021_backend.Migrations
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("SubmitTime")
|
b.Property<DateTime>("SubmitTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Tel")
|
b.Property<string>("Tel")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Timelist")
|
b.Property<List<int>>("Timelist")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<int>("Yard")
|
b.Property<int>("Yard")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Submissions");
|
b.ToTable("Submissions");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.User", b =>
|
modelBuilder.Entity("_2021_backend.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -241,7 +256,7 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<string>("stuID")
|
b.Property<string>("stuID")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
namespace _2021_backend.Migrations
|
namespace _2021_backend.Migrations
|
||||||
{
|
{
|
||||||
public partial class Initial : Migration
|
public partial class initial : Migration
|
||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
|
@ -12,57 +15,61 @@ namespace _2021_backend.Migrations
|
||||||
name: "Comments",
|
name: "Comments",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
Operator = table.Column<Guid>(type: "uuid", nullable: false),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Operator = table.Column<int>(type: "integer", nullable: false),
|
||||||
Content = table.Column<string>(type: "text", nullable: false),
|
Content = table.Column<string>(type: "text", nullable: false),
|
||||||
AddTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
Student = table.Column<Guid>(type: "uuid", nullable: false)
|
Student = table.Column<int>(type: "integer", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Comments", x => x.Guid);
|
table.PrimaryKey("PK_Comments", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Sessions",
|
name: "Sessions",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
Day = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
BeginTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
Day = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
BeginTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
Place = table.Column<string>(type: "text", nullable: false),
|
Place = table.Column<string>(type: "text", nullable: false),
|
||||||
Chiefs = table.Column<List<Guid>>(type: "uuid[]", nullable: true),
|
Chiefs = table.Column<List<int>>(type: "integer[]", nullable: true),
|
||||||
Capacity = table.Column<int>(type: "integer", nullable: false),
|
Capacity = table.Column<int>(type: "integer", nullable: false),
|
||||||
SendSMS = table.Column<bool>(type: "boolean", nullable: false),
|
SendSMS = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
Students = table.Column<List<Guid>>(type: "uuid[]", nullable: true)
|
Students = table.Column<List<int>>(type: "integer[]", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Sessions", x => x.Guid);
|
table.PrimaryKey("PK_Sessions", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "SMS",
|
name: "SMS",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
Host = table.Column<Guid>(type: "uuid", nullable: false),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Host = table.Column<int>(type: "integer", nullable: false),
|
||||||
Tel = table.Column<string>(type: "text", nullable: true),
|
Tel = table.Column<string>(type: "text", nullable: true),
|
||||||
Data = table.Column<List<string>>(type: "text[]", nullable: true),
|
Data = table.Column<List<string>>(type: "text[]", nullable: true),
|
||||||
Type = table.Column<int>(type: "integer", nullable: false),
|
Type = table.Column<int>(type: "integer", nullable: false),
|
||||||
Sender = table.Column<string>(type: "text", nullable: true),
|
Sender = table.Column<string>(type: "text", nullable: true),
|
||||||
SendTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
SendTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_SMS", x => x.Guid);
|
table.PrimaryKey("PK_SMS", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Students",
|
name: "Students",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
Name = table.Column<string>(type: "text", nullable: true),
|
Name = table.Column<string>(type: "text", nullable: true),
|
||||||
Stuid = table.Column<string>(type: "text", nullable: true),
|
Stuid = table.Column<string>(type: "text", nullable: true),
|
||||||
Sex = table.Column<int>(type: "integer", nullable: false),
|
Sex = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
|
@ -72,27 +79,28 @@ namespace _2021_backend.Migrations
|
||||||
Email = table.Column<string>(type: "text", nullable: true),
|
Email = table.Column<string>(type: "text", nullable: true),
|
||||||
Tel = table.Column<string>(type: "text", nullable: true),
|
Tel = table.Column<string>(type: "text", nullable: true),
|
||||||
Exp = table.Column<int>(type: "integer", nullable: false),
|
Exp = table.Column<int>(type: "integer", nullable: false),
|
||||||
InterviewTime = table.Column<Guid>(type: "uuid", nullable: false),
|
InterviewTime = table.Column<int>(type: "integer", nullable: false),
|
||||||
Submissions = table.Column<List<Guid>>(type: "uuid[]", nullable: true),
|
Submissions = table.Column<List<int>>(type: "integer[]", nullable: true),
|
||||||
Messages = table.Column<List<Guid>>(type: "uuid[]", nullable: true),
|
Messages = table.Column<List<int>>(type: "integer[]", nullable: true),
|
||||||
Timelist = table.Column<List<Guid>>(type: "uuid[]", nullable: true),
|
Timelist = table.Column<List<int>>(type: "integer[]", nullable: true),
|
||||||
Comments = table.Column<List<Guid>>(type: "uuid[]", nullable: true),
|
Comments = table.Column<List<int>>(type: "integer[]", nullable: true),
|
||||||
Score = table.Column<int>(type: "integer", nullable: false),
|
Score = table.Column<int>(type: "integer", nullable: false),
|
||||||
Status = table.Column<int>(type: "integer", nullable: false),
|
Status = table.Column<int>(type: "integer", nullable: false),
|
||||||
LastSubmission = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
LastSubmission = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
RegisterTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
RegisterTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Students", x => x.Guid);
|
table.PrimaryKey("PK_Students", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Submissions",
|
name: "Submissions",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
Host = table.Column<Guid>(type: "uuid", nullable: false),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Host = table.Column<int>(type: "integer", nullable: false),
|
||||||
Name = table.Column<string>(type: "text", nullable: true),
|
Name = table.Column<string>(type: "text", nullable: true),
|
||||||
Stuid = table.Column<string>(type: "text", nullable: true),
|
Stuid = table.Column<string>(type: "text", nullable: true),
|
||||||
Sex = table.Column<int>(type: "integer", nullable: false),
|
Sex = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
|
@ -102,20 +110,21 @@ namespace _2021_backend.Migrations
|
||||||
Email = table.Column<string>(type: "text", nullable: true),
|
Email = table.Column<string>(type: "text", nullable: true),
|
||||||
Tel = table.Column<string>(type: "text", nullable: true),
|
Tel = table.Column<string>(type: "text", nullable: true),
|
||||||
Exp = table.Column<int>(type: "integer", nullable: false),
|
Exp = table.Column<int>(type: "integer", nullable: false),
|
||||||
Timelist = table.Column<List<Guid>>(type: "uuid[]", nullable: true),
|
Timelist = table.Column<List<int>>(type: "integer[]", nullable: true),
|
||||||
Address = table.Column<string>(type: "text", nullable: true),
|
Address = table.Column<string>(type: "text", nullable: true),
|
||||||
SubmitTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
SubmitTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Submissions", x => x.Guid);
|
table.PrimaryKey("PK_Submissions", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Users",
|
name: "Users",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
stuID = table.Column<string>(type: "text", nullable: true),
|
stuID = table.Column<string>(type: "text", nullable: true),
|
||||||
Name = table.Column<string>(type: "text", nullable: true),
|
Name = table.Column<string>(type: "text", nullable: true),
|
||||||
Secret = table.Column<string>(type: "text", nullable: true),
|
Secret = table.Column<string>(type: "text", nullable: true),
|
||||||
|
|
@ -123,7 +132,7 @@ namespace _2021_backend.Migrations
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Users", x => x.Guid);
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using _2021_backend.Data;
|
using _2021_backend.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
namespace _2021_backend.Migrations
|
namespace _2021_backend.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(BackendContext))]
|
[DbContext(typeof(BackendContext))]
|
||||||
|
|
@ -16,48 +18,88 @@ namespace _2021_backend.Migrations
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63)
|
.HasAnnotation("ProductVersion", "6.0.2")
|
||||||
.HasAnnotation("ProductVersion", "5.0.9")
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Comment", b =>
|
modelBuilder.Entity("_2021_backend.Models.Comment", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<DateTime>("AddTime")
|
b.Property<DateTime>("AddTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Content")
|
b.Property<string>("Content")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<Guid>("Operator")
|
b.Property<int>("Operator")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<Guid>("Student")
|
b.Property<int>("Student")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Comments");
|
b.ToTable("Comments", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("_2021_backend.Models.Session", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("BeginTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Capacity")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<List<int>>("Chiefs")
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Day")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Place")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("SendSMS")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<List<int>>("Students")
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Sessions", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.SMS", b =>
|
modelBuilder.Entity("_2021_backend.Models.SMS", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<List<string>>("Data")
|
b.Property<List<string>>("Data")
|
||||||
.HasColumnType("text[]");
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
b.Property<Guid>("Host")
|
b.Property<int>("Host")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("SendTime")
|
b.Property<DateTime>("SendTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Sender")
|
b.Property<string>("Sender")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -68,52 +110,21 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<int>("Type")
|
b.Property<int>("Type")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("SMS");
|
b.ToTable("SMS", (string)null);
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Session", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Guid")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("BeginTime")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<int>("Capacity")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<List<Guid>>("Chiefs")
|
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Day")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Place")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("SendSMS")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<List<Guid>>("Students")
|
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
|
||||||
b.HasKey("Guid");
|
|
||||||
|
|
||||||
b.ToTable("Sessions");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Student", b =>
|
modelBuilder.Entity("_2021_backend.Models.Student", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Comments")
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
b.Property<List<int>>("Comments")
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -124,23 +135,23 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<int>("Grade")
|
b.Property<int>("Grade")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<Guid>("InterviewTime")
|
b.Property<int>("InterviewTime")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("LastSubmission")
|
b.Property<DateTime>("LastSubmission")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Major")
|
b.Property<string>("Major")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Messages")
|
b.Property<List<int>>("Messages")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("RegisterTime")
|
b.Property<DateTime>("RegisterTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<int>("Score")
|
b.Property<int>("Score")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
@ -154,28 +165,30 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<string>("Stuid")
|
b.Property<string>("Stuid")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Submissions")
|
b.Property<List<int>>("Submissions")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<string>("Tel")
|
b.Property<string>("Tel")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Timelist")
|
b.Property<List<int>>("Timelist")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<int>("Yard")
|
b.Property<int>("Yard")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Students");
|
b.ToTable("Students", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.Submission", b =>
|
modelBuilder.Entity("_2021_backend.Models.Submission", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Address")
|
b.Property<string>("Address")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -189,8 +202,8 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<int>("Grade")
|
b.Property<int>("Grade")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<Guid>("Host")
|
b.Property<int>("Host")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<string>("Major")
|
b.Property<string>("Major")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -205,27 +218,29 @@ namespace _2021_backend.Migrations
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("SubmitTime")
|
b.Property<DateTime>("SubmitTime")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Tel")
|
b.Property<string>("Tel")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<List<Guid>>("Timelist")
|
b.Property<List<int>>("Timelist")
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
b.Property<int>("Yard")
|
b.Property<int>("Yard")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Submissions");
|
b.ToTable("Submissions", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("_2021_backend.Models.User", b =>
|
modelBuilder.Entity("_2021_backend.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Guid")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
@ -239,9 +254,9 @@ namespace _2021_backend.Migrations
|
||||||
b.Property<string>("stuID")
|
b.Property<string>("stuID")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.HasKey("Guid");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users", (string)null);
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,30 +11,31 @@ namespace _2021_backend.Models
|
||||||
{
|
{
|
||||||
public Comment()
|
public Comment()
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
AddTime = DateTime.Now;
|
AddTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Key]
|
[Key]
|
||||||
public Guid Guid { get; set; }
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
[Required()]
|
[Required()]
|
||||||
[Display(Name ="评论者")]
|
[Display(Name = "评论者")]
|
||||||
public Guid Operator { get; set; }
|
public int Operator { get; set; }
|
||||||
|
|
||||||
[Required()]
|
[Required()]
|
||||||
[Display(Name ="内容")]
|
[Display(Name = "内容")]
|
||||||
public string Content { get; set; }
|
public string Content { get; set; }
|
||||||
[Display(Name = "评论时间")]
|
[Display(Name = "评论时间")]
|
||||||
[DataType(DataType.DateTime)]
|
[DataType(DataType.DateTime)]
|
||||||
public DateTime AddTime { get; set; }
|
public DateTime AddTime { get; set; }
|
||||||
[Display(Name ="被评论者")]
|
[Display(Name = "被评论者")]
|
||||||
public Guid Student { get; set; }
|
public int Student { get; set; }
|
||||||
public Comment(Guid opid,string content, Guid stuguid)
|
public Comment(int opid, string content, int stuint)
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
Operator = opid;
|
Operator = opid;
|
||||||
Content = content;
|
Content = content;
|
||||||
Student = stuguid;
|
Student = stuint;
|
||||||
AddTime = DateTime.Now;
|
AddTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace _2021_backend.Models
|
namespace _2021_backend.Models
|
||||||
{
|
{
|
||||||
|
|
@ -18,16 +19,16 @@ namespace _2021_backend.Models
|
||||||
{
|
{
|
||||||
public SMS()
|
public SMS()
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
Tel = "";
|
Tel = "";
|
||||||
Data = new List<string> { };
|
Data = new List<string> { };
|
||||||
Type = SMSType.Accept;
|
Type = SMSType.Accept;
|
||||||
Sender = "";
|
Sender = "";
|
||||||
SendTime = DateTime.Now;
|
SendTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
public SMS(SMSPartialDto dto, Guid host)
|
public SMS(SMSPartialDto dto, int host)
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
Tel = dto.SubscriberNumber;
|
Tel = dto.SubscriberNumber;
|
||||||
Host = host;
|
Host = host;
|
||||||
Sender = dto.SubscriberNumber.ToString();
|
Sender = dto.SubscriberNumber.ToString();
|
||||||
|
|
@ -37,17 +38,18 @@ namespace _2021_backend.Models
|
||||||
SendTime = tm;
|
SendTime = tm;
|
||||||
}
|
}
|
||||||
[Key]
|
[Key]
|
||||||
public Guid Guid { get; set; }
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Display(Name ="Host")]
|
public int Id { get; set; }
|
||||||
public Guid Host { get; set; }
|
[Display(Name = "Host")]
|
||||||
[Display(Name ="电话号码")]
|
public int Host { get; set; }
|
||||||
|
[Display(Name = "电话号码")]
|
||||||
public string Tel { get; set; }
|
public string Tel { get; set; }
|
||||||
|
|
||||||
[Display(Name ="短信内容")]
|
[Display(Name = "短信内容")]
|
||||||
public List<string> Data { get; set; }
|
public List<string> Data { get; set; }
|
||||||
[Display(Name ="短信类型")]
|
[Display(Name = "短信类型")]
|
||||||
public SMSType Type { get; set; }
|
public SMSType Type { get; set; }
|
||||||
[Display(Name ="发送者")]
|
[Display(Name = "发送者")]
|
||||||
public string Sender { get; set; }
|
public string Sender { get; set; }
|
||||||
[Display(Name = "发送时间")]
|
[Display(Name = "发送时间")]
|
||||||
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
|
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,13 @@ namespace _2021_backend.Models
|
||||||
|
|
||||||
public Session()
|
public Session()
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
}
|
}
|
||||||
[Key]
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Required()]
|
[Required()]
|
||||||
[Display(Name = "场次GUID")]
|
[Display(Name = "场次int")]
|
||||||
public Guid Guid { get; set; }
|
public int Id { get; set; }
|
||||||
[Required()]
|
[Required()]
|
||||||
[Display(Name = "活动日期")]
|
[Display(Name = "活动日期")]
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
|
|
@ -35,7 +36,7 @@ namespace _2021_backend.Models
|
||||||
[Required()]
|
[Required()]
|
||||||
public string Place { get; set; }
|
public string Place { get; set; }
|
||||||
[Display(Name = "主活动官")]
|
[Display(Name = "主活动官")]
|
||||||
public List<Guid> Chiefs { get; set; }
|
public List<int> Chiefs { get; set; }
|
||||||
|
|
||||||
[Display(Name = "可容纳人数")]
|
[Display(Name = "可容纳人数")]
|
||||||
public int Capacity { get; set; }
|
public int Capacity { get; set; }
|
||||||
|
|
@ -43,7 +44,7 @@ namespace _2021_backend.Models
|
||||||
[Display(Name = "短信通知")]
|
[Display(Name = "短信通知")]
|
||||||
public bool SendSMS { get; set; }
|
public bool SendSMS { get; set; }
|
||||||
[Display(Name = "活动的人")]
|
[Display(Name = "活动的人")]
|
||||||
public List<Guid> Students { get; set; }
|
public List<int> Students { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class SessionDto
|
public class SessionDto
|
||||||
|
|
@ -57,7 +58,7 @@ namespace _2021_backend.Models
|
||||||
public class SessionDtoComparer : IEqualityComparer<SessionDto>
|
public class SessionDtoComparer : IEqualityComparer<SessionDto>
|
||||||
{
|
{
|
||||||
#region IEqualityComparer<user> Members
|
#region IEqualityComparer<user> Members
|
||||||
public bool Equals(SessionDto a,SessionDto b)
|
public bool Equals(SessionDto a, SessionDto b)
|
||||||
{
|
{
|
||||||
return a.Day == b.Day && a.BeginTime == b.BeginTime;
|
return a.Day == b.Day && a.BeginTime == b.BeginTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
@ -64,22 +65,22 @@ namespace _2021_backend.Models
|
||||||
Major = sub.Major;
|
Major = sub.Major;
|
||||||
Yard = sub.Yard;
|
Yard = sub.Yard;
|
||||||
Exp = sub.Exp;
|
Exp = sub.Exp;
|
||||||
Timelist = sub.Timelist;
|
Timelist = sub.Timelist;
|
||||||
Submissions.Add(sub.Guid);
|
Submissions.Add(sub.Id);
|
||||||
}
|
}
|
||||||
public Student()
|
public Student()
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
Comments = new List<Guid>();
|
Comments = new List<int>();
|
||||||
Messages = new List<Guid>();
|
Messages = new List<int>();
|
||||||
Submissions = new List<Guid>();
|
Submissions = new List<int>();
|
||||||
Timelist = new List<Guid>();
|
Timelist = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Student create(Submission sub)
|
public static Student create(Submission sub)
|
||||||
{
|
{
|
||||||
Student student = new Student();
|
Student student = new Student();
|
||||||
student.Guid = Guid.NewGuid();
|
student.Id = 0;
|
||||||
student.Name = sub.Name;
|
student.Name = sub.Name;
|
||||||
student.Email = sub.Email;
|
student.Email = sub.Email;
|
||||||
student.Tel = sub.Tel;
|
student.Tel = sub.Tel;
|
||||||
|
|
@ -90,13 +91,14 @@ namespace _2021_backend.Models
|
||||||
student.Yard = sub.Yard;
|
student.Yard = sub.Yard;
|
||||||
student.Exp = sub.Exp;
|
student.Exp = sub.Exp;
|
||||||
student.Timelist = sub.Timelist;
|
student.Timelist = sub.Timelist;
|
||||||
student.Submissions.Add(sub.Guid);
|
student.Submissions.Add(sub.Id);
|
||||||
student.RegisterTime = sub.SubmitTime;
|
student.RegisterTime = sub.SubmitTime;
|
||||||
return student;
|
return student;
|
||||||
}
|
}
|
||||||
[Key]
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Display(Name = "ID")]
|
[Display(Name = "ID")]
|
||||||
public Guid Guid { get; set; }
|
public int Id { get; set; }
|
||||||
[Display(Name = "姓名")]
|
[Display(Name = "姓名")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[Display(Name = "学号")]
|
[Display(Name = "学号")]
|
||||||
|
|
@ -107,7 +109,7 @@ namespace _2021_backend.Models
|
||||||
public grade Grade { get; set; }
|
public grade Grade { get; set; }
|
||||||
|
|
||||||
[Display(Name = "学园")]
|
[Display(Name = "学园")]
|
||||||
public yard Yard { get; set; }
|
public yard Yard { get; set; }
|
||||||
[Display(Name = "专业")]
|
[Display(Name = "专业")]
|
||||||
public string Major { get; set; }
|
public string Major { get; set; }
|
||||||
[Display(Name = "电子邮件")]
|
[Display(Name = "电子邮件")]
|
||||||
|
|
@ -116,20 +118,20 @@ namespace _2021_backend.Models
|
||||||
public string Tel { get; set; }
|
public string Tel { get; set; }
|
||||||
|
|
||||||
[Display(Name = "经验程度")]
|
[Display(Name = "经验程度")]
|
||||||
public experience Exp { get; set; }
|
public experience Exp { get; set; }
|
||||||
|
|
||||||
[Display(Name = "最终场次")]
|
[Display(Name = "最终场次")]
|
||||||
public Guid InterviewTime { get; set; }
|
public int InterviewTime { get; set; }
|
||||||
[Display(Name = "提交记录")]
|
[Display(Name = "提交记录")]
|
||||||
public List<Guid> Submissions { get; set; }
|
public List<int> Submissions { get; set; }
|
||||||
[Display(Name = "短信记录")]
|
[Display(Name = "短信记录")]
|
||||||
public List<Guid> Messages { get; set; }
|
public List<int> Messages { get; set; }
|
||||||
[Display(Name = "可选场次")]
|
[Display(Name = "可选场次")]
|
||||||
public List<Guid> Timelist { get; set; }
|
public List<int> Timelist { get; set; }
|
||||||
[Display(Name = "评论")]
|
[Display(Name = "评论")]
|
||||||
public List<Guid> Comments { get; set; }
|
public List<int> Comments { get; set; }
|
||||||
[Display(Name = "打分")]
|
[Display(Name = "打分")]
|
||||||
public int Score { get; set; }
|
public int Score { get; set; }
|
||||||
|
|
||||||
[Display(Name = "状态")]
|
[Display(Name = "状态")]
|
||||||
public status Status { get; set; }
|
public status Status { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using Org.BouncyCastle.Asn1.Cms;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -11,8 +12,9 @@ namespace _2021_backend.Models
|
||||||
{
|
{
|
||||||
public class Submission
|
public class Submission
|
||||||
{
|
{
|
||||||
public Submission() {
|
public Submission()
|
||||||
Guid = Guid.NewGuid();
|
{
|
||||||
|
Id = 0;
|
||||||
SubmitTime = DateTime.Now;
|
SubmitTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
public Submission(SubmissionDto Dto, string ip)
|
public Submission(SubmissionDto Dto, string ip)
|
||||||
|
|
@ -26,16 +28,17 @@ namespace _2021_backend.Models
|
||||||
Tel = Dto.Tel;
|
Tel = Dto.Tel;
|
||||||
Exp = (experience)Dto.Exp;
|
Exp = (experience)Dto.Exp;
|
||||||
Yard = (yard)Dto.Yard;
|
Yard = (yard)Dto.Yard;
|
||||||
Timelist = new List<Guid>();
|
Timelist = new List<int>();
|
||||||
Guid = System.Guid.NewGuid();
|
Id = 0;
|
||||||
SubmitTime = DateTime.Now;
|
SubmitTime = DateTime.Now;
|
||||||
Address = ip;
|
Address = ip;
|
||||||
}
|
}
|
||||||
[Key]
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Display(Name = "ID")]
|
[Display(Name = "ID")]
|
||||||
public Guid Guid { get; set; }
|
public int Id { get; set; }
|
||||||
[Display(Name ="Host")]
|
[Display(Name = "Host")]
|
||||||
public Guid Host { get; set; }
|
public int Host { get; set; }
|
||||||
[Display(Name = "姓名")]
|
[Display(Name = "姓名")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[Display(Name = "学号")]
|
[Display(Name = "学号")]
|
||||||
|
|
@ -58,9 +61,9 @@ namespace _2021_backend.Models
|
||||||
public experience Exp { get; set; }
|
public experience Exp { get; set; }
|
||||||
|
|
||||||
[Display(Name = "时间列表")]
|
[Display(Name = "时间列表")]
|
||||||
public List<Guid> Timelist { get; set; }
|
public List<int> Timelist { get; set; }
|
||||||
[Display(Name ="Ip Address")]
|
[Display(Name = "Ip Address")]
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
[Display(Name = "提交时间")]
|
[Display(Name = "提交时间")]
|
||||||
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
|
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
|
||||||
public DateTime SubmitTime { get; set; }
|
public DateTime SubmitTime { get; set; }
|
||||||
|
|
@ -69,8 +72,8 @@ namespace _2021_backend.Models
|
||||||
}
|
}
|
||||||
public class TimeSpec
|
public class TimeSpec
|
||||||
{
|
{
|
||||||
public DateTime Day { get; set; }
|
public DateTime Day { get; set; }
|
||||||
public DateTime BeginTime { get; set; }
|
public DateTime BeginTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SubmissionDto
|
public class SubmissionDto
|
||||||
|
|
@ -91,12 +94,12 @@ namespace _2021_backend.Models
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
[Required()]
|
[Required()]
|
||||||
public string Tel { get; set; }
|
public string Tel { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Required()]
|
[Required()]
|
||||||
public int Exp { get; set; }
|
public int Exp { get; set; }
|
||||||
[Required()]
|
[Required()]
|
||||||
public List<TimeSpec> Timelist { get; set; }
|
public List<TimeSpec> Timelist { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public static Regex r = new Regex("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
|
public static Regex r = new Regex("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
|
||||||
|
|
@ -118,7 +121,7 @@ namespace _2021_backend.Models
|
||||||
if (Major.Length > 20)
|
if (Major.Length > 20)
|
||||||
return false;
|
return false;
|
||||||
if (Yard >= 6 && Yard <= 0) return false;
|
if (Yard >= 6 && Yard <= 0) return false;
|
||||||
if(Exp >= 5 && Exp <= 0) return false;
|
if (Exp >= 5 && Exp <= 0) return false;
|
||||||
if (!r.IsMatch(Email))
|
if (!r.IsMatch(Email))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -10,37 +10,37 @@ using Microsoft.EntityFrameworkCore.Internal;
|
||||||
|
|
||||||
namespace _2021_backend.Models
|
namespace _2021_backend.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
public User()
|
public User()
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid();
|
Id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User Bot;
|
public static User Bot;
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Display(Name ="ID")]
|
[Display(Name = "ID")]
|
||||||
public Guid Guid { get; set; }
|
public int Id { get; set; }
|
||||||
[Display(Name = "学号")]
|
[Display(Name = "学号")]
|
||||||
public string stuID { get; set; }
|
public string stuID { get; set; }
|
||||||
[Display(Name ="姓名")]
|
[Display(Name = "姓名")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[Display(Name ="密码")]
|
[Display(Name = "密码")]
|
||||||
public string Secret { get; set; }
|
public string Secret { get; set; }
|
||||||
[Display(Name ="是否管理员")]
|
[Display(Name = "是否管理员")]
|
||||||
public bool isManager { get; set; }
|
public bool isManager { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class Login
|
public class Login
|
||||||
{
|
{
|
||||||
private readonly string[] Manager = { "3200102610", "3190104611", "3190104698", "3190103719", "3190104143", "3190100494", "3190103301", "3190102034", "3190100151", "3190103577", "3190105399", "3190100133" };
|
private readonly string[] Manager = { "3200102610", "3190104611", "3190104698", "3190103719", "3190104143", "3190100494", "3190103301", "3190102034", "3190100151", "3190103577", "3190105399", "3190100133" };
|
||||||
[JsonProperty("username")]
|
[JsonProperty("username")]
|
||||||
public string id_student { get; set; }
|
public string id_student { get; set; }
|
||||||
[JsonProperty("password")]
|
[JsonProperty("password")]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public Login(string name,string pwd)
|
public Login(string name, string pwd)
|
||||||
{
|
{
|
||||||
id_student = name;
|
id_student = name;
|
||||||
Password = pwd;
|
Password = pwd;
|
||||||
|
|
@ -48,7 +48,7 @@ namespace _2021_backend.Models
|
||||||
public string GetSHASecret() => _2021_backend.Utils.EvaCryptoHelper.Password2Secret(Password);
|
public string GetSHASecret() => _2021_backend.Utils.EvaCryptoHelper.Password2Secret(Password);
|
||||||
public bool isManager()
|
public bool isManager()
|
||||||
{
|
{
|
||||||
if (Array.IndexOf(Manager,id_student) != -1)
|
if (Array.IndexOf(Manager, id_student) != -1)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ namespace _2021_backend.Pages.Account
|
||||||
{
|
{
|
||||||
var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme, ClaimTypes.Name, ClaimTypes.Role);
|
var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme, ClaimTypes.Name, ClaimTypes.Role);
|
||||||
identity.AddClaim(new Claim(ClaimTypes.Name, user.Name));
|
identity.AddClaim(new Claim(ClaimTypes.Name, user.Name));
|
||||||
identity.AddClaim(new Claim(ClaimTypes.Sid, user.Guid.ToString()));
|
identity.AddClaim(new Claim(ClaimTypes.Sid, user.Id.ToString()));
|
||||||
identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, username));
|
identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, username));
|
||||||
if (user.isManager)
|
if (user.isManager)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@ namespace _2021_backend.Pages.Message
|
||||||
|
|
||||||
public IActionResult Construct(int PageId)
|
public IActionResult Construct(int PageId)
|
||||||
{
|
{
|
||||||
List<Guid> stus;
|
List<int> stus;
|
||||||
IQueryable<Guid> q;
|
IQueryable<int> q;
|
||||||
if (!String.IsNullOrEmpty(SearchString)) q = from e in Context.Students where e.Name.Contains(SearchString) select e.Guid;
|
if (!String.IsNullOrEmpty(SearchString)) q = from e in Context.Students where e.Name.Contains(SearchString) select e.Id;
|
||||||
else q = from e in Context.Students select e.Guid;
|
else q = from e in Context.Students select e.Id;
|
||||||
stus = q.ToList();
|
stus = q.ToList();
|
||||||
var q2 = from e in Context.SMS where stus.Contains(e.Host) select e;
|
var q2 = from e in Context.SMS where stus.Contains(e.Host) select e;
|
||||||
if (showReceive && !showSend) q2 = from e in q2 where e.Type == SMSType.Reply select e;
|
if (showReceive && !showSend) q2 = from e in q2 where e.Type == SMSType.Reply select e;
|
||||||
|
|
@ -94,7 +94,7 @@ namespace _2021_backend.Pages.Message
|
||||||
foreach (var e in stu)
|
foreach (var e in stu)
|
||||||
{
|
{
|
||||||
if (e.Status == status.刚报名)
|
if (e.Status == status.刚报名)
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.Signed, e, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
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);
|
||||||
|
|
@ -107,8 +107,8 @@ namespace _2021_backend.Pages.Message
|
||||||
{
|
{
|
||||||
if (e.Status == status.不通过)
|
if (e.Status == status.不通过)
|
||||||
{
|
{
|
||||||
if (!Context.SMS.Any(it => it.Host == e.Guid && it.Type == SMSType.Reject))
|
if (!Context.SMS.Any(it => it.Host == e.Id && it.Type == SMSType.Reject))
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.Reject, e, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
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);
|
||||||
|
|
@ -121,7 +121,7 @@ namespace _2021_backend.Pages.Message
|
||||||
{
|
{
|
||||||
if (e.Status != status.不通过 && e.Status != status.已选时间)
|
if (e.Status != status.不通过 && e.Status != status.已选时间)
|
||||||
{
|
{
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSelect, e, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
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();
|
Context.SaveChanges();
|
||||||
|
|
@ -135,8 +135,8 @@ namespace _2021_backend.Pages.Message
|
||||||
{
|
{
|
||||||
if (e.Status == status.通过)
|
if (e.Status == status.通过)
|
||||||
{
|
{
|
||||||
if (!Context.SMS.Any(it => it.Host == e.Guid && it.Type == SMSType.Accept))
|
if (!Context.SMS.Any(it => it.Host == e.Id && it.Type == SMSType.Accept))
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.Accept, e, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
await Utils.TencentSMS.Send(Context, SMSType.Accept, e, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -149,9 +149,9 @@ namespace _2021_backend.Pages.Message
|
||||||
foreach(var e in stu)
|
foreach(var e in stu)
|
||||||
{
|
{
|
||||||
var t = Context.Sessions.Find(e.InterviewTime);
|
var t = Context.Sessions.Find(e.InterviewTime);
|
||||||
if(t != null && t.Students.Find(s => s==e.Guid)!= Guid.Empty && e.Status == status.已选时间)
|
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(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
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.已确认时间;
|
e.Status = status.已确认时间;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
[Display(Name = "活动官")]
|
[Display(Name = "活动官")]
|
||||||
public string ChiefGuid { get; set; }
|
public string Chiefint { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public List<SelectListItem> ChiefList { get; set; }
|
public List<SelectListItem> ChiefList { get; set; }
|
||||||
|
|
@ -34,7 +34,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet()
|
public async Task<IActionResult> OnGet()
|
||||||
{
|
{
|
||||||
var qlst = from e in Context.Users select (new SelectListItem { Value = e.Guid.ToString(), Text = e.Name, Selected = false, Disabled = false });
|
var qlst = from e in Context.Users select (new SelectListItem { Value = e.Id.ToString(), Text = e.Name, Selected = false, Disabled = false });
|
||||||
var lst = qlst.ToList().Distinct().ToList();
|
var lst = qlst.ToList().Distinct().ToList();
|
||||||
ChiefList = lst;
|
ChiefList = lst;
|
||||||
return Page();
|
return Page();
|
||||||
|
|
@ -48,8 +48,8 @@ namespace _2021_backend.Pages.Sessions
|
||||||
{
|
{
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
InterviewTime.Students = new List<Guid>();
|
InterviewTime.Students = new List<int>();
|
||||||
InterviewTime.Chiefs = new List<Guid>();
|
InterviewTime.Chiefs = new List<int>();
|
||||||
Session interviewTimeSecond = new Session();
|
Session interviewTimeSecond = new Session();
|
||||||
if (CreateTwo)
|
if (CreateTwo)
|
||||||
{
|
{
|
||||||
|
|
@ -62,9 +62,9 @@ namespace _2021_backend.Pages.Sessions
|
||||||
Day = InterviewTime.Day,
|
Day = InterviewTime.Day,
|
||||||
BeginTime = InterviewTime.BeginTime,
|
BeginTime = InterviewTime.BeginTime,
|
||||||
Place = anotherPlace,
|
Place = anotherPlace,
|
||||||
Chiefs = new List<Guid>(),
|
Chiefs = new List<int>(),
|
||||||
SendSMS = InterviewTime.SendSMS,
|
SendSMS = InterviewTime.SendSMS,
|
||||||
Students = new List<Guid>(),
|
Students = new List<int>(),
|
||||||
Capacity = InterviewTime.Capacity
|
Capacity = InterviewTime.Capacity
|
||||||
};
|
};
|
||||||
Context.Add(interviewTimeSecond);
|
Context.Add(interviewTimeSecond);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="InterviewTime.Guid" />
|
<input type="hidden" asp-for="InterviewTime.Id" />
|
||||||
<input type="submit" value="确定删除" class="btn btn-danger" /> |
|
<input type="submit" value="确定删除" class="btn btn-danger" /> |
|
||||||
<a asp-page="./Index">Back to List</a>
|
<a asp-page="./Index">Back to List</a>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(string? id)
|
public async Task<IActionResult> OnGetAsync(string? id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
InterviewTime = Context.Sessions.Find(guid);
|
InterviewTime = Context.Sessions.Find(idx);
|
||||||
|
|
||||||
if (InterviewTime == null)
|
if (InterviewTime == null)
|
||||||
{
|
{
|
||||||
|
|
@ -41,12 +41,12 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync(string? id)
|
public async Task<IActionResult> OnPostAsync(string? id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
InterviewTime = await Context.Sessions.FindAsync(guid);
|
InterviewTime = await Context.Sessions.FindAsync(idx);
|
||||||
|
|
||||||
if (InterviewTime != null)
|
if (InterviewTime != null)
|
||||||
{
|
{
|
||||||
|
|
@ -57,15 +57,15 @@ namespace _2021_backend.Pages.Sessions
|
||||||
Student stu = Context.Students.Find(x);
|
Student stu = Context.Students.Find(x);
|
||||||
if (stu != null)
|
if (stu != null)
|
||||||
{
|
{
|
||||||
stu.InterviewTime = Guid.Empty;
|
stu.InterviewTime = 0;
|
||||||
stu.Timelist.RemoveAll(it => it == guid);
|
stu.Timelist.RemoveAll(it => it == idx);
|
||||||
}
|
}
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach(var x in Context.Students)
|
foreach(var x in Context.Students)
|
||||||
{
|
{
|
||||||
x.Timelist.RemoveAll(it => it == guid);
|
x.Timelist.RemoveAll(it => it == idx);
|
||||||
}
|
}
|
||||||
Context.Sessions.Remove(InterviewTime);
|
Context.Sessions.Remove(InterviewTime);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,6 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-page="./Edit" asp-route-id="@Model.CurSession.Guid">Edit</a> |
|
<a asp-page="./Edit" asp-route-id="@Model.CurSession.Id">Edit</a> |
|
||||||
<a asp-page="./Index">Back to List</a>
|
<a asp-page="./Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(string? id)
|
public async Task<IActionResult> OnGetAsync(string? id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
CurSession = Context.Sessions.Find(guid);
|
CurSession = Context.Sessions.Find(idx);
|
||||||
if (CurSession == null)
|
if (CurSession == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="CurSession.Guid" />
|
<input type="hidden" asp-for="CurSession.Id" />
|
||||||
<input type="hidden" asp-for="CurGuid">
|
<input type="hidden" asp-for="Curint">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="newDay" class="control-label"></label>
|
<label asp-for="newDay" class="control-label"></label>
|
||||||
<input asp-for="newDay" class="form-control" />
|
<input asp-for="newDay" class="form-control" />
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label class="col-sm-2">添加一个</label>
|
<label class="col-sm-2">添加一个</label>
|
||||||
<select asp-items=Model.Stulist id="stuselect" asp-for="addedStu" class="col-sm-2"></select>
|
<select asp-items=Model.Stulist id="stuselect" asp-for="addedStu" class="col-sm-2"></select>
|
||||||
<input type="hidden" asp-for="CurGuid" />
|
<input type="hidden" asp-for="Curint" />
|
||||||
<input type="submit" value="Go!" class="btn btn-primary" style="margin-left:5px" asp-page-handler="Add" />
|
<input type="submit" value="Go!" class="btn btn-primary" style="margin-left:5px" asp-page-handler="Add" />
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
|
|
@ -76,11 +76,11 @@
|
||||||
<td>@Html.DisplayFor(model=>stu.Name)</td>
|
<td>@Html.DisplayFor(model=>stu.Name)</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<a asp-page="/Students/Details" asp-route-idstr=@stu.Guid.ToString() class="btn btn-primary">详细信息</a>
|
<a asp-page="/Students/Details" asp-route-idstr=@stu.Id.ToString() class="btn btn-primary">详细信息</a>
|
||||||
<div style="float:left">
|
<div style="float:left">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="CurGuid">
|
<input type="hidden" asp-for="Curint">
|
||||||
<input type="submit" value="删除" class="btn btn-danger" asp-page-handler="Delete" asp-route-id=@stu.Guid.ToString() />
|
<input type="submit" value="删除" class="btn btn-danger" asp-page-handler="Delete" asp-route-id=@stu.Id.ToString() />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label class="col-sm-2">添加一个</label>
|
<label class="col-sm-2">添加一个</label>
|
||||||
<select id="chiefselect"asp-items=Model.ChiefList asp-for="addedChief" class="col-sm-2"></select>
|
<select id="chiefselect"asp-items=Model.ChiefList asp-for="addedChief" class="col-sm-2"></select>
|
||||||
<input type="hidden" asp-for="CurGuid" />
|
<input type="hidden" asp-for="Curint" />
|
||||||
<input type="submit" value="Go!" class="btn btn-primary" style="margin-left:5px" asp-page-handler="AddChief" />
|
<input type="submit" value="Go!" class="btn btn-primary" style="margin-left:5px" asp-page-handler="AddChief" />
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
|
|
@ -121,8 +121,8 @@
|
||||||
<td>
|
<td>
|
||||||
<div style="float:left">
|
<div style="float:left">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="CurGuid">
|
<input type="hidden" asp-for="Curint">
|
||||||
<input type="submit" value="删除" class="btn btn-danger" asp-page-handler="DeleteChief" asp-route-id=@chf.Guid.ToString() />
|
<input type="submit" value="删除" class="btn btn-danger" asp-page-handler="DeleteChief" asp-route-id=@chf.Id.ToString() />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
public Session CurSession { get; set; }
|
public Session CurSession { get; set; }
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public string CurGuid { get; set; }
|
public string Curint { get; set; }
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public string ChiefSearch { get; set; }
|
public string ChiefSearch { get; set; }
|
||||||
|
|
@ -34,7 +34,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
public List<SelectListItem> Stulist { get; set; }
|
public List<SelectListItem> Stulist { get; set; }
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public Guid addedChief { get; set; }
|
public int addedChief { get; set; }
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public string addedStu { get; set; }
|
public string addedStu { get; set; }
|
||||||
|
|
@ -71,13 +71,13 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
public IActionResult Construct(string id)
|
public IActionResult Construct(string id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
CurGuid = id;
|
Curint = id;
|
||||||
CurSession = Context.Sessions.Find(guid);
|
CurSession = Context.Sessions.Find(idx);
|
||||||
|
|
||||||
newDay = CurSession.Day;
|
newDay = CurSession.Day;
|
||||||
newTime = CurSession.BeginTime;
|
newTime = CurSession.BeginTime;
|
||||||
|
|
@ -86,10 +86,10 @@ namespace _2021_backend.Pages.Sessions
|
||||||
newPlace = CurSession.Place;
|
newPlace = CurSession.Place;
|
||||||
|
|
||||||
if (CurSession == null) return RedirectToPage("./Index", new { errmsg = "未找到该活动场次" });
|
if (CurSession == null) return RedirectToPage("./Index", new { errmsg = "未找到该活动场次" });
|
||||||
var qlst = from e in Context.Users select (new SelectListItem { Value = e.Guid.ToString(), Text = e.Name, Selected = false, Disabled = false });
|
var qlst = from e in Context.Users select (new SelectListItem { Value = e.Id.ToString(), Text = e.Name, Selected = false, Disabled = false });
|
||||||
ChiefList = qlst.ToList().Distinct().ToList();
|
ChiefList = qlst.ToList().Distinct().ToList();
|
||||||
|
|
||||||
var slst = from e in Context.Students where e.InterviewTime == Guid.Empty select new SelectListItem { Value = e.Guid.ToString(), Text = e.Name, Selected = false, Disabled = false };
|
var slst = from e in Context.Students where e.InterviewTime == 0 select new SelectListItem { Value = e.Id.ToString(), Text = e.Name, Selected = false, Disabled = false };
|
||||||
Stulist = slst.ToList().Distinct().ToList();
|
Stulist = slst.ToList().Distinct().ToList();
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +103,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
// more details, see https://aka.ms/RazorPagesCRUD.
|
// more details, see https://aka.ms/RazorPagesCRUD.
|
||||||
public async Task<IActionResult> OnPostAsync()
|
public async Task<IActionResult> OnPostAsync()
|
||||||
{
|
{
|
||||||
var ssn = Context.Sessions.Find(Guid.Parse(CurGuid));
|
var ssn = Context.Sessions.Find(int.Parse(Curint));
|
||||||
ssn.SendSMS = sendSMS;
|
ssn.SendSMS = sendSMS;
|
||||||
ssn.Day = newDay;
|
ssn.Day = newDay;
|
||||||
ssn.BeginTime = newTime;
|
ssn.BeginTime = newTime;
|
||||||
|
|
@ -116,73 +116,73 @@ namespace _2021_backend.Pages.Sessions
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostDeleteAsync(string id)
|
public async Task<IActionResult> OnPostDeleteAsync(string id)
|
||||||
{
|
{
|
||||||
CurSession = Context.Sessions.Find(Guid.Parse(CurGuid));
|
CurSession = Context.Sessions.Find(int.Parse(Curint));
|
||||||
var guid = Guid.Parse(id);
|
var idx = int.Parse(id);
|
||||||
if (!string.IsNullOrEmpty(id))
|
if (!string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
if (Context.Students.Any(it => it.Guid == guid))
|
if (Context.Students.Any(it => it.Id == idx))
|
||||||
{
|
{
|
||||||
Context.Students.Find(guid).InterviewTime = Guid.Empty;
|
Context.Students.Find(idx).InterviewTime = 0;
|
||||||
CurSession.Students.RemoveAll(it => it == guid);
|
CurSession.Students.RemoveAll(it => it == idx);
|
||||||
}
|
}
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
}
|
}
|
||||||
return Construct(CurGuid);
|
return Construct(Curint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAddAsync()
|
public async Task<IActionResult> OnPostAddAsync()
|
||||||
{
|
{
|
||||||
CurSession = Context.Sessions.Find(Guid.Parse(CurGuid));
|
CurSession = Context.Sessions.Find(int.Parse(Curint));
|
||||||
var guid = Guid.Parse(addedStu);
|
var idx = int.Parse(addedStu);
|
||||||
if (!string.IsNullOrEmpty(addedStu))
|
if (!string.IsNullOrEmpty(addedStu))
|
||||||
{
|
{
|
||||||
if (Context.Students.Any(it => it.Guid == guid))
|
if (Context.Students.Any(it => it.Id == idx))
|
||||||
{
|
{
|
||||||
var stu = Context.Students.Find(guid);
|
var stu = Context.Students.Find(idx);
|
||||||
if(stu.InterviewTime != Guid.Empty)
|
if(stu.InterviewTime != 0)
|
||||||
{
|
{
|
||||||
var oldtime = Context.Sessions.Find(stu.InterviewTime);
|
var oldtime = Context.Sessions.Find(stu.InterviewTime);
|
||||||
if(oldtime != null)
|
if(oldtime != null)
|
||||||
{
|
{
|
||||||
oldtime.Students.RemoveAll(s => s == stu.Guid);
|
oldtime.Students.RemoveAll(s => s == stu.Id);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stu.InterviewTime = CurSession.Guid;
|
stu.InterviewTime = CurSession.Id;
|
||||||
stu.Status = status.已选时间;
|
stu.Status = status.已选时间;
|
||||||
CurSession.Students.Add(guid);
|
CurSession.Students.Add(idx);
|
||||||
}
|
}
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
}
|
}
|
||||||
return Construct(CurGuid);
|
return Construct(Curint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAddChiefAsync()
|
public async Task<IActionResult> OnPostAddChiefAsync()
|
||||||
{
|
{
|
||||||
CurSession = Context.Sessions.Find(Guid.Parse(CurGuid));
|
CurSession = Context.Sessions.Find(int.Parse(Curint));
|
||||||
if (Context.Users.Any(it => it.Guid == addedChief))
|
if (Context.Users.Any(it => it.Id == addedChief))
|
||||||
{
|
{
|
||||||
CurSession.Chiefs.Add(addedChief);
|
CurSession.Chiefs.Add(addedChief);
|
||||||
}
|
}
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
return Construct(CurGuid);
|
return Construct(Curint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostDeleteChiefAsync(string id)
|
public async Task<IActionResult> OnPostDeleteChiefAsync(string id)
|
||||||
{
|
{
|
||||||
var guid = Guid.Parse(id);
|
var idx = int.Parse(id);
|
||||||
CurSession = Context.Sessions.Find(Guid.Parse(CurGuid));
|
CurSession = Context.Sessions.Find(int.Parse(Curint));
|
||||||
if (CurSession.Chiefs.Contains(guid))
|
if (CurSession.Chiefs.Contains(idx))
|
||||||
{
|
{
|
||||||
CurSession.Chiefs.Remove(guid);
|
CurSession.Chiefs.Remove(idx);
|
||||||
}
|
}
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
return Construct(CurGuid);
|
return Construct(Curint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool InterviewTimeExists(Guid id)
|
private bool InterviewTimeExists(int id)
|
||||||
{
|
{
|
||||||
return Context.Sessions.Any(e => e.Guid == id);
|
return Context.Sessions.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,9 +157,9 @@
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="./Edit" asp-route-id="@item.Guid">编辑</a> |
|
<a asp-page="./Edit" asp-route-id="@item.Id">编辑</a> |
|
||||||
<a asp-page="./Delete" asp-route-id="@item.Guid">删除</a> |
|
<a asp-page="./Delete" asp-route-id="@item.Id">删除</a> |
|
||||||
<a asp-page-handler="Reset" asp-route-id="@item.Guid">重置</a>
|
<a asp-page-handler="Reset" asp-route-id="@item.Id">重置</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,16 +89,16 @@ namespace _2021_backend.Pages.Sessions
|
||||||
return Construct(errmsg);
|
return Construct(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetResetAsync(Guid id)
|
public async Task<IActionResult> OnGetResetAsync(int id)
|
||||||
{
|
{
|
||||||
if(Context.Sessions.Any(it => it.Guid == id))
|
if(Context.Sessions.Any(it => it.Id == id))
|
||||||
{
|
{
|
||||||
var s = Context.Sessions.Find(id);
|
var s = Context.Sessions.Find(id);
|
||||||
foreach(var st in s.Students)
|
foreach(var st in s.Students)
|
||||||
{
|
{
|
||||||
var e = Context.Students.Find(st);
|
var e = Context.Students.Find(st);
|
||||||
e.Status = status.需调整时间;
|
e.Status = status.需调整时间;
|
||||||
e.InterviewTime = Guid.Empty;
|
e.InterviewTime = 0;
|
||||||
}
|
}
|
||||||
s.Students.Clear();
|
s.Students.Clear();
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
{
|
{
|
||||||
foreach(var s in Context.Students)
|
foreach(var s in Context.Students)
|
||||||
{
|
{
|
||||||
s.InterviewTime = Guid.Empty;
|
s.InterviewTime = 0;
|
||||||
s.Status = status.需调整时间;
|
s.Status = status.需调整时间;
|
||||||
s.Timelist.Clear();
|
s.Timelist.Clear();
|
||||||
}
|
}
|
||||||
|
|
@ -152,9 +152,9 @@ namespace _2021_backend.Pages.Sessions
|
||||||
{
|
{
|
||||||
if(s.Status == status.已选时间)
|
if(s.Status == status.已选时间)
|
||||||
{
|
{
|
||||||
s.InterviewTime = Guid.Empty;
|
s.InterviewTime = 0;
|
||||||
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Guid == it));
|
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Id == it));
|
||||||
s.Timelist.Sort((Guid a, Guid b) =>
|
s.Timelist.Sort((int a, int b) =>
|
||||||
{
|
{
|
||||||
var x = Context.Sessions.Find(a);
|
var x = Context.Sessions.Find(a);
|
||||||
var y = Context.Sessions.Find(b);
|
var y = Context.Sessions.Find(b);
|
||||||
|
|
@ -193,7 +193,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
var ntm = new List<Session>();
|
var ntm = new List<Session>();
|
||||||
foreach(var j in tm)
|
foreach(var j in tm)
|
||||||
{
|
{
|
||||||
var k = sess.Find(it => it.Guid == j);
|
var k = sess.Find(it => it.Id == j);
|
||||||
ntm.Add(k);
|
ntm.Add(k);
|
||||||
}
|
}
|
||||||
ntm.Sort((Session a,Session b) =>
|
ntm.Sort((Session a,Session b) =>
|
||||||
|
|
@ -202,17 +202,17 @@ namespace _2021_backend.Pages.Sessions
|
||||||
var y = a.BeginTime.CompareTo(b.BeginTime);
|
var y = a.BeginTime.CompareTo(b.BeginTime);
|
||||||
return x != 0 ? x : y;
|
return x != 0 ? x : y;
|
||||||
});
|
});
|
||||||
List<Guid> nl = new List<Guid>();
|
List<int> nl = new List<int>();
|
||||||
foreach(var j in ntm)
|
foreach(var j in ntm)
|
||||||
{
|
{
|
||||||
if(i.Status != status.不通过 && i.Status != status.通过 && i.Status != status.已确认时间)
|
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.Guid) )) continue;
|
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.Guid);
|
nl.Add(j.Id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nl.Add(j.Guid);
|
nl.Add(j.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -236,9 +236,9 @@ namespace _2021_backend.Pages.Sessions
|
||||||
{
|
{
|
||||||
if (s.Status == status.已选时间)
|
if (s.Status == status.已选时间)
|
||||||
{
|
{
|
||||||
s.InterviewTime = Guid.Empty;
|
s.InterviewTime = 0;
|
||||||
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Guid == it));
|
s.Timelist.RemoveAll(it => !Context.Sessions.Any(k => k.Id == it));
|
||||||
s.Timelist.Sort((Guid a, Guid b) =>
|
s.Timelist.Sort((int a, int b) =>
|
||||||
{
|
{
|
||||||
var x = Context.Sessions.Find(a);
|
var x = Context.Sessions.Find(a);
|
||||||
var y = Context.Sessions.Find(b);
|
var y = Context.Sessions.Find(b);
|
||||||
|
|
@ -256,7 +256,7 @@ namespace _2021_backend.Pages.Sessions
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
foreach(var item in loads)
|
foreach(var item in loads)
|
||||||
{
|
{
|
||||||
Session s = Context.Sessions.Find(item.Guid);
|
Session s = Context.Sessions.Find(item.Id);
|
||||||
if(s != null)
|
if(s != null)
|
||||||
{
|
{
|
||||||
s.BeginTime = item.BeginTime;
|
s.BeginTime = item.BeginTime;
|
||||||
|
|
@ -264,12 +264,12 @@ namespace _2021_backend.Pages.Sessions
|
||||||
s.Capacity = item.Capacity;
|
s.Capacity = item.Capacity;
|
||||||
s.SendSMS = item.SendSMS;
|
s.SendSMS = item.SendSMS;
|
||||||
s.Chiefs = item.Chiefs;
|
s.Chiefs = item.Chiefs;
|
||||||
s.Students = new List<Guid>();
|
s.Students = new List<int>();
|
||||||
foreach(var s2 in item.Students)
|
foreach(var s2 in item.Students)
|
||||||
{
|
{
|
||||||
if (Context.Students.Any(k => k.Guid == s2))
|
if (Context.Students.Any(k => k.Id == s2))
|
||||||
{
|
{
|
||||||
Context.Students.Find(s2).InterviewTime = item.Guid;
|
Context.Students.Find(s2).InterviewTime = item.Id;
|
||||||
s.Students.Add(s2);
|
s.Students.Add(s2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="Student.Guid" />
|
<input type="hidden" asp-for="Student.Id" />
|
||||||
<input type="submit" value="删除" class="btn btn-danger" /> |
|
<input type="submit" value="删除" class="btn btn-danger" /> |
|
||||||
<a asp-page="./Index">返回列表</a>
|
<a asp-page="./Index">返回列表</a>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ namespace _2021_backend.Pages.Students
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Guid id = Guid.Parse(idstr);
|
int id = int.Parse(idstr);
|
||||||
|
|
||||||
Student = await Context.Students.FirstOrDefaultAsync(m => m.Guid == id);
|
Student = await Context.Students.FirstOrDefaultAsync(m => m.Id == id);
|
||||||
|
|
||||||
if (Student == null)
|
if (Student == null)
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +45,7 @@ namespace _2021_backend.Pages.Students
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Guid id = Guid.Parse(idstr);
|
int id = int.Parse(idstr);
|
||||||
|
|
||||||
Student = await Context.Students.FindAsync(id);
|
Student = await Context.Students.FindAsync(id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
<h5>此人的最终得分 : @Html.DisplayFor(model => model.Student.Score)</h5>
|
<h5>此人的最终得分 : @Html.DisplayFor(model => model.Student.Score)</h5>
|
||||||
<form method="post" class="form-inline m-2">
|
<form method="post" class="form-inline m-2">
|
||||||
<input type="hidden" asp-for="Student.Guid" />
|
<input type="hidden" asp-for="Student.Id" />
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
操作
|
操作
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
<span asp-validation-for="NewComment" class="text-danger"></span>
|
<span asp-validation-for="NewComment" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="hidden" asp-for="Student.Guid" />
|
<input type="hidden" asp-for="Student.Id" />
|
||||||
<input type="submit" value="→" class="btn btn-primary btn-sm" />
|
<input type="submit" value="→" class="btn btn-primary btn-sm" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -175,7 +175,7 @@
|
||||||
{
|
{
|
||||||
var it = Model.Student.Timelist[i];
|
var it = Model.Student.Timelist[i];
|
||||||
var dt = Model.Context.Sessions.Find(it);
|
var dt = Model.Context.Sessions.Find(it);
|
||||||
if (dt.Capacity > dt.Students.Count || dt.Students.Contains(Model.Student.Guid))
|
if (dt.Capacity > dt.Students.Count || dt.Students.Contains(Model.Student.Id))
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -211,9 +211,9 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<form method="post" class="form-inline">
|
<form method="post" class="form-inline">
|
||||||
<input type="hidden" asp-for="Student.Guid" />
|
<input type="hidden" asp-for="Student.Id" />
|
||||||
<a asp-page="/Sessions/Edit" asp-route-id="@it.ToString()" class="btn btn-sm btn-primary">场次详情</a>
|
<a asp-page="/Sessions/Edit" asp-route-id="@it.ToString()" class="btn btn-sm btn-primary">场次详情</a>
|
||||||
<input type="submit" asp-page-handler="Select" asp-route-stu="@Model.Student.Guid" asp-route-time="@it.ToString()" class="btn btn-sm btn-warning" value="选择这个" />
|
<input type="submit" asp-page-handler="Select" asp-route-stu="@Model.Student.Id" asp-route-time="@it.ToString()" class="btn btn-sm btn-warning" value="选择这个" />
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -225,7 +225,7 @@
|
||||||
Ta的短信
|
Ta的短信
|
||||||
</h4>
|
</h4>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="Student.Guid" />
|
<input type="hidden" asp-for="Student.Id" />
|
||||||
<input type="submit" value="拉取5天内的回复短信" class="btn btn-primary" asp-page-handler="Pull" />
|
<input type="submit" value="拉取5天内的回复短信" class="btn btn-primary" asp-page-handler="Pull" />
|
||||||
<input type="submit" value="发送报名确认短信" class="btn btn-primary" asp-page-handler="Sign" />
|
<input type="submit" value="发送报名确认短信" class="btn btn-primary" asp-page-handler="Sign" />
|
||||||
<input type="submit" value="发送活动场次确认短信" class="btn btn-primary" asp-page-handler="Time" />
|
<input type="submit" value="发送活动场次确认短信" class="btn btn-primary" asp-page-handler="Time" />
|
||||||
|
|
@ -355,8 +355,8 @@
|
||||||
@Html.DisplayFor(modelItem => sub.SubmitTime)
|
@Html.DisplayFor(modelItem => sub.SubmitTime)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="/Submissions/Edit" asp-route-strid="@sub.Guid">Edit</a> |
|
<a asp-page="/Submissions/Edit" asp-route-strid="@sub.Id">Edit</a> |
|
||||||
<a asp-page="/Submissions/Details" asp-route-strid="@sub.Guid">Details</a>
|
<a asp-page="/Submissions/Details" asp-route-strid="@sub.Id">Details</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
@ -366,6 +366,6 @@
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a asp-page="./Edit" asp-route-idstr="@Model.Student.Guid">编辑信息</a> |
|
<a asp-page="./Edit" asp-route-idstr="@Model.Student.Id">编辑信息</a> |
|
||||||
<a asp-page="./Index">返回列表</a>
|
<a asp-page="./Index">返回列表</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace _2021_backend.Pages.Students
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Guid id = Guid.Parse(idstr);
|
int id = int.Parse(idstr);
|
||||||
Student = Context.Students.Find(id);
|
Student = Context.Students.Find(id);
|
||||||
if (Student == null)
|
if (Student == null)
|
||||||
{
|
{
|
||||||
|
|
@ -62,7 +62,7 @@ namespace _2021_backend.Pages.Students
|
||||||
Sessions.Add(tm);
|
Sessions.Add(tm);
|
||||||
}
|
}
|
||||||
Messages = Context.SMS.Where(it => it.Host == id).ToList();
|
Messages = Context.SMS.Where(it => it.Host == id).ToList();
|
||||||
CurComments = Context.Comments.Where(cmt => cmt.Student == Student.Guid).ToList();
|
CurComments = Context.Comments.Where(cmt => cmt.Student == Student.Id).ToList();
|
||||||
Sessions.Sort((Session a, Session b) => {
|
Sessions.Sort((Session a, Session b) => {
|
||||||
var x = a.Day.CompareTo(b.Day);
|
var x = a.Day.CompareTo(b.Day);
|
||||||
var y = a.BeginTime.CompareTo(b.BeginTime);
|
var y = a.BeginTime.CompareTo(b.BeginTime);
|
||||||
|
|
@ -84,60 +84,60 @@ namespace _2021_backend.Pages.Students
|
||||||
if (!string.IsNullOrWhiteSpace(NewComment))
|
if (!string.IsNullOrWhiteSpace(NewComment))
|
||||||
{
|
{
|
||||||
var cmt = new Comment();
|
var cmt = new Comment();
|
||||||
cmt.Student = Student.Guid;
|
cmt.Student = Student.Id;
|
||||||
cmt.Content = NewComment;
|
cmt.Content = NewComment;
|
||||||
cmt.Operator = Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value);
|
cmt.Operator = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value);
|
||||||
var stu = Context.Students.Find(Student.Guid);
|
var stu = Context.Students.Find(Student.Id);
|
||||||
stu.Comments.Add(cmt.Guid);
|
stu.Comments.Add(cmt.Id);
|
||||||
Context.Comments.Add(cmt);
|
Context.Comments.Add(cmt);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
}
|
}
|
||||||
Construct(Student.Guid.ToString());
|
Construct(Student.Id.ToString());
|
||||||
return RedirectToPage(new { idstr = Student.Guid.ToString() });
|
return RedirectToPage(new { idstr = Student.Id.ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAcceptAsync()
|
public async Task<IActionResult> OnPostAcceptAsync()
|
||||||
{
|
{
|
||||||
Student = Context.Students.Find(Student.Guid);
|
Student = Context.Students.Find(Student.Id);
|
||||||
Student.Status = status.通过;
|
Student.Status = status.通过;
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
CurComments = Context.Comments.Where(cmt => cmt.Student == Student.Guid).ToList();
|
CurComments = Context.Comments.Where(cmt => cmt.Student == Student.Id).ToList();
|
||||||
Messages = Context.SMS.Where(it => it.Host == Student.Guid).ToList();
|
Messages = Context.SMS.Where(it => it.Host == Student.Id).ToList();
|
||||||
Construct(Student.Guid.ToString());
|
Construct(Student.Id.ToString());
|
||||||
return RedirectToPage(new { idstr = Student.Guid.ToString() });
|
return RedirectToPage(new { idstr = Student.Id.ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostRejectAsync()
|
public async Task<IActionResult> OnPostRejectAsync()
|
||||||
{
|
{
|
||||||
Student = Context.Students.Find(Student.Guid);
|
Student = Context.Students.Find(Student.Id);
|
||||||
Student.Status = status.不通过;
|
Student.Status = status.不通过;
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
Student.Score = 0;
|
Student.Score = 0;
|
||||||
CurComments = Context.Comments.Where(cmt => cmt.Student == Student.Guid).ToList();
|
CurComments = Context.Comments.Where(cmt => cmt.Student == Student.Id).ToList();
|
||||||
Messages = Context.SMS.Where(it => it.Host == Student.Guid).ToList();
|
Messages = Context.SMS.Where(it => it.Host == Student.Id).ToList();
|
||||||
Construct(Student.Guid.ToString());
|
Construct(Student.Id.ToString());
|
||||||
return RedirectToPage(new { idstr = Student.Guid.ToString() });
|
return RedirectToPage(new { idstr = Student.Id.ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostSelectAsync(Guid stu, Guid time)
|
public async Task<IActionResult> OnPostSelectAsync(int stu, int time)
|
||||||
{
|
{
|
||||||
var st = Context.Students.Find(stu);
|
var st = Context.Students.Find(stu);
|
||||||
if (st != null)
|
if (st != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Context.Sessions.Any(it => it.Guid == time))
|
if (Context.Sessions.Any(it => it.Id == time))
|
||||||
{
|
{
|
||||||
var tm = Context.Sessions.Find(time);
|
var tm = Context.Sessions.Find(time);
|
||||||
if (tm.Students.Count < tm.Capacity)
|
if (tm.Students.Count < tm.Capacity)
|
||||||
{
|
{
|
||||||
if (st.InterviewTime != Guid.Empty)
|
if (st.InterviewTime != 0)
|
||||||
{
|
{
|
||||||
var tmold = Context.Sessions.Find(st.InterviewTime);
|
var tmold = Context.Sessions.Find(st.InterviewTime);
|
||||||
if (tmold != null)
|
if (tmold != null)
|
||||||
{
|
{
|
||||||
tmold.Students.RemoveAll(it => it == st.Guid);
|
tmold.Students.RemoveAll(it => it == st.Id);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -148,58 +148,58 @@ namespace _2021_backend.Pages.Students
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostPullAsync()
|
public async Task<IActionResult> OnPostPullAsync()
|
||||||
{
|
{
|
||||||
await Utils.TencentSMS.Pull(Context, Context.Students.Find(Student.Guid), true);
|
await Utils.TencentSMS.Pull(Context, Context.Students.Find(Student.Id), true);
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostRankAsync()
|
public async Task<IActionResult> OnPostRankAsync()
|
||||||
{
|
{
|
||||||
var s = Context.Students.Find(Student.Guid);
|
var s = Context.Students.Find(Student.Id);
|
||||||
s.Score = score;
|
s.Score = score;
|
||||||
s.Status = status.已评分;
|
s.Status = status.已评分;
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostResultAsync()
|
public async Task<IActionResult> OnPostResultAsync()
|
||||||
{
|
{
|
||||||
var stu = Context.Students.Find(Student.Guid);
|
var stu = Context.Students.Find(Student.Id);
|
||||||
if (stu.Status == status.通过)
|
if (stu.Status == status.通过)
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.Accept, stu, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
await Utils.TencentSMS.Send(Context, SMSType.Accept, stu, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||||
else if (stu.Status == status.不通过)
|
else if (stu.Status == status.不通过)
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.Reject, stu, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
await Utils.TencentSMS.Send(Context, SMSType.Reject, stu, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostSignAsync()
|
public async Task<IActionResult> OnPostSignAsync()
|
||||||
{
|
{
|
||||||
var stu = Context.Students.Find(Student.Guid);
|
var stu = Context.Students.Find(Student.Id);
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.Signed, stu, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
await Utils.TencentSMS.Send(Context, SMSType.Signed, stu, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostSelectTimeAsync()
|
public async Task<IActionResult> OnPostSelectTimeAsync()
|
||||||
{
|
{
|
||||||
var stu = Context.Students.Find(Student.Guid);
|
var stu = Context.Students.Find(Student.Id);
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSelect, stu, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
await Utils.TencentSMS.Send(Context, SMSType.TimeSelect, stu, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||||
stu.Status = status.需调整时间;
|
stu.Status = status.需调整时间;
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostTimeAsync()
|
public async Task<IActionResult> OnPostTimeAsync()
|
||||||
{
|
{
|
||||||
var stu = Context.Students.Find(Student.Guid);
|
var stu = Context.Students.Find(Student.Id);
|
||||||
await Utils.TencentSMS.Send(Context, SMSType.TimeSet, stu, Context.Users.Find(Guid.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
await Utils.TencentSMS.Send(Context, SMSType.TimeSet, stu, Context.Users.Find(int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value)).Name);
|
||||||
stu.Status = status.已确认时间;
|
stu.Status = status.已确认时间;
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
return Construct(Student.Guid.ToString());
|
return Construct(Student.Id.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="Student.Guid" />
|
<input type="hidden" asp-for="Student.Id" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Student.Name" class="control-label"></label>
|
<label asp-for="Student.Name" class="control-label"></label>
|
||||||
<input asp-for="Student.Name" class="form-control" />
|
<input asp-for="Student.Name" class="form-control" />
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ namespace _2021_backend.Pages.Students
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Guid id = Guid.Parse(idstr);
|
int id = int.Parse(idstr);
|
||||||
Student = await Context.Students.AsNoTracking().FirstOrDefaultAsync(m => m.Guid == id);
|
Student = await Context.Students.AsNoTracking().FirstOrDefaultAsync(m => m.Id == id);
|
||||||
|
|
||||||
if (Student == null)
|
if (Student == null)
|
||||||
{
|
{
|
||||||
|
|
@ -40,7 +40,7 @@ namespace _2021_backend.Pages.Students
|
||||||
// For more details, see https://aka.ms/RazorPagesCRUD.
|
// For more details, see https://aka.ms/RazorPagesCRUD.
|
||||||
public async Task<IActionResult> OnPostAsync()
|
public async Task<IActionResult> OnPostAsync()
|
||||||
{
|
{
|
||||||
var stu = Context.Students.Find(Student.Guid);
|
var stu = Context.Students.Find(Student.Id);
|
||||||
stu.Status = Student.Status;
|
stu.Status = Student.Status;
|
||||||
stu.Email = Student.Email;
|
stu.Email = Student.Email;
|
||||||
stu.Name = Student.Name;
|
stu.Name = Student.Name;
|
||||||
|
|
@ -53,9 +53,9 @@ namespace _2021_backend.Pages.Students
|
||||||
return RedirectToPage("./Index");
|
return RedirectToPage("./Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool StudentExists(Guid id)
|
private bool StudentExists(int id)
|
||||||
{
|
{
|
||||||
return Context.Students.Any(e => e.Guid == id);
|
return Context.Students.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,10 @@
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="./Details" asp-route-idstr="@item.Guid.ToString()"> @Html.DisplayFor(modelItem => item.Name)</a>
|
<a asp-page="./Details" asp-route-idstr="@item.Id.ToString()"> @Html.DisplayFor(modelItem => item.Name)</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="./Details" asp-route-idstr="@item.Guid.ToString()"> @Html.DisplayFor(modelItem => item.Stuid)</a>
|
<a asp-page="./Details" asp-route-idstr="@item.Id.ToString()"> @Html.DisplayFor(modelItem => item.Stuid)</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Sex)
|
@Html.DisplayFor(modelItem => item.Sex)
|
||||||
|
|
@ -135,9 +135,9 @@
|
||||||
@Html.DisplayFor(modelItem => item.RegisterTime)
|
@Html.DisplayFor(modelItem => item.RegisterTime)
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="./Edit" asp-route-idstr="@item.Guid.ToString()">编辑资料</a> |
|
<a asp-page="./Edit" asp-route-idstr="@item.Id.ToString()">编辑资料</a> |
|
||||||
<a asp-page="./Details" asp-route-idstr="@item.Guid.ToString()">审阅</a> |
|
<a asp-page="./Details" asp-route-idstr="@item.Id.ToString()">审阅</a> |
|
||||||
<a asp-page="./Delete" asp-route-idstr="@item.Guid.ToString()">删除</a>
|
<a asp-page="./Delete" asp-route-idstr="@item.Id.ToString()">删除</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace _2021_backend.Pages.Submissions
|
||||||
{
|
{
|
||||||
stu = Student.create(Submission);
|
stu = Student.create(Submission);
|
||||||
stu.Status = status.刚报名;
|
stu.Status = status.刚报名;
|
||||||
var q2 = from e in Context.Sessions select e.Guid;
|
var q2 = from e in Context.Sessions select e.Id;
|
||||||
var lst = q2.ToList();
|
var lst = q2.ToList();
|
||||||
stu.Timelist = lst;
|
stu.Timelist = lst;
|
||||||
Context.Students.Add(stu);
|
Context.Students.Add(stu);
|
||||||
|
|
@ -47,7 +47,7 @@ namespace _2021_backend.Pages.Submissions
|
||||||
stu = q.FirstOrDefault();
|
stu = q.FirstOrDefault();
|
||||||
stu.Update(Submission);
|
stu.Update(Submission);
|
||||||
}
|
}
|
||||||
Submission.Host = stu.Guid;
|
Submission.Host = stu.Id;
|
||||||
Context.Submissions.Add(Submission);
|
Context.Submissions.Add(Submission);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="Submission.Guid" />
|
<input type="hidden" asp-for="Submission.Id" />
|
||||||
<input type="submit" value="删除" class="btn btn-danger" asp-route-id="@Model.Submission.Guid.ToString()"/> |
|
<input type="submit" value="删除" class="btn btn-danger" asp-route-id="@Model.Submission.Id.ToString()"/> |
|
||||||
<a asp-page="./Index">返回列表</a>
|
<a asp-page="./Index">返回列表</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ namespace _2021_backend.Pages.Submissions
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(string? strid)
|
public async Task<IActionResult> OnGetAsync(string? strid)
|
||||||
{
|
{
|
||||||
Guid id = Guid.Parse(strid);
|
int id = int.Parse(strid);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Submission = Context.Submissions.FirstOrDefault(m => m.Guid == id);
|
Submission = Context.Submissions.FirstOrDefault(m => m.Id == id);
|
||||||
|
|
||||||
if (Submission == null)
|
if (Submission == null)
|
||||||
{
|
{
|
||||||
|
|
@ -38,7 +38,7 @@ namespace _2021_backend.Pages.Submissions
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync(Guid? id)
|
public async Task<IActionResult> OnPostAsync(int? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
|
|
@ -51,7 +51,7 @@ namespace _2021_backend.Pages.Submissions
|
||||||
var stu = Context.Students.Find(Submission.Host);
|
var stu = Context.Students.Find(Submission.Host);
|
||||||
if (stu != null)
|
if (stu != null)
|
||||||
{
|
{
|
||||||
stu.Submissions.Remove(Submission.Guid);
|
stu.Submissions.Remove(Submission.Id);
|
||||||
}
|
}
|
||||||
Context.Submissions.Remove(Submission);
|
Context.Submissions.Remove(Submission);
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,6 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-page="./Edit" asp-route-id="@Model.Submission.Guid">Edit</a> |
|
<a asp-page="./Edit" asp-route-id="@Model.Submission.Id">Edit</a> |
|
||||||
<a asp-page="./Index">返回列表</a>
|
<a asp-page="./Index">返回列表</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ namespace _2021_backend.Pages.Submissions
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Guid id = Guid.Parse(strid);
|
int id = int.Parse(strid);
|
||||||
Submission = await _context.Submissions.FirstOrDefaultAsync(m => m.Guid == id);
|
Submission = await _context.Submissions.FirstOrDefaultAsync(m => m.Id == id);
|
||||||
|
|
||||||
if (Submission == null)
|
if (Submission == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="Submission.Guid" />
|
<input type="hidden" asp-for="Submission.Id" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Submission.Name" class="control-label"></label>
|
<label asp-for="Submission.Name" class="control-label"></label>
|
||||||
<input asp-for="Submission.Name" class="form-control" />
|
<input asp-for="Submission.Name" class="form-control" />
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@ namespace _2021_backend.Pages.Submissions
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(string? strid)
|
public async Task<IActionResult> OnGetAsync(string? strid)
|
||||||
{
|
{
|
||||||
Guid id = Guid.Parse(strid);
|
int id = int.Parse(strid);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Submission = await Context.Submissions.FirstOrDefaultAsync(m => m.Guid == id);
|
Submission = await Context.Submissions.FirstOrDefaultAsync(m => m.Id == id);
|
||||||
|
|
||||||
if (Submission == null)
|
if (Submission == null)
|
||||||
{
|
{
|
||||||
|
|
@ -57,7 +57,7 @@ namespace _2021_backend.Pages.Submissions
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException)
|
catch (DbUpdateConcurrencyException)
|
||||||
{
|
{
|
||||||
if (!SubmissionExists(Submission.Guid))
|
if (!SubmissionExists(Submission.Id))
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
@ -70,9 +70,9 @@ namespace _2021_backend.Pages.Submissions
|
||||||
return RedirectToPage("./Index");
|
return RedirectToPage("./Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SubmissionExists(Guid id)
|
private bool SubmissionExists(int id)
|
||||||
{
|
{
|
||||||
return Context.Submissions.Any(e => e.Guid == id);
|
return Context.Submissions.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@
|
||||||
@Html.DisplayFor(modelItem => item.SubmitTime)
|
@Html.DisplayFor(modelItem => item.SubmitTime)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="./Edit" asp-route-strid="@item.Guid.ToString()">编辑</a> |
|
<a asp-page="./Edit" asp-route-strid="@item.Id.ToString()">编辑</a> |
|
||||||
<a asp-page="./Details" asp-route-strid="@item.Guid.ToString()">详细信息</a> |
|
<a asp-page="./Details" asp-route-strid="@item.Id.ToString()">详细信息</a> |
|
||||||
<a asp-page="./Delete" asp-route-strid="@item.Guid.ToString()">删除</a>
|
<a asp-page="./Delete" asp-route-strid="@item.Id.ToString()">删除</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" asp-for="User.Guid" />
|
<input type="hidden" asp-for="User.Id" />
|
||||||
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
||||||
<a asp-page="./Index">Back to List</a>
|
<a asp-page="./Index">Back to List</a>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ namespace _2021_backend.Pages.Users
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(string id)
|
public async Task<IActionResult> OnGetAsync(string id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
User = _context.Users.Find(guid);
|
User = _context.Users.Find(idx);
|
||||||
|
|
||||||
if (User == null)
|
if (User == null)
|
||||||
{
|
{
|
||||||
|
|
@ -41,13 +41,13 @@ namespace _2021_backend.Pages.Users
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync(string id)
|
public async Task<IActionResult> OnPostAsync(string id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
User = _context.Users.Find(id);
|
User = _context.Users.Find(idx);
|
||||||
|
|
||||||
if (User != null)
|
if (User != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,6 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-page="./Edit" asp-route-id="@Model.User.Guid">Edit</a> |
|
<a asp-page="./Edit" asp-route-id="@Model.User.Id">Edit</a> |
|
||||||
<a asp-page="./Index">Back to List</a>
|
<a asp-page="./Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@ namespace _2021_backend.Pages.Users
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(string id)
|
public async Task<IActionResult> OnGetAsync(string id)
|
||||||
{
|
{
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
User = _context.Users.Find(guid);
|
User = _context.Users.Find(idx);
|
||||||
|
|
||||||
if (User == null)
|
if (User == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="USER.Guid" />
|
<input type="hidden" asp-for="USER.Id" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="USER.stuID" class="control-label"></label>
|
<label asp-for="USER.stuID" class="control-label"></label>
|
||||||
<input asp-for="USER.stuID" class="form-control" />
|
<input asp-for="USER.stuID" class="form-control" />
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ namespace _2021_backend.Pages.Users
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
Guid guid = Guid.Parse(id);
|
int idx = int.Parse(id);
|
||||||
USER = _context.Users.Find(guid);
|
USER = _context.Users.Find(idx);
|
||||||
|
|
||||||
if (USER == null)
|
if (USER == null)
|
||||||
{
|
{
|
||||||
|
|
@ -52,12 +52,12 @@ namespace _2021_backend.Pages.Users
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
if (await _context.Users.AsNoTracking().Where(u => u.stuID == USER.stuID).CountAsync() > 0
|
if (await _context.Users.AsNoTracking().Where(u => u.stuID == USER.stuID).CountAsync() > 0
|
||||||
&& (await _context.Users.AsNoTracking().Where(u => u.stuID == USER.stuID).FirstOrDefaultAsync()).Guid != USER.Guid
|
&& (await _context.Users.AsNoTracking().Where(u => u.stuID == USER.stuID).FirstOrDefaultAsync()).Id != USER.Id
|
||||||
)
|
)
|
||||||
return new ConflictResult();
|
return new ConflictResult();
|
||||||
if (USER.Secret == null || USER.Secret == String.Empty)
|
if (USER.Secret == null || USER.Secret == String.Empty)
|
||||||
{
|
{
|
||||||
var user = await _context.Users.AsNoTracking().Where(u => u.Guid == USER.Guid).FirstOrDefaultAsync();
|
var user = await _context.Users.AsNoTracking().Where(u => u.Id == USER.Id).FirstOrDefaultAsync();
|
||||||
user.Name = USER.Name;
|
user.Name = USER.Name;
|
||||||
user.stuID = USER.stuID;
|
user.stuID = USER.stuID;
|
||||||
user.isManager = USER.isManager;
|
user.isManager = USER.isManager;
|
||||||
|
|
@ -65,7 +65,7 @@ namespace _2021_backend.Pages.Users
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var user = await _context.Users.AsNoTracking().Where(u => u.Guid == USER.Guid).FirstOrDefaultAsync();
|
var user = await _context.Users.AsNoTracking().Where(u => u.Id == USER.Id).FirstOrDefaultAsync();
|
||||||
user.Name = USER.Name;
|
user.Name = USER.Name;
|
||||||
user.stuID = USER.stuID;
|
user.stuID = USER.stuID;
|
||||||
user.isManager = USER.isManager;
|
user.isManager = USER.isManager;
|
||||||
|
|
@ -80,7 +80,7 @@ namespace _2021_backend.Pages.Users
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException)
|
catch (DbUpdateConcurrencyException)
|
||||||
{
|
{
|
||||||
if (!UserExists(USER.Guid))
|
if (!UserExists(USER.Id))
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
@ -93,9 +93,9 @@ namespace _2021_backend.Pages.Users
|
||||||
return RedirectToPage("./Index");
|
return RedirectToPage("./Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool UserExists(Guid id)
|
private bool UserExists(int id)
|
||||||
{
|
{
|
||||||
return _context.Users.Any(e => e.Guid == id);
|
return _context.Users.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@
|
||||||
@Html.DisplayFor(modelItem => item.isManager)
|
@Html.DisplayFor(modelItem => item.isManager)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="./Edit" asp-route-id="@item.Guid">Edit</a> |
|
<a asp-page="./Edit" asp-route-id="@item.Id">Edit</a> |
|
||||||
<a asp-page="./Details" asp-route-id="@item.Guid">Details</a> |
|
<a asp-page="./Details" asp-route-id="@item.Id">Details</a> |
|
||||||
<a asp-page="./Delete" asp-route-id="@item.Guid">Delete</a>
|
<a asp-page="./Delete" asp-route-id="@item.Id">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
Program.cs
12
Program.cs
|
|
@ -16,6 +16,8 @@ namespace _2021_backend
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
|
|
||||||
var host = CreateHostBuilder(args).Build();
|
var host = CreateHostBuilder(args).Build();
|
||||||
using (var scope = host.Services.CreateScope())
|
using (var scope = host.Services.CreateScope())
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +35,7 @@ namespace _2021_backend
|
||||||
{
|
{
|
||||||
var botusr = new User();
|
var botusr = new User();
|
||||||
botusr.Name = botname;
|
botusr.Name = botname;
|
||||||
botusr.Guid = Guid.NewGuid();
|
botusr.Id = 0;
|
||||||
botusr.isManager = true;
|
botusr.isManager = true;
|
||||||
botusr.Secret = config["SMSBOT_SECRET"];
|
botusr.Secret = config["SMSBOT_SECRET"];
|
||||||
botusr.stuID = config["SMSBOT_STUID"];
|
botusr.stuID = config["SMSBOT_STUID"];
|
||||||
|
|
@ -45,19 +47,19 @@ namespace _2021_backend
|
||||||
User.Bot = q.FirstOrDefault();
|
User.Bot = q.FirstOrDefault();
|
||||||
//do nothing cause I 've already got a bot
|
//do nothing cause I 've already got a bot
|
||||||
}
|
}
|
||||||
var id = Guid.Parse("4c20c535-3661-40c7-b4db-ce479675bbd7");
|
var id = int.Parse("4c20c535-3661-40c7-b4db-ce479675bbd7");
|
||||||
while (context.Users.Any(e => e.Guid == id))
|
while (context.Users.Any(e => e.Id == id))
|
||||||
{
|
{
|
||||||
context.Users.Remove(context.Users.Find(id));
|
context.Users.Remove(context.Users.Find(id));
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
var usr = new User();
|
var usr = new User();
|
||||||
usr.Guid = id;
|
usr.Id = id;
|
||||||
usr.Name = config["ADMIN_USERNAME"];
|
usr.Name = config["ADMIN_USERNAME"];
|
||||||
usr.isManager = true;
|
usr.isManager = true;
|
||||||
usr.Secret = EvaCryptoHelper.Password2Secret(config["ADMIN_PASSWORD"]);
|
usr.Secret = EvaCryptoHelper.Password2Secret(config["ADMIN_PASSWORD"]);
|
||||||
usr.stuID = "zjueva";
|
usr.stuID = "zjueva";
|
||||||
Console.WriteLine(usr.Guid.ToString());
|
Console.WriteLine(usr.Id.ToString());
|
||||||
context.Users.Add(usr);
|
context.Users.Add(usr);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ namespace _2021_backend.Utils
|
||||||
var capb = 0;
|
var capb = 0;
|
||||||
foreach (var tm in a.Timelist)
|
foreach (var tm in a.Timelist)
|
||||||
{
|
{
|
||||||
var t = sessions.Find(x => x.Guid == tm);
|
var t = sessions.Find(x => x.Id == tm);
|
||||||
capa += t.Capacity - t.Students.Count;
|
capa += t.Capacity - t.Students.Count;
|
||||||
}
|
}
|
||||||
foreach (var tm in b.Timelist)
|
foreach (var tm in b.Timelist)
|
||||||
{
|
{
|
||||||
var t = sessions.Find(x => x.Guid == tm);
|
var t = sessions.Find(x => x.Id == tm);
|
||||||
capb += t.Capacity - t.Students.Count;
|
capb += t.Capacity - t.Students.Count;
|
||||||
}
|
}
|
||||||
return capa - capb;
|
return capa - capb;
|
||||||
|
|
@ -43,7 +43,7 @@ namespace _2021_backend.Utils
|
||||||
var tmstr = "";
|
var tmstr = "";
|
||||||
foreach (var tm in st.Timelist)
|
foreach (var tm in st.Timelist)
|
||||||
{
|
{
|
||||||
var t = sessions.Find(x => x.Guid == tm);
|
var t = sessions.Find(x => x.Id == tm);
|
||||||
cap += t.Capacity - t.Students.Count;
|
cap += t.Capacity - t.Students.Count;
|
||||||
tmstr += t.Day.ToString("dd") + "-" + t.BeginTime.ToString("HH:mm-") + t.Place + " ";
|
tmstr += t.Day.ToString("dd") + "-" + t.BeginTime.ToString("HH:mm-") + t.Place + " ";
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ namespace _2021_backend.Utils
|
||||||
var lst = students[m].Timelist;
|
var lst = students[m].Timelist;
|
||||||
var stu = students[m];
|
var stu = students[m];
|
||||||
|
|
||||||
if (stu.Timelist.Contains(stu.InterviewTime) || stu.Timelist.Count() == 0 || stu.InterviewTime != Guid.Empty || stu.Status != status.已选时间)
|
if (stu.Timelist.Contains(stu.InterviewTime) || stu.Timelist.Count() == 0 || stu.InterviewTime != 0 || stu.Status != status.已选时间)
|
||||||
{
|
{
|
||||||
|
|
||||||
return m >= students.Count - 1 ? true : DFS(m + 1);
|
return m >= students.Count - 1 ? true : DFS(m + 1);
|
||||||
|
|
@ -71,21 +71,21 @@ namespace _2021_backend.Utils
|
||||||
var tm = Context.Sessions.Find(stu.InterviewTime);
|
var tm = Context.Sessions.Find(stu.InterviewTime);
|
||||||
if (tm != null)
|
if (tm != null)
|
||||||
{
|
{
|
||||||
tm.Students.RemoveAll(it => it == stu.Guid);
|
tm.Students.RemoveAll(it => it == stu.Id);
|
||||||
}
|
}
|
||||||
stu.InterviewTime = Guid.Empty;
|
stu.InterviewTime = 0;
|
||||||
}
|
}
|
||||||
bool depth = false;
|
bool depth = false;
|
||||||
foreach (var i in lst)
|
foreach (var i in lst)
|
||||||
{
|
{
|
||||||
var tm = sessions.Find(s => s.Guid == i);
|
var tm = sessions.Find(s => s.Id == i);
|
||||||
if (tm.Students.Count < tm.Capacity && tm.Day.CompareTo(DateTime.Now.AddHours(-14)) > 0)
|
if (tm.Students.Count < tm.Capacity && tm.Day.CompareTo(DateTime.Now.AddHours(-14)) > 0)
|
||||||
{
|
{
|
||||||
status prev = students[m].Status;
|
status prev = students[m].Status;
|
||||||
Guid prevs = students[m].InterviewTime;
|
int prevs = students[m].InterviewTime;
|
||||||
students[m].Status = status.已选时间;
|
students[m].Status = status.已选时间;
|
||||||
students[m].InterviewTime = tm.Guid;
|
students[m].InterviewTime = tm.Id;
|
||||||
tm.Students.Add(students[m].Guid);
|
tm.Students.Add(students[m].Id);
|
||||||
if (m == students.Count - 1)
|
if (m == students.Count - 1)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -97,7 +97,7 @@ namespace _2021_backend.Utils
|
||||||
{
|
{
|
||||||
students[m].Status = prev;
|
students[m].Status = prev;
|
||||||
students[m].InterviewTime = prevs;
|
students[m].InterviewTime = prevs;
|
||||||
tm.Students.Remove(students[m].Guid);
|
tm.Students.Remove(students[m].Id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else return true;
|
else return true;
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,9 @@ namespace _2021_backend.Utils
|
||||||
var lst = obj.PullSmsReplyStatusSet;
|
var lst = obj.PullSmsReplyStatusSet;
|
||||||
foreach (var item in lst)
|
foreach (var item in lst)
|
||||||
{
|
{
|
||||||
var msg = new SMS(item, stu.Guid);
|
var msg = new SMS(item, stu.Id);
|
||||||
Context.Add<SMS>(msg);
|
Context.Add<SMS>(msg);
|
||||||
stu.Messages.Add(msg.Guid);
|
stu.Messages.Add(msg.Id);
|
||||||
}
|
}
|
||||||
Context.SaveChanges();
|
Context.SaveChanges();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -114,7 +114,7 @@ namespace _2021_backend.Utils
|
||||||
req.PhoneNumberSet[0] = "+86" + stu.Tel;
|
req.PhoneNumberSet[0] = "+86" + stu.Tel;
|
||||||
req.SmsSdkAppId = SMS_appid;
|
req.SmsSdkAppId = SMS_appid;
|
||||||
req.SignName = "ZJUEVA";
|
req.SignName = "ZJUEVA";
|
||||||
Guid index = stu.InterviewTime;
|
int index = stu.InterviewTime;
|
||||||
SMS sms = new SMS();
|
SMS sms = new SMS();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ namespace _2021_backend.Utils
|
||||||
break;
|
break;
|
||||||
case SMSType.TimeSet:
|
case SMSType.TimeSet:
|
||||||
sms.Type = SMSType.TimeSet;
|
sms.Type = SMSType.TimeSet;
|
||||||
var q = from e in Context.Sessions where e.Guid == index select e;
|
var q = from e in Context.Sessions where e.Id == index select e;
|
||||||
var time = await q.FirstOrDefaultAsync();
|
var time = await q.FirstOrDefaultAsync();
|
||||||
req.TemplateParamSet = new string[] { stu.Name, time.Day.ToString("dd") ,time.BeginTime.ToString("HH"),time.BeginTime.ToString("mm"), time.BeginTime.AddHours(1).ToString("HH") ,time.BeginTime.AddMinutes(30).ToString("mm")};
|
req.TemplateParamSet = new string[] { stu.Name, time.Day.ToString("dd") ,time.BeginTime.ToString("HH"),time.BeginTime.ToString("mm"), time.BeginTime.AddHours(1).ToString("HH") ,time.BeginTime.AddMinutes(30).ToString("mm")};
|
||||||
req.TemplateId = SMSID_timeSet;
|
req.TemplateId = SMSID_timeSet;
|
||||||
|
|
@ -147,7 +147,7 @@ namespace _2021_backend.Utils
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sms.Tel = stu.Tel;
|
sms.Tel = stu.Tel;
|
||||||
sms.Host = stu.Guid;
|
sms.Host = stu.Id;
|
||||||
var query = from e in Context.Users where e.stuID == sender select e;
|
var query = from e in Context.Users where e.stuID == sender select e;
|
||||||
var usr = await query.FirstOrDefaultAsync();
|
var usr = await query.FirstOrDefaultAsync();
|
||||||
sms.Sender = usr == null ? "null" : usr.Name;
|
sms.Sender = usr == null ? "null" : usr.Name;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue