Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set up database #935

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions Gordon360/Models/CCT/Context/CCTContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public CCTContext(DbContextOptions<CCTContext> options)
public virtual DbSet<ERROR_LOG> ERROR_LOG { get; set; }
public virtual DbSet<EmergencyContact> EmergencyContact { get; set; }
public virtual DbSet<FacStaff> FacStaff { get; set; }
public virtual DbSet<FacStaff_Field_Type> FacStaff_Field_Type { get; set; }
public virtual DbSet<FacStaff_Privacy> FacStaff_Privacy { get; set; }
public virtual DbSet<FacStaff_Viewer_Type> FacStaff_Viewer_Type { get; set; }
public virtual DbSet<Graduation> Graduation { get; set; }
public virtual DbSet<Health_Question> Health_Question { get; set; }
public virtual DbSet<Health_Status> Health_Status { get; set; }
Expand Down Expand Up @@ -295,6 +298,23 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.BuildingDescription).IsFixedLength();
});

modelBuilder.Entity<FacStaff_Field_Type>(entity =>
{
entity.Property(e => e.ID).ValueGeneratedOnAdd();
});

modelBuilder.Entity<FacStaff_Privacy>(entity =>
{
entity.Property(e => e.Field).HasDefaultValueSql("((0))");

entity.Property(e => e.Viewer).HasDefaultValueSql("((0))");
});

modelBuilder.Entity<FacStaff_Viewer_Type>(entity =>
{
entity.Property(e => e.ID).ValueGeneratedOnAdd();
});

modelBuilder.Entity<Graduation>(entity =>
{
entity.ToView("Graduation", "dbo");
Expand Down Expand Up @@ -509,10 +529,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

modelBuilder.Entity<Participant>(entity =>
{
entity.HasKey(e => e.Username)
.HasName("PK__Particip__536C85E53B50E910");
entity.Property(e => e.AllowEmails).HasDefaultValueSql("((1))");

entity.Property(e => e.ID).ValueGeneratedOnAdd();

entity.Property(e => e.SpecifiedGender).IsFixedLength();
});

modelBuilder.Entity<ParticipantActivity>(entity =>
Expand All @@ -525,6 +546,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.HasOne(d => d.ParticipantUsernameNavigation)
.WithMany(p => p.ParticipantActivity)
.HasForeignKey(d => d.ParticipantUsername)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ParticipantActivity_Participant");

entity.HasOne(d => d.PrivType)
Expand All @@ -540,7 +562,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.WithMany(p => p.ParticipantNotification)
.HasForeignKey(d => d.ParticipantUsername)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_PartipantNotification_Participant");
.HasConstraintName("FK_ParticipantNotification_Participant");
});

modelBuilder.Entity<ParticipantStatusHistory>(entity =>
Expand All @@ -563,6 +585,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.HasOne(d => d.ParticipantUsernameNavigation)
.WithMany(p => p.ParticipantTeam)
.HasForeignKey(d => d.ParticipantUsername)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_ParticipantTeam_Participant");

entity.HasOne(d => d.RoleType)
Expand Down
7 changes: 0 additions & 7 deletions Gordon360/Models/CCT/Context/DbContextExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
Expand Down Expand Up @@ -31,12 +30,6 @@ public static async Task<List<T>> SqlQueryAsync<T>(this DbContext db, string sql
return default;
}
}
public static async Task<int> GetNextValueForSequence(this DbContext _context, Sequence sequence)
{
SqlParameter result = new SqlParameter("@result", System.Data.SqlDbType.Int) { Direction = System.Data.ParameterDirection.Output };
await _context.Database.ExecuteSqlRawAsync($"SELECT @result = (NEXT VALUE FOR [{CCTSequenceEnum.GetDescription(sequence)}])", result);
return (int)result.Value;
}
}

public class OutputParameter<TValue>
Expand Down
14 changes: 13 additions & 1 deletion Gordon360/Models/CCT/Context/efpt.CCT.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
"Name": "[dbo].[ERROR_LOG]",
"ObjectType": 0
},
{
"Name": "[dbo].[FacStaff_Field_Type]",
"ObjectType": 0
},
{
"Name": "[dbo].[FacStaff_Privacy]",
"ObjectType": 0
},
{
"Name": "[dbo].[FacStaff_Viewer_Type]",
"ObjectType": 0
},
{
"Name": "[dbo].[Health_Question]",
"ObjectType": 0
Expand Down Expand Up @@ -799,7 +811,7 @@
"ObjectType": 1
}
],
"UiHint": "SQLTrain1.CCT",
"UiHint": "sqltrain1.CCT.dbo",
"UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": true,
"UseDbContextSplitting": false,
Expand Down
8 changes: 8 additions & 0 deletions Gordon360/Models/CCT/RecIM/Participant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Gordon360.Models.CCT
{
[Table("Participant", Schema = "RecIM")]
[Index("Username", "IsCustom", Name = "Unique_Participant", IsUnique = true)]
public partial class Participant
{
public Participant()
Expand All @@ -26,6 +27,13 @@ public Participant()
public string Username { get; set; }
public bool IsAdmin { get; set; }
public int ID { get; set; }
[Required]
[StringLength(1)]
[Unicode(false)]
public string SpecifiedGender { get; set; }
[Required]
public bool? AllowEmails { get; set; }
public bool IsCustom { get; set; }

[InverseProperty("ParticipantUsernameNavigation")]
public virtual ICollection<MatchParticipant> MatchParticipant { get; set; }
Expand Down
12 changes: 5 additions & 7 deletions Gordon360/Models/CCT/dbo/Alumni.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ namespace Gordon360.Models.CCT
[Keyless]
public partial class Alumni
{
[Required]
[StringLength(25)]
[StringLength(9)]
[Unicode(false)]
public string ID { get; set; }
[StringLength(25)]
[Unicode(false)]
public string WebUpdate { get; set; }
public int? WebUpdate { get; set; }
[StringLength(50)]
[Unicode(false)]
public string Title { get; set; }
Expand Down Expand Up @@ -111,6 +108,7 @@ public partial class Alumni
[StringLength(15)]
[Unicode(false)]
public string Barcode { get; set; }
[Required]
[StringLength(50)]
[Unicode(false)]
public string AD_Username { get; set; }
Expand All @@ -121,9 +119,9 @@ public partial class Alumni
public string Country { get; set; }
[StringLength(50)]
[Unicode(false)]
public string Major2Description { get; set; }
public string Major1Description { get; set; }
[StringLength(50)]
[Unicode(false)]
public string Major1Description { get; set; }
public string Major2Description { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,5 @@ namespace Gordon360.Models.CCT
{
public partial class FINALIZATION_MARK_AS_CURRENTLY_COMPLETEDResult
{
public string UserID { get; set; }
public string Period { get; set; }
public bool FinalizationCompleted { get; set; }
public string RootQuery { get; set; }
public string BypassApprover { get; set; }
public DateTime? DateFinalized { get; set; }
public string IgnoreHoldsApprover { get; set; }
public DateTime DateInserted { get; set; }
public DateTime DateUpdated { get; set; }
public string HeadcountsAsOfDateFinalized { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ namespace Gordon360.Models.CCT
{
public partial class FINALIZATION_UPDATECELLPHONEResult
{
public bool? Success { get; set; }
public string Message { get; set; }
}
}
6 changes: 4 additions & 2 deletions Gordon360/Models/CCT/dbo/FacStaff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ namespace Gordon360.Models.CCT
[Keyless]
public partial class FacStaff
{
[Required]
[StringLength(10)]
[StringLength(9)]
[Unicode(false)]
public string ID { get; set; }
[StringLength(5)]
Expand Down Expand Up @@ -75,6 +74,9 @@ public partial class FacStaff
[StringLength(15)]
[Unicode(false)]
public string HomePhone { get; set; }
[StringLength(15)]
[Unicode(false)]
public string MobilePhone { get; set; }
[StringLength(1)]
[Unicode(false)]
public string HomeFax { get; set; }
Expand Down
20 changes: 20 additions & 0 deletions Gordon360/Models/CCT/dbo/FacStaff_Field_Type.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Gordon360.Models.CCT
{
[Table("FacStaff_Field_Type", Schema = "dbo")]
public partial class FacStaff_Field_Type
{
public int ID { get; set; }
[Key]
[StringLength(50)]
[Unicode(false)]
public string Field { get; set; }
}
}
27 changes: 27 additions & 0 deletions Gordon360/Models/CCT/dbo/FacStaff_Privacy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Gordon360.Models.CCT
{
[Table("FacStaff_Privacy", Schema = "dbo")]
public partial class FacStaff_Privacy
{
[Key]
[StringLength(10)]
[Unicode(false)]
public string gordon_id { get; set; }
[Required]
[StringLength(50)]
[Unicode(false)]
public string Field { get; set; }
[Required]
[StringLength(50)]
[Unicode(false)]
public string Viewer { get; set; }
}
}
20 changes: 20 additions & 0 deletions Gordon360/Models/CCT/dbo/FacStaff_Viewer_Type.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Gordon360.Models.CCT
{
[Table("FacStaff_Viewer_Type", Schema = "dbo")]
public partial class FacStaff_Viewer_Type
{
public int ID { get; set; }
[Key]
[StringLength(50)]
[Unicode(false)]
public string Viewer { get; set; }
}
}
12 changes: 0 additions & 12 deletions Gordon360/Models/CCT/dbo/GET_AA_ADMINResults.cs

This file was deleted.

1 change: 1 addition & 0 deletions Gordon360/Models/CCT/dbo/Housing_HallChoices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Gordon360.Models.CCT
{
[Table("Housing_HallChoices", Schema = "dbo")]
[Index("HousingAppID", Name = "IX_Housing_HallChoices")]
public partial class Housing_HallChoices
{
Expand Down
6 changes: 0 additions & 6 deletions Gordon360/Models/CCT/dbo/STUDENT_JOBS_PER_ID_NUMResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@ namespace Gordon360.Models.CCT
{
public partial class STUDENT_JOBS_PER_ID_NUMResult
{
public string Job_Title { get; set; }
public string Job_Department { get; set; }
public string Job_Department_Name { get; set; }
public DateTime? Job_Start_Date { get; set; }
public DateTime? Job_End_Date { get; set; }
public DateTime? Job_Expected_End_Date { get; set; }
}
}
3 changes: 1 addition & 2 deletions Gordon360/Models/CCT/dbo/Student.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ namespace Gordon360.Models.CCT
[Keyless]
public partial class Student
{
[Required]
[StringLength(10)]
[StringLength(9)]
[Unicode(false)]
public string ID { get; set; }
[StringLength(3)]
Expand Down
2 changes: 0 additions & 2 deletions Gordon360/Models/CCT/dbo/UPDATE_CELL_PHONEResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ namespace Gordon360.Models.CCT
{
public partial class UPDATE_CELL_PHONEResult
{
public bool? Success { get; set; }
public string Message { get; set; }
}
}