initial source commit

This commit is contained in:
Gary Sharp
2013-02-01 12:35:28 +11:00
parent 543a005d31
commit 0a93429800
1103 changed files with 285609 additions and 0 deletions
+132
View File
@@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class Job
{
[Key]
public int Id { get; set; }
[Required]
public string JobTypeId { get; set; }
public string DeviceSerialNumber { get; set; }
public string UserId { get; set; }
[Required]
public string OpenedTechUserId { get; set; }
public DateTime OpenedDate { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? ExpectedClosedDate { get; set; }
public string ClosedTechUserId { get; set; }
public DateTime? ClosedDate { get; set; }
public long? Flags { get; set; }
[Display(Name = "Technician Held Device")]
public DateTime? DeviceHeld { get; set; }
public string DeviceHeldTechUserId { get; set; }
[StringLength(100)]
public string DeviceHeldLocation { get; set; }
public DateTime? DeviceReadyForReturn { get; set; }
public string DeviceReadyForReturnTechUserId { get; set; }
public DateTime? DeviceReturnedDate { get; set; }
public string DeviceReturnedTechUserId { get; set; }
public DateTime? WaitingForUserAction { get; set; }
[ForeignKey("JobTypeId")]
public virtual JobType JobType { get; set; }
public virtual IList<JobSubType> JobSubTypes { get; set; }
[ForeignKey("DeviceSerialNumber")]
public virtual Device Device { get; set; }
[ForeignKey("UserId")]
public virtual User User { get; set; }
[ForeignKey("OpenedTechUserId")]
public virtual User OpenedTechUser { get; set; }
[ForeignKey("ClosedTechUserId")]
public virtual User ClosedTechUser { get; set; }
[ForeignKey("DeviceHeldTechUserId")]
public virtual User DeviceHeldTechUser { get; set; }
[ForeignKey("DeviceReadyForReturnTechUserId")]
public virtual User DeviceReadyForReturnTechUser { get; set; }
[ForeignKey("DeviceReturnedTechUserId")]
public virtual User DeviceReturnedTechUser { get; set; }
//// Added 2012-10-23 G# - DBv5 Migration
//public virtual IList<JobAssignment> JobAssignments { get; set; }
//// End Added 2012-10-23 G# - DBv5 Migration
public virtual IList<JobAttachment> JobAttachments { get; set; }
public virtual IList<JobComponent> JobComponents { get; set; }
public virtual IList<JobLog> JobLogs { get; set; }
public virtual JobMetaInsurance JobMetaInsurance { get; set; }
public virtual JobMetaWarranty JobMetaWarranty { get; set; }
public virtual JobMetaNonWarranty JobMetaNonWarranty { get; set; }
#region Helper Members
public decimal JobComponentsTotalCost()
{
if (this.JobComponents != null)
{
return this.JobComponents.Sum(jc => jc.Cost);
}
return decimal.Zero;
}
#endregion
public static class JobStatusIds
{
public const string AwaitingAccountingPayment = "AwaitingAccountingPayment";
public const string AwaitingAccountingCharge = "AwaitingAccountingCharge";
public const string AwaitingDeviceReturn = "AwaitingDeviceReturn";
public const string AwaitingInsuranceProcessing = "AwaitingInsuranceProcessing";
public const string AwaitingRepairs = "AwaitingRepairs";
public const string AwaitingUserAction = "AwaitingUserAction";
public const string AwaitingWarrantyRepair = "AwaitingWarrantyRepair";
public const string Closed = "Closed";
public const string Open = "Open";
}
[Flags]
public enum UserManagementFlags : long
{
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Content - Games")]
Infringement_ContentGames = 1,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Content - Illegal")]
Infringement_ContentIllegal = 2,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Content - Violence")]
Infringement_ContentViolence = 4,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Content - Pornography")]
Infringement_ContentPornography = 8,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Hacking")]
Infringement_Hacking = 16,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Proxy Bypass")]
Infringement_ProxyBypass = 32,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Breach Usage Agreement")]
Infringement_BreachUsageAgreement = 64,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Infringement, Name = "Breach Financial Agreement")]
Infringement_BreachFinancialAgreement = 128,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Contact, Name = "Phone")]
Contact_Phone = 4294967296,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Contact, Name = "Email")]
Contact_Email = 8589934592,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Contact, Name = "In Person")]
Contact_InPerson = 17179869184,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Contact, Name = "SMS")]
Contact_SMS = 34359738368,
[Display(GroupName = JobSubType.UserManagementJobSubTypes.Contact, Name = "Mail")]
Contact_Mail = 68719476736,
}
}
}
@@ -0,0 +1,30 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
//namespace Disco.Models.Repository
//{
// // Added 2012-10-23 G# - DBv5 Migration
// public class JobAssignment
// {
// [Key, Required, ColumnAttribute(Order = 0)]
// public int JobId { get; set; }
// [Key, Required, ColumnAttribute(Order = 1)]
// public string TechUserId { get; set; }
// [Key, Required, ColumnAttribute(Order = 2)]
// public DateTime AssignedDate { get; set; }
// public DateTime? UnassignedDate { get; set; }
// public DateTime? TargetCompletionDate { get; set; }
// [ForeignKey("JobId"), InverseProperty("JobAssignments")]
// public virtual Job Job { get; set; }
// [ForeignKey("TechUserId")]
// public User TechUser { get; set; }
// }
//}
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobAttachment
{
[Key]
public int Id { get; set; }
public int JobId { get; set; }
[Required]
public string TechUserId { get; set; }
[Required, StringLength(500)]
public string Filename { get; set; }
[Required, StringLength(500)]
public string MimeType { get; set; }
public DateTime Timestamp { get; set; }
[StringLength(500), Required]
public string Comments { get; set; }
public string DocumentTemplateId { get; set; }
[ForeignKey("JobId"), InverseProperty("JobAttachments")]
public virtual Job Job { get; set; }
[ForeignKey("TechUserId")]
public virtual User TechUser { get; set; }
[ForeignKey("DocumentTemplateId")]
public virtual DocumentTemplate DocumentTemplate { get; set; }
}
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobComponent
{
[Key]
public int Id { get; set; }
public int JobId { get; set; }
[Required]
public string TechUserId { get; set; }
[StringLength(500)]
public string Description { get; set; }
public decimal Cost { get; set; }
[ForeignKey("JobId")]
public virtual Job Job { get; set; }
[ForeignKey("TechUserId")]
public virtual User TechUser { get; set; }
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobLog
{
[Key]
public int Id { get; set; }
public int JobId { get; set; }
[Required]
public string TechUserId { get; set; }
public DateTime Timestamp { get; set; }
[Required]
public string Comments { get; set; }
[ForeignKey("JobId")]
public Job Job { get; set; }
[ForeignKey("TechUserId")]
public User TechUser { get; set; }
}
}
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobMetaInsurance
{
[Required, Key]
public int JobId { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? LossOrDamageDate { get; set; }
[StringLength(200)]
public string EventLocation { get; set; }
[DataType(DataType.MultilineText)]
public string Description { get; set; }
[Display(Name = "Caused by Third Party")]
public bool ThirdPartyCaused { get; set; }
[StringLength(200)]
public string ThirdPartyCausedName { get; set; }
[DataType(DataType.MultilineText), StringLength(600)]
public string ThirdPartyCausedWhy { get; set; }
[StringLength(1200), DataType(DataType.MultilineText)]
public string WitnessesNamesAddresses { get; set; }
[StringLength(200)]
public string BurglaryTheftMethodOfEntry { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? PropertyLastSeenDate { get; set; }
[Display(Name = "Police Notified")]
public bool PoliceNotified { get; set; }
[StringLength(200)]
public string PoliceNotifiedStation { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd}", HtmlEncode = false)]
public DateTime? PoliceNotifiedDate { get; set; }
[StringLength(400)]
public string PoliceNotifiedCrimeReportNo { get; set; }
[DataType(DataType.MultilineText), StringLength(800)]
public string RecoverReduceAction { get; set; }
[StringLength(500)]
public string OtherInterestedParties { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd}", HtmlEncode = false)]
public DateTime? DateOfPurchase { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? ClaimFormSentDate { get; set; }
public string ClaimFormSentUserId { get; set; }
[Required, ForeignKey("JobId")]
public virtual Job Job { get; set; }
[ForeignKey("ClaimFormSentUserId")]
public virtual User ClaimFormSentUser { get; set; }
}
}
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobMetaNonWarranty
{
[Key, Required]
public int JobId { get; set; }
public bool IsInsuranceClaim { get; set; }
// Feature Request 2012-05-10 by Michael E: https://disco.uservoice.com/forums/159707-feedback/suggestions/2811092-document-template-option-flatten-form-on-generate
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? AccountingChargeRequiredDate { get; set; }
[ForeignKey("AccountingChargeRequiredUserId")]
public virtual User AccountingChargeRequiredUser { get; set; }
public string AccountingChargeRequiredUserId { get; set; }
// End Feature Request
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? AccountingChargeAddedDate { get; set; }
[ForeignKey("AccountingChargeAddedUserId")]
public virtual User AccountingChargeAddedUser { get; set; }
public string AccountingChargeAddedUserId { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? AccountingChargePaidDate { get; set; }
[ForeignKey("AccountingChargePaidUserId")]
public virtual User AccountingChargePaidUser { get; set; }
public string AccountingChargePaidUserId { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? PurchaseOrderRaisedDate { get; set; }
[ForeignKey("PurchaseOrderRaisedUserId")]
public virtual User PurchaseOrderRaisedUser { get; set; }
public string PurchaseOrderRaisedUserId { get; set; }
[StringLength(20)]
public string PurchaseOrderReference { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? PurchaseOrderSentDate { get; set; }
[ForeignKey("PurchaseOrderSentUserId")]
public virtual User PurchaseOrderSentUser { get; set; }
public string PurchaseOrderSentUserId { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? InvoiceReceivedDate { get; set; }
[ForeignKey("InvoiceReceivedUserId")]
public virtual User InvoiceReceivedUser { get; set; }
public string InvoiceReceivedUserId { get; set; }
[StringLength(100)]
public string RepairerName { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? RepairerLoggedDate { get; set; }
[StringLength(100)]
public string RepairerReference { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? RepairerCompletedDate { get; set; }
[ForeignKey("JobId"), Required]
public virtual Job Job { get; set; }
}
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobMetaWarranty
{
[Required, Key]
public int JobId { get; set; }
[StringLength(100)]
public string ExternalName { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? ExternalLoggedDate { get; set; }
[StringLength(100)]
public string ExternalReference { get; set; }
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? ExternalCompletedDate { get; set; }
[ForeignKey("JobId"), Required]
public virtual Job Job { get; set; }
}
}
+37
View File
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class JobSubType
{
[Key, StringLength(20), Column(Order = 0)]
public string Id { get; set; }
[Key, Required, Column(Order = 1)]
public string JobTypeId { get; set; }
[Required, StringLength(100)]
public string Description { get; set; }
public virtual IList<DocumentTemplate> AttachmentTypes { get; set; }
public virtual IList<DeviceComponent> DeviceComponents { get; set; }
[ForeignKey("JobTypeId")]
public virtual JobType JobType { get; set; }
public virtual IList<Job> Jobs { get; set; }
public static class UserManagementJobSubTypes
{
public const string Infringement = "Infringement";
public const string Contact = "Contact";
}
public override string ToString()
{
return this.Description;
}
}
}
+34
View File
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Repository
{
public class JobType
{
[StringLength(5), Key]
public string Id { get; set; }
[StringLength(100)]
public string Description { get; set; }
public virtual IList<JobSubType> JobSubTypes { get; set; }
public override string ToString()
{
return this.Description;
}
public static class JobTypeIds
{
public const string HMisc = "HMisc";
public const string HNWar = "HNWar";
public const string HWar = "HWar";
public const string SApp = "SApp";
public const string SImg = "SImg";
public const string SOS = "SOS";
public const string UMgmt = "UMgmt";
}
}
}