initial add
This commit is contained in:
116
Fab2ApprovalSystem-Copy/Models/AccountViewModels.cs
Normal file
116
Fab2ApprovalSystem-Copy/Models/AccountViewModels.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class LoginModel
|
||||
{
|
||||
[Key]
|
||||
public int UserID { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Login ID")]
|
||||
public string LoginID { get; set; }
|
||||
|
||||
//[Required]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public bool IsAdmin { get; set; }
|
||||
public DateTime? LastLogin { get; set; }
|
||||
|
||||
public bool OOO { get; set; }
|
||||
|
||||
public DateTime? OOOStartDate { get; set; }
|
||||
public DateTime? OOOExpirationDate { get; set; }
|
||||
|
||||
public int DelegatedTo { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
|
||||
[Display(Name="Delegated To")]
|
||||
public string DelegatedToFullName { get; set; }
|
||||
|
||||
[Display(Name = "OOO Action")]
|
||||
public virtual string OOOStatusWithUserID
|
||||
{
|
||||
get
|
||||
{
|
||||
return UserID.ToString() + "~" + (OOO ? "1" : "0") + "~" + FullName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class UserProfile
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
//public class ExternalLoginConfirmationViewModel
|
||||
//{
|
||||
// [Required]
|
||||
// [Display(Name = "User name")]
|
||||
// public string UserName { get; set; }
|
||||
//}
|
||||
|
||||
//public class ManageUserViewModel
|
||||
//{
|
||||
// [Required]
|
||||
// [DataType(DataType.Password)]
|
||||
// [Display(Name = "Current password")]
|
||||
// public string OldPassword { get; set; }
|
||||
|
||||
// [Required]
|
||||
// [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
// [DataType(DataType.Password)]
|
||||
// [Display(Name = "New password")]
|
||||
// public string NewPassword { get; set; }
|
||||
|
||||
// [DataType(DataType.Password)]
|
||||
// [Display(Name = "Confirm new password")]
|
||||
// [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||
// public string ConfirmPassword { get; set; }
|
||||
//}
|
||||
|
||||
//public class LoginViewModel
|
||||
//{
|
||||
// [Required]
|
||||
// [Display(Name = "User name")]
|
||||
// public string UserName { get; set; }
|
||||
|
||||
// [Required]
|
||||
// [DataType(DataType.Password)]
|
||||
// [Display(Name = "Password")]
|
||||
// public string Password { get; set; }
|
||||
|
||||
// [Display(Name = "Remember me?")]
|
||||
// public bool RememberMe { get; set; }
|
||||
//}
|
||||
|
||||
//public class RegisterViewModel
|
||||
//{
|
||||
// [Required]
|
||||
// [Display(Name = "User name")]
|
||||
// public string UserName { get; set; }
|
||||
|
||||
// [Required]
|
||||
// [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
// [DataType(DataType.Password)]
|
||||
// [Display(Name = "Password")]
|
||||
// public string Password { get; set; }
|
||||
|
||||
// [DataType(DataType.Password)]
|
||||
// [Display(Name = "Confirm password")]
|
||||
// [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
// public string ConfirmPassword { get; set; }
|
||||
//}
|
||||
}
|
73
Fab2ApprovalSystem-Copy/Models/AdminModels.cs
Normal file
73
Fab2ApprovalSystem-Copy/Models/AdminModels.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
//public class DocumentType
|
||||
//{
|
||||
//}
|
||||
|
||||
public class WorkFlow
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Role
|
||||
{
|
||||
public int RoleID { get; set; }
|
||||
public string RoleName { get; set; }
|
||||
public List<SubRole> SubRoles { get; set; }
|
||||
|
||||
public Role()
|
||||
{
|
||||
SubRoles = new List<SubRole>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class WorkFlowSteps
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class SubRole
|
||||
{
|
||||
public int SubRoleID { get; set; }
|
||||
public string SubRoleCategoryItem { get; set; }
|
||||
public int RoleID { get; set; }
|
||||
public bool Inactive { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class UserSubRole
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ParentChildModel
|
||||
{
|
||||
public int id { get; set; }
|
||||
public int parentid { get; set; }
|
||||
public string text { get; set; }
|
||||
public string value { get; set; }
|
||||
|
||||
public List<ParentChildModel> Children = new List<ParentChildModel>();
|
||||
|
||||
}
|
||||
//public class TrainingGroup
|
||||
//{
|
||||
// public int TrainingGroupID { get; set; }
|
||||
// public string TrainingGroupName { get; set; }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
16
Fab2ApprovalSystem-Copy/Models/AllUserModel.cs
Normal file
16
Fab2ApprovalSystem-Copy/Models/AllUserModel.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class AllUserModel
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
}
|
20
Fab2ApprovalSystem-Copy/Models/ApprovalLog.cs
Normal file
20
Fab2ApprovalSystem-Copy/Models/ApprovalLog.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class ApprovalLog
|
||||
{
|
||||
|
||||
public int ApprovalLogID;
|
||||
public int IssueID;
|
||||
public int UserID;
|
||||
public string OperationType;
|
||||
public int SubRoleID;
|
||||
public string OperationLog;
|
||||
public int DocumentTypeID;
|
||||
|
||||
}
|
||||
}
|
21
Fab2ApprovalSystem-Copy/Models/ApprovalLogHistory.cs
Normal file
21
Fab2ApprovalSystem-Copy/Models/ApprovalLogHistory.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class ApprovalLogHistory
|
||||
{
|
||||
public int ApprovalLogID { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string Operation { get; set; }
|
||||
public string SubRole { get; set; }
|
||||
|
||||
//[Display(Name = "Operation Time")]
|
||||
public DateTime OperationTime { get; set; }
|
||||
public string Comments { get; set; }
|
||||
|
||||
}
|
||||
}
|
34
Fab2ApprovalSystem-Copy/Models/Back Up Models.txt
Normal file
34
Fab2ApprovalSystem-Copy/Models/Back Up Models.txt
Normal file
@ -0,0 +1,34 @@
|
||||
public partial class TrainingGroupMember
|
||||
{
|
||||
public Fab2ApprovalSystem.DMO.UserAccountDMO userDMO = new DMO.UserAccountDMO();
|
||||
public int ID { get; set; }
|
||||
public int TrainingGroupID { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
string fullName = userDMO.GetUserByID(UserID).FullName;
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TrainingAssignment
|
||||
{
|
||||
public Fab2ApprovalSystem.DMO.UserAccountDMO userDMO = new DMO.UserAccountDMO();
|
||||
public int ID { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
string fullName = userDMO.GetUserByID(UserID).FullName;
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
public Nullable<System.DateTime> DateAssigned { get; set; }
|
||||
public Nullable<System.DateTime> DateCompleted { get; set; }
|
||||
public Nullable<int> TrainingID { get; set; }
|
||||
public bool status { get; set; }
|
||||
}
|
20
Fab2ApprovalSystem-Copy/Models/C_8DAuditedStandard.cs
Normal file
20
Fab2ApprovalSystem-Copy/Models/C_8DAuditedStandard.cs
Normal file
@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class C_8DAuditedStandard
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Standard { get; set; }
|
||||
}
|
||||
}
|
21
Fab2ApprovalSystem-Copy/Models/C_8DAuditedStandardByAudit.cs
Normal file
21
Fab2ApprovalSystem-Copy/Models/C_8DAuditedStandardByAudit.cs
Normal file
@ -0,0 +1,21 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class C_8DAuditedStandardByAudit
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int AuditNo { get; set; }
|
||||
public int AuditedStandardID { get; set; }
|
||||
}
|
||||
}
|
374
Fab2ApprovalSystem-Copy/Models/ChangeControlModel.cs
Normal file
374
Fab2ApprovalSystem-Copy/Models/ChangeControlModel.cs
Normal file
@ -0,0 +1,374 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCChangeControl
|
||||
{
|
||||
public int PlanNumber { get; set; }
|
||||
public int OwnerID { get; set; }
|
||||
public byte CurrentStep { get; set; }
|
||||
public int Status { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
|
||||
public int ChangeLevel { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public int IsITAR { get; set; }
|
||||
public int IsMedical { get; set; }
|
||||
public int IsRadHard { get; set; }
|
||||
public int IsAutomotive { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string PartNumbers { get; set; }
|
||||
public string ToolTypes { get; set; }
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public bool RecordLocked { get; set; }
|
||||
public DateTime RecordLockedDate { get; set; }
|
||||
public string ReasonForChange { get; set; }
|
||||
public string ChangeDescription { get; set; }
|
||||
public DateTime LastUpdateDate { get; set; }
|
||||
public int PCR1ID { get; set; }
|
||||
public int PCR2ID { get; set; }
|
||||
public int PCR3ID {get;set;}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCAttachment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime? UploadDateTime { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string RequirementsNotes { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public int PlanNumber { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCGeneration
|
||||
{
|
||||
public int GenerationID { get; set; }
|
||||
public string Generation { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCLogistics
|
||||
{
|
||||
public int LogisticsID { get; set; }
|
||||
public string Logistics { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCProcess
|
||||
{
|
||||
public int ProcessID { get; set; }
|
||||
public string Process { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//public class CCToolType
|
||||
//{
|
||||
// public int ToolTypeID { get; set; }
|
||||
// public string ToolType { get; set; }
|
||||
//}
|
||||
|
||||
public class CCPartNumber
|
||||
{
|
||||
public string PartNumberID { get; set; }
|
||||
public string PartNumber { get; set; }
|
||||
}
|
||||
|
||||
|
||||
#region Meeting
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCMeeting
|
||||
{
|
||||
public int MeetingID { get; set; }
|
||||
public List<string> PCRValueIDs { get; set; }
|
||||
public string PCRValueIDsDisplay { get
|
||||
{
|
||||
if(PCRValueIDs.Count < 1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return string.Join(",", PCRValueIDs);
|
||||
} }
|
||||
public int PlanNumber { get; set; }
|
||||
public byte CurrentStep { get; set; }
|
||||
public string Title {get;set;}
|
||||
public int? ChangeLevel
|
||||
{
|
||||
get;set;
|
||||
}
|
||||
public string PCRB { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? MeetingDate { get; set; }
|
||||
public int Decision { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public int Status { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? ClosedDate { get; set;}
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? CancelledDate { get; set; }
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public DateTime RecordLockedDate { get; set; }
|
||||
public DateTime LastUpdateDate { get; set; }
|
||||
public string RecordLockByName { get; set; }
|
||||
public bool PCRBClosed { get; set; }
|
||||
|
||||
|
||||
public CCMeeting()
|
||||
{
|
||||
PCRValueIDs = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
public class CCPCRB
|
||||
{
|
||||
public int PCRBID { get; set; }
|
||||
public int PlanNumber { get; set; }
|
||||
public string PCRB { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public int Decision { get; set; }
|
||||
public string Notes { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCMeetingAttendee
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int MeetingID { get; set; }
|
||||
public string AttendeeName { get; set; }
|
||||
public string JobTitle { get; set; }
|
||||
public string Location { get; set; }
|
||||
public int AttendeeID { get; set; }
|
||||
|
||||
}
|
||||
public class CCPCRBAttendee
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int PCRBID { get; set; }
|
||||
public string AttendeeName { get; set; }
|
||||
public string JobTitle { get; set; }
|
||||
public string Location { get; set; }
|
||||
public bool Approved { get; set; }
|
||||
public int AttendeeID { get; set; }
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
public class CCMeetingAttachment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime UploadDateTime { get; set; }
|
||||
public string Title { get; set; }
|
||||
public int MeetingID { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCDecisionSummary
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int MeetingID { get; set; }
|
||||
public string DecisionNotes { get; set; }
|
||||
public string ECNLinks { get; set; }
|
||||
public string LotDispoLinks { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCDecisionSummaryLink
|
||||
{
|
||||
public string Link { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCMeetingActionItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int MeetingID { get; set; }
|
||||
public string ActionItemName { get; set; }
|
||||
public string ResponsiblePerson { get; set; }
|
||||
public string Gating { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public string ResponsibleID { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class CCPCRBActionItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int PCRBID { get; set; }
|
||||
public string ActionItemName { get; set; }
|
||||
public string ResponsiblePerson { get; set; }
|
||||
public string Gating { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public string ResponsibleID { get; set; }
|
||||
|
||||
}
|
||||
public class CCPCRBActionItemAll
|
||||
{
|
||||
[Key]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int MeetingID { get; set; }
|
||||
public string ActionItemName { get; set; }
|
||||
public string ResponsiblePerson { get; set; }
|
||||
public string Gating { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public string PCRB { get; set; }
|
||||
public string Updates { get; set; }
|
||||
public bool ClosedStatus { get; set; }
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
public int ClosedBy { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime UploadDateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CCMeetingActionItemAll
|
||||
{
|
||||
[Key]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int MeetingID { get; set; }
|
||||
public string ActionItemName { get; set; }
|
||||
public string ResponsiblePerson { get; set; }
|
||||
public string Gating { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public string PCRB { get; set; }
|
||||
public string Updates { get; set; }
|
||||
public bool ClosedStatus { get; set; }
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
public int ClosedBy { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime UploadDateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class MeetingList
|
||||
{
|
||||
public int MeetingID { get; set; }
|
||||
public string MeetingInfo{ get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class MeetingDecisionSummaryList
|
||||
{
|
||||
public string PCRB { get; set; }
|
||||
public DateTime? MeetingDate { get; set; }
|
||||
public string DecisionNotes { get; set; }
|
||||
public string ECNLinks { get; set; }
|
||||
public string LotDispoLinks { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class UserList
|
||||
{
|
||||
public int AttendeeID { set; get; }
|
||||
public string AttendeeName { get; set; }
|
||||
}
|
||||
|
||||
public class ActionItemResponsible
|
||||
{
|
||||
public string ResponsibleID { set; get; }
|
||||
public string ResponsibleName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SiteList
|
||||
{
|
||||
public string SiteID { set; get; }
|
||||
public string SiteName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ChangeControlList
|
||||
{
|
||||
public string IssueID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Owner { get; set; }
|
||||
public string ChangeLevel { get; set; }
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? StatusDate { get; set; }
|
||||
public string PCRBStatus { get; set; }
|
||||
public string Generations { get; set; }
|
||||
public string Logistics { get; set; }
|
||||
public string Processes { get; set; }
|
||||
public string ToolTypes { get; set; }
|
||||
public string ActionItemResponsibility { get; set; }
|
||||
}
|
||||
|
||||
public class PCRValue
|
||||
{
|
||||
public string PCRValueID { set; get; }
|
||||
public string PCRValueName { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
218
Fab2ApprovalSystem-Copy/Models/Common.cs
Normal file
218
Fab2ApprovalSystem-Copy/Models/Common.cs
Normal file
@ -0,0 +1,218 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
using System.Web.Mvc;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class CredentialsStorage
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public class Lot
|
||||
{
|
||||
public int LotID { get; set; }
|
||||
[Display(Name = "Wafer Lot#")]
|
||||
public string LotNumber { get; set; }
|
||||
// public string ParentLotNumber { set; get { return LotNumber.Length >= 7 ? LotNumber.Substring(0, 7) : LotNumber; } }
|
||||
public string ParentLotNumber { set; get; }
|
||||
|
||||
public int MRBNumber { get; set; }
|
||||
public string MRBDispoType { get; set; }
|
||||
public bool GoodToSubmit { get; set; }
|
||||
public string SubmitErrorMessage { get; set; }
|
||||
// Lot Disposition Issue Number
|
||||
public int IssueID { get; set; }
|
||||
public string IssueIDWithoutMRB { get; set; }
|
||||
public string DieLotNumber { get; set; }
|
||||
public string Description { get; set; }
|
||||
[Display(Name = "New PN#")]
|
||||
public string NewPartNo { get; set; }
|
||||
[Display(Name = "WIP PN#")]
|
||||
public string WipPartNo { get; set; }
|
||||
[Display(Name = "Die PN#")]
|
||||
public string DiePartNo { get; set; }
|
||||
[Display(Name = "Device Type")]
|
||||
public string ProductFamily { get; set; }
|
||||
public string Gen { get; set; }
|
||||
public string Channel { get; set; }
|
||||
public string Hexsize { get; set; }
|
||||
public double Voltage { get; set; }
|
||||
public int WaferCount { get; set; }
|
||||
public int ReleaseCount { get; set; }
|
||||
public int ScrapCount { get; set; }
|
||||
public int DieCount { get; set; }
|
||||
public string Location { get; set; }
|
||||
public double TotalCost { get; set; }
|
||||
public int LotStatusOptionID { get; set; }
|
||||
public string LotStatusOptionName { get; set; }
|
||||
public double WaferCost { get; set; }
|
||||
public double DieCost { get; set; }
|
||||
|
||||
[UIHint("LotStatusOptionTemplate")]
|
||||
[Display(Name = "Lot Status")]
|
||||
public LotStatusOptionViewModel LotStatusOption { get; set; }
|
||||
|
||||
public ScrapLot ScrapLotWafer { get; set; }
|
||||
|
||||
[Display(Name = "Lot Dispos")]
|
||||
public string OtherLotDispos { get; set; }
|
||||
|
||||
//MRB Lot
|
||||
//[CustomDispoTypeValidationAttribute(ErrorMessage = "The values can only either A or B or C or D")]
|
||||
public char? DispoType { get; set; }
|
||||
[Display(Name = "Lot Dispos")]
|
||||
public string LotDispositionsLinkedToLot { get; set; }
|
||||
|
||||
[Display(Name = "MRBs")]
|
||||
public string MRBsLinkedToLot { get; set; }
|
||||
|
||||
public string Status { get; set; }
|
||||
|
||||
public int OpenIssueWithExistingLots { get; set; }
|
||||
public string QualityCode { get; set; }
|
||||
|
||||
[Display(Name = "Source Lot#")]
|
||||
public string SourceLot { get; set; }
|
||||
public string SourceAction { get; set; }
|
||||
public DateTime? SourceActionTime { get; set; }
|
||||
public DateTime? SPNTransmitTime { get; set; }
|
||||
public string SPNTransmitMsg { get; set; }
|
||||
[Display(Name = "MRBs")]
|
||||
public string OtherMRBs { get; set; }
|
||||
|
||||
public Lot()
|
||||
{
|
||||
LotStatusOption = new LotStatusOptionViewModel();
|
||||
ScrapLotWafer = new ScrapLot();
|
||||
|
||||
}
|
||||
|
||||
public bool IsDirty { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class MRBHoldFlagReport
|
||||
{
|
||||
public string LotNo { get; set; }
|
||||
public string TransactionType { get; set; }
|
||||
|
||||
public string PartNo { get; set; }
|
||||
public string CurrentLocation { get; set; }
|
||||
public string CurrentOperation { get; set; }
|
||||
public int StartQty { get; set; }
|
||||
public int CurrentQty { get; set; }
|
||||
public string LotStatus { get; set; }
|
||||
public string OperStatus { get; set; }
|
||||
public string Successful { get; set; }
|
||||
public string Comment { get; set; }
|
||||
|
||||
public string PriorMRBHoldLocation { get; set; }
|
||||
public string PriorMRBHoldOperation { get; set; }
|
||||
public string PriorMRB_DispoType { get; set; }
|
||||
|
||||
public string CurrentMRBHoldLocation { get; set; }
|
||||
public string CurrentMRBHoldOperation { get; set; }
|
||||
public string CurrentMRB_DispoType { get; set; }
|
||||
|
||||
|
||||
public string MRB_DispoType { get; set; }
|
||||
public DateTime TransactionDateTime { get; set; }
|
||||
public string MRBLocation { get; set; }
|
||||
public string MRBOperation { get; set; }
|
||||
|
||||
public bool Reprocess { get; set; }
|
||||
|
||||
public bool HasErrors { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class MRBLotsTobeSentToSPN
|
||||
{
|
||||
public string LotNumber { get; set; }
|
||||
public int MRBNumber { get; set; }
|
||||
public char? DispoType { get; set; }
|
||||
public char AddRemoveChangeMRBFlag { get; set; }
|
||||
public bool IsDirty { get; set; }
|
||||
public bool SentToSPN { get; set; }
|
||||
public DateTime MRBLotLastSentToSPNDatetime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class CustomDispoTypeValidationAttribute : ValidationAttribute, IClientValidatable
|
||||
{
|
||||
public override bool IsValid(object value)
|
||||
{
|
||||
char tem = (char)value;
|
||||
var productName = tem.ToString();
|
||||
if (!string.IsNullOrEmpty(productName))
|
||||
{
|
||||
return Regex.IsMatch(productName, "^[A,B,C,D]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
|
||||
{
|
||||
yield return new ModelClientValidationRule
|
||||
{
|
||||
ErrorMessage = ErrorMessage,
|
||||
ValidationType = "dispotypevalidation"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Department
|
||||
{
|
||||
//public int LotDispoDepartmentID { get; set; }
|
||||
//public int IssueID { get; set; }
|
||||
public int DepartmentID { get; set; }
|
||||
public string DepartmentName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class AffectedModule
|
||||
{
|
||||
public int ModuleID { get; set; }
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class WIPPart
|
||||
{
|
||||
public string WIPPartData { get; set; }
|
||||
public string PartNumber { get; set; }
|
||||
public string SiliconPartNumber { get; set; }
|
||||
public string ProcessFlow { get; set; }
|
||||
}
|
||||
|
||||
public class ProductFamilies
|
||||
{
|
||||
public int ProductFamilyID { get; set; }
|
||||
public string ProductFamily { get; set; }
|
||||
}
|
||||
|
||||
public class LotSplitAnalysisResult
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string ParentLotNo { get; set; }
|
||||
public string LotNo { get; set; }
|
||||
public DateTime ActionTime { get; set; }
|
||||
public string ActionType { get; set; }
|
||||
public bool? IsAffected { get; set; }
|
||||
}
|
||||
|
||||
}
|
239
Fab2ApprovalSystem-Copy/Models/ECNModel.cs
Normal file
239
Fab2ApprovalSystem-Copy/Models/ECNModel.cs
Normal file
@ -0,0 +1,239 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class ECN :System.Object
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public int ECNNumber {get;set;}
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime IssueDate {get;set;}
|
||||
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? SubmitedDate { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? CloseDate { get; set; }
|
||||
|
||||
public int OriginatorID { get; set; }
|
||||
public string OriginatorName { get; set; }
|
||||
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
||||
// in order to get the selected items from the control
|
||||
public List<int> DepartmentIDs { get; set; }
|
||||
|
||||
public List<int> ModuleIDs { get; set; }
|
||||
public List<int> AreaIDs { get; set; }
|
||||
public List<int> TechnologyIDs { get; set; }
|
||||
public List<int> AcknowledgementByIDs { get; set; }
|
||||
public List<int> TrainingByIDs { get; set; }
|
||||
|
||||
public bool IsECN { get; set; }
|
||||
public bool IsTECN { get; set; }
|
||||
public bool IsEmergencyTECN { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
//[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? ExtensionDate { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? CancellationDate { get; set; }
|
||||
|
||||
public bool AcknowledgementRequired { get; set; }
|
||||
public bool TrainingRequired { get; set; }
|
||||
public int? AreaID { get; set; }
|
||||
public int? TechnologyID { get; set; }
|
||||
public bool PCRBRequired { get; set; }
|
||||
public string PCRBNumber { get; set; }
|
||||
public bool TestProgramChangeRequired { get; set; }
|
||||
public bool SPCChangeRequired { get; set; }
|
||||
public bool NewPartFlowRequired { get; set; }
|
||||
public bool SPNChangeRequired { get; set; }
|
||||
public string ImplementationDetails { get; set; }
|
||||
public int ImpactOnEnvironment { get; set; }
|
||||
public string ImpactOnEnvironmentDescription { get; set; }
|
||||
public int ImpactOnCapacity { get; set; }
|
||||
public string ImpactOnCapacityDescription { get; set; }
|
||||
public bool IsMA { get; set; }
|
||||
public bool IsRH { get; set; }
|
||||
public bool IsAU { get; set; }
|
||||
public bool IsIndustrial { get; set; }
|
||||
public int MaterialConsumptionChangeRequired { get; set; }
|
||||
public string MaterialConsumptionChangeDescription { get; set; }
|
||||
public string ReasonForChange { get; set; }
|
||||
public string DescriptionOfChange { get; set; }
|
||||
public bool NotAFlowChange { get; set; }
|
||||
public bool AttachECN_TECNToLots { get; set; }
|
||||
public bool SPNFlowChangeAtSingleStep { get; set; }
|
||||
public bool SPNFlowChangeAtMultipleSteps { get; set; }
|
||||
public byte CurrentStep{ get; set; }
|
||||
public bool TECNExtensionState { get; set; }
|
||||
public bool Cancelled { get; set; }
|
||||
|
||||
public bool CancellationApproved { get; set; }
|
||||
public bool CancellationInProgress { get; set; }
|
||||
public DateTime? CancellationApprovalDate { get; set; }
|
||||
public bool ExpirationProcessed {get;set;}
|
||||
public bool ExpirationInProgress { get; set; }
|
||||
public DateTime? ExpirationProcessedlDate { get; set; }
|
||||
public bool ReSubmitted { get; set; }
|
||||
public bool Converted { get; set; }
|
||||
public string ConvertedToType { get; set; }
|
||||
public int? ConvertedToNumber { get; set; }
|
||||
public int? ConvertedFromNumber { get; set; }
|
||||
public int WorkFlowNumber { get; set; }
|
||||
public bool LockedForConversion { get; set; }
|
||||
public bool ConversionRejected { get; set; }
|
||||
public bool ConversionApprovalInProgress { get; set; }
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public string RecordLockByName { get; set; }
|
||||
public DateTime? RecordLockedDate { get; set; }
|
||||
public int LastUpdatedBy { get; set; }
|
||||
public DateTime? LastUpdateDate { get; set; }
|
||||
public DateTime LastUpdateTimeStamp { get; set; }
|
||||
|
||||
public int? CategoryID { get; set; }
|
||||
|
||||
public bool FIChangeRequired { get; set; }
|
||||
public string NumberOfLotsAffected { get; set; }
|
||||
public bool? RecipeChange { get; set; }
|
||||
public List<int> ProductFamilyIDs { get; set; }
|
||||
|
||||
public bool Deleted { get; set; }
|
||||
public bool IsDocEC { get; set; }
|
||||
public bool MetrologyChangeRequired { get; set; }
|
||||
public ECN()
|
||||
{
|
||||
DepartmentIDs = new List<int>();
|
||||
ModuleIDs = new List<int>();
|
||||
AreaIDs = new List<int>();
|
||||
TechnologyIDs = new List<int>();
|
||||
AcknowledgementByIDs = new List<int>();
|
||||
TrainingByIDs = new List<int>();
|
||||
ProductFamilyIDs = new List<int>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override bool Equals(System.Object obj)
|
||||
{
|
||||
// If parameter is null return false.
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If parameter cannot be cast to Point return false.
|
||||
ECN p = obj as ECN;
|
||||
if ((System.Object)p == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if the fields match:
|
||||
return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
/// <returns></returns>
|
||||
public bool Equals(ECN p)
|
||||
{
|
||||
// If parameter is null return false:
|
||||
if ((object)p == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
foreach (PropertyInfo pi in p.GetType().GetProperties())
|
||||
{
|
||||
foreach(PropertyInfo px in this.GetType().GetProperties())
|
||||
{
|
||||
if (pi.Name.ToLower() == px.Name.ToLower())
|
||||
{
|
||||
if (pi.GetValue(p).Equals(px.GetValue(this)))
|
||||
break;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
// Return true if the fields match:
|
||||
//return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ECNAffectedDeparmtent
|
||||
{
|
||||
//public int LotDispoDepartmentID { get; set; }
|
||||
//public int IssueID { get; set; }
|
||||
public int DepartmentID { get; set; }
|
||||
public string DepartmentName { get; set; }
|
||||
}
|
||||
|
||||
public class ECNAffectedModule
|
||||
{
|
||||
public int ModuleID { get; set; }
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ECNCategory
|
||||
{
|
||||
public int CategoryID { get; set; }
|
||||
public string CategoryName { get; set; }
|
||||
}
|
||||
|
||||
public class ECNAttachment
|
||||
{
|
||||
public int AttachmentID { set; get; }
|
||||
public int ECNNumber { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UserID { get; set; }
|
||||
// extrafield
|
||||
public string FullName { get; set; }
|
||||
public string UploadDate { get; set; }
|
||||
public string Path { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ECNArea
|
||||
{
|
||||
public int AreaID { set; get; }
|
||||
public string Area { get; set; }
|
||||
}
|
||||
|
||||
public class ECNTechnology
|
||||
{
|
||||
public int TechnologyID { get; set; }
|
||||
public string Technology { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ECNAcknowledgementTrainingBy
|
||||
{
|
||||
public int AcknowledgementTrainingByID { get; set; }
|
||||
public string AcknowledgementTrainingBy { get; set; }
|
||||
}
|
||||
|
||||
}
|
20
Fab2ApprovalSystem-Copy/Models/ECNTrainingBy.cs
Normal file
20
Fab2ApprovalSystem-Copy/Models/ECNTrainingBy.cs
Normal file
@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ECNTrainingBy
|
||||
{
|
||||
public int ECNNumber { get; set; }
|
||||
public int AcknowledgementTrainingByID { get; set; }
|
||||
}
|
||||
}
|
17
Fab2ApprovalSystem-Copy/Models/ECNTypeChangeLog.cs
Normal file
17
Fab2ApprovalSystem-Copy/Models/ECNTypeChangeLog.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class ECNTypeChangeLog
|
||||
{
|
||||
public int ECNNumber;
|
||||
public int UserID;
|
||||
public string ECNTypeFrom;
|
||||
public string ECNTypeTo;
|
||||
|
||||
|
||||
}
|
||||
}
|
449
Fab2ApprovalSystem-Copy/Models/EightDModel.cs
Normal file
449
Fab2ApprovalSystem-Copy/Models/EightDModel.cs
Normal file
@ -0,0 +1,449 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class AuditList
|
||||
{
|
||||
public string AuditNo { get; set; }
|
||||
public string AuditTitle { get; set; }
|
||||
public string AuditType { get; set; }
|
||||
public string Auditors { get; set; }
|
||||
public string PendingCAFindingsAIOwners { get; set; }
|
||||
public string PendingCAOwners { get; set; }
|
||||
public DateTime? AuditDate { get; set; }
|
||||
public string FindingCategories { get; set; }
|
||||
public string AuditedAreas { get; set; }
|
||||
public string CADisp { get; set; }
|
||||
public string CorrectiveActions { get; set; }
|
||||
public string AuditScore { get; set; }
|
||||
public string AuditStatus { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class Audit
|
||||
{
|
||||
public int AuditNo { set; get; }
|
||||
public int OriginatorID { get; set; }
|
||||
public string OriginatorName { get; set; }
|
||||
public string AuditTitle { get; set; }
|
||||
//public int AuditTypeID { get; set; }
|
||||
public int AuditScore { get; set; }
|
||||
public DateTime? AuditDate { get; set; }
|
||||
//public int Auditors { get; set; } // List of Auditors
|
||||
public string AuditFindingCategories { get; set; }
|
||||
public int AuditStatus { get; set; }
|
||||
//public int AuditedAreaID { get; set; }
|
||||
public string NoOfMajorNonConformities { get; set; }
|
||||
public string NoOfMinorNonConformities { get; set; }
|
||||
public string Auditees { get; set; }
|
||||
public List<int> AuditorIDs { get; set; }
|
||||
public List<int> AuditTypeIDs { get; set; }
|
||||
public List<int> AuditedAreaIDs { get; set; }
|
||||
public List<int> AuditedStandardIDs { get; set; }
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public bool RecordLocked { get; set; }
|
||||
public DateTime RecordLockedDate { get; set; }
|
||||
public DateTime LastUpdateDate { get; set; }
|
||||
public CAFindings CAFindings { get; set; }
|
||||
public Audit()
|
||||
{
|
||||
AuditorIDs = new List<int>();
|
||||
AuditTypeIDs = new List<int>();
|
||||
AuditedAreaIDs = new List<int>();
|
||||
CAFindings = new CAFindings();
|
||||
}
|
||||
}
|
||||
public class Auditees
|
||||
{
|
||||
string UserName { get; set; }
|
||||
}
|
||||
|
||||
public class AuditType
|
||||
{
|
||||
public int AuditTypeID { get; set; }
|
||||
public string AuditTypeName { get; set; }
|
||||
}
|
||||
|
||||
public class Auditor
|
||||
{
|
||||
public int AuditorID { get; set; }
|
||||
public string AuditorName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public class AuditedArea
|
||||
{
|
||||
public int AuditedAreaID { get; set; }
|
||||
public string AuditedAreaName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class AuditFindings
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int AuditNo { get; set; }
|
||||
public string Findings { get; set; }
|
||||
public string ViolatedClause { get; set; }
|
||||
public string FindingType { get; set; }
|
||||
public string AuditFindingCategoryID { get; set; }
|
||||
public string FindingCategories { get; set; }
|
||||
public int CANo { get; set; }
|
||||
public string CANoDisp { get; set; }
|
||||
public string CAStatus { get; set; }
|
||||
public int CAOwnerID { get; set; }
|
||||
public string CAOwner { get; set; }
|
||||
public DateTime AssignedDate { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class AuditFindingCategory
|
||||
{
|
||||
public int AuditFindingCategoryID { get; set; }
|
||||
public string AuditFindingCategoryName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class AuditReportAttachment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public int? CAFindingsID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime? UploadDateTime { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string RequirementsNotes { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public int AuditNo { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CorrectiveAction
|
||||
{
|
||||
public int CANo { get; set; }
|
||||
public string CANoDisp { get; set; }
|
||||
public int AuditNo { get; set; }
|
||||
public int RequestorID { get; set; }
|
||||
public string RequestorName { get; set; }
|
||||
public string CATitle { get; set; }
|
||||
public bool D0Completed { get; set; }
|
||||
public DateTime? D0CompleteDate { get; set; }
|
||||
public bool D0Approved { get; set; }
|
||||
public DateTime? D0ApprovedDate { get; set; }
|
||||
public bool TriggerApproval { get; set; }
|
||||
public bool TriggerSectionApproval { get; set; }
|
||||
public string SectionApproval { get; set; }
|
||||
public DateTime? IssueDate { get; set; }
|
||||
public string CAType { get; set; }
|
||||
public bool IsCACompleted { get; set; }
|
||||
public DateTime CACompletedDate { get; set; }
|
||||
public int ApprovalStatus { get; set; }
|
||||
public int WorkFlowNumber { get; set; }
|
||||
public byte CurrentStep { get; set; }
|
||||
public int D1AssigneeID { get; set; }
|
||||
public int CurrentD1AssigneeID { get; set; }
|
||||
public string D1AssigneeName { get; set; }
|
||||
public int CASourceID { get; set; }
|
||||
public string CASource { get; set; }
|
||||
public int ModuleID { get; set; }
|
||||
public int Status { get; set; }
|
||||
public string StatusName { get; set; }
|
||||
public string Stage { get; set; }
|
||||
public int QAID { get; set; }
|
||||
public string PendingApprovers { get; set; }
|
||||
public string PendingAIOwners { get; set; }
|
||||
public string Tools { get; set; }
|
||||
public string RelatedMRB { get; set; }
|
||||
public int RelatedAudit { get; set; }
|
||||
public string D2ProblemDescription { get; set; }
|
||||
public List<int> RiskAssessmentAreaIDs { get; set; }
|
||||
public List<int> ModuleIDs { get; set; }
|
||||
public string D3RiskAssessmentNotes { get; set; }
|
||||
public bool D3Completed { get; set; }
|
||||
public DateTime? D3CompleteDate { get; set; }
|
||||
public bool D3Approved { get; set; }
|
||||
public DateTime? D3ApprovedDate { get; set; }
|
||||
public string D4RootCause1 { get; set; }
|
||||
public string D4RootCause2 { get; set; }
|
||||
public string D4RootCause3 { get; set; }
|
||||
public string D4RootCause4 { get; set; }
|
||||
public DateTime? D4CompleteDate { get; set; }
|
||||
public bool D4Completed { get; set; }
|
||||
public bool D4Approved { get; set; }
|
||||
public DateTime? D4ApprovedDate { get; set; }
|
||||
public DateTime? D5CompleteDate { get; set; }
|
||||
public bool D5Completed { get; set; }
|
||||
public DateTime? D6ValidatedDate { get; set; }
|
||||
public bool D6Validated { get; set; }
|
||||
public DateTime? D7CompleteDate { get; set; }
|
||||
public bool D7Completed { get; set; }
|
||||
public bool D5Approved { get; set; }
|
||||
public DateTime? D5ApprovedDate { get; set; }
|
||||
public DateTime? D8DueDate { get; set; }
|
||||
public DateTime? D8CompletedDate { get; set; }
|
||||
public bool D8Completed { get; set; }
|
||||
public DateTime? D8ApprovedDate { get; set; }
|
||||
public bool D8Approved { get; set; }
|
||||
public string D8TeamRecognition { get; set; }
|
||||
public string D8LessonsLearned { get; set; }
|
||||
public string TeamMembers { get; set; }
|
||||
public DateTime? ApprovedDate { get; set; }
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public bool RecordLocked { get; set; }
|
||||
public DateTime RecordLockedDate { get; set; }
|
||||
public DateTime LastUpdateDate { get; set; }
|
||||
public List<int> TeamMemberIDs { get; set; }
|
||||
public D5D6CorrectivetAction D5D6CorrectivetAction { get; set; }
|
||||
public D7PreventiveAction D7PreventiveAction { get; set; }
|
||||
public string D0Comments { get; set; }
|
||||
public int TeamCaptainID { get; set; }
|
||||
public string TeamCaptainName { get; set; }
|
||||
public int CASponsorID { get; set; }
|
||||
public string CASponsorName { get; set; }
|
||||
public string CustomerName { get; set; }
|
||||
public string CustomerPartNo { get; set; }
|
||||
public string IFXPartNo { get; set; }
|
||||
public int PartQty { get; set; }
|
||||
public string InvoiceNo { get; set; }
|
||||
public string PurchaseOrderNo { get; set; }
|
||||
public string SalesOrderNo { get; set; }
|
||||
public double DollarImpact { get; set; }
|
||||
public string BackgroundInfo { get; set; }
|
||||
public string Analysis { get; set; }
|
||||
public string VisualVerification { get; set; }
|
||||
public string InterimContainmentAction { get; set; }
|
||||
public string ICAVerificationResults { get; set; }
|
||||
public string ICAValidationActivities { get; set; }
|
||||
public string RootCauseVerification { get; set; }
|
||||
public string EscapePoint { get; set; }
|
||||
public DateTime? FollowUpDate { get; set; }
|
||||
|
||||
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
|
||||
public CorrectiveAction()
|
||||
{
|
||||
TeamMemberIDs = new List<int>();
|
||||
ModuleIDs = new List<int>();
|
||||
RiskAssessmentAreaIDs = new List<int>();
|
||||
D5D6CorrectivetAction = new D5D6CorrectivetAction();
|
||||
D7PreventiveAction = new D7PreventiveAction();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CASource
|
||||
{
|
||||
public int CASourceID { get; set; }
|
||||
public string CASourceName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CAUserList
|
||||
{
|
||||
public int UserID { get; set; }
|
||||
public string UserName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CAModule
|
||||
{
|
||||
public int ModuleID { get; set; }
|
||||
public string ModuleName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CA_Attachment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string FileExtension { get; set; }
|
||||
public string Section { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime? UploadDateTime { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string RequirementsNotes { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public int? CANo { get; set; }
|
||||
public int? D5D6CAID { get; set; }
|
||||
public int? D7PAID { get; set; }
|
||||
public int? CAFindingsID { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class D3ContainmentAction
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int CANo { get; set; }
|
||||
public string Section { get; set; }
|
||||
public string ContainmentAction { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string ECNLinks { get; set; }
|
||||
public int ResponsibilityOwnerID { get; set; }
|
||||
public int CurrentResponsibilityOwnerID { get; set; }
|
||||
public string ResponsibilityOwnerName { get; set; }
|
||||
public DateTime? ECD { get; set; }
|
||||
public DateTime? ImplementedDate { get; set; }
|
||||
public DateTime AssignedDate { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class RiskAssessmentArea
|
||||
{
|
||||
public int RiskAssessmentAreaID { get; set; }
|
||||
public string RiskAssessmentAreaName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class D5D6CorrectivetAction
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int CANo { get; set; }
|
||||
public string CorrectiveAction { get; set; }
|
||||
public string CARequired { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string ECNLinks { get; set; }
|
||||
public string AttachmentLinks { get; set; }
|
||||
public int ResponsibilityOwnerID { get; set; }
|
||||
public int CurrentResponsibilityOwnerID { get; set; }
|
||||
public string ResponsibilityOwnerName { get; set; }
|
||||
public DateTime? ECD { get; set; }
|
||||
public DateTime? ImplementedDate { get; set; }
|
||||
public bool IsImplemented { get; set; }
|
||||
public string ImprovementID { get; set; }
|
||||
public string Improvement { get; set; }
|
||||
public CA_Attachment CA_Attachment { get; set; }
|
||||
public DateTime AssignedDate { get; set; }
|
||||
public bool Approved { get; set; }
|
||||
|
||||
public D5D6CorrectivetAction()
|
||||
{
|
||||
CA_Attachment = new CA_Attachment();
|
||||
}
|
||||
public string ActionType { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class D5D6Improvement
|
||||
{
|
||||
public int D5D6ImprovementID { get; set; }
|
||||
public string D5D6ImprovementName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class D7PreventiveAction
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int CANo { get; set; }
|
||||
public string PreventiveAction { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string ECNLinks { get; set; }
|
||||
public string AttachmentLinks { get; set; }
|
||||
public int ResponsibilityOwnerID { get; set; }
|
||||
public int CurrentResponsibilityOwnerID { get; set; }
|
||||
public string ResponsibilityOwnerName { get; set; }
|
||||
public DateTime? ECD { get; set; }
|
||||
public DateTime? ImplementedDate { get; set; }
|
||||
public CA_Attachment CA_Attachment { get; set; }
|
||||
public DateTime AssignedDate { get; set; }
|
||||
|
||||
public D7PreventiveAction()
|
||||
{
|
||||
CA_Attachment = new CA_Attachment();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CAFindings
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int AuditNo { get; set; }
|
||||
public string CAFinding { get; set; }
|
||||
public string CorrectiveAction { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string AttachmentLinks { get; set; }
|
||||
public int? CurrentResponsibilityOwnerID { get; set; }
|
||||
public int? ResponsibilityOwnerID { get; set; }
|
||||
public string ResponsibilityOwnerName { get; set; }
|
||||
public DateTime? ECD { get; set; }
|
||||
public DateTime? ImplementedDate { get; set; }
|
||||
public AuditReportAttachment Audit_Attachment { get; set; }
|
||||
public DateTime AssignedDate { get; set; }
|
||||
|
||||
public CAFindings()
|
||||
{
|
||||
Audit_Attachment = new AuditReportAttachment();
|
||||
}
|
||||
|
||||
}
|
||||
public class CASectionApproval
|
||||
{
|
||||
public string DSection { get; set; }
|
||||
public string Fullname { get; set; }
|
||||
public string ApprovalStatus { get; set; }
|
||||
public DateTime? DateAssigned { get; set; }
|
||||
public DateTime? DateCompleted { get; set; }
|
||||
public string Comments { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CANoList
|
||||
{
|
||||
public int CANo { get; set; }
|
||||
public string CANoDisp { get; set; }
|
||||
}
|
||||
|
||||
}
|
31
Fab2ApprovalSystem-Copy/Models/FabApproval.Context.cs
Normal file
31
Fab2ApprovalSystem-Copy/Models/FabApproval.Context.cs
Normal file
@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class FabApprovalSystemEntitiesAll : DbContext
|
||||
{
|
||||
public FabApprovalSystemEntitiesAll()
|
||||
: base("name=FabApprovalSystemEntitiesAll")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public virtual DbSet<C_8DAuditedStandard> C_8DAuditedStandard { get; set; }
|
||||
public virtual DbSet<C_8DAuditedStandardByAudit> C_8DAuditedStandardByAudit { get; set; }
|
||||
}
|
||||
}
|
636
Fab2ApprovalSystem-Copy/Models/FabApproval.Context.tt
Normal file
636
Fab2ApprovalSystem-Copy/Models/FabApproval.Context.tt
Normal file
@ -0,0 +1,636 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"FabApproval.edmx";
|
||||
var textTransform = DynamicTextTransformation.Create(this);
|
||||
var code = new CodeGenerationTools(this);
|
||||
var ef = new MetadataTools(this);
|
||||
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
|
||||
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
|
||||
var itemCollection = loader.CreateEdmItemCollection(inputFile);
|
||||
var modelNamespace = loader.GetModelNamespace(inputFile);
|
||||
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
|
||||
|
||||
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
|
||||
if (container == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
#>
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
|
||||
//
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
<#
|
||||
|
||||
var codeNamespace = code.VsNamespaceSuggestion();
|
||||
if (!String.IsNullOrEmpty(codeNamespace))
|
||||
{
|
||||
#>
|
||||
namespace <#=code.EscapeNamespace(codeNamespace)#>
|
||||
{
|
||||
<#
|
||||
PushIndent(" ");
|
||||
}
|
||||
|
||||
#>
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
<#
|
||||
if (container.FunctionImports.Any())
|
||||
{
|
||||
#>
|
||||
using System.Data.Entity.Core.Objects;
|
||||
using System.Linq;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
|
||||
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
|
||||
{
|
||||
public <#=code.Escape(container)#>()
|
||||
: base("name=<#=container.Name#>")
|
||||
{
|
||||
<#
|
||||
if (!loader.IsLazyLoadingEnabled(container))
|
||||
{
|
||||
#>
|
||||
this.Configuration.LazyLoadingEnabled = false;
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
|
||||
{
|
||||
// Note: the DbSet members are defined below such that the getter and
|
||||
// setter always have the same accessibility as the DbSet definition
|
||||
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
<#
|
||||
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.DbSet(entitySet)#>
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var edmFunction in container.FunctionImports)
|
||||
{
|
||||
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
|
||||
if (!String.IsNullOrEmpty(codeNamespace))
|
||||
{
|
||||
PopIndent();
|
||||
#>
|
||||
}
|
||||
<#
|
||||
}
|
||||
#>
|
||||
<#+
|
||||
|
||||
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
if (typeMapper.IsComposable(edmFunction))
|
||||
{
|
||||
#>
|
||||
|
||||
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
|
||||
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
|
||||
{
|
||||
<#+
|
||||
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
|
||||
#>
|
||||
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
|
||||
}
|
||||
<#+
|
||||
}
|
||||
else
|
||||
{
|
||||
#>
|
||||
|
||||
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
|
||||
{
|
||||
<#+
|
||||
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
|
||||
#>
|
||||
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
|
||||
}
|
||||
<#+
|
||||
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
|
||||
{
|
||||
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
|
||||
{
|
||||
#>
|
||||
var <#=name#> = <#=isNotNull#> ?
|
||||
<#=notNullInit#> :
|
||||
<#=nullInit#>;
|
||||
|
||||
<#+
|
||||
}
|
||||
|
||||
public const string TemplateId = "CSharp_DbContext_Context_EF6";
|
||||
|
||||
public class CodeStringGenerator
|
||||
{
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly TypeMapper _typeMapper;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(typeMapper, "typeMapper");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
|
||||
_code = code;
|
||||
_typeMapper = typeMapper;
|
||||
_ef = ef;
|
||||
}
|
||||
|
||||
public string Property(EdmProperty edmProperty)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
Accessibility.ForProperty(edmProperty),
|
||||
_typeMapper.GetTypeName(edmProperty.TypeUsage),
|
||||
_code.Escape(edmProperty),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
|
||||
}
|
||||
|
||||
public string NavigationProperty(NavigationProperty navProp)
|
||||
{
|
||||
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
|
||||
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
|
||||
_code.Escape(navProp),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
|
||||
}
|
||||
|
||||
public string AccessibilityAndVirtual(string accessibility)
|
||||
{
|
||||
return accessibility + (accessibility != "private" ? " virtual" : "");
|
||||
}
|
||||
|
||||
public string EntityClassOpening(EntityType entity)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1}partial class {2}{3}",
|
||||
Accessibility.ForType(entity),
|
||||
_code.SpaceAfter(_code.AbstractOption(entity)),
|
||||
_code.Escape(entity),
|
||||
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
|
||||
}
|
||||
|
||||
public string EnumOpening(SimpleType enumType)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} enum {1} : {2}",
|
||||
Accessibility.ForType(enumType),
|
||||
_code.Escape(enumType),
|
||||
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
|
||||
}
|
||||
|
||||
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
|
||||
{
|
||||
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
|
||||
{
|
||||
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
|
||||
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
|
||||
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
|
||||
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
|
||||
}
|
||||
}
|
||||
|
||||
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} IQueryable<{1}> {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
_code.Escape(edmFunction),
|
||||
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
|
||||
}
|
||||
|
||||
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
edmFunction.NamespaceName,
|
||||
edmFunction.Name,
|
||||
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
|
||||
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
|
||||
}
|
||||
|
||||
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
|
||||
if (includeMergeOption)
|
||||
{
|
||||
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
_code.Escape(edmFunction),
|
||||
paramList);
|
||||
}
|
||||
|
||||
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
|
||||
if (includeMergeOption)
|
||||
{
|
||||
callParams = ", mergeOption" + callParams;
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
|
||||
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
edmFunction.Name,
|
||||
callParams);
|
||||
}
|
||||
|
||||
public string DbSet(EntitySet entitySet)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
|
||||
Accessibility.ForReadOnlyProperty(entitySet),
|
||||
_typeMapper.GetTypeName(entitySet.ElementType),
|
||||
_code.Escape(entitySet));
|
||||
}
|
||||
|
||||
public string DbSetInitializer(EntitySet entitySet)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} = Set<{1}>();",
|
||||
_code.Escape(entitySet),
|
||||
_typeMapper.GetTypeName(entitySet.ElementType));
|
||||
}
|
||||
|
||||
public string UsingDirectives(bool inHeader, bool includeCollections = true)
|
||||
{
|
||||
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
|
||||
? string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}using System;{1}" +
|
||||
"{2}",
|
||||
inHeader ? Environment.NewLine : "",
|
||||
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
|
||||
inHeader ? "" : Environment.NewLine)
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeMapper
|
||||
{
|
||||
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
|
||||
|
||||
private readonly System.Collections.IList _errors;
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public static string FixNamespaces(string typeName)
|
||||
{
|
||||
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
|
||||
}
|
||||
|
||||
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
ArgumentNotNull(errors, "errors");
|
||||
|
||||
_code = code;
|
||||
_ef = ef;
|
||||
_errors = errors;
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, string modelNamespace)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
|
||||
{
|
||||
if (edmType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var collectionType = edmType as CollectionType;
|
||||
if (collectionType != null)
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
|
||||
}
|
||||
|
||||
var typeName = _code.Escape(edmType.MetadataProperties
|
||||
.Where(p => p.Name == ExternalTypeNameAttributeName)
|
||||
.Select(p => (string)p.Value)
|
||||
.FirstOrDefault())
|
||||
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
|
||||
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
|
||||
_code.Escape(edmType));
|
||||
|
||||
if (edmType is StructuralType)
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
|
||||
if (edmType is SimpleType)
|
||||
{
|
||||
var clrType = UnderlyingClrType(edmType);
|
||||
if (!IsEnumType(edmType))
|
||||
{
|
||||
typeName = _code.Escape(clrType);
|
||||
}
|
||||
|
||||
typeName = FixNamespaces(typeName);
|
||||
|
||||
return clrType.IsValueType && isNullable == true ?
|
||||
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
|
||||
typeName;
|
||||
}
|
||||
|
||||
throw new ArgumentException("edmType");
|
||||
}
|
||||
|
||||
public Type UnderlyingClrType(EdmType edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
var primitiveType = edmType as PrimitiveType;
|
||||
if (primitiveType != null)
|
||||
{
|
||||
return primitiveType.ClrEquivalentType;
|
||||
}
|
||||
|
||||
if (IsEnumType(edmType))
|
||||
{
|
||||
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
|
||||
}
|
||||
|
||||
return typeof(object);
|
||||
}
|
||||
|
||||
public object GetEnumMemberValue(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var valueProperty = enumMember.GetType().GetProperty("Value");
|
||||
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public string GetEnumMemberName(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var nameProperty = enumMember.GetType().GetProperty("Name");
|
||||
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var membersProperty = enumType.GetType().GetProperty("Members");
|
||||
return membersProperty != null
|
||||
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
|
||||
: Enumerable.Empty<MetadataItem>();
|
||||
}
|
||||
|
||||
public bool EnumIsFlags(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
|
||||
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public bool IsEnumType(GlobalItem edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
return edmType.GetType().Name == "EnumType";
|
||||
}
|
||||
|
||||
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public string CreateLiteral(object value)
|
||||
{
|
||||
if (value == null || value.GetType() != typeof(TimeSpan))
|
||||
{
|
||||
return _code.CreateLiteral(value);
|
||||
}
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
|
||||
}
|
||||
|
||||
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
|
||||
{
|
||||
ArgumentNotNull(types, "types");
|
||||
ArgumentNotNull(sourceFile, "sourceFile");
|
||||
|
||||
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
if (types.Any(item => !hash.Add(item)))
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(sourceFile, -1, -1, "6023",
|
||||
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return GetItemsToGenerate<SimpleType>(itemCollection)
|
||||
.Where(e => IsEnumType(e));
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
|
||||
{
|
||||
return itemCollection
|
||||
.OfType<T>()
|
||||
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
|
||||
.OrderBy(i => i.Name);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return itemCollection
|
||||
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
|
||||
.Select(g => GetGlobalItemName(g));
|
||||
}
|
||||
|
||||
public string GetGlobalItemName(GlobalItem item)
|
||||
{
|
||||
if (item is EdmType)
|
||||
{
|
||||
return ((EdmType)item).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((EntityContainer)item).Name;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
|
||||
}
|
||||
|
||||
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
|
||||
return returnParamsProperty == null
|
||||
? edmFunction.ReturnParameter
|
||||
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool IsComposable(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
|
||||
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
|
||||
}
|
||||
|
||||
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
|
||||
{
|
||||
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
}
|
||||
|
||||
public TypeUsage GetReturnType(EdmFunction edmFunction)
|
||||
{
|
||||
var returnParam = GetReturnParameter(edmFunction);
|
||||
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
|
||||
}
|
||||
|
||||
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
|
||||
{
|
||||
var returnType = GetReturnType(edmFunction);
|
||||
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ArgumentNotNull<T>(T arg, string name) where T : class
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
#>
|
10
Fab2ApprovalSystem-Copy/Models/FabApproval.Designer.cs
generated
Normal file
10
Fab2ApprovalSystem-Copy/Models/FabApproval.Designer.cs
generated
Normal file
@ -0,0 +1,10 @@
|
||||
// T4 code generation is enabled for model 'C:\Users\Ouellette\Desktop\VSProjects\Mesa_FI\Fab2ApprovalSystem\Fab2ApprovalSystem-branch-Prod20190626\Fab2ApprovalSystem\Models\FabApproval.edmx'.
|
||||
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
|
||||
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
|
||||
// is open in the designer.
|
||||
|
||||
// If no context and entity classes have been generated, it may be because you created an empty model but
|
||||
// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
|
||||
// classes for your model, open the model in the designer, right-click on the designer surface, and
|
||||
// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
|
||||
// Item...'.
|
9
Fab2ApprovalSystem-Copy/Models/FabApproval.cs
Normal file
9
Fab2ApprovalSystem-Copy/Models/FabApproval.cs
Normal file
@ -0,0 +1,9 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
96
Fab2ApprovalSystem-Copy/Models/FabApproval.edmx
Normal file
96
Fab2ApprovalSystem-Copy/Models/FabApproval.edmx
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- EF Runtime content -->
|
||||
<edmx:Runtime>
|
||||
<!-- SSDL content -->
|
||||
<edmx:StorageModels>
|
||||
<Schema Namespace="FabApprovalSystemModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
|
||||
<EntityType Name="_8DAuditedStandard">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="Standard" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="_8DAuditedStandardByAudit">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="AuditNo" Type="int" Nullable="false" />
|
||||
<Property Name="AuditedStandardID" Type="int" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="FabApprovalSystemModelStoreContainer">
|
||||
<EntitySet Name="_8DAuditedStandard" EntityType="Self._8DAuditedStandard" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="_8DAuditedStandardByAudit" EntityType="Self._8DAuditedStandardByAudit" Schema="dbo" store:Type="Tables" />
|
||||
</EntityContainer>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="FabApprovalSystemModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
|
||||
<EntityType Name="C_8DAuditedStandard">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Standard" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="FabApprovalSystemEntitiesAll" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="C_8DAuditedStandard" EntityType="Self.C_8DAuditedStandard" />
|
||||
<EntitySet Name="C_8DAuditedStandardByAudit" EntityType="FabApprovalSystemModel.C_8DAuditedStandardByAudit" />
|
||||
</EntityContainer>
|
||||
<EntityType Name="C_8DAuditedStandardByAudit">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="AuditNo" Type="Int32" Nullable="false" />
|
||||
<Property Name="AuditedStandardID" Type="Int32" Nullable="false" />
|
||||
</EntityType>
|
||||
</Schema>
|
||||
</edmx:ConceptualModels>
|
||||
<!-- C-S mapping content -->
|
||||
<edmx:Mappings>
|
||||
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
|
||||
<EntityContainerMapping StorageEntityContainer="FabApprovalSystemModelStoreContainer" CdmEntityContainer="FabApprovalSystemEntitiesAll">
|
||||
<EntitySetMapping Name="C_8DAuditedStandard">
|
||||
<EntityTypeMapping TypeName="FabApprovalSystemModel.C_8DAuditedStandard">
|
||||
<MappingFragment StoreEntitySet="_8DAuditedStandard">
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
<ScalarProperty Name="Standard" ColumnName="Standard" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="C_8DAuditedStandardByAudit">
|
||||
<EntityTypeMapping TypeName="FabApprovalSystemModel.C_8DAuditedStandardByAudit">
|
||||
<MappingFragment StoreEntitySet="_8DAuditedStandardByAudit">
|
||||
<ScalarProperty Name="AuditedStandardID" ColumnName="AuditedStandardID" />
|
||||
<ScalarProperty Name="AuditNo" ColumnName="AuditNo" />
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
</EntityContainerMapping>
|
||||
</Mapping>
|
||||
</edmx:Mappings>
|
||||
</edmx:Runtime>
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<Connection>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
|
||||
</DesignerInfoPropertySet>
|
||||
</Connection>
|
||||
<Options>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="ValidateOnBuild" Value="true" />
|
||||
<DesignerProperty Name="EnablePluralization" Value="true" />
|
||||
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
|
||||
<DesignerProperty Name="UseLegacyProvider" Value="false" />
|
||||
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
|
||||
</DesignerInfoPropertySet>
|
||||
</Options>
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<Diagrams></Diagrams>
|
||||
</Designer>
|
||||
</edmx:Edmx>
|
13
Fab2ApprovalSystem-Copy/Models/FabApproval.edmx.diagram
Normal file
13
Fab2ApprovalSystem-Copy/Models/FabApproval.edmx.diagram
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
<Diagram DiagramId="58469c29f5a74e309581006b6a9608fa" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="FabApprovalSystemModel.C_8DAuditedStandard" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="FabApprovalSystemModel.C_8DAuditedStandardByAudit" Width="1.5" PointX="3.375" PointY="0.75" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
733
Fab2ApprovalSystem-Copy/Models/FabApproval.tt
Normal file
733
Fab2ApprovalSystem-Copy/Models/FabApproval.tt
Normal file
@ -0,0 +1,733 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"FabApproval.edmx";
|
||||
var textTransform = DynamicTextTransformation.Create(this);
|
||||
var code = new CodeGenerationTools(this);
|
||||
var ef = new MetadataTools(this);
|
||||
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
|
||||
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
|
||||
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
|
||||
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
|
||||
|
||||
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
WriteHeader(codeStringGenerator, fileManager);
|
||||
|
||||
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
|
||||
{
|
||||
fileManager.StartNewFile(entity.Name + ".cs");
|
||||
BeginNamespace(code);
|
||||
#>
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
|
||||
<#=codeStringGenerator.EntityClassOpening(entity)#>
|
||||
{
|
||||
<#
|
||||
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
|
||||
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
|
||||
var complexProperties = typeMapper.GetComplexProperties(entity);
|
||||
|
||||
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public <#=code.Escape(entity)#>()
|
||||
{
|
||||
<#
|
||||
foreach (var edmProperty in propertiesWithDefaultValues)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var navigationProperty in collectionNavigationProperties)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var complexProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
<#
|
||||
}
|
||||
|
||||
var simpleProperties = typeMapper.GetSimpleProperties(entity);
|
||||
if (simpleProperties.Any())
|
||||
{
|
||||
foreach (var edmProperty in simpleProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(edmProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
|
||||
if (complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach(var complexProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(complexProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
|
||||
var navigationProperties = typeMapper.GetNavigationProperties(entity);
|
||||
if (navigationProperties.Any())
|
||||
{
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach (var navigationProperty in navigationProperties)
|
||||
{
|
||||
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
|
||||
{
|
||||
#>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
<#
|
||||
}
|
||||
#>
|
||||
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
EndNamespace(code);
|
||||
}
|
||||
|
||||
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
|
||||
{
|
||||
fileManager.StartNewFile(complex.Name + ".cs");
|
||||
BeginNamespace(code);
|
||||
#>
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
|
||||
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
|
||||
{
|
||||
<#
|
||||
var complexProperties = typeMapper.GetComplexProperties(complex);
|
||||
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
|
||||
|
||||
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
public <#=code.Escape(complex)#>()
|
||||
{
|
||||
<#
|
||||
foreach (var edmProperty in propertiesWithDefaultValues)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var complexProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
<#
|
||||
}
|
||||
|
||||
var simpleProperties = typeMapper.GetSimpleProperties(complex);
|
||||
if (simpleProperties.Any())
|
||||
{
|
||||
foreach(var edmProperty in simpleProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(edmProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
|
||||
if (complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach(var edmProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(edmProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
EndNamespace(code);
|
||||
}
|
||||
|
||||
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
|
||||
{
|
||||
fileManager.StartNewFile(enumType.Name + ".cs");
|
||||
BeginNamespace(code);
|
||||
#>
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
|
||||
<#
|
||||
if (typeMapper.EnumIsFlags(enumType))
|
||||
{
|
||||
#>
|
||||
[Flags]
|
||||
<#
|
||||
}
|
||||
#>
|
||||
<#=codeStringGenerator.EnumOpening(enumType)#>
|
||||
{
|
||||
<#
|
||||
var foundOne = false;
|
||||
|
||||
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
|
||||
{
|
||||
foundOne = true;
|
||||
#>
|
||||
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
|
||||
<#
|
||||
}
|
||||
|
||||
if (foundOne)
|
||||
{
|
||||
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
EndNamespace(code);
|
||||
}
|
||||
|
||||
fileManager.Process();
|
||||
|
||||
#>
|
||||
<#+
|
||||
|
||||
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
|
||||
{
|
||||
fileManager.StartHeader();
|
||||
#>
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
|
||||
//
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
|
||||
<#+
|
||||
fileManager.EndBlock();
|
||||
}
|
||||
|
||||
public void BeginNamespace(CodeGenerationTools code)
|
||||
{
|
||||
var codeNamespace = code.VsNamespaceSuggestion();
|
||||
if (!String.IsNullOrEmpty(codeNamespace))
|
||||
{
|
||||
#>
|
||||
namespace <#=code.EscapeNamespace(codeNamespace)#>
|
||||
{
|
||||
<#+
|
||||
PushIndent(" ");
|
||||
}
|
||||
}
|
||||
|
||||
public void EndNamespace(CodeGenerationTools code)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
|
||||
{
|
||||
PopIndent();
|
||||
#>
|
||||
}
|
||||
<#+
|
||||
}
|
||||
}
|
||||
|
||||
public const string TemplateId = "CSharp_DbContext_Types_EF6";
|
||||
|
||||
public class CodeStringGenerator
|
||||
{
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly TypeMapper _typeMapper;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(typeMapper, "typeMapper");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
|
||||
_code = code;
|
||||
_typeMapper = typeMapper;
|
||||
_ef = ef;
|
||||
}
|
||||
|
||||
public string Property(EdmProperty edmProperty)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
Accessibility.ForProperty(edmProperty),
|
||||
_typeMapper.GetTypeName(edmProperty.TypeUsage),
|
||||
_code.Escape(edmProperty),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
|
||||
}
|
||||
|
||||
public string NavigationProperty(NavigationProperty navProp)
|
||||
{
|
||||
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
|
||||
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
|
||||
_code.Escape(navProp),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
|
||||
}
|
||||
|
||||
public string AccessibilityAndVirtual(string accessibility)
|
||||
{
|
||||
return accessibility + (accessibility != "private" ? " virtual" : "");
|
||||
}
|
||||
|
||||
public string EntityClassOpening(EntityType entity)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1}partial class {2}{3}",
|
||||
Accessibility.ForType(entity),
|
||||
_code.SpaceAfter(_code.AbstractOption(entity)),
|
||||
_code.Escape(entity),
|
||||
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
|
||||
}
|
||||
|
||||
public string EnumOpening(SimpleType enumType)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} enum {1} : {2}",
|
||||
Accessibility.ForType(enumType),
|
||||
_code.Escape(enumType),
|
||||
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
|
||||
}
|
||||
|
||||
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
|
||||
{
|
||||
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
|
||||
{
|
||||
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
|
||||
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
|
||||
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
|
||||
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
|
||||
}
|
||||
}
|
||||
|
||||
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} IQueryable<{1}> {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
_code.Escape(edmFunction),
|
||||
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
|
||||
}
|
||||
|
||||
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
edmFunction.NamespaceName,
|
||||
edmFunction.Name,
|
||||
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
|
||||
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
|
||||
}
|
||||
|
||||
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
|
||||
if (includeMergeOption)
|
||||
{
|
||||
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
_code.Escape(edmFunction),
|
||||
paramList);
|
||||
}
|
||||
|
||||
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
|
||||
if (includeMergeOption)
|
||||
{
|
||||
callParams = ", mergeOption" + callParams;
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
|
||||
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
edmFunction.Name,
|
||||
callParams);
|
||||
}
|
||||
|
||||
public string DbSet(EntitySet entitySet)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
|
||||
Accessibility.ForReadOnlyProperty(entitySet),
|
||||
_typeMapper.GetTypeName(entitySet.ElementType),
|
||||
_code.Escape(entitySet));
|
||||
}
|
||||
|
||||
public string UsingDirectives(bool inHeader, bool includeCollections = true)
|
||||
{
|
||||
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
|
||||
? string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}using System;{1}" +
|
||||
"{2}",
|
||||
inHeader ? Environment.NewLine : "",
|
||||
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
|
||||
inHeader ? "" : Environment.NewLine)
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeMapper
|
||||
{
|
||||
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
|
||||
|
||||
private readonly System.Collections.IList _errors;
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
ArgumentNotNull(errors, "errors");
|
||||
|
||||
_code = code;
|
||||
_ef = ef;
|
||||
_errors = errors;
|
||||
}
|
||||
|
||||
public static string FixNamespaces(string typeName)
|
||||
{
|
||||
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, string modelNamespace)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
|
||||
{
|
||||
if (edmType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var collectionType = edmType as CollectionType;
|
||||
if (collectionType != null)
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
|
||||
}
|
||||
|
||||
var typeName = _code.Escape(edmType.MetadataProperties
|
||||
.Where(p => p.Name == ExternalTypeNameAttributeName)
|
||||
.Select(p => (string)p.Value)
|
||||
.FirstOrDefault())
|
||||
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
|
||||
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
|
||||
_code.Escape(edmType));
|
||||
|
||||
if (edmType is StructuralType)
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
|
||||
if (edmType is SimpleType)
|
||||
{
|
||||
var clrType = UnderlyingClrType(edmType);
|
||||
if (!IsEnumType(edmType))
|
||||
{
|
||||
typeName = _code.Escape(clrType);
|
||||
}
|
||||
|
||||
typeName = FixNamespaces(typeName);
|
||||
|
||||
return clrType.IsValueType && isNullable == true ?
|
||||
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
|
||||
typeName;
|
||||
}
|
||||
|
||||
throw new ArgumentException("edmType");
|
||||
}
|
||||
|
||||
public Type UnderlyingClrType(EdmType edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
var primitiveType = edmType as PrimitiveType;
|
||||
if (primitiveType != null)
|
||||
{
|
||||
return primitiveType.ClrEquivalentType;
|
||||
}
|
||||
|
||||
if (IsEnumType(edmType))
|
||||
{
|
||||
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
|
||||
}
|
||||
|
||||
return typeof(object);
|
||||
}
|
||||
|
||||
public object GetEnumMemberValue(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var valueProperty = enumMember.GetType().GetProperty("Value");
|
||||
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public string GetEnumMemberName(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var nameProperty = enumMember.GetType().GetProperty("Name");
|
||||
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var membersProperty = enumType.GetType().GetProperty("Members");
|
||||
return membersProperty != null
|
||||
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
|
||||
: Enumerable.Empty<MetadataItem>();
|
||||
}
|
||||
|
||||
public bool EnumIsFlags(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
|
||||
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public bool IsEnumType(GlobalItem edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
return edmType.GetType().Name == "EnumType";
|
||||
}
|
||||
|
||||
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public string CreateLiteral(object value)
|
||||
{
|
||||
if (value == null || value.GetType() != typeof(TimeSpan))
|
||||
{
|
||||
return _code.CreateLiteral(value);
|
||||
}
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
|
||||
}
|
||||
|
||||
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
|
||||
{
|
||||
ArgumentNotNull(types, "types");
|
||||
ArgumentNotNull(sourceFile, "sourceFile");
|
||||
|
||||
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
if (types.Any(item => !hash.Add(item)))
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(sourceFile, -1, -1, "6023",
|
||||
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return GetItemsToGenerate<SimpleType>(itemCollection)
|
||||
.Where(e => IsEnumType(e));
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
|
||||
{
|
||||
return itemCollection
|
||||
.OfType<T>()
|
||||
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
|
||||
.OrderBy(i => i.Name);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return itemCollection
|
||||
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
|
||||
.Select(g => GetGlobalItemName(g));
|
||||
}
|
||||
|
||||
public string GetGlobalItemName(GlobalItem item)
|
||||
{
|
||||
if (item is EdmType)
|
||||
{
|
||||
return ((EdmType)item).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((EntityContainer)item).Name;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
|
||||
}
|
||||
|
||||
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
|
||||
return returnParamsProperty == null
|
||||
? edmFunction.ReturnParameter
|
||||
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool IsComposable(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
|
||||
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
|
||||
}
|
||||
|
||||
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
|
||||
{
|
||||
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
}
|
||||
|
||||
public TypeUsage GetReturnType(EdmFunction edmFunction)
|
||||
{
|
||||
var returnParam = GetReturnParameter(edmFunction);
|
||||
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
|
||||
}
|
||||
|
||||
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
|
||||
{
|
||||
var returnType = GetReturnType(edmFunction);
|
||||
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ArgumentNotNull<T>(T arg, string name) where T : class
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
#>
|
17
Fab2ApprovalSystem-Copy/Models/IdentityModels.cs
Normal file
17
Fab2ApprovalSystem-Copy/Models/IdentityModels.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
|
||||
public class ApplicationUser : IdentityUser
|
||||
{
|
||||
}
|
||||
|
||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
{
|
||||
public ApplicationDbContext()
|
||||
: base("DefaultConnection")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
281
Fab2ApprovalSystem-Copy/Models/LotDispositionModels.cs
Normal file
281
Fab2ApprovalSystem-Copy/Models/LotDispositionModels.cs
Normal file
@ -0,0 +1,281 @@
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class LotDisposition
|
||||
{
|
||||
//[Editable(false)]
|
||||
[Display(Name = "Issue Number")]
|
||||
public int IssueID { get; set; }
|
||||
//[Editable(false)]
|
||||
public string Title { get; set; }
|
||||
public bool PERequired { get; set; }
|
||||
public string IssueDescription { get; set; }
|
||||
[ReadOnly(true)]
|
||||
public DateTime? IssueDate { get; set; }
|
||||
public DateTime? SubmitedDate { get; set; }
|
||||
public DateTime? CloseDate { get; set; }
|
||||
public int OriginatorID { get; set; }
|
||||
public string OriginatorName { get; set; }
|
||||
public string ReasonForDisposition { get; set; }
|
||||
public int ResponsibilityID { get; set; }
|
||||
public int ResponsibilityIssueID { get; set; }
|
||||
public string SPNScrapCode { get; set; }
|
||||
public byte CurrentStep { get; set; }
|
||||
// Extra field Defined for Scraping wafer for a given lot
|
||||
public Lot Lot { get; set; }
|
||||
//Extra field defined for Attachments
|
||||
public Attachment DocumentAttachment { get; set; }
|
||||
|
||||
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
||||
// in order to get the selected items from the control
|
||||
public List<int> DepartmentIDs { get; set; }
|
||||
|
||||
public List<Attachment> Attachments { get; set; }
|
||||
public List<Approval> Approvals { get; set; }
|
||||
public List<ScrapLot> ScrapLots { get; set; }
|
||||
|
||||
public int CANo { get; set; }
|
||||
[Display(Name = "MRB Required")]
|
||||
public bool MRBRequired { get; set; }
|
||||
public int WorkFlowNumber { get; set; }
|
||||
|
||||
[Display(Name = "Dispositon By OCAP")]
|
||||
public bool DispositionByOCAP { get; set; }
|
||||
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public string RecordLockByName { get; set; }
|
||||
public DateTime? RecordLockedDate { get; set; }
|
||||
public int LastUpdatedBy { get; set; }
|
||||
public DateTime? LastUpdateDate { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public LotDisposition()
|
||||
{
|
||||
DepartmentIDs = new List<int>();
|
||||
Lot = new Lot();
|
||||
DocumentAttachment = new Attachment();
|
||||
//Lots = new List<Lot>();
|
||||
Attachments = new List<Attachment>();
|
||||
Approvals = new List<Approval>();
|
||||
ScrapLots = new List<ScrapLot>();
|
||||
IssueDate = DateTime.Now;
|
||||
CurrentStep = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//public class Lot
|
||||
//{
|
||||
// public int LotID { get; set; }
|
||||
// [Display(Name = "Wafer Lot#")]
|
||||
// public string LotNumber { get; set; }
|
||||
// public string ParentLotNumber { get { return LotNumber.Length >= 7 ? LotNumber.Substring(0, 7) : LotNumber; } }
|
||||
|
||||
// public int MRBNumber { get; set; }
|
||||
// public int IssueID { get; set; }
|
||||
// public string DieLotNumber { get; set; }
|
||||
// public string Description { get; set; }
|
||||
// [Display(Name="New PN#")]
|
||||
// public string NewPartNo { get; set; }
|
||||
// [Display(Name = "WIP PN#")]
|
||||
// public string WipPartNo { get; set; }
|
||||
// [Display(Name = "Die PN#")]
|
||||
// public string DiePartNo { get; set; }
|
||||
// [Display(Name="Family")]
|
||||
// public string ProductFamily { get; set; }
|
||||
// public double Gen { get; set; }
|
||||
// public string Channel { get; set; }
|
||||
// public double Hexsize { get; set; }
|
||||
// public double Voltage { get; set; }
|
||||
// public int WaferCount { get; set; }
|
||||
// public int ReleaseCount { get; set; }
|
||||
// public int ScrapCount { get; set; }
|
||||
// public int DieCount { get; set; }
|
||||
// public string Location { get; set; }
|
||||
// public double TotalCost { get; set; }
|
||||
// public int LotStatusOptionID { get; set; }
|
||||
// public string LotStatusOptionName { get; set; }
|
||||
// public double WaferCost { get; set; }
|
||||
// public double DieCost { get; set; }
|
||||
|
||||
// [UIHint("LotStatusOptionTemplate")]
|
||||
// [Display(Name="Lot Status")]
|
||||
// public LotStatusOptionViewModel LotStatusOption { get; set; }
|
||||
|
||||
// public ScrapLot ScrapLotWafer { get; set; }
|
||||
|
||||
|
||||
// public Lot()
|
||||
// {
|
||||
// LotStatusOption = new LotStatusOptionViewModel();
|
||||
// ScrapLotWafer = new ScrapLot();
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
public class LotDispoDepartment
|
||||
{
|
||||
//public int LotDispoDepartmentID { get; set; }
|
||||
//public int IssueID { get; set; }
|
||||
public int DepartmentID { get; set; }
|
||||
public string DepartmentName { get; set; }
|
||||
}
|
||||
|
||||
public class Attachment
|
||||
{
|
||||
public int AttachmentID { set; get; }
|
||||
public int IssueID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UserID { get; set; }
|
||||
// extrafield
|
||||
public string FullName { get; set; }
|
||||
public string UploadDate { get; set; }
|
||||
public string Path { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Approval
|
||||
{
|
||||
public int ApprovalID { get; set; }
|
||||
public int IssueID { get; set; }
|
||||
string StateName { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public int SubRoleID { get; set; }
|
||||
public int ItemStatus { get; set; }
|
||||
public int Step { get; set; }
|
||||
public DateTime? NotifyDate { get; set; }
|
||||
public DateTime? AssignedDate { get; set; }
|
||||
public DateTime? RoleAssignedDate { get; set; }
|
||||
public DateTime? CompleteDateTime { get; set; }
|
||||
public string UserComments { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ScrapLot
|
||||
{
|
||||
|
||||
|
||||
public string LotNo { get; set; }
|
||||
public int IssueID { get; set; }
|
||||
public int ScrapCount { get; set; }
|
||||
public int ReleaseCount { get; set; }
|
||||
public int SplitOfHoldCount { get; set; }
|
||||
public int CloseToQDBCount { get; set; }
|
||||
|
||||
// extra field ( a viewmodel can be created)
|
||||
public int WaferCount { get; set; }
|
||||
|
||||
public byte Lot1State { get; set; }
|
||||
public byte Lot2State { get; set; }
|
||||
public byte Lot3State { get; set; }
|
||||
public byte Lot4State { get; set; }
|
||||
public byte Lot5State { get; set; }
|
||||
public byte Lot6State { get; set; }
|
||||
public byte Lot7State { get; set; }
|
||||
public byte Lot8State { get; set; }
|
||||
public byte Lot9State { get; set; }
|
||||
public byte Lot10State { get; set; }
|
||||
public byte Lot11State { get; set; }
|
||||
public byte Lot12State { get; set; }
|
||||
public byte Lot13State { get; set; }
|
||||
public byte Lot14State { get; set; }
|
||||
public byte Lot15State { get; set; }
|
||||
public byte Lot16State { get; set; }
|
||||
public byte Lot17State { get; set; }
|
||||
public byte Lot18State { get; set; }
|
||||
public byte Lot19State { get; set; }
|
||||
public byte Lot20State { get; set; }
|
||||
public byte Lot21State { get; set; }
|
||||
public byte Lot22State { get; set; }
|
||||
public byte Lot23State { get; set; }
|
||||
public byte Lot24State { get; set; }
|
||||
public byte Lot25State { get; set; }
|
||||
public byte Lot26State { get; set; }
|
||||
public byte Lot27State { get; set; }
|
||||
public byte Lot28State { get; set; }
|
||||
public byte Lot29State { get; set; }
|
||||
public byte Lot30State { get; set; }
|
||||
public byte Lot31State { get; set; }
|
||||
public byte Lot32State { get; set; }
|
||||
public byte Lot33State { get; set; }
|
||||
public byte Lot34State { get; set; }
|
||||
public byte Lot35State { get; set; }
|
||||
public byte Lot36State { get; set; }
|
||||
public byte Lot37State { get; set; }
|
||||
public byte Lot38State { get; set; }
|
||||
public byte Lot39State { get; set; }
|
||||
public byte Lot40State { get; set; }
|
||||
public byte Lot41State { get; set; }
|
||||
public byte Lot42State { get; set; }
|
||||
public byte Lot43State { get; set; }
|
||||
public byte Lot44State { get; set; }
|
||||
public byte Lot45State { get; set; }
|
||||
public byte Lot46State { get; set; }
|
||||
public byte Lot47State { get; set; }
|
||||
public byte Lot48State { get; set; }
|
||||
public byte Lot49State { get; set; }
|
||||
public byte Lot50State { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Users
|
||||
{
|
||||
public int OriginatorID { get; set; }
|
||||
public string Originatorname { get;set;}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Responsibility
|
||||
{
|
||||
public int ResponsibilityID { get; set; }
|
||||
public string ResponsibilityName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ResponsibilityIssue
|
||||
{
|
||||
public int ResponsibilityIssueID { get; set; }
|
||||
public string Issue { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Comments
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int IssueID {get; set;}
|
||||
public string CommentedBy { get; set; }
|
||||
public string UserName{ get; set; }
|
||||
public string UserComments { get; set; }
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
463
Fab2ApprovalSystem-Copy/Models/LotTravellerModel.cs
Normal file
463
Fab2ApprovalSystem-Copy/Models/LotTravellerModel.cs
Normal file
@ -0,0 +1,463 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class LTWorkRequest
|
||||
{
|
||||
|
||||
public int ID{ get; set; }
|
||||
public int SWRNumber{ get; set; }
|
||||
public bool RecordLockIndicator{ get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public string RecordLockByName { get; set; }
|
||||
public byte CurrentStep { get; set; }
|
||||
public int Revision{ get; set; }
|
||||
public bool IsCurrentRevision { get; set; }
|
||||
public int OriginatorID{ get; set; }
|
||||
public DateTime? OriginatedDate { get; set; }
|
||||
public DateTime? SubmitedDate { get; set; }
|
||||
public DateTime? CloseDate { get; set; }
|
||||
public int Status{ get; set; }
|
||||
public bool IsITAR{ get; set; }
|
||||
public string Title{ get; set; }
|
||||
public char? LotType{ get; set; }
|
||||
public string PCRBNumber{ get; set; }
|
||||
public int? EngLotStartRequired{ get; set; }
|
||||
public int? LotTypeConversion{ get; set; }
|
||||
public int? QualLot{ get; set; }
|
||||
public string PurposeOfRequest{ get; set; }
|
||||
public DateTime? PlannedLotStartDate{ get; set; }
|
||||
public DateTime? PlannedScheduledCloseDate{ get; set; }
|
||||
public string ChargeDepartment{ get; set; }
|
||||
public string AllocationToUse{ get; set; }
|
||||
public int? PredictedCyleTime{ get; set; }
|
||||
public string ChargesForRawWafers{ get; set; }
|
||||
public string DeptChargedForRawWafers{ get; set; }
|
||||
public string DeptOwnerForRawWafers{ get; set; }
|
||||
public string FabCost{ get; set; }
|
||||
public string DeptChargedForFabCost{ get; set; }
|
||||
public string SignOn{ get; set; }
|
||||
public string Verb1{ get; set; }
|
||||
public DateTime? EstimatedBinCLoseDate { get; set; }
|
||||
public int? TotalQty { get; set; }
|
||||
public int? StartQty{ get; set; }
|
||||
public string Verb2{ get; set; }
|
||||
public string WIPArea{ get; set; }
|
||||
public DateTime? LotStartDate{ get; set; }
|
||||
public string LotNumber { get; set; }
|
||||
public string WIPPartNumber{ get; set; }
|
||||
public string PartDescription { get; set; }
|
||||
public string DefaultEPISiliconPartNumber { get; set; }
|
||||
public string ProcessFlow{ get; set; }
|
||||
public string EmployeeID{ get; set; }
|
||||
public string VerbComment{ get; set; }
|
||||
public int? RecordSiliconLotInSPNTapeTagTotrav { get;set;}
|
||||
public string SiliconLotNoCassette1 { get; set; }
|
||||
|
||||
public bool SiliconOnHand { get; set; }
|
||||
public DateTime? SiliconExpectedDueDate { get; set; }
|
||||
public string SiliconComments { get; set; }
|
||||
|
||||
public bool ReticleOnHand { get; set; }
|
||||
public DateTime? ReticleExpectedDueDate { get; set; }
|
||||
public string ReticleComments { get; set; }
|
||||
|
||||
public bool SPNTransferOnHand { get; set; }
|
||||
public DateTime? SPNTransferExpectedDueDate { get; set; }
|
||||
public string SPNTransferComments { get; set; }
|
||||
|
||||
public bool ProbeCardOnHand { get; set; }
|
||||
public DateTime? ProbeCardExpectedDueDate { get; set; }
|
||||
public string ProbeCardComments { get; set; }
|
||||
|
||||
public bool ProbeRecipeOnHand { get; set; }
|
||||
public DateTime? ProbeRecipeExpectedDueDate { get; set; }
|
||||
public string ProbeRecipeComments { get; set; }
|
||||
|
||||
public bool ProcessChangeDetailsOnHand { get; set; }
|
||||
public DateTime? ProcessChangeDetailsDueDate { get; set; }
|
||||
|
||||
public string LotStartCheckListComments { get; set; }
|
||||
|
||||
public LTHoldStep LTHoldStep { get; set; }
|
||||
public LTWorkRequestAttachment WorkRequestAttachment { get; set; }
|
||||
public int LotCount { get; set; }
|
||||
|
||||
// View Model attributes
|
||||
public List<int> DepartmentIDs { get; set; }
|
||||
public List<int> ModuleIDs { get; set; }
|
||||
public string OriginatorName { get; set; }
|
||||
public string RevisionComments { get; set; }
|
||||
public LTMaterial LTMaterial { get; set; }
|
||||
public int PreviousWorkRequestID { get; set; }
|
||||
public int WorkFlowNumber { get; set; }
|
||||
public string ApprovalStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return Status == 1? "Approved" : "Pending";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public LTWorkRequest()
|
||||
{
|
||||
DepartmentIDs = new List<int>();
|
||||
ModuleIDs = new List<int>();
|
||||
LTHoldStep = new LTHoldStep();
|
||||
LTMaterial = new LTMaterial();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class LTMaterial
|
||||
{
|
||||
public int ID { get; set; }
|
||||
[Display(Name = "WIP Part #")]
|
||||
public string WIPPartNumber { get; set; }
|
||||
[Display(Name = "EPI Silicon Part#")]
|
||||
public string EPISiliconPartNumber { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
public string Supplier { get; set; }
|
||||
public string Source { get; set; }
|
||||
public int LTWorkRequestID { get; set; }
|
||||
public int PreviousMaterialID { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTAffectedDepartment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int DepartmentID { get; set; }
|
||||
public int LTWorkRequestID { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTAffectedModule
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int ModuleID { get; set; }
|
||||
public int LTWorkRequestID { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//public class LTMaterial
|
||||
//{
|
||||
// public int ID { get; set; }
|
||||
// public string WIPPartNumber { get; set; }
|
||||
// public string Description { get; set; }
|
||||
// public string EPISiliconPartNumber { get; set; }
|
||||
// public int Quantity { get; set; }
|
||||
// public string Supplier { get; set; }
|
||||
// public int LTWorkRequestID { get; set; }
|
||||
|
||||
// public LTMaterial()
|
||||
// {
|
||||
// Description = "";
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTLotStartCheckList
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Item { get; set; }
|
||||
public bool OnHand { get; set; }
|
||||
public DateTime? ExpectedDueDate { get; set; }
|
||||
public int LTWorkRequestID { get; set; }
|
||||
public string Comments { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTHoldStep
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string BaseFlow { get; set; }
|
||||
public string Location { get; set; }
|
||||
|
||||
[Display(Name="Seq")]
|
||||
public string OperSequence { get; set; }
|
||||
|
||||
public string Operation { get; set; }
|
||||
public string OperationDescription { get; set; }
|
||||
public string ChangeInstructions { get; set; }
|
||||
public string FileNames { get; set; }
|
||||
public int LTWorkRequestID { get; set; }
|
||||
public int UpdatedBy { get; set; }
|
||||
public LTWorkRequestAttachment LTWorkRequestAttachment { get; set; }
|
||||
public int Revision { get; set; }
|
||||
public int SWRNumber { get; set; }
|
||||
public int currentStep { get; set; }
|
||||
public int PreviousHoldStepID { get; set; }
|
||||
public LTHoldStep()
|
||||
{
|
||||
LTWorkRequestAttachment = new LTWorkRequestAttachment();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTWorkRequestAttachment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string DocType { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public DateTime? UploadDateTime { get; set; }
|
||||
public int LTHoldStepID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public int Revision { get; set; }
|
||||
public int WorkRequestID { get; set; }
|
||||
public int SWRNumber { get; set; }
|
||||
public string FileExtension { get; set; }
|
||||
public int PreviousWorkRequestAttachmentID { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTLotTravelerHeaderViewModel
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int SWRNumber { get; set; }
|
||||
public string LotNumber { get; set; }
|
||||
public string Title { get; set; } //
|
||||
public string Status { get; set; } //
|
||||
public string Originator { get; set; } //
|
||||
public string WIPPartNumber { get; set; }
|
||||
public string PartDescription { get; set; }
|
||||
public string BaseFlow { set; get; }
|
||||
public bool IsITAR { set; get; }
|
||||
public DateTime? LastUpdate { get; set; }
|
||||
public string LastUpdatedBy { get; set; }
|
||||
public string PurposeOfRequest { get; set; }
|
||||
//public int Quantity { get; set; }
|
||||
//public bool TravelerAttachedToLot { get; set; }
|
||||
public int LotTravCurrentRevision { get; set; }
|
||||
public LTLotTravelerHoldSteps LTLotTravelerHoldStep { get; set; }
|
||||
public bool IsCurrentRevision { get; set; }
|
||||
//public string Comments { get; set; }
|
||||
public int LTWorkRequestID { get; set; }
|
||||
public int LotTravRevID { get; set; }
|
||||
public bool RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public int RecordLockedByName { get; set; }
|
||||
public List<Revision> Revisions { get; set; }
|
||||
public bool TravelerClosed { get; set; }
|
||||
public DateTime? TravelerClosedDate { get; set; }
|
||||
public string TravelerClosedBy { get; set; }
|
||||
public string TravelerClosedReason { get; set; }
|
||||
public int WorkReqRevision { get; set; }
|
||||
|
||||
public string TravelerStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return TravelerClosedDate == null ? "Open" : "Closed";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LTLotTravelerHeaderViewModel()
|
||||
{
|
||||
LTLotTravelerHoldStep = new LTLotTravelerHoldSteps();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTLot
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int WorkRequestID { get; set; }
|
||||
public string LotNumber { get; set; }
|
||||
public string WIPPartNumber { get; set; }
|
||||
public int WaferQty { get; set; }
|
||||
public string PartDescription { get; set; }
|
||||
public string Process { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string Operation { get; set; }
|
||||
public string LotStatus { get; set; }
|
||||
public bool IsTravelerGenerated { get; set; }
|
||||
[Display(Name="Revision")]
|
||||
public int LotTravelerCurrentRevision { get; set; }
|
||||
public int LotUploadedBy { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
public DateTime LotUploadDatetime { get; set; }
|
||||
public int WRWithExistingLot { get; set; }
|
||||
public string TravelerStatus { get; set; }
|
||||
public bool TravelerClosed { get; set; }
|
||||
public DateTime? TravelerClosedDate { get; set; }
|
||||
//public int RecordLockIndicator { get; set; }
|
||||
//public int RecordLockedBy { get; set; }
|
||||
//public DateTime? RecordLockedDateTime { get; set; }
|
||||
//public bool IsCurrentRevision { get; set;}
|
||||
//public int Revision { get; set; }
|
||||
[Display(Name = "")]
|
||||
public string ButtonAttrib
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IsTravelerGenerated ? "True" : "False") + "~" + ID + "~" + WorkRequestID + "~" + LotStatus + "~" + TravelerStatus;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTLotTravelerRevisionAttrib
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int LTLotID { get; set; }
|
||||
public int RevisionNumber { get; set; }
|
||||
public bool IsCurrentRevision { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public int RecordLockIndicator { get; set; }
|
||||
public int RecordLockedBy { get; set; }
|
||||
public DateTime? RecordLockedDate { get; set; }
|
||||
public int TravelerLastUpdatedBy { get; set; }
|
||||
public DateTime? TraverlerLastUpdatedDatetime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class LTLotTravlerHistory
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTLotTravelerHoldSteps
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string Operation { get; set; }
|
||||
public string OperSequence { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string OperationDescription { get; set; }
|
||||
public string ChangeInstructions { get; set; }
|
||||
public bool OLHoldInSPN { get; set; }
|
||||
public string ExecutionTaskComments { get; set; }
|
||||
public string EmployeeID { get; set; }
|
||||
public bool Completed { get; set; }
|
||||
public DateTime? SignOffTime { get; set; }
|
||||
public int SignedOffBy { get; set; }
|
||||
[Display(Name="SignedOff By")]
|
||||
public string SignedOffByName { get; set; }
|
||||
public int LotTravelerRevisionID { get; set; }
|
||||
public string RevisionComments { get; set; }
|
||||
public DateTime? UpdatedDateTime { get; set; }
|
||||
public int? UpdatedBy { get; set; }
|
||||
public int CurrentRevision { get; set; }
|
||||
// view model fields
|
||||
public string FileNames { get; set; }
|
||||
public int SWRNumber { get; set; }
|
||||
public int LTLotID { get; set; }
|
||||
public int WorkRequestID { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LTLotTravAttachment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string FileGUID { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string DocType { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public int LotTravelerRevisionID { get; set; }
|
||||
public int LTLotTravHoldStepID { get; set; }
|
||||
public DateTime? UploadTime { get; set; }
|
||||
public int UploadedByID { get; set; }
|
||||
public string UploadedByName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// </summary>
|
||||
public class BaseFlowLocation
|
||||
{
|
||||
public string Location { get; set; }
|
||||
}
|
||||
|
||||
public class BaseFlowOperations
|
||||
{
|
||||
public string Operation { get; set; }
|
||||
public string OperationDesc { get; set; }
|
||||
public string OperCode { get; set; }
|
||||
public string SeqCode { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// </summary>
|
||||
public class BaseFlowLocationOperation
|
||||
{
|
||||
public string BaseFlow { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string Operation { get; set; }
|
||||
}
|
||||
|
||||
public class PartNumberAttrib
|
||||
{
|
||||
public string PartNumber { get; set; }
|
||||
public string SiliconAndDesc { get; set; }
|
||||
}
|
||||
|
||||
public class Revision
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int RevisionNumber { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class LotWithTraveler
|
||||
{
|
||||
public int LotID { get; set; }
|
||||
public string LotNumber { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class RevisionHistory
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string RevisionedBy { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public DateTime RevisionCreateDate { get; set; }
|
||||
}
|
||||
}
|
226
Fab2ApprovalSystem-Copy/Models/MRBModels.cs
Normal file
226
Fab2ApprovalSystem-Copy/Models/MRBModels.cs
Normal file
@ -0,0 +1,226 @@
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MRB
|
||||
{
|
||||
|
||||
public int MRBNumber {get;set;}
|
||||
public string Title { get; set; }
|
||||
public int MRBRaisedAreaID { get; set; }
|
||||
public int OriginatorID { get; set; }
|
||||
public int Owner { get; set; }
|
||||
public int Module { get; set; }
|
||||
public DateTime? MRBRaisedDate { get; set; }
|
||||
public string Process { get; set; }
|
||||
public int ApprovalStatus { get; set; }
|
||||
public string Tool { get; set; }
|
||||
public string ToolCSV { get; set; }
|
||||
public int NumberOfLotsAffected { get; set; }
|
||||
public int NumberOfWafersAffected { get; set; }
|
||||
public int NumberOfDiesAffected { get; set; }
|
||||
public DateTime? ApprovalDate { get; set; }
|
||||
public int CANo { get; set; }
|
||||
public string IssueDescription { get; set; }
|
||||
public DateTime? IssueDetectedDate { get; set; }
|
||||
public DateTime? IssueStartDate { get; set; }
|
||||
public DateTime? IssueEndDate { get; set; }
|
||||
|
||||
// viewmodel
|
||||
public string OwnerName { get; set; }
|
||||
public List<int> PartGroupIDs { get; set; }
|
||||
public List<int> ModuleIDs { get; set; }
|
||||
public List<int> DispositionIDs { get; set; }
|
||||
public List<int> RiskAssessmentIDs { get; set; }
|
||||
|
||||
//public List<PartGroup> PartGroups { get; set; }
|
||||
//public List<Module> Modules { get; set; }
|
||||
//public List<Disposition> Dispositions { get; set; }
|
||||
//public List<RiskAssessment> RiskAssessments { get; set; }
|
||||
|
||||
public string Notes { get; set; }
|
||||
public string OwnerApprover { get; set; }
|
||||
public string MfgEngineeringAppover { get; set; }
|
||||
public string YEApprover { get; set; }
|
||||
public string PEApprover { get; set; }
|
||||
public string OtherApprovers { get; set; }
|
||||
public string QualityApprovers { get; set; }
|
||||
//public string Details { get; set; }
|
||||
public byte CurrentStep { get; set; }
|
||||
public string DetailsFolder { get; set; }
|
||||
public bool CustomerImpacted { get; set; }
|
||||
public int WorkFlowNumber { get; set; }
|
||||
|
||||
public string ApprovalStatusString {
|
||||
get
|
||||
{
|
||||
switch (ApprovalStatus)
|
||||
{
|
||||
case 0:
|
||||
return "PENDING";
|
||||
case 1:
|
||||
return "APPROVED";
|
||||
default:
|
||||
return "CLOSED";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public MRB()
|
||||
{
|
||||
PartGroupIDs = new List<int>();
|
||||
ModuleIDs = new List<int>();
|
||||
DispositionIDs = new List<int>();
|
||||
RiskAssessmentIDs = new List<int>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//public class zMRBLot
|
||||
//{
|
||||
// public int LotID { get; set; }
|
||||
// [Display(Name = "Wafer Lot#")]
|
||||
// public string LotNumber { get; set; }
|
||||
// public string ParentLotNumber { get { return LotNumber.Length >= 7 ? LotNumber.Substring(0, 7) : LotNumber; } }
|
||||
|
||||
// public int MRBNumber { get; set; }
|
||||
// public string DieLotNumber { get; set; }
|
||||
// public string Description { get; set; }
|
||||
// [Display(Name = "New PN#")]
|
||||
// public string NewPartNo { get; set; }
|
||||
// [Display(Name = "WIP PN#")]
|
||||
// public string WipPartNo { get; set; }
|
||||
// [Display(Name = "Die PN#")]
|
||||
// public string DiePartNo { get; set; }
|
||||
// [Display(Name = "Family")]
|
||||
// public string ProductFamily { get; set; }
|
||||
// public double Gen { get; set; }
|
||||
// public string Channel { get; set; }
|
||||
// public double Hexsize { get; set; }
|
||||
// public double Voltage { get; set; }
|
||||
// public int WaferCount { get; set; }
|
||||
// public int ReleaseCount { get; set; }
|
||||
// public int ScrapCount { get; set; }
|
||||
// public int DieCount { get; set; }
|
||||
// public string Location { get; set; }
|
||||
// public double TotalCost { get; set; }
|
||||
// public string LotStatusOptionName { get; set; }
|
||||
// public double WaferCost { get; set; }
|
||||
// public double DieCost { get; set; }
|
||||
//}
|
||||
|
||||
|
||||
public class PartGroup
|
||||
{
|
||||
public int PartGroupID { get; set; }
|
||||
public string PartGroupName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class Module
|
||||
{
|
||||
public int ModuleID { get; set; }
|
||||
//public int MRBNumber { get; set; }
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RiskAssessment
|
||||
{
|
||||
|
||||
public int RiskAssessmentID { get; set; }
|
||||
//public int MRBNumber { get; set; }
|
||||
public string RiskAssessmentName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Disposition
|
||||
{
|
||||
|
||||
public int DispositionID { get; set; }
|
||||
public int MRBNumber { get; set; }
|
||||
[Display(Name = "Type")]
|
||||
public string DispositionType { get; set; }
|
||||
[Display(Name="Dispo Desc")]
|
||||
public string DispositionName { get; set; }
|
||||
public string DispositionNotes { get; set; }
|
||||
|
||||
//Duplicated as the CloseToQDBOptionID is being used in the dropdown in the Grid kept the old code
|
||||
public int CloseToQDBOption_ID { get; set; }
|
||||
//public string CloseToQDBOption { get; set; }
|
||||
|
||||
[UIHint("CloseToQDBTemplate")]
|
||||
[Display(Name = "Close To QDB(Yes/No)")]
|
||||
public CloseToQDBOptionViewModel CloseToQDBOption { get; set; }
|
||||
|
||||
[Display(Name = "MRB Flag to SPN")]
|
||||
public string CloseToQDBOptionString
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (CloseToQDBOption_ID)
|
||||
{
|
||||
case 0:
|
||||
return "No";
|
||||
case 1:
|
||||
return "Yes";
|
||||
default:
|
||||
return "No";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class MRBAttachment
|
||||
{
|
||||
public int AttachmentID { set; get; }
|
||||
public int MRBNumber { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UserID { get; set; }
|
||||
// extrafield
|
||||
public string FullName { get; set; }
|
||||
public string UploadDate { get; set; }
|
||||
public string Path { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ContainmentActionObj
|
||||
{
|
||||
public int ContainmentActionID { get; set; }
|
||||
public int MRBNumber { get; set; }
|
||||
public string ContainmentAction { get; set; }
|
||||
public int ResponsibilityOwnerID { get; set; }
|
||||
public int CurrentResponsibilityOwnerID { get; set; }
|
||||
public string ResponsibilityOwner { get; set; }
|
||||
|
||||
//[DataType(DataType.Date)]
|
||||
public DateTime? ECD { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? ImplementedDate { get; set; }
|
||||
}
|
||||
|
||||
public class SPN_MRB
|
||||
{
|
||||
public int MRBNumber;
|
||||
public char? DispoType;
|
||||
}
|
||||
}
|
85
Fab2ApprovalSystem-Copy/Models/PartsRequestModels.cs
Normal file
85
Fab2ApprovalSystem-Copy/Models/PartsRequestModels.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class PartsRequest
|
||||
{
|
||||
public int PRNumber { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
public DateTime CreateDate { get; set; }
|
||||
public DateTime? SubmitDate { get; set; }
|
||||
public DateTime? CloseDate { get; set; }
|
||||
|
||||
public int OriginatorID { get; set; }
|
||||
public int RequestorID { get; set; }
|
||||
public int TechLeadID { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public DateTime? LastUpdateDate { get; set; }
|
||||
|
||||
public int CurrentStep { get; set; }
|
||||
|
||||
public string Status { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class PartsRequestAttachment
|
||||
{
|
||||
public int AttachmentID { set; get; }
|
||||
public int PRNumber { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public string UploadDate { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class PartsRequestAttachmentList
|
||||
{
|
||||
public int AttachmentID { set; get; }
|
||||
public int PRNumber { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public string UploadDate { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
|
||||
public class PartsRequestList
|
||||
{
|
||||
public int PRNumber { get; set; }
|
||||
public string Title { get; set; }
|
||||
public DateTime CreateDate { get; set; }
|
||||
public DateTime SubmitDate { get; set; }
|
||||
public DateTime CloseDate { get; set; }
|
||||
public string Originator { get; set; }
|
||||
public string Requestor { get; set; }
|
||||
public string TechLead { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string PendingApprovers { get; set; }
|
||||
}
|
||||
|
||||
public class MyPartsRequestList
|
||||
{
|
||||
public int PRNumber { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DateTime CreateDate { get; set; }
|
||||
public DateTime? SubmitDate { get; set; }
|
||||
public DateTime? CloseDate { get; set; }
|
||||
public string Originator { get; set; }
|
||||
public string Requestor { get; set; }
|
||||
public string TechLead { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string PendingApprovers { get; set; }
|
||||
public string WorkFlowStepName { get; set; }
|
||||
}
|
||||
|
||||
}
|
68
Fab2ApprovalSystem-Copy/Models/ProductViewModel.cs
Normal file
68
Fab2ApprovalSystem-Copy/Models/ProductViewModel.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class ProductViewModel
|
||||
{
|
||||
[ScaffoldColumn(false)]
|
||||
public int ProductID
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
[DisplayName("Product name")]
|
||||
public string ProductName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
[DisplayName("Unit price")]
|
||||
[DataType(DataType.Currency)]
|
||||
[Range(0, int.MaxValue)]
|
||||
public decimal UnitPrice
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
[DisplayName("Units in stock")]
|
||||
[DataType("Integer")]
|
||||
[Range(0, int.MaxValue)]
|
||||
public int UnitsInStock
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool Discontinued
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DisplayName("Last supply")]
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime LastSupply
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataType("Integer")]
|
||||
public int UnitsOnOrder
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
20
Fab2ApprovalSystem-Copy/Models/TECNNotificationsUser.cs
Normal file
20
Fab2ApprovalSystem-Copy/Models/TECNNotificationsUser.cs
Normal file
@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class TECNNotificationsUser
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
15
Fab2ApprovalSystem-Copy/Models/TestModels.cs
Normal file
15
Fab2ApprovalSystem-Copy/Models/TestModels.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class TestModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<string> Countries { get; set; }
|
||||
|
||||
}
|
||||
}
|
59
Fab2ApprovalSystem-Copy/Models/Training.cs
Normal file
59
Fab2ApprovalSystem-Copy/Models/Training.cs
Normal file
@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
|
||||
public partial class Training
|
||||
{
|
||||
public int TrainingID { get; set; }
|
||||
public int ECN { get; set; }
|
||||
public Nullable<System.DateTime> StartedDate { get; set; }
|
||||
public Nullable<System.DateTime> CompletedDate { get; set; }
|
||||
public Nullable<bool> Status { get; set; }
|
||||
public Nullable<bool> Deleted { get; set; }
|
||||
public Nullable<System.DateTime> DeletedDate { get; set; }
|
||||
[NotMapped]
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
ECN_DMO ecnDMO = new ECN_DMO();
|
||||
string ECNTitle = ecnDMO.GetECN(ECN).Title;
|
||||
|
||||
return ECNTitle;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string ECNTrainingGroups
|
||||
{
|
||||
get
|
||||
{
|
||||
ECN_DMO ecnDMO = new ECN_DMO();
|
||||
TrainingDMO trainingDMO = new TrainingDMO();
|
||||
ECN ecn = ecnDMO.GetECN(ECN);
|
||||
List<int> trainingGroupIDs = trainingDMO.GetECNAssignedTrainingGroups(ECN);
|
||||
|
||||
string groupNames = "";
|
||||
|
||||
foreach (int groupId in trainingGroupIDs)
|
||||
{
|
||||
string groupName = trainingDMO.GetTrainingGroupByID(groupId).TrainingGroupName;
|
||||
groupNames += groupName + ",";
|
||||
}
|
||||
return groupNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
Fab2ApprovalSystem-Copy/Models/TrainingAssignment.cs
Normal file
28
Fab2ApprovalSystem-Copy/Models/TrainingAssignment.cs
Normal file
@ -0,0 +1,28 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class TrainingAssignment
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public Nullable<System.DateTime> DateAssigned { get; set; }
|
||||
public Nullable<System.DateTime> DateCompleted { get; set; }
|
||||
public int TrainingID { get; set; }
|
||||
public bool status { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public Nullable<bool> Deleted { get; set; }
|
||||
public Nullable<System.DateTime> DeletedDate { get; set; }
|
||||
public Nullable<System.DateTime> LastNotification { get; set; }
|
||||
}
|
||||
}
|
37
Fab2ApprovalSystem-Copy/Models/TrainingDB.Context.cs
Normal file
37
Fab2ApprovalSystem-Copy/Models/TrainingDB.Context.cs
Normal file
@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class FabApprovalTrainingEntities : DbContext
|
||||
{
|
||||
public FabApprovalTrainingEntities()
|
||||
: base("name=FabApprovalTrainingEntities")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public virtual DbSet<TrainingGroupMember> TrainingGroupMembers { get; set; }
|
||||
public virtual DbSet<TrainingGroup> TrainingGroups { get; set; }
|
||||
public virtual DbSet<TrainingAssignment> TrainingAssignments { get; set; }
|
||||
public virtual DbSet<ECNTrainingBy> ECNTrainingBies { get; set; }
|
||||
public virtual DbSet<TrainingDocAck> TrainingDocAcks { get; set; }
|
||||
public virtual DbSet<Training> Trainings { get; set; }
|
||||
public virtual DbSet<TrainingReportUser> TrainingReportUsers { get; set; }
|
||||
public virtual DbSet<TECNNotificationsUser> TECNNotificationsUsers { get; set; }
|
||||
}
|
||||
}
|
636
Fab2ApprovalSystem-Copy/Models/TrainingDB.Context.tt
Normal file
636
Fab2ApprovalSystem-Copy/Models/TrainingDB.Context.tt
Normal file
@ -0,0 +1,636 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"TrainingDB.edmx";
|
||||
var textTransform = DynamicTextTransformation.Create(this);
|
||||
var code = new CodeGenerationTools(this);
|
||||
var ef = new MetadataTools(this);
|
||||
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
|
||||
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
|
||||
var itemCollection = loader.CreateEdmItemCollection(inputFile);
|
||||
var modelNamespace = loader.GetModelNamespace(inputFile);
|
||||
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
|
||||
|
||||
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
|
||||
if (container == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
#>
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
|
||||
//
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
<#
|
||||
|
||||
var codeNamespace = code.VsNamespaceSuggestion();
|
||||
if (!String.IsNullOrEmpty(codeNamespace))
|
||||
{
|
||||
#>
|
||||
namespace <#=code.EscapeNamespace(codeNamespace)#>
|
||||
{
|
||||
<#
|
||||
PushIndent(" ");
|
||||
}
|
||||
|
||||
#>
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
<#
|
||||
if (container.FunctionImports.Any())
|
||||
{
|
||||
#>
|
||||
using System.Data.Entity.Core.Objects;
|
||||
using System.Linq;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
|
||||
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
|
||||
{
|
||||
public <#=code.Escape(container)#>()
|
||||
: base("name=<#=container.Name#>")
|
||||
{
|
||||
<#
|
||||
if (!loader.IsLazyLoadingEnabled(container))
|
||||
{
|
||||
#>
|
||||
this.Configuration.LazyLoadingEnabled = false;
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
|
||||
{
|
||||
// Note: the DbSet members are defined below such that the getter and
|
||||
// setter always have the same accessibility as the DbSet definition
|
||||
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
<#
|
||||
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.DbSet(entitySet)#>
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var edmFunction in container.FunctionImports)
|
||||
{
|
||||
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
|
||||
if (!String.IsNullOrEmpty(codeNamespace))
|
||||
{
|
||||
PopIndent();
|
||||
#>
|
||||
}
|
||||
<#
|
||||
}
|
||||
#>
|
||||
<#+
|
||||
|
||||
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
if (typeMapper.IsComposable(edmFunction))
|
||||
{
|
||||
#>
|
||||
|
||||
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
|
||||
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
|
||||
{
|
||||
<#+
|
||||
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
|
||||
#>
|
||||
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
|
||||
}
|
||||
<#+
|
||||
}
|
||||
else
|
||||
{
|
||||
#>
|
||||
|
||||
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
|
||||
{
|
||||
<#+
|
||||
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
|
||||
#>
|
||||
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
|
||||
}
|
||||
<#+
|
||||
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
|
||||
{
|
||||
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
|
||||
{
|
||||
#>
|
||||
var <#=name#> = <#=isNotNull#> ?
|
||||
<#=notNullInit#> :
|
||||
<#=nullInit#>;
|
||||
|
||||
<#+
|
||||
}
|
||||
|
||||
public const string TemplateId = "CSharp_DbContext_Context_EF6";
|
||||
|
||||
public class CodeStringGenerator
|
||||
{
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly TypeMapper _typeMapper;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(typeMapper, "typeMapper");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
|
||||
_code = code;
|
||||
_typeMapper = typeMapper;
|
||||
_ef = ef;
|
||||
}
|
||||
|
||||
public string Property(EdmProperty edmProperty)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
Accessibility.ForProperty(edmProperty),
|
||||
_typeMapper.GetTypeName(edmProperty.TypeUsage),
|
||||
_code.Escape(edmProperty),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
|
||||
}
|
||||
|
||||
public string NavigationProperty(NavigationProperty navProp)
|
||||
{
|
||||
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
|
||||
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
|
||||
_code.Escape(navProp),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
|
||||
}
|
||||
|
||||
public string AccessibilityAndVirtual(string accessibility)
|
||||
{
|
||||
return accessibility + (accessibility != "private" ? " virtual" : "");
|
||||
}
|
||||
|
||||
public string EntityClassOpening(EntityType entity)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1}partial class {2}{3}",
|
||||
Accessibility.ForType(entity),
|
||||
_code.SpaceAfter(_code.AbstractOption(entity)),
|
||||
_code.Escape(entity),
|
||||
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
|
||||
}
|
||||
|
||||
public string EnumOpening(SimpleType enumType)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} enum {1} : {2}",
|
||||
Accessibility.ForType(enumType),
|
||||
_code.Escape(enumType),
|
||||
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
|
||||
}
|
||||
|
||||
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
|
||||
{
|
||||
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
|
||||
{
|
||||
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
|
||||
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
|
||||
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
|
||||
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
|
||||
}
|
||||
}
|
||||
|
||||
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} IQueryable<{1}> {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
_code.Escape(edmFunction),
|
||||
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
|
||||
}
|
||||
|
||||
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
edmFunction.NamespaceName,
|
||||
edmFunction.Name,
|
||||
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
|
||||
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
|
||||
}
|
||||
|
||||
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
|
||||
if (includeMergeOption)
|
||||
{
|
||||
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
_code.Escape(edmFunction),
|
||||
paramList);
|
||||
}
|
||||
|
||||
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
|
||||
if (includeMergeOption)
|
||||
{
|
||||
callParams = ", mergeOption" + callParams;
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
|
||||
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
edmFunction.Name,
|
||||
callParams);
|
||||
}
|
||||
|
||||
public string DbSet(EntitySet entitySet)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
|
||||
Accessibility.ForReadOnlyProperty(entitySet),
|
||||
_typeMapper.GetTypeName(entitySet.ElementType),
|
||||
_code.Escape(entitySet));
|
||||
}
|
||||
|
||||
public string DbSetInitializer(EntitySet entitySet)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} = Set<{1}>();",
|
||||
_code.Escape(entitySet),
|
||||
_typeMapper.GetTypeName(entitySet.ElementType));
|
||||
}
|
||||
|
||||
public string UsingDirectives(bool inHeader, bool includeCollections = true)
|
||||
{
|
||||
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
|
||||
? string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}using System;{1}" +
|
||||
"{2}",
|
||||
inHeader ? Environment.NewLine : "",
|
||||
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
|
||||
inHeader ? "" : Environment.NewLine)
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeMapper
|
||||
{
|
||||
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
|
||||
|
||||
private readonly System.Collections.IList _errors;
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public static string FixNamespaces(string typeName)
|
||||
{
|
||||
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
|
||||
}
|
||||
|
||||
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
ArgumentNotNull(errors, "errors");
|
||||
|
||||
_code = code;
|
||||
_ef = ef;
|
||||
_errors = errors;
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, string modelNamespace)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
|
||||
{
|
||||
if (edmType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var collectionType = edmType as CollectionType;
|
||||
if (collectionType != null)
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
|
||||
}
|
||||
|
||||
var typeName = _code.Escape(edmType.MetadataProperties
|
||||
.Where(p => p.Name == ExternalTypeNameAttributeName)
|
||||
.Select(p => (string)p.Value)
|
||||
.FirstOrDefault())
|
||||
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
|
||||
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
|
||||
_code.Escape(edmType));
|
||||
|
||||
if (edmType is StructuralType)
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
|
||||
if (edmType is SimpleType)
|
||||
{
|
||||
var clrType = UnderlyingClrType(edmType);
|
||||
if (!IsEnumType(edmType))
|
||||
{
|
||||
typeName = _code.Escape(clrType);
|
||||
}
|
||||
|
||||
typeName = FixNamespaces(typeName);
|
||||
|
||||
return clrType.IsValueType && isNullable == true ?
|
||||
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
|
||||
typeName;
|
||||
}
|
||||
|
||||
throw new ArgumentException("edmType");
|
||||
}
|
||||
|
||||
public Type UnderlyingClrType(EdmType edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
var primitiveType = edmType as PrimitiveType;
|
||||
if (primitiveType != null)
|
||||
{
|
||||
return primitiveType.ClrEquivalentType;
|
||||
}
|
||||
|
||||
if (IsEnumType(edmType))
|
||||
{
|
||||
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
|
||||
}
|
||||
|
||||
return typeof(object);
|
||||
}
|
||||
|
||||
public object GetEnumMemberValue(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var valueProperty = enumMember.GetType().GetProperty("Value");
|
||||
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public string GetEnumMemberName(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var nameProperty = enumMember.GetType().GetProperty("Name");
|
||||
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var membersProperty = enumType.GetType().GetProperty("Members");
|
||||
return membersProperty != null
|
||||
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
|
||||
: Enumerable.Empty<MetadataItem>();
|
||||
}
|
||||
|
||||
public bool EnumIsFlags(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
|
||||
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public bool IsEnumType(GlobalItem edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
return edmType.GetType().Name == "EnumType";
|
||||
}
|
||||
|
||||
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public string CreateLiteral(object value)
|
||||
{
|
||||
if (value == null || value.GetType() != typeof(TimeSpan))
|
||||
{
|
||||
return _code.CreateLiteral(value);
|
||||
}
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
|
||||
}
|
||||
|
||||
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
|
||||
{
|
||||
ArgumentNotNull(types, "types");
|
||||
ArgumentNotNull(sourceFile, "sourceFile");
|
||||
|
||||
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
if (types.Any(item => !hash.Add(item)))
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(sourceFile, -1, -1, "6023",
|
||||
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return GetItemsToGenerate<SimpleType>(itemCollection)
|
||||
.Where(e => IsEnumType(e));
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
|
||||
{
|
||||
return itemCollection
|
||||
.OfType<T>()
|
||||
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
|
||||
.OrderBy(i => i.Name);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return itemCollection
|
||||
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
|
||||
.Select(g => GetGlobalItemName(g));
|
||||
}
|
||||
|
||||
public string GetGlobalItemName(GlobalItem item)
|
||||
{
|
||||
if (item is EdmType)
|
||||
{
|
||||
return ((EdmType)item).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((EntityContainer)item).Name;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
|
||||
}
|
||||
|
||||
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
|
||||
return returnParamsProperty == null
|
||||
? edmFunction.ReturnParameter
|
||||
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool IsComposable(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
|
||||
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
|
||||
}
|
||||
|
||||
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
|
||||
{
|
||||
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
}
|
||||
|
||||
public TypeUsage GetReturnType(EdmFunction edmFunction)
|
||||
{
|
||||
var returnParam = GetReturnParameter(edmFunction);
|
||||
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
|
||||
}
|
||||
|
||||
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
|
||||
{
|
||||
var returnType = GetReturnType(edmFunction);
|
||||
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ArgumentNotNull<T>(T arg, string name) where T : class
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
#>
|
10
Fab2ApprovalSystem-Copy/Models/TrainingDB.Designer.cs
generated
Normal file
10
Fab2ApprovalSystem-Copy/Models/TrainingDB.Designer.cs
generated
Normal file
@ -0,0 +1,10 @@
|
||||
// T4 code generation is enabled for model 'C:\Users\Ouellette\Desktop\VSProjects\Mesa_FI\Fab2ApprovalSystem\Fab2ApprovalSystem-branch-Prod20190626\Fab2ApprovalSystem\Models\TrainingDB.edmx'.
|
||||
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
|
||||
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
|
||||
// is open in the designer.
|
||||
|
||||
// If no context and entity classes have been generated, it may be because you created an empty model but
|
||||
// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
|
||||
// classes for your model, open the model in the designer, right-click on the designer surface, and
|
||||
// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
|
||||
// Item...'.
|
9
Fab2ApprovalSystem-Copy/Models/TrainingDB.cs
Normal file
9
Fab2ApprovalSystem-Copy/Models/TrainingDB.cs
Normal file
@ -0,0 +1,9 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
334
Fab2ApprovalSystem-Copy/Models/TrainingDB.edmx
Normal file
334
Fab2ApprovalSystem-Copy/Models/TrainingDB.edmx
Normal file
@ -0,0 +1,334 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- EF Runtime content -->
|
||||
<edmx:Runtime>
|
||||
<!-- SSDL content -->
|
||||
<edmx:StorageModels>
|
||||
<Schema Namespace="FabApprovalTrainingModels.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
|
||||
<!--Errors Found During Generation:
|
||||
warning 6002: The table/view 'FabApprovalSystem.dbo.ECNTrainingBy' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.-->
|
||||
<EntityType Name="ECNTrainingBy">
|
||||
<Key>
|
||||
<PropertyRef Name="ECNNumber" />
|
||||
<PropertyRef Name="AcknowledgementTrainingByID" />
|
||||
</Key>
|
||||
<Property Name="ECNNumber" Type="int" Nullable="false" />
|
||||
<Property Name="AcknowledgementTrainingByID" Type="int" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="TECNNotificationsUsers">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="UserId" Type="int" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="Training">
|
||||
<Key>
|
||||
<PropertyRef Name="TrainingID" />
|
||||
</Key>
|
||||
<Property Name="TrainingID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="ECN" Type="int" Nullable="false" />
|
||||
<Property Name="StartedDate" Type="datetime" />
|
||||
<Property Name="CompletedDate" Type="datetime" />
|
||||
<Property Name="Status" Type="bit" />
|
||||
<Property Name="Deleted" Type="bit" />
|
||||
<Property Name="DeletedDate" Type="datetime" />
|
||||
</EntityType>
|
||||
<EntityType Name="TrainingAssignments">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="UserID" Type="int" Nullable="false" />
|
||||
<Property Name="DateAssigned" Type="datetime" />
|
||||
<Property Name="DateCompleted" Type="datetime" />
|
||||
<Property Name="TrainingID" Type="int" Nullable="false" />
|
||||
<Property Name="status" Type="bit" Nullable="false" />
|
||||
<Property Name="FullName" Type="varchar" MaxLength="100" />
|
||||
<Property Name="Deleted" Type="bit" />
|
||||
<Property Name="DeletedDate" Type="datetime" />
|
||||
<Property Name="LastNotification" Type="datetime" />
|
||||
</EntityType>
|
||||
<EntityType Name="TrainingDocAcks">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="TrainingAssignmentID" Type="int" Nullable="false" />
|
||||
<Property Name="ECNNumber" Type="int" Nullable="false" />
|
||||
<Property Name="AttachmentID" Type="int" Nullable="false" />
|
||||
<Property Name="DateReviewed" Type="date" />
|
||||
<Property Name="Reviewed" Type="bit" />
|
||||
<Property Name="FileName" Type="varchar" MaxLength="300" />
|
||||
<Property Name="Deleted" Type="bit" />
|
||||
<Property Name="DeletedDate" Type="datetime" />
|
||||
</EntityType>
|
||||
<!--Errors Found During Generation:
|
||||
warning 6002: The table/view 'FabApprovalSystem.dbo.TrainingGroupMembers' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.-->
|
||||
<EntityType Name="TrainingGroupMembers">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
<PropertyRef Name="TrainingGroupID" />
|
||||
<PropertyRef Name="UserID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="TrainingGroupID" Type="int" Nullable="false" />
|
||||
<Property Name="UserID" Type="int" Nullable="false" />
|
||||
<Property Name="FullName" Type="varchar" MaxLength="100" />
|
||||
</EntityType>
|
||||
<!--Errors Found During Generation:
|
||||
warning 6002: The table/view 'FabApprovalSystem.dbo.TrainingGroups' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.-->
|
||||
<EntityType Name="TrainingGroups">
|
||||
<Key>
|
||||
<PropertyRef Name="TrainingGroupID" />
|
||||
<PropertyRef Name="TrainingGroupName" />
|
||||
</Key>
|
||||
<Property Name="TrainingGroupID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="TrainingGroupName" Type="varchar" MaxLength="50" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="TrainingReportUsers">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="UserId" Type="int" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="FabApprovalTrainingModelsStoreContainer">
|
||||
<EntitySet Name="TECNNotificationsUsers" EntityType="Self.TECNNotificationsUsers" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Training" EntityType="Self.Training" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="TrainingAssignments" EntityType="Self.TrainingAssignments" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="TrainingDocAcks" EntityType="Self.TrainingDocAcks" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="TrainingReportUsers" EntityType="Self.TrainingReportUsers" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="ECNTrainingBy" EntityType="Self.ECNTrainingBy" store:Type="Tables" store:Schema="dbo">
|
||||
<DefiningQuery>SELECT
|
||||
[ECNTrainingBy].[ECNNumber] AS [ECNNumber],
|
||||
[ECNTrainingBy].[AcknowledgementTrainingByID] AS [AcknowledgementTrainingByID]
|
||||
FROM [dbo].[ECNTrainingBy] AS [ECNTrainingBy]</DefiningQuery>
|
||||
</EntitySet>
|
||||
<EntitySet Name="TrainingGroupMembers" EntityType="Self.TrainingGroupMembers" store:Type="Tables" store:Schema="dbo">
|
||||
<DefiningQuery>SELECT
|
||||
[TrainingGroupMembers].[ID] AS [ID],
|
||||
[TrainingGroupMembers].[TrainingGroupID] AS [TrainingGroupID],
|
||||
[TrainingGroupMembers].[UserID] AS [UserID],
|
||||
[TrainingGroupMembers].[FullName] AS [FullName]
|
||||
FROM [dbo].[TrainingGroupMembers] AS [TrainingGroupMembers]</DefiningQuery>
|
||||
</EntitySet>
|
||||
<EntitySet Name="TrainingGroups" EntityType="Self.TrainingGroups" store:Type="Tables" store:Schema="dbo">
|
||||
<DefiningQuery>SELECT
|
||||
[TrainingGroups].[TrainingGroupID] AS [TrainingGroupID],
|
||||
[TrainingGroups].[TrainingGroupName] AS [TrainingGroupName]
|
||||
FROM [dbo].[TrainingGroups] AS [TrainingGroups]</DefiningQuery>
|
||||
</EntitySet>
|
||||
</EntityContainer>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="FabApprovalTrainingModels" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
|
||||
<EntityType Name="TrainingGroupMember">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
<PropertyRef Name="TrainingGroupID" />
|
||||
<PropertyRef Name="UserID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="TrainingGroupID" Type="Int32" Nullable="false" />
|
||||
<Property Name="UserID" Type="Int32" Nullable="false" />
|
||||
<Property Name="FullName" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="TrainingGroup">
|
||||
<Key>
|
||||
<PropertyRef Name="TrainingGroupID" />
|
||||
<PropertyRef Name="TrainingGroupName" />
|
||||
</Key>
|
||||
<Property Name="TrainingGroupID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="TrainingGroupName" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="FabApprovalTrainingEntities" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="TrainingGroupMembers" EntityType="Self.TrainingGroupMember" />
|
||||
<EntitySet Name="TrainingGroups" EntityType="Self.TrainingGroup" />
|
||||
<EntitySet Name="TrainingAssignments" EntityType="FabApprovalTrainingModels.TrainingAssignment" />
|
||||
<EntitySet Name="ECNTrainingBies" EntityType="FabApprovalTrainingModels.ECNTrainingBy" />
|
||||
<EntitySet Name="TrainingDocAcks" EntityType="FabApprovalTrainingModels.TrainingDocAck" />
|
||||
<EntitySet Name="Trainings" EntityType="FabApprovalTrainingModels.Training" />
|
||||
<EntitySet Name="TrainingReportUsers" EntityType="FabApprovalTrainingModels.TrainingReportUser" />
|
||||
<EntitySet Name="TECNNotificationsUsers" EntityType="FabApprovalTrainingModels.TECNNotificationsUser" />
|
||||
</EntityContainer>
|
||||
<EntityType Name="TrainingAssignment">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="UserID" Type="Int32" Nullable="false" />
|
||||
<Property Name="DateAssigned" Type="DateTime" Precision="3" />
|
||||
<Property Name="DateCompleted" Type="DateTime" Precision="3" />
|
||||
<Property Name="TrainingID" Type="Int32" Nullable="false" />
|
||||
<Property Name="status" Type="Boolean" Nullable="false" />
|
||||
<Property Name="FullName" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="Deleted" Type="Boolean" />
|
||||
<Property Name="DeletedDate" Type="DateTime" Precision="3" />
|
||||
<Property Name="LastNotification" Type="DateTime" Precision="3" />
|
||||
</EntityType>
|
||||
<EntityType Name="ECNTrainingBy">
|
||||
<Key>
|
||||
<PropertyRef Name="ECNNumber" />
|
||||
<PropertyRef Name="AcknowledgementTrainingByID" />
|
||||
</Key>
|
||||
<Property Name="ECNNumber" Type="Int32" Nullable="false" />
|
||||
<Property Name="AcknowledgementTrainingByID" Type="Int32" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="TrainingDocAck">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="TrainingAssignmentID" Type="Int32" Nullable="false" />
|
||||
<Property Name="ECNNumber" Type="Int32" Nullable="false" />
|
||||
<Property Name="AttachmentID" Type="Int32" Nullable="false" />
|
||||
<Property Name="DateReviewed" Type="DateTime" Precision="0" />
|
||||
<Property Name="Reviewed" Type="Boolean" />
|
||||
<Property Name="FileName" Type="String" MaxLength="300" FixedLength="false" Unicode="false" />
|
||||
<Property Name="Deleted" Type="Boolean" />
|
||||
<Property Name="DeletedDate" Type="DateTime" Precision="3" />
|
||||
</EntityType>
|
||||
<EntityType Name="Training">
|
||||
<Key>
|
||||
<PropertyRef Name="TrainingID" />
|
||||
</Key>
|
||||
<Property Name="TrainingID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="ECN" Type="Int32" Nullable="false" />
|
||||
<Property Name="StartedDate" Type="DateTime" Precision="3" />
|
||||
<Property Name="CompletedDate" Type="DateTime" Precision="3" />
|
||||
<Property Name="Status" Type="Boolean" />
|
||||
<Property Name="Deleted" Type="Boolean" />
|
||||
<Property Name="DeletedDate" Type="DateTime" Precision="3" />
|
||||
</EntityType>
|
||||
<EntityType Name="TrainingReportUser">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="UserId" Type="Int32" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="TECNNotificationsUser">
|
||||
<Key>
|
||||
<PropertyRef Name="ID" />
|
||||
</Key>
|
||||
<Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="UserId" Type="Int32" Nullable="false" />
|
||||
</EntityType>
|
||||
</Schema>
|
||||
</edmx:ConceptualModels>
|
||||
<!-- C-S mapping content -->
|
||||
<edmx:Mappings>
|
||||
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
|
||||
<EntityContainerMapping StorageEntityContainer="FabApprovalTrainingModelsStoreContainer" CdmEntityContainer="FabApprovalTrainingEntities">
|
||||
<EntitySetMapping Name="TrainingGroupMembers">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.TrainingGroupMember">
|
||||
<MappingFragment StoreEntitySet="TrainingGroupMembers">
|
||||
<ScalarProperty Name="FullName" ColumnName="FullName" />
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
<ScalarProperty Name="TrainingGroupID" ColumnName="TrainingGroupID" />
|
||||
<ScalarProperty Name="UserID" ColumnName="UserID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="TrainingGroups">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.TrainingGroup">
|
||||
<MappingFragment StoreEntitySet="TrainingGroups">
|
||||
<ScalarProperty Name="TrainingGroupID" ColumnName="TrainingGroupID" />
|
||||
<ScalarProperty Name="TrainingGroupName" ColumnName="TrainingGroupName" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="TrainingAssignments">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.TrainingAssignment">
|
||||
<MappingFragment StoreEntitySet="TrainingAssignments">
|
||||
<ScalarProperty Name="LastNotification" ColumnName="LastNotification" />
|
||||
<ScalarProperty Name="DeletedDate" ColumnName="DeletedDate" />
|
||||
<ScalarProperty Name="Deleted" ColumnName="Deleted" />
|
||||
<ScalarProperty Name="FullName" ColumnName="FullName" />
|
||||
<ScalarProperty Name="status" ColumnName="status" />
|
||||
<ScalarProperty Name="TrainingID" ColumnName="TrainingID" />
|
||||
<ScalarProperty Name="DateCompleted" ColumnName="DateCompleted" />
|
||||
<ScalarProperty Name="DateAssigned" ColumnName="DateAssigned" />
|
||||
<ScalarProperty Name="UserID" ColumnName="UserID" />
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="ECNTrainingBies">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.ECNTrainingBy">
|
||||
<MappingFragment StoreEntitySet="ECNTrainingBy">
|
||||
<ScalarProperty Name="AcknowledgementTrainingByID" ColumnName="AcknowledgementTrainingByID" />
|
||||
<ScalarProperty Name="ECNNumber" ColumnName="ECNNumber" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="TrainingDocAcks">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.TrainingDocAck">
|
||||
<MappingFragment StoreEntitySet="TrainingDocAcks">
|
||||
<ScalarProperty Name="DeletedDate" ColumnName="DeletedDate" />
|
||||
<ScalarProperty Name="Deleted" ColumnName="Deleted" />
|
||||
<ScalarProperty Name="FileName" ColumnName="FileName" />
|
||||
<ScalarProperty Name="Reviewed" ColumnName="Reviewed" />
|
||||
<ScalarProperty Name="DateReviewed" ColumnName="DateReviewed" />
|
||||
<ScalarProperty Name="AttachmentID" ColumnName="AttachmentID" />
|
||||
<ScalarProperty Name="ECNNumber" ColumnName="ECNNumber" />
|
||||
<ScalarProperty Name="TrainingAssignmentID" ColumnName="TrainingAssignmentID" />
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="Trainings">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.Training">
|
||||
<MappingFragment StoreEntitySet="Training">
|
||||
<ScalarProperty Name="DeletedDate" ColumnName="DeletedDate" />
|
||||
<ScalarProperty Name="Deleted" ColumnName="Deleted" />
|
||||
<ScalarProperty Name="Status" ColumnName="Status" />
|
||||
<ScalarProperty Name="CompletedDate" ColumnName="CompletedDate" />
|
||||
<ScalarProperty Name="StartedDate" ColumnName="StartedDate" />
|
||||
<ScalarProperty Name="ECN" ColumnName="ECN" />
|
||||
<ScalarProperty Name="TrainingID" ColumnName="TrainingID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="TrainingReportUsers">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.TrainingReportUser">
|
||||
<MappingFragment StoreEntitySet="TrainingReportUsers">
|
||||
<ScalarProperty Name="UserId" ColumnName="UserId" />
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="TECNNotificationsUsers">
|
||||
<EntityTypeMapping TypeName="FabApprovalTrainingModels.TECNNotificationsUser">
|
||||
<MappingFragment StoreEntitySet="TECNNotificationsUsers">
|
||||
<ScalarProperty Name="UserId" ColumnName="UserId" />
|
||||
<ScalarProperty Name="ID" ColumnName="ID" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
</EntityContainerMapping>
|
||||
</Mapping>
|
||||
</edmx:Mappings>
|
||||
</edmx:Runtime>
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<Connection>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
|
||||
</DesignerInfoPropertySet>
|
||||
</Connection>
|
||||
<Options>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="ValidateOnBuild" Value="true" />
|
||||
<DesignerProperty Name="EnablePluralization" Value="true" />
|
||||
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
|
||||
<DesignerProperty Name="UseLegacyProvider" Value="false" />
|
||||
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
|
||||
</DesignerInfoPropertySet>
|
||||
</Options>
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<Diagrams></Diagrams>
|
||||
</Designer>
|
||||
</edmx:Edmx>
|
19
Fab2ApprovalSystem-Copy/Models/TrainingDB.edmx.diagram
Normal file
19
Fab2ApprovalSystem-Copy/Models/TrainingDB.edmx.diagram
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
<Diagram DiagramId="b180f74eced94d7a808d54ab573d5a13" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.TrainingGroupMember" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.TrainingGroup" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.TrainingAssignment" Width="1.5" PointX="2.75" PointY="3.75" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.ECNTrainingBy" Width="1.5" PointX="5.375" PointY="0.75" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.TrainingDocAck" Width="1.5" PointX="8" PointY="2.5" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.Training" Width="1.5" PointX="5.625" PointY="3.5" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.TrainingReportUser" Width="1.5" PointX="10.25" PointY="2.5" />
|
||||
<EntityTypeShape EntityType="FabApprovalTrainingModels.TECNNotificationsUser" Width="1.5" PointX="5.375" PointY="6.75" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
733
Fab2ApprovalSystem-Copy/Models/TrainingDB.tt
Normal file
733
Fab2ApprovalSystem-Copy/Models/TrainingDB.tt
Normal file
@ -0,0 +1,733 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"TrainingDB.edmx";
|
||||
var textTransform = DynamicTextTransformation.Create(this);
|
||||
var code = new CodeGenerationTools(this);
|
||||
var ef = new MetadataTools(this);
|
||||
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
|
||||
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
|
||||
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
|
||||
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
|
||||
|
||||
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
WriteHeader(codeStringGenerator, fileManager);
|
||||
|
||||
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
|
||||
{
|
||||
fileManager.StartNewFile(entity.Name + ".cs");
|
||||
BeginNamespace(code);
|
||||
#>
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
|
||||
<#=codeStringGenerator.EntityClassOpening(entity)#>
|
||||
{
|
||||
<#
|
||||
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
|
||||
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
|
||||
var complexProperties = typeMapper.GetComplexProperties(entity);
|
||||
|
||||
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public <#=code.Escape(entity)#>()
|
||||
{
|
||||
<#
|
||||
foreach (var edmProperty in propertiesWithDefaultValues)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var navigationProperty in collectionNavigationProperties)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var complexProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
<#
|
||||
}
|
||||
|
||||
var simpleProperties = typeMapper.GetSimpleProperties(entity);
|
||||
if (simpleProperties.Any())
|
||||
{
|
||||
foreach (var edmProperty in simpleProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(edmProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
|
||||
if (complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach(var complexProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(complexProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
|
||||
var navigationProperties = typeMapper.GetNavigationProperties(entity);
|
||||
if (navigationProperties.Any())
|
||||
{
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach (var navigationProperty in navigationProperties)
|
||||
{
|
||||
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
|
||||
{
|
||||
#>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
<#
|
||||
}
|
||||
#>
|
||||
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
EndNamespace(code);
|
||||
}
|
||||
|
||||
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
|
||||
{
|
||||
fileManager.StartNewFile(complex.Name + ".cs");
|
||||
BeginNamespace(code);
|
||||
#>
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
|
||||
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
|
||||
{
|
||||
<#
|
||||
var complexProperties = typeMapper.GetComplexProperties(complex);
|
||||
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
|
||||
|
||||
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
public <#=code.Escape(complex)#>()
|
||||
{
|
||||
<#
|
||||
foreach (var edmProperty in propertiesWithDefaultValues)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
|
||||
<#
|
||||
}
|
||||
|
||||
foreach (var complexProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
<#
|
||||
}
|
||||
|
||||
var simpleProperties = typeMapper.GetSimpleProperties(complex);
|
||||
if (simpleProperties.Any())
|
||||
{
|
||||
foreach(var edmProperty in simpleProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(edmProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
|
||||
if (complexProperties.Any())
|
||||
{
|
||||
#>
|
||||
|
||||
<#
|
||||
foreach(var edmProperty in complexProperties)
|
||||
{
|
||||
#>
|
||||
<#=codeStringGenerator.Property(edmProperty)#>
|
||||
<#
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
EndNamespace(code);
|
||||
}
|
||||
|
||||
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
|
||||
{
|
||||
fileManager.StartNewFile(enumType.Name + ".cs");
|
||||
BeginNamespace(code);
|
||||
#>
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
|
||||
<#
|
||||
if (typeMapper.EnumIsFlags(enumType))
|
||||
{
|
||||
#>
|
||||
[Flags]
|
||||
<#
|
||||
}
|
||||
#>
|
||||
<#=codeStringGenerator.EnumOpening(enumType)#>
|
||||
{
|
||||
<#
|
||||
var foundOne = false;
|
||||
|
||||
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
|
||||
{
|
||||
foundOne = true;
|
||||
#>
|
||||
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
|
||||
<#
|
||||
}
|
||||
|
||||
if (foundOne)
|
||||
{
|
||||
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
EndNamespace(code);
|
||||
}
|
||||
|
||||
fileManager.Process();
|
||||
|
||||
#>
|
||||
<#+
|
||||
|
||||
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
|
||||
{
|
||||
fileManager.StartHeader();
|
||||
#>
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
|
||||
//
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
|
||||
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
|
||||
<#+
|
||||
fileManager.EndBlock();
|
||||
}
|
||||
|
||||
public void BeginNamespace(CodeGenerationTools code)
|
||||
{
|
||||
var codeNamespace = code.VsNamespaceSuggestion();
|
||||
if (!String.IsNullOrEmpty(codeNamespace))
|
||||
{
|
||||
#>
|
||||
namespace <#=code.EscapeNamespace(codeNamespace)#>
|
||||
{
|
||||
<#+
|
||||
PushIndent(" ");
|
||||
}
|
||||
}
|
||||
|
||||
public void EndNamespace(CodeGenerationTools code)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
|
||||
{
|
||||
PopIndent();
|
||||
#>
|
||||
}
|
||||
<#+
|
||||
}
|
||||
}
|
||||
|
||||
public const string TemplateId = "CSharp_DbContext_Types_EF6";
|
||||
|
||||
public class CodeStringGenerator
|
||||
{
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly TypeMapper _typeMapper;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(typeMapper, "typeMapper");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
|
||||
_code = code;
|
||||
_typeMapper = typeMapper;
|
||||
_ef = ef;
|
||||
}
|
||||
|
||||
public string Property(EdmProperty edmProperty)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
Accessibility.ForProperty(edmProperty),
|
||||
_typeMapper.GetTypeName(edmProperty.TypeUsage),
|
||||
_code.Escape(edmProperty),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
|
||||
}
|
||||
|
||||
public string NavigationProperty(NavigationProperty navProp)
|
||||
{
|
||||
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
|
||||
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
|
||||
_code.Escape(navProp),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
|
||||
}
|
||||
|
||||
public string AccessibilityAndVirtual(string accessibility)
|
||||
{
|
||||
return accessibility + (accessibility != "private" ? " virtual" : "");
|
||||
}
|
||||
|
||||
public string EntityClassOpening(EntityType entity)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1}partial class {2}{3}",
|
||||
Accessibility.ForType(entity),
|
||||
_code.SpaceAfter(_code.AbstractOption(entity)),
|
||||
_code.Escape(entity),
|
||||
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
|
||||
}
|
||||
|
||||
public string EnumOpening(SimpleType enumType)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} enum {1} : {2}",
|
||||
Accessibility.ForType(enumType),
|
||||
_code.Escape(enumType),
|
||||
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
|
||||
}
|
||||
|
||||
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
|
||||
{
|
||||
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
|
||||
{
|
||||
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
|
||||
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
|
||||
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
|
||||
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
|
||||
}
|
||||
}
|
||||
|
||||
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} IQueryable<{1}> {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
_code.Escape(edmFunction),
|
||||
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
|
||||
}
|
||||
|
||||
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
|
||||
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
|
||||
edmFunction.NamespaceName,
|
||||
edmFunction.Name,
|
||||
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
|
||||
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
|
||||
}
|
||||
|
||||
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
|
||||
if (includeMergeOption)
|
||||
{
|
||||
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2}({3})",
|
||||
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
|
||||
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
_code.Escape(edmFunction),
|
||||
paramList);
|
||||
}
|
||||
|
||||
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
|
||||
{
|
||||
var parameters = _typeMapper.GetParameters(edmFunction);
|
||||
var returnType = _typeMapper.GetReturnType(edmFunction);
|
||||
|
||||
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
|
||||
if (includeMergeOption)
|
||||
{
|
||||
callParams = ", mergeOption" + callParams;
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
|
||||
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
|
||||
edmFunction.Name,
|
||||
callParams);
|
||||
}
|
||||
|
||||
public string DbSet(EntitySet entitySet)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
|
||||
Accessibility.ForReadOnlyProperty(entitySet),
|
||||
_typeMapper.GetTypeName(entitySet.ElementType),
|
||||
_code.Escape(entitySet));
|
||||
}
|
||||
|
||||
public string UsingDirectives(bool inHeader, bool includeCollections = true)
|
||||
{
|
||||
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
|
||||
? string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}using System;{1}" +
|
||||
"{2}",
|
||||
inHeader ? Environment.NewLine : "",
|
||||
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
|
||||
inHeader ? "" : Environment.NewLine)
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeMapper
|
||||
{
|
||||
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
|
||||
|
||||
private readonly System.Collections.IList _errors;
|
||||
private readonly CodeGenerationTools _code;
|
||||
private readonly MetadataTools _ef;
|
||||
|
||||
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
|
||||
{
|
||||
ArgumentNotNull(code, "code");
|
||||
ArgumentNotNull(ef, "ef");
|
||||
ArgumentNotNull(errors, "errors");
|
||||
|
||||
_code = code;
|
||||
_ef = ef;
|
||||
_errors = errors;
|
||||
}
|
||||
|
||||
public static string FixNamespaces(string typeName)
|
||||
{
|
||||
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
|
||||
}
|
||||
|
||||
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
|
||||
{
|
||||
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, string modelNamespace)
|
||||
{
|
||||
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
|
||||
}
|
||||
|
||||
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
|
||||
{
|
||||
if (edmType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var collectionType = edmType as CollectionType;
|
||||
if (collectionType != null)
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
|
||||
}
|
||||
|
||||
var typeName = _code.Escape(edmType.MetadataProperties
|
||||
.Where(p => p.Name == ExternalTypeNameAttributeName)
|
||||
.Select(p => (string)p.Value)
|
||||
.FirstOrDefault())
|
||||
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
|
||||
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
|
||||
_code.Escape(edmType));
|
||||
|
||||
if (edmType is StructuralType)
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
|
||||
if (edmType is SimpleType)
|
||||
{
|
||||
var clrType = UnderlyingClrType(edmType);
|
||||
if (!IsEnumType(edmType))
|
||||
{
|
||||
typeName = _code.Escape(clrType);
|
||||
}
|
||||
|
||||
typeName = FixNamespaces(typeName);
|
||||
|
||||
return clrType.IsValueType && isNullable == true ?
|
||||
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
|
||||
typeName;
|
||||
}
|
||||
|
||||
throw new ArgumentException("edmType");
|
||||
}
|
||||
|
||||
public Type UnderlyingClrType(EdmType edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
var primitiveType = edmType as PrimitiveType;
|
||||
if (primitiveType != null)
|
||||
{
|
||||
return primitiveType.ClrEquivalentType;
|
||||
}
|
||||
|
||||
if (IsEnumType(edmType))
|
||||
{
|
||||
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
|
||||
}
|
||||
|
||||
return typeof(object);
|
||||
}
|
||||
|
||||
public object GetEnumMemberValue(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var valueProperty = enumMember.GetType().GetProperty("Value");
|
||||
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public string GetEnumMemberName(MetadataItem enumMember)
|
||||
{
|
||||
ArgumentNotNull(enumMember, "enumMember");
|
||||
|
||||
var nameProperty = enumMember.GetType().GetProperty("Name");
|
||||
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
|
||||
}
|
||||
|
||||
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var membersProperty = enumType.GetType().GetProperty("Members");
|
||||
return membersProperty != null
|
||||
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
|
||||
: Enumerable.Empty<MetadataItem>();
|
||||
}
|
||||
|
||||
public bool EnumIsFlags(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
|
||||
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public bool IsEnumType(GlobalItem edmType)
|
||||
{
|
||||
ArgumentNotNull(edmType, "edmType");
|
||||
|
||||
return edmType.GetType().Name == "EnumType";
|
||||
}
|
||||
|
||||
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
|
||||
{
|
||||
ArgumentNotNull(enumType, "enumType");
|
||||
|
||||
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
|
||||
}
|
||||
|
||||
public string CreateLiteral(object value)
|
||||
{
|
||||
if (value == null || value.GetType() != typeof(TimeSpan))
|
||||
{
|
||||
return _code.CreateLiteral(value);
|
||||
}
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
|
||||
}
|
||||
|
||||
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
|
||||
{
|
||||
ArgumentNotNull(types, "types");
|
||||
ArgumentNotNull(sourceFile, "sourceFile");
|
||||
|
||||
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
if (types.Any(item => !hash.Add(item)))
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(sourceFile, -1, -1, "6023",
|
||||
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return GetItemsToGenerate<SimpleType>(itemCollection)
|
||||
.Where(e => IsEnumType(e));
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
|
||||
{
|
||||
return itemCollection
|
||||
.OfType<T>()
|
||||
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
|
||||
.OrderBy(i => i.Name);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
|
||||
{
|
||||
return itemCollection
|
||||
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
|
||||
.Select(g => GetGlobalItemName(g));
|
||||
}
|
||||
|
||||
public string GetGlobalItemName(GlobalItem item)
|
||||
{
|
||||
if (item is EdmType)
|
||||
{
|
||||
return ((EdmType)item).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((EntityContainer)item).Name;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
|
||||
{
|
||||
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type);
|
||||
}
|
||||
|
||||
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
|
||||
{
|
||||
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
|
||||
}
|
||||
|
||||
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
|
||||
return returnParamsProperty == null
|
||||
? edmFunction.ReturnParameter
|
||||
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool IsComposable(EdmFunction edmFunction)
|
||||
{
|
||||
ArgumentNotNull(edmFunction, "edmFunction");
|
||||
|
||||
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
|
||||
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
|
||||
}
|
||||
|
||||
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
|
||||
{
|
||||
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
|
||||
}
|
||||
|
||||
public TypeUsage GetReturnType(EdmFunction edmFunction)
|
||||
{
|
||||
var returnParam = GetReturnParameter(edmFunction);
|
||||
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
|
||||
}
|
||||
|
||||
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
|
||||
{
|
||||
var returnType = GetReturnType(edmFunction);
|
||||
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ArgumentNotNull<T>(T arg, string name) where T : class
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
#>
|
27
Fab2ApprovalSystem-Copy/Models/TrainingDocAck.cs
Normal file
27
Fab2ApprovalSystem-Copy/Models/TrainingDocAck.cs
Normal file
@ -0,0 +1,27 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class TrainingDocAck
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int TrainingAssignmentID { get; set; }
|
||||
public int ECNNumber { get; set; }
|
||||
public int AttachmentID { get; set; }
|
||||
public Nullable<System.DateTime> DateReviewed { get; set; }
|
||||
public Nullable<bool> Reviewed { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public Nullable<bool> Deleted { get; set; }
|
||||
public Nullable<System.DateTime> DeletedDate { get; set; }
|
||||
}
|
||||
}
|
20
Fab2ApprovalSystem-Copy/Models/TrainingGroup.cs
Normal file
20
Fab2ApprovalSystem-Copy/Models/TrainingGroup.cs
Normal file
@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class TrainingGroup
|
||||
{
|
||||
public int TrainingGroupID { get; set; }
|
||||
public string TrainingGroupName { get; set; }
|
||||
}
|
||||
}
|
22
Fab2ApprovalSystem-Copy/Models/TrainingGroupMember.cs
Normal file
22
Fab2ApprovalSystem-Copy/Models/TrainingGroupMember.cs
Normal file
@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class TrainingGroupMember
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int TrainingGroupID { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
}
|
20
Fab2ApprovalSystem-Copy/Models/TrainingReportUser.cs
Normal file
20
Fab2ApprovalSystem-Copy/Models/TrainingReportUser.cs
Normal file
@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class TrainingReportUser
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
22
Fab2ApprovalSystem-Copy/Models/WinEventLogModel.cs
Normal file
22
Fab2ApprovalSystem-Copy/Models/WinEventLogModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class WinEventLog
|
||||
{
|
||||
//[Key]
|
||||
|
||||
public int SysDocumentID{ get; set; }
|
||||
public int IssueID { get; set; }
|
||||
public string DocumentType { get; set; }
|
||||
public string UserID { get; set; }
|
||||
public string OperationType { get; set; }
|
||||
public string Comments { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
43
Fab2ApprovalSystem-Copy/Models/WorkFlowModels.cs
Normal file
43
Fab2ApprovalSystem-Copy/Models/WorkFlowModels.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models
|
||||
{
|
||||
public class ApprovalModel
|
||||
{
|
||||
public int ApprovalID { get; set; }
|
||||
public int? IssueID { get; set; }
|
||||
public string RoleName { get; set; } // nullable
|
||||
public string SubRole { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public int SubRoleID { get; set; }
|
||||
public int? ItemStatus { get; set; }
|
||||
public int? Step { get; set; }
|
||||
public DateTime NotifyDate { get; set; } // nullable
|
||||
public DateTime AssignedDate { get; set; } // nullable
|
||||
public DateTime RoleAssignedDate { get; set; } // nullable
|
||||
public DateTime CompletedDate { get; set; } // nullable
|
||||
public string Comments { get; set; } // nullable
|
||||
public byte? ApprovalType { get; set; }
|
||||
public Guid? BackToApprovalID { get; set; }
|
||||
public int DocumentTypeID { get; set; }
|
||||
public bool DisplayDeniedDocument { get; set; }
|
||||
public bool Delegated { get; set; }
|
||||
}
|
||||
|
||||
public class WorkflowSteps
|
||||
{
|
||||
public int WorkflowStepID { get; set; }
|
||||
public int WorkflowID { get; set; }
|
||||
public int WorkflowStepNumber { get; set; }
|
||||
public string WorkFlowStepName { get; set; } // nullable
|
||||
public int RoleID { get; set; }
|
||||
public bool RulesApply { get; set; }
|
||||
public int ApprovalType { get; set; }
|
||||
public bool? AllowReject { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user