private static void LoadApplicants() { for (int i = 0; i < 10; i++) { var profile = new Profile { FirstName = string.Format("FName{0}", i), LastName = string.Format("LName{0}", i), Address1 = shortRandString, City = shortRandString, State = shortRandString }; var applicant = new Applicant() { Email = string.Format("email{0}@fake.com", i), IsActive = true }; profile.AssociatedApplicant = applicant; applicant.Profiles.Add(profile); GenericBLL <Applicant, int> .EnsurePersistent(applicant); GenericBLL <Profile, int> .EnsurePersistent(profile); } }
private static void LoadUser() { //Let's put a user for testing var user = new User { FirstName = "Test", LastName = "User", LoginIDs = new List <Login>() }; var userLogin = new Login() { User = user }; EntityIdSetter.SetIdOf <string>(userLogin, "tester"); user.LoginIDs.Add(userLogin); //Now associate this person with some units user.Units = new List <Unit>(); var apls = UnitBLL.GetByID("APLS"); var chem = UnitBLL.GetByID("CHEM"); user.Units.Add(apls); user.Units.Add(chem); UserBLL.EnsurePersistent(user, true); GenericBLL <Login, string> .EnsurePersistent(userLogin, true); }
public override void LoadData() { base.LoadData(); //Create a default change tracking insance var changeType = new ChangeType { Type = StaticProperties.TestString }; var changeTracking = new ChangeTracking { ChangeDate = DateTime.Now, ObjectChanged = StaticProperties.TestString, ObjectChangedID = StaticProperties.TestString, UserName = StaticProperties.TestString, ChangeType = changeType }; using (var ts = new TransactionScope()) { GenericBLL <ChangeType, int> .EnsurePersistent(changeType); GenericBLL <ChangeTracking, int> .EnsurePersistent(changeTracking); ts.CommitTransaction(); } }
public override void LoadData() { base.LoadData(); Login login = new Login(); EntityIdSetter.SetIdOf <string>(login, StaticProperties.TestString); //Load in a user User user = new User(); user.FirstName = StaticProperties.TestString; user.LastName = StaticProperties.TestString; user.LoginIDs = new List <Login> { login }; login.User = user; using (var ts = new TransactionScope()) { UserBLL.EnsurePersistent(user); GenericBLL <Login, string> .EnsurePersistent(login, true); ts.CommitTransaction(); } }
private static void LoadLookupTypes() { for (int i = 0; i < 4; i++) { var templateType = new TemplateType() { Type = string.Format("type{0}", i) }; var fileType = new FileType() { ApplicationFile = i % 2 == 0, FileTypeName = string.Format("type{0}", i) }; GenericBLL <TemplateType, int> .EnsurePersistent(templateType); GenericBLL <FileType, int> .EnsurePersistent(fileType); } }
public void CanSaveMessageTrackingEntry() { var tracking = new MessageTracking { From = StaticProperties.TestString, To = StaticProperties.TestString, SentBy = StaticProperties.TestString, Body = StaticProperties.TestString, DateSent = DateTime.Now }; using (var ts = new TransactionScope()) { GenericBLL <MessageTracking, int> .EnsurePersistent(tracking); ts.CommitTransaction(); } }
private static void LoadApplications() { for (int i = 0; i < 20; i++) { for (int j = 0; j < 5; j++) //5 applications per position { var application = new Application() { AppliedPosition = GenericBLL <Position, int> .GetByID(i + 1), AssociatedProfile = GenericBLL <Profile, int> .GetByID(j + 1), LastUpdated = DateTime.Now, Email = string.Format("email{0}@fake.com", j), Submitted = i < 10 //First 10 were submitted }; GenericBLL <Application, int> .EnsurePersistent(application); } } }
private static void LoadPositions() { for (int i = 0; i < 20; i++) //Add 10 positions { var pos = new Position() { AdminAccepted = i < 15, Closed = i % 5 == 0, AllowApps = i < 13, PositionTitle = "Position Title", HRRep = "HR Rep", HREmail = "*****@*****.**", HRPhone = "555-5555", ReferenceTemplate = new Template() { TemplateText = "Sample Text", TemplateType = GenericBLL <TemplateType, int> .GetByID(1) }, DescriptionFile = new File() { Description = "Some File", FileName = "SomeFile", FileType = GenericBLL <FileType, int> .GetByID(1) }, SearchPlanFile = new File() { Description = "Some file2", FileName = "TEST", FileType = GenericBLL <FileType, int> .GetByID(1) } }; pos.Departments = new List <Department> { new Department() { AssociatedPosition = pos, DepartmentFIS = "AANS", PrimaryDept = true }, new Department() { AssociatedPosition = pos, DepartmentFIS = "ADNO", PrimaryDept = false } }; if (i < 10) { pos.Departments.Add( new Department() { AssociatedPosition = pos, DepartmentFIS = "CHEM", PrimaryDept = false } //Add CHEM (school 3 to last 10 positions ); } if (i < 5 || i > 17) { pos.Departments.Add( new Department() { AssociatedPosition = pos, DepartmentFIS = "APLS", PrimaryDept = false }); } var descriptionFile = pos.DescriptionFile; var searchPlanFile = pos.SearchPlanFile; GenericBLL <File, int> .EnsurePersistent(descriptionFile); GenericBLL <File, int> .EnsurePersistent(searchPlanFile); GenericBLL <Position, int> .EnsurePersistent(pos); } }