diff --git a/asg_form/Controllers/Champion.cs b/asg_form/Controllers/Champion.cs index 3699c68..ee133c1 100644 --- a/asg_form/Controllers/Champion.cs +++ b/asg_form/Controllers/Champion.cs @@ -110,7 +110,7 @@ namespace asg_form.Controllers { public long Id { get; set; } public form form { get; set; } - public Events.T_events events { get; set; } + public T_events events { get; set; } public string msg { get; set; } } diff --git a/asg_form/Controllers/Dbset.cs b/asg_form/Controllers/Dbset.cs index 5407572..09de205 100644 --- a/asg_form/Controllers/Dbset.cs +++ b/asg_form/Controllers/Dbset.cs @@ -1,5 +1,6 @@  using asg_form.Controllers.Store; +using asg_form.Controllers.Team; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DataEncryption; @@ -27,6 +28,9 @@ namespace asg_form.Controllers builder.Property(a => a.Status).IsRequired(); } } + + + public void Configure(EntityTypeBuilder
builder) { builder.ToTable("F_form"); @@ -35,11 +39,38 @@ namespace asg_form.Controllers builder.Property(e => e.team_password).IsRequired(); builder.Property(e => e.time).IsRequired(); builder.Property(e => e.piaoshu).IsRequired(); - builder.HasOne(c => c.events).WithMany(a => a.forms).IsRequired(); + builder.HasOne(c => c.events).WithMany(a => a.forms).IsRequired(); } } + + class TeamConfig : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("F_Team"); + builder.Property(e => e.team_name).IsRequired(); + builder.Property(e => e.team_tel).IsRequired(); + builder.Property(e => e.team_password).IsRequired(); + builder.Property(e => e.time).IsRequired(); + builder.Property(e => e.piaoshu).IsRequired(); + builder.HasMany(a => a.Events).WithMany(a => a.Teams).UsingEntity(j => j.ToTable("T_Teams_Player")); + + } + } + + class PlayerConfig : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("F_Player"); + + } + } + + + class RoleConfig : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) @@ -129,9 +160,9 @@ namespace asg_form.Controllers builder.HasOne(e => e.team).WithMany(o=>o.logs).IsRequired(); } } - class EventsConfig : IEntityTypeConfiguration + class EventsConfig : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("F_events"); builder.Property(e => e.Id).IsRequired(); @@ -189,15 +220,16 @@ namespace asg_form.Controllers class TestDbContext : DbContext { + public DbSet Teams { get; set; } + public DbSet Players { get; set; } - public DbSet Forms { get; set; } public DbSet Roles { get; set; } public DbSet news { get; set; } public DbSet blogs { get; set; } public DbSet schlogs { get; set; } public DbSet team_Games { get; set; } - public DbSet events { get; set; } + public DbSet events { get; set; } public DbSet Champions { get; set; } public DbSet com_Forms { get; set; } public DbSet T_Friends { get; set; } diff --git a/asg_form/Controllers/Events.cs b/asg_form/Controllers/Events.cs index 32d533b..979c8b0 100644 --- a/asg_form/Controllers/Events.cs +++ b/asg_form/Controllers/Events.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using asg_form.Controllers.Team; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; @@ -162,17 +163,7 @@ namespace asg_form.Controllers } - public class T_events - { - public int Id { get; set; } - public string? name { get; set; } - public bool? is_over { get; set; } - public DateTime? opentime { get; set; } - public List? forms { get; set; } - public Uri? events_rule_uri { get; set; } - public string? promChart { get; set; } - - } + public class events_get { public int Id { get; set; } @@ -183,4 +174,16 @@ namespace asg_form.Controllers } } + public class T_events + { + public int Id { get; set; } + public string? name { get; set; } + public bool? is_over { get; set; } + public DateTime? opentime { get; set; } + public List Teams { get; set; }=new List(); + public List? forms { get; set; } + public Uri? events_rule_uri { get; set; } + public string? promChart { get; set; } + + } } diff --git a/asg_form/Controllers/Team/TeamDB.cs b/asg_form/Controllers/Team/TeamDB.cs new file mode 100644 index 0000000..0926957 --- /dev/null +++ b/asg_form/Controllers/Team/TeamDB.cs @@ -0,0 +1,35 @@ +namespace asg_form.Controllers.Team +{ + public class T_Team + { + + public List Events { get; set; }=new List(); + public long Id { get; set; } + public bool is_check { get; set; } + public int piaoshu { get; set; } + public long time { get; set; } + public string team_name { get; set; } + public string team_password { get; set; } + public string team_tel { get; set; } + public string logo_uri { get; set; } + + // public string? belong { get; set; } + public List role { get; set; } = new List(); + } + public class T_Player + { + public long Id { get; set; } + + public T_Team Team { get; set; }//属于哪个队伍 + + public string role_id { get; set; } = "无"; + public string role_name { get; set; } = "无";//阵容 + public string? Game_Name { get; set; } = "未知"; + public string role_lin { get; set; } + public string? Id_Card { get; set; } = "未知"; + public string? Common_Roles { get; set; } = "未知"; + public string? Phone_Number { get; set; } = "未知"; + public string? Id_Card_Name { get; set; } = "未知"; + public int? Historical_Ranks { get; set; } = 0; + } +} diff --git a/asg_form/Controllers/Team/Team_http.cs b/asg_form/Controllers/Team/Team_http.cs new file mode 100644 index 0000000..c0dad23 --- /dev/null +++ b/asg_form/Controllers/Team/Team_http.cs @@ -0,0 +1,210 @@ +using asg_form.Controllers.Hubs; +using Manganese.Text; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; +using static 所有队伍; + +namespace asg_form.Controllers.Team +{ + public class Team_http:ControllerBase + { + + private readonly RoleManager roleManager; + private readonly UserManager userManager; + + private readonly IHubContext hubContext; + public Team_http(IHubContext hubContext, RoleManager roleManager, UserManager userManager) + { + this.hubContext = hubContext; + this.roleManager = roleManager; + this.userManager = userManager; + } + + [Route("api/v1/form/my")] + [HttpPost] + [Authorize] + public async Task> Posthameform(string eventname) + { + long id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value.ToInt64(); + var user = await userManager.Users.FirstAsync(a=>a.Id==id); + var team= user.myteam; + using(TestDbContext db=new TestDbContext()) + { + var events= await db.events.FirstAsync(a=>a.name==eventname); + events.Teams.Add(team); + await db.SaveChangesAsync(); + } + return Ok("成功"); + } + + + /// + /// 获取我的表单 + /// + /// + [Authorize] + [Route("api/v2/user/form")] + [HttpGet] + public async Task> getmyform() + { + + string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; + var ouser = userManager.Users.Include(a => a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64()); + if (ouser.haveform == null) + { + return BadRequest(new error_mb { code = 400, message = "你没有绑定表单" }); + + } + ouser.haveform.events.forms = null; + foreach (var role in ouser.haveform.role) + { + role.form = null; + } + return ouser.haveform; + + + + } + + + + /// + /// 提交表单 eventname留空代表创建战队 + /// + /// + /// 表单信息 + /// 谷歌人机验证验证码 + /// + [Route("api/v3/form/")] + [HttpPost] + [Authorize] + public async Task> PostAsync(IFormFile imageFile, [FromForm] form_get_new for1) + { + + using (TestDbContext ctx = new TestDbContext()) { + string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; + var user = await userManager.FindByIdAsync(id); + + + if (ctx.Teams.Include(a => a.Events).Any(e => e.team_name == for1.team_name)) + { + return BadRequest(new error_mb { code = 400, message = "有重名队伍" }); + } + else + { + if (imageFile == null || imageFile.Length == 0) + return BadRequest("Invalid image file."); + // 将文件保存到磁盘 + var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"loge/", $"{imageFile.FileName}"); + using (var stream = new FileStream(filePath, FileMode.Create)) + { + await imageFile.CopyToAsync(stream); + } // 返回成功响应 + // base64toimg(for1.logo_base64, $@"{AppDomain.CurrentDomain.BaseDirectory}loge\{for1.events_name}\{for1.team_name}.png"); + + + + + T_Team form1 = new T_Team(); + form1.logo_uri = $"/loge/{for1.team_name}.png"; + form1.team_name = for1.team_name; + form1.team_password = for1.team_password; + form1.team_tel = for1.team_tel; + if (for1.events_name == null) + { + + } + else + { + var events = await ctx.events.FirstAsync(ctx => ctx.name == for1.events_name); + + form1.Events.Add(events); + } + + List role = new List(); + foreach (role_get a in for1.role_get) + { + role.Add(new T_Player { role_id = a.role_id, role_lin = a.role_lin, role_name = a.role_name, Common_Roles = a.Common_Roles, Historical_Ranks = a.Historical_Ranks, Id_Card = a.Id_Card, Game_Name = a.Game_Name, Phone_Number = a.Phone_Number, Id_Card_Name = a.Id_Card_Name }); + } + form1.role = role; + + await ctx.Teams.AddAsync(form1); + await ctx.SaveChangesAsync(); + user.myteam = form1; + await userManager.UpdateAsync(user); + // int nownumber = ctx.Forms.Count(); + //ChatRoomHub chat = new ChatRoomHub(); + // await chat.formok(nownumber, for1.team_name); + + } + + } + + + return "ok!"; + + + + } + + + + /// + /// 获得所有表单信息 + /// + /// 页数 + /// 每页长度 + /// + + [Route("api/v2/form/all")] + [HttpGet] + [Authorize] + public List Getform(short page, short page_long, string sort, string eventsname) + { + using (TestDbContext ctx = new TestDbContext()) + { + + + int c = ctx.Teams.Count(); + int b = page_long * page; + if (page_long * page > c) + { + b = c; + } + var events = ctx.events.First(ctx => ctx.name == eventsname); + List forms; + if (sort == "vote") + { + var team1 = ctx.events.Include(a => a.Teams).Select(a => new {a.name,a.Teams}).First(a=>a.name==eventsname); + forms= team1.Teams.Where(a=>a.is_check==true).OrderByDescending(a => a.piaoshu).ToList(); + + } + else + { + //改为按照id倒序排序 + //forms = ctx.Forms.Include(a => a.role).Skip(page_long * page - page_long).Take(page_long).ToList(); + var team1 = ctx.events.Include(a => a.Teams).Select(a => new { a.name, a.Teams }).First(a => a.name == eventsname); + forms = team1.Teams.Where(a => a.is_check == true).OrderByDescending(a => a.Id).ToList(); + + } + List teams = new List(); + + + foreach (T_Team for1 in forms) + { + var team = new team { id = for1.Id, name = for1.team_name, timer = for1.time, piaoshu = for1.piaoshu, logo_uri = for1.logo_uri }; + + teams.Add(team); + // a++; + } + return teams; + } + } + + + } +} diff --git a/asg_form/Controllers/admin.cs b/asg_form/Controllers/admin.cs index e720934..4eed192 100644 --- a/asg_form/Controllers/admin.cs +++ b/asg_form/Controllers/admin.cs @@ -625,8 +625,8 @@ else{ if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) { TestDbContext ctx = new TestDbContext(); - var form = await ctx.Forms.Include(a => a.role).FirstOrDefaultAsync(a => a.Id == formid); - var users = await userManager.Users.Include(a => a.haveform).Where(a => a.haveform == form).ToListAsync(); + var form = await ctx.Teams.Include(a => a.role).FirstOrDefaultAsync(a => a.Id == formid); + var users = await userManager.Users.Include(a => a.myteam).Where(a => a.myteam == form).ToListAsync(); try { foreach (var user in users) @@ -639,7 +639,7 @@ else{ { } - ctx.Forms.Remove(form); ; + ctx.Teams.Remove(form); ; await ctx.SaveChangesAsync(); logger.Warn($"管理员删除了表单{formid},参赛选手:{string.Join(',', form.role.Select(a => a.role_name))}"); return Ok("删除成功!"); diff --git a/asg_form/Controllers/booking.cs b/asg_form/Controllers/booking.cs index 332060f..869c53f 100644 --- a/asg_form/Controllers/booking.cs +++ b/asg_form/Controllers/booking.cs @@ -27,6 +27,7 @@ namespace asg_form.Controllers [Route("api/newbooking")] [HttpPost] + public async Task> newbooking() { string username = this.User.FindFirst(ClaimTypes.Name)!.Value; diff --git a/asg_form/Controllers/excel.cs b/asg_form/Controllers/excel.cs index 383a530..5cbeda0 100644 --- a/asg_form/Controllers/excel.cs +++ b/asg_form/Controllers/excel.cs @@ -1,15 +1,9 @@ - -using asg_form; -using Masuit.Tools.Files; +using asg_form.Controllers.Team; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Cors.Infrastructure; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Rewrite; using Microsoft.EntityFrameworkCore; -using Mirai.Net.Data.Shared; using OfficeOpenXml; -using OfficeOpenXml.Packaging.Ionic.Zlib; using OfficeOpenXml.Style; using System.Drawing; using System.IO.Compression; @@ -41,7 +35,7 @@ namespace asg_form.Controllers - public static void ExportToExcel_noadmin(List data, string fileName) + public static void ExportToExcel_noadmin(List data, string fileName) { using (var package = new ExcelPackage()) { @@ -62,7 +56,7 @@ namespace asg_form.Controllers worksheet.Cells[1, a].Style.Fill.BackgroundColor.SetColor(Color.RoyalBlue); a++; } - var pic = worksheet.Drawings.AddPicture(form.team_name, $@"{AppDomain.CurrentDomain.BaseDirectory}loge\{form.events.name}\{form.team_name}.png"); + var pic = worksheet.Drawings.AddPicture(form.team_name, $@"{AppDomain.CurrentDomain.BaseDirectory}loge\{form.team_name}.png"); pic.SetSize(50, 50); pic.SetPosition(26, 0); worksheet.Cells[2, 2].Value = form.Id; @@ -113,11 +107,11 @@ namespace asg_form.Controllers - public static void ExportToExcel(List data, string fileName) + public static void ExportToExcel(List data, string fileName) { using (var package = new ExcelPackage()) { - foreach(var form in data) + foreach (var form in data) { var worksheet = package.Workbook.Worksheets.Add(form.team_name); worksheet.Cells[1, 1].Value = "队伍logo"; @@ -127,18 +121,18 @@ namespace asg_form.Controllers worksheet.Cells[1, 5].Value = "队伍密码"; worksheet.Cells[1, 6].Value = "队伍票数"; - + int a = 1; - while (a<=6) + while (a <= 6) { worksheet.Cells[1, a].Style.Font.Bold = true; worksheet.Cells[1, a].Style.Font.Color.SetColor(Color.White); - worksheet.Cells[1, a].Style.Fill.PatternType= ExcelFillStyle.Solid; + worksheet.Cells[1, a].Style.Fill.PatternType = ExcelFillStyle.Solid; worksheet.Cells[1, a].Style.Fill.BackgroundColor.SetColor(Color.RoyalBlue); a++; } - var pic= worksheet.Drawings.AddPicture(form.team_name, $@"{AppDomain.CurrentDomain.BaseDirectory}loge\{form.events.name}\{form.team_name}.png"); - pic.SetSize(50,50); + var pic = worksheet.Drawings.AddPicture(form.team_name, $@"{AppDomain.CurrentDomain.BaseDirectory}loge\{form.team_name}.png"); + pic.SetSize(50, 50); pic.SetPosition(26, 0); worksheet.Cells[2, 2].Value = form.Id; worksheet.Cells[2, 3].Value = form.team_name; @@ -198,7 +192,7 @@ namespace asg_form.Controllers { TestDbContext ctx = new TestDbContext(); List data = new List(); - List teams = ctx.Forms.Include(a => a.role).Where(a => a.team_name.IndexOf(search)>=0).ToList(); + List teams = ctx.Forms.Include(a => a.role).Where(a => a.team_name.IndexOf(search) >= 0).ToList(); foreach (var team in teams) { var roles = team.role; @@ -213,12 +207,12 @@ namespace asg_form.Controllers data.Add(allteam); } return data; - } + } else { return BadRequest(new error_mb { code = 400, message = "无权访问" }); } - + } @@ -233,12 +227,12 @@ namespace asg_form.Controllers if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) { -using(TestDbContext ctx =new TestDbContext()) + using (TestDbContext ctx = new TestDbContext()) { - object data = userManager.Users.Select(a => new {a.Id,a.UserName,a.chinaname,a.Email,a.officium}).Where(a => a.officium != null).GroupBy(a => a.officium).ToList(); + object data = userManager.Users.Select(a => new { a.Id, a.UserName, a.chinaname, a.Email, a.officium }).Where(a => a.officium != null).GroupBy(a => a.officium).ToList(); return data; } - + } else { @@ -271,7 +265,7 @@ using(TestDbContext ctx =new TestDbContext()) post_User.officium = user1.officium; post_User.chinaname = user1.chinaname; - post_User.Base64=user1.UserBase64; + post_User.Base64 = user1.UserBase64; post_User.Roles = (List?)await userManager.GetRolesAsync(user1); data.Add(post_User); } @@ -319,8 +313,8 @@ using(TestDbContext ctx =new TestDbContext()) [HttpGet] public async Task>> searchuser_bychinaname(string search) { - - if (this.User.FindAll(ClaimTypes.Role).Any(a=>a.Value=="admin")) + + if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) { TestDbContext ctx = new TestDbContext(); List data = new List(); @@ -354,13 +348,10 @@ using(TestDbContext ctx =new TestDbContext()) { string guid = Guid.NewGuid().ToString(); TestDbContext testDb = new TestDbContext(); - List result = testDb.Forms - .Include(a => a.role) - .Include(a => a.events) - .Where(e => e.events.name == event_name).ToList(); + List result = testDb.Teams.ToList(); if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin")) { - + ExportToExcel(result, $"{AppDomain.CurrentDomain.BaseDirectory}excel/{guid}.xlsx"); return Ok(guid); } @@ -371,7 +362,7 @@ using(TestDbContext ctx =new TestDbContext()) } else { - return BadRequest(new error_mb { code=400,message="无管理员" }); + return BadRequest(new error_mb { code = 400, message = "无管理员" }); } } @@ -386,7 +377,7 @@ using(TestDbContext ctx =new TestDbContext()) { DirectoryInfo di = new DirectoryInfo($@"{AppDomain.CurrentDomain.BaseDirectory}excel"); FileInfo[] files = di.GetFiles(); - foreach(var file in files) + foreach (var file in files) { System.IO.File.Delete(file.FullName); } @@ -451,12 +442,12 @@ using(TestDbContext ctx =new TestDbContext()) [ResponseCache(Duration = 30)] public async Task> form_count() { - Dictionary keys=new Dictionary(); - - using(TestDbContext ctx =new TestDbContext()) + Dictionary keys = new Dictionary(); + + using (TestDbContext ctx = new TestDbContext()) { var all_event = await ctx.events.ToListAsync(); - foreach(var eventt in all_event ) + foreach (var eventt in all_event) { keys.Add(eventt.name, ctx.Forms.Where(a => a.events == eventt).Count()); @@ -486,13 +477,13 @@ using(TestDbContext ctx =new TestDbContext()) } - /// - /// 获得所有战队信息 - /// - /// - /// - /// - [Authorize] + /// + /// 获得所有战队信息 + /// + /// + /// + /// + [Authorize] [Route("api/v1/admin/form/all")] [HttpGet] public async Task>> Post(string events) @@ -503,16 +494,16 @@ using(TestDbContext ctx =new TestDbContext()) TestDbContext ctx = new TestDbContext(); - var teams = ctx.Forms.Include(a => a.role).Include(a=>a.events).Where(a=>a.events.name==events).ToList(); - foreach( var team in teams) + var teams = ctx.Forms.Include(a => a.role).Include(a => a.events).Where(a => a.events.name == events).ToList(); + foreach (var team in teams) { team.events.forms = null; - foreach(var role in team.role) + foreach (var role in team.role) { role.form = null; } } - + return teams; @@ -539,7 +530,7 @@ using(TestDbContext ctx =new TestDbContext()) -public class allteam + public class allteam { /// /// 战队id @@ -557,6 +548,6 @@ public class allteam - + } } \ No newline at end of file diff --git a/asg_form/Controllers/form_cs.cs b/asg_form/Controllers/form_cs.cs index 77f2e9b..f0cd4d0 100644 --- a/asg_form/Controllers/form_cs.cs +++ b/asg_form/Controllers/form_cs.cs @@ -367,58 +367,7 @@ namespace asg_form.Controllers } - /// - /// бϢ - /// - /// ҳ - /// ÿҳ - /// - - [Route("api/v1/form/all")] - [HttpGet] - [Authorize] - public List Getform(short page,short page_long,string sort,string eventsname) - { - TestDbContext ctx = new TestDbContext(); - - - int c = ctx.Forms.Count(); - int b = page_long * page; - if (page_long * page > c) - { - b = c; - } - var events= ctx.events.First(ctx => ctx.name == eventsname); - List forms; - if(sort=="vote") - { - forms = ctx.Forms.Include(a => a.role).Include(a=>a.events).OrderByDescending(a => a.piaoshu).Where(a=>a.events==events).Skip(page_long * page - page_long).Take(page_long).ToList(); - } - else - { - //Ϊid - //forms = ctx.Forms.Include(a => a.role).Skip(page_long * page - page_long).Take(page_long).ToList(); - forms = ctx.Forms.Include(a => a.role).Include(a => a.events).OrderByDescending(a => a.Id).Where(a => a.events == events).Skip(page_long * page - page_long).Take(page_long).ToList(); - - } - List teams = new List(); - - - foreach (form for1 in forms) - { - var team = new team { id=for1.Id,name = for1.team_name, timer = for1.time, piaoshu = for1.piaoshu ,logo_uri=for1.logo_uri}; - foreach (var role in for1.role) - { - team.rolename.Add(new roletwo { name = role.role_name, lin = role.role_lin }); - } - teams.Add(team); - // a++; - } - return teams; - } - - - + @@ -518,7 +467,7 @@ namespace asg_form.Controllers public string team_password { get; set; } public string team_tel { get; set; } public string logo_uri { get; set; } - public Events.T_events events { get; set; } + public T_events events { get; set; } // public string? belong { get; set; } public List role { get; set; } = new List(); @@ -545,7 +494,7 @@ namespace asg_form.Controllers public string team_password { get; set; } public string team_tel { get; set; } // public string logo_base64 { get; set; } - public string events_name { get; set; } + public string? events_name { get; set; } // public string? belong { get; set; } public List role_get { get; set; } } @@ -595,17 +544,11 @@ public class { public long id { get; set; } public string name { get; set; } - public DateTime timer { get; set; } + public long timer { get; set; } public int piaoshu { get; set; } public string logo_uri { get; set; } - public List rolename { get; set; }=new List(); } - public class roletwo - { - public string name { get; set; } - public string lin { get; set; } - } diff --git a/asg_form/Migrations/20240825035334_newteam.Designer.cs b/asg_form/Migrations/20240825035334_newteam.Designer.cs new file mode 100644 index 0000000..2003060 --- /dev/null +++ b/asg_form/Migrations/20240825035334_newteam.Designer.cs @@ -0,0 +1,994 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using asg_form.Controllers; + +#nullable disable + +namespace asg_form.Migrations +{ + [DbContext(typeof(IDBcontext))] + [Migration("20240825035334_newteam")] + partial class newteam + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("RoleId") + .HasColumnType("bigint"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("T_TeamT_events", b => + { + b.Property("EventsId") + .HasColumnType("int"); + + b.Property("TeamsId") + .HasColumnType("bigint"); + + b.HasKey("EventsId", "TeamsId"); + + b.HasIndex("TeamsId"); + + b.ToTable("T_Teams_Player", (string)null); + }); + + modelBuilder.Entity("T_news", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FormName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("msg") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("time") + .IsRequired() + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("F_news", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("eventsId") + .HasColumnType("int"); + + b.Property("formId") + .HasColumnType("bigint"); + + b.Property("msg") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("eventsId"); + + b.HasIndex("formId"); + + b.ToTable("F_Champion", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("bigint"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("information") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("T_Store", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Storeid") + .HasColumnType("bigint"); + + b.Property("buyerid") + .HasColumnType("bigint"); + + b.Property("isVerification") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("Storeid"); + + b.ToTable("T_Storeinfo", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.T_Friend", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("account") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("comMsg") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("comTime") + .HasColumnType("datetime2"); + + b.Property("comType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("degree") + .HasColumnType("int"); + + b.Property("headName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("headTel") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("orgName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("F_Friend", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.T_config", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Substance") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("msg") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("T_Config", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.T_events", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("events_rule_uri") + .HasColumnType("nvarchar(max)"); + + b.Property("is_over") + .HasColumnType("bit"); + + b.Property("name") + .HasColumnType("nvarchar(max)"); + + b.Property("opentime") + .HasColumnType("datetime2"); + + b.Property("promChart") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("F_events", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Common_Roles") + .HasColumnType("nvarchar(max)"); + + b.Property("Game_Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Historical_Ranks") + .HasColumnType("int"); + + b.Property("Id_Card") + .HasColumnType("nvarchar(max)"); + + b.Property("Id_Card_Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Phone_Number") + .HasColumnType("nvarchar(max)"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.Property("role_id") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("role_lin") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("role_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TeamId"); + + b.ToTable("F_Player", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("is_check") + .HasColumnType("bit"); + + b.Property("logo_uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("piaoshu") + .HasColumnType("int"); + + b.Property("team_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team_password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team_tel") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("time") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("F_Team", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.comform+com_form", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Com_Cocial_media") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Com_Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Com_qq") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.Property("idv_id") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("introduction") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("F_ComForm", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.form", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("eventsId") + .HasColumnType("int"); + + b.Property("logo_uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("piaoshu") + .HasColumnType("int"); + + b.Property("team_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team_password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team_tel") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("time") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("eventsId"); + + b.ToTable("F_form", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Common_Roles") + .HasColumnType("nvarchar(max)"); + + b.Property("Game_Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Historical_Ranks") + .HasColumnType("int"); + + b.Property("Id_Card") + .HasColumnType("nvarchar(max)"); + + b.Property("Id_Card_Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Phone_Number") + .HasColumnType("nvarchar(max)"); + + b.Property("formId") + .HasColumnType("bigint"); + + b.Property("role_id") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("role_lin") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("role_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("formId"); + + b.ToTable("F_role", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.schedule+schedule_log", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("chickteam") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("teamid") + .HasColumnType("bigint"); + + b.Property("userid") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("win") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("teamid"); + + b.ToTable("F_achlog", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.schedule+team_game", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("belong") + .HasColumnType("nvarchar(max)"); + + b.Property("bilibiliuri") + .HasColumnType("nvarchar(max)"); + + b.Property("commentary") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("opentime") + .HasColumnType("datetime2"); + + b.Property("referee") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("tag") + .HasColumnType("nvarchar(max)"); + + b.Property("team1_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team1_piaoshu") + .HasColumnType("int"); + + b.Property("team2_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team2_piaoshu") + .HasColumnType("int"); + + b.Property("winteam") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("F_game", (string)null); + }); + + modelBuilder.Entity("asg_form.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("msg") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("asg_form.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("Integral") + .HasColumnType("bigint"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserBase64") + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("chinaname") + .HasColumnType("nvarchar(max)"); + + b.Property("haveformId") + .HasColumnType("bigint"); + + b.Property("isbooking") + .HasColumnType("bit"); + + b.Property("myteamId") + .HasColumnType("bigint"); + + b.Property("officium") + .HasColumnType("nvarchar(max)"); + + b.Property("point") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.HasIndex("haveformId"); + + b.HasIndex("myteamId"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("asg_form.blog+blog_db", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("formuser") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("msg") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("pushtime") + .HasColumnType("datetime2"); + + b.Property("title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.ToTable("F_blog", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("asg_form.Role", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("asg_form.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("asg_form.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("asg_form.Role", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("asg_form.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("asg_form.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("T_TeamT_events", b => + { + b.HasOne("asg_form.Controllers.T_events", null) + .WithMany() + .HasForeignKey("EventsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("asg_form.Controllers.Team.T_Team", null) + .WithMany() + .HasForeignKey("TeamsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b => + { + b.HasOne("asg_form.Controllers.T_events", "events") + .WithMany() + .HasForeignKey("eventsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("asg_form.Controllers.form", "form") + .WithMany() + .HasForeignKey("formId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("events"); + + b.Navigation("form"); + }); + + modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b => + { + b.HasOne("asg_form.Controllers.Store.StoreDB", "Store") + .WithMany("buyer") + .HasForeignKey("Storeid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Store"); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Player", b => + { + b.HasOne("asg_form.Controllers.Team.T_Team", "Team") + .WithMany("role") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("asg_form.Controllers.form", b => + { + b.HasOne("asg_form.Controllers.T_events", "events") + .WithMany("forms") + .HasForeignKey("eventsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("events"); + }); + + modelBuilder.Entity("asg_form.Controllers.role", b => + { + b.HasOne("asg_form.Controllers.form", "form") + .WithMany("role") + .HasForeignKey("formId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("form"); + }); + + modelBuilder.Entity("asg_form.Controllers.schedule+schedule_log", b => + { + b.HasOne("asg_form.Controllers.schedule+team_game", "team") + .WithMany("logs") + .HasForeignKey("teamid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("team"); + }); + + modelBuilder.Entity("asg_form.User", b => + { + b.HasOne("asg_form.Controllers.form", "haveform") + .WithMany() + .HasForeignKey("haveformId"); + + b.HasOne("asg_form.Controllers.Team.T_Team", "myteam") + .WithMany() + .HasForeignKey("myteamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("haveform"); + + b.Navigation("myteam"); + }); + + modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b => + { + b.Navigation("buyer"); + }); + + modelBuilder.Entity("asg_form.Controllers.T_events", b => + { + b.Navigation("forms"); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Team", b => + { + b.Navigation("role"); + }); + + modelBuilder.Entity("asg_form.Controllers.form", b => + { + b.Navigation("role"); + }); + + modelBuilder.Entity("asg_form.Controllers.schedule+team_game", b => + { + b.Navigation("logs"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/asg_form/Migrations/20240825035334_newteam.cs b/asg_form/Migrations/20240825035334_newteam.cs new file mode 100644 index 0000000..36cf70e --- /dev/null +++ b/asg_form/Migrations/20240825035334_newteam.cs @@ -0,0 +1,179 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace asg_form.Migrations +{ + /// + public partial class newteam : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Type", + table: "F_news", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "promChart", + table: "F_events", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "myteamId", + table: "AspNetUsers", + type: "bigint", + nullable: false, + defaultValue: 0L); + + migrationBuilder.CreateTable( + name: "F_Team", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + is_check = table.Column(type: "bit", nullable: false), + piaoshu = table.Column(type: "int", nullable: false), + time = table.Column(type: "bigint", nullable: false), + team_name = table.Column(type: "nvarchar(max)", nullable: false), + team_password = table.Column(type: "nvarchar(max)", nullable: false), + team_tel = table.Column(type: "nvarchar(max)", nullable: false), + logo_uri = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_F_Team", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "T_Config", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(max)", nullable: false), + Substance = table.Column(type: "nvarchar(max)", nullable: false), + msg = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Config", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "F_Player", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TeamId = table.Column(type: "bigint", nullable: false), + role_id = table.Column(type: "nvarchar(max)", nullable: false), + role_name = table.Column(type: "nvarchar(max)", nullable: false), + Game_Name = table.Column(type: "nvarchar(max)", nullable: true), + role_lin = table.Column(type: "nvarchar(max)", nullable: false), + Id_Card = table.Column(type: "nvarchar(max)", nullable: true), + Common_Roles = table.Column(type: "nvarchar(max)", nullable: true), + Phone_Number = table.Column(type: "nvarchar(max)", nullable: true), + Id_Card_Name = table.Column(type: "nvarchar(max)", nullable: true), + Historical_Ranks = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_F_Player", x => x.Id); + table.ForeignKey( + name: "FK_F_Player_F_Team_TeamId", + column: x => x.TeamId, + principalTable: "F_Team", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "T_Teams_Player", + columns: table => new + { + EventsId = table.Column(type: "int", nullable: false), + TeamsId = table.Column(type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Teams_Player", x => new { x.EventsId, x.TeamsId }); + table.ForeignKey( + name: "FK_T_Teams_Player_F_Team_TeamsId", + column: x => x.TeamsId, + principalTable: "F_Team", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_T_Teams_Player_F_events_EventsId", + column: x => x.EventsId, + principalTable: "F_events", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUsers_myteamId", + table: "AspNetUsers", + column: "myteamId"); + + migrationBuilder.CreateIndex( + name: "IX_F_Player_TeamId", + table: "F_Player", + column: "TeamId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Teams_Player_TeamsId", + table: "T_Teams_Player", + column: "TeamsId"); + + migrationBuilder.AddForeignKey( + name: "FK_AspNetUsers_F_Team_myteamId", + table: "AspNetUsers", + column: "myteamId", + principalTable: "F_Team", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AspNetUsers_F_Team_myteamId", + table: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "F_Player"); + + migrationBuilder.DropTable( + name: "T_Config"); + + migrationBuilder.DropTable( + name: "T_Teams_Player"); + + migrationBuilder.DropTable( + name: "F_Team"); + + migrationBuilder.DropIndex( + name: "IX_AspNetUsers_myteamId", + table: "AspNetUsers"); + + migrationBuilder.DropColumn( + name: "Type", + table: "F_news"); + + migrationBuilder.DropColumn( + name: "promChart", + table: "F_events"); + + migrationBuilder.DropColumn( + name: "myteamId", + table: "AspNetUsers"); + } + } +} diff --git a/asg_form/Migrations/IDBcontextModelSnapshot.cs b/asg_form/Migrations/IDBcontextModelSnapshot.cs index 7ba0339..9ae0567 100644 --- a/asg_form/Migrations/IDBcontextModelSnapshot.cs +++ b/asg_form/Migrations/IDBcontextModelSnapshot.cs @@ -125,6 +125,54 @@ namespace asg_form.Migrations b.ToTable("AspNetUserTokens", (string)null); }); + modelBuilder.Entity("T_TeamT_events", b => + { + b.Property("EventsId") + .HasColumnType("int"); + + b.Property("TeamsId") + .HasColumnType("bigint"); + + b.HasKey("EventsId", "TeamsId"); + + b.HasIndex("TeamsId"); + + b.ToTable("T_Teams_Player", (string)null); + }); + + modelBuilder.Entity("T_news", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FormName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("msg") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("time") + .IsRequired() + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("F_news", (string)null); + }); + modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b => { b.Property("Id") @@ -251,15 +299,15 @@ namespace asg_form.Migrations b.ToTable("F_Friend", (string)null); }); - modelBuilder.Entity("asg_form.Controllers.T_news", b => + modelBuilder.Entity("asg_form.Controllers.T_config", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("bigint"); + .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("FormName") + b.Property("Substance") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -268,16 +316,125 @@ namespace asg_form.Migrations .HasColumnType("nvarchar(max)"); b.Property("msg") - .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("time") - .IsRequired() - .HasColumnType("datetime2"); - b.HasKey("Id"); - b.ToTable("F_news", (string)null); + b.ToTable("T_Config", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.T_events", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("events_rule_uri") + .HasColumnType("nvarchar(max)"); + + b.Property("is_over") + .HasColumnType("bit"); + + b.Property("name") + .HasColumnType("nvarchar(max)"); + + b.Property("opentime") + .HasColumnType("datetime2"); + + b.Property("promChart") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("F_events", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Common_Roles") + .HasColumnType("nvarchar(max)"); + + b.Property("Game_Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Historical_Ranks") + .HasColumnType("int"); + + b.Property("Id_Card") + .HasColumnType("nvarchar(max)"); + + b.Property("Id_Card_Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Phone_Number") + .HasColumnType("nvarchar(max)"); + + b.Property("TeamId") + .HasColumnType("bigint"); + + b.Property("role_id") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("role_lin") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("role_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TeamId"); + + b.ToTable("F_Player", (string)null); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("is_check") + .HasColumnType("bit"); + + b.Property("logo_uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("piaoshu") + .HasColumnType("int"); + + b.Property("team_name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team_password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("team_tel") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("time") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("F_Team", (string)null); }); modelBuilder.Entity("asg_form.Controllers.comform+com_form", b => @@ -486,31 +643,6 @@ namespace asg_form.Migrations b.ToTable("F_game", (string)null); }); - modelBuilder.Entity("asg_form.Model.T_events", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("events_rule_uri") - .HasColumnType("nvarchar(max)"); - - b.Property("is_over") - .HasColumnType("bit"); - - b.Property("name") - .HasColumnType("nvarchar(max)"); - - b.Property("opentime") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("F_events", (string)null); - }); - modelBuilder.Entity("asg_form.Role", b => { b.Property("Id") @@ -618,6 +750,9 @@ namespace asg_form.Migrations b.Property("isbooking") .HasColumnType("bit"); + b.Property("myteamId") + .HasColumnType("bigint"); + b.Property("officium") .HasColumnType("nvarchar(max)"); @@ -636,6 +771,8 @@ namespace asg_form.Migrations b.HasIndex("haveformId"); + b.HasIndex("myteamId"); + b.ToTable("AspNetUsers", (string)null); }); @@ -718,9 +855,24 @@ namespace asg_form.Migrations .IsRequired(); }); + modelBuilder.Entity("T_TeamT_events", b => + { + b.HasOne("asg_form.Controllers.T_events", null) + .WithMany() + .HasForeignKey("EventsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("asg_form.Controllers.Team.T_Team", null) + .WithMany() + .HasForeignKey("TeamsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b => { - b.HasOne("asg_form.Model.T_events", "events") + b.HasOne("asg_form.Controllers.T_events", "events") .WithMany() .HasForeignKey("eventsId") .OnDelete(DeleteBehavior.Cascade) @@ -748,9 +900,20 @@ namespace asg_form.Migrations b.Navigation("Store"); }); + modelBuilder.Entity("asg_form.Controllers.Team.T_Player", b => + { + b.HasOne("asg_form.Controllers.Team.T_Team", "Team") + .WithMany("role") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Team"); + }); + modelBuilder.Entity("asg_form.Controllers.form", b => { - b.HasOne("asg_form.Model.T_events", "events") + b.HasOne("asg_form.Controllers.T_events", "events") .WithMany("forms") .HasForeignKey("eventsId") .OnDelete(DeleteBehavior.Cascade) @@ -787,7 +950,15 @@ namespace asg_form.Migrations .WithMany() .HasForeignKey("haveformId"); + b.HasOne("asg_form.Controllers.Team.T_Team", "myteam") + .WithMany() + .HasForeignKey("myteamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.Navigation("haveform"); + + b.Navigation("myteam"); }); modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b => @@ -795,6 +966,16 @@ namespace asg_form.Migrations b.Navigation("buyer"); }); + modelBuilder.Entity("asg_form.Controllers.T_events", b => + { + b.Navigation("forms"); + }); + + modelBuilder.Entity("asg_form.Controllers.Team.T_Team", b => + { + b.Navigation("role"); + }); + modelBuilder.Entity("asg_form.Controllers.form", b => { b.Navigation("role"); @@ -804,11 +985,6 @@ namespace asg_form.Migrations { b.Navigation("logs"); }); - - modelBuilder.Entity("asg_form.Model.T_events", b => - { - b.Navigation("forms"); - }); #pragma warning restore 612, 618 } } diff --git a/asg_form/User.cs b/asg_form/User.cs index 33efc8e..8f06b39 100644 --- a/asg_form/User.cs +++ b/asg_form/User.cs @@ -1,6 +1,7 @@  using System.ComponentModel; using asg_form.Controllers; +using asg_form.Controllers.Team; using Microsoft.AspNetCore.Identity; namespace asg_form @@ -14,6 +15,7 @@ namespace asg_form public DateTime CreationTime { get; set; } public form? haveform { get; set; } + public T_Team myteam { get; set; } public bool? isbooking { get; set; } public string? chinaname { get; set; }