public Assignment SetTargetAssignment(int regionId, DateTimeOffset dateTime) { if (regionId == 0) { return(null); } if (dateTime == DateTimeOffset.MinValue) { return(null); } var technicianRole = TechnicianRoles.FirstOrDefault(tr => tr.Regions.Any(r => r.Id == regionId)); var workDay = WorkDays.FirstOrDefault(wd => wd.Date.Date == dateTime.Date); if (technicianRole == null || workDay == null) { return(null); } var shift = Assignment.Create(technicianRole, workDay); technicianRole.Assignments.Add(shift); return(shift); }
public Assignment AddAssignment(Assignment.ICreateParam param) { var assignment = Assignment.Create(param); unitOfWork.Assignments.Add(assignment); unitOfWork.Complete(); return(assignment); }
public void UpdateStatus_TestAssertFail() { // ARRANGE var assignment = Assignment.Create(createParam); assignment.AssignmentStatus = AssignmentStatus.Done; // ACT & ASSERT assignment.UpdateStatus(AssignmentStatus.Future); }
public void CanDelete_TestAssertTrue() { // ARRANGE var assignment = Assignment.Create(createParam); // ACT var canDelete = assignment.CanDelete(); // ASSERT Assert.IsTrue(canDelete); }
public void UpdateStatus_TestAssertSuccess() { // ARRANGE var assignment = Assignment.Create(createParam); // ACT assignment.UpdateStatus(AssignmentStatus.Done); // ASSERT Assert.AreEqual(AssignmentStatus.Done, assignment.AssignmentStatus); }
public void Create_Test() { // ARRANGE // ... // ACT var assignment = Assignment.Create(createParam); // ASSERT Assert.AreEqual(AssignmentStatus.Future, assignment.AssignmentStatus); }
public void CanDelete_TestAssertFalse() { // ARRANGE var assignment = Assignment.Create(createParam); assignment.Subtasks.Add(Subtask.Create(new SubtaskCreateParam { Name = "Test subtask", Description = "123", Priority = SubtaskPriority.High })); // ACT var canDelete = assignment.CanDelete(); // ASSERT Assert.IsFalse(canDelete); }
public static IEnumerable <Assignment> CreateAssignments(Project[] projects) { return(new List <Assignment>() { Assignment.Create(CreateAssignmentCreateParam(projects[0], "Task 1", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[0], "Task 1.1", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[0], "Task 1.2", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[1], "Task 2", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[1], "Task 2.1", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[2], "Task 3", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[2], "Task 3.1", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[3], "Task 4", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[3], "Task 4.1", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[3], "Task 4.2", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[4], "Task 5", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[4], "Task 5.1", "Got stuff to do for this!")), Assignment.Create(CreateAssignmentCreateParam(projects[5], "Task 6", "Got stuff to do for this!")), }); }
public void IsOvertime_Test() { // ARRANGE var assignment = Assignment.Create(createParam); assignment.Subtasks.Add(Subtask.Create(new SubtaskCreateParam { Name = "Test subtask", Description = "123", Priority = SubtaskPriority.High })); var subtask = assignment.Subtasks.First(); // subtask.Entries.Add(new EntryCreateParam() { Date = DateTime.Now, }) // ACT var canDelete = assignment.CanDelete(); // ASSERT Assert.IsFalse(canDelete); }
private Assignment CreateTestAssignment() { var projectTypeCreateParam = new ProjectTypeCreateParam { Name = "Test", Description = "Test project type" }; var projectCreateParam = new ProjectCreateParam { Description = "Project description", Name = "New project", ProjectType = ProjectType.Create(projectTypeCreateParam) }; uow.ProjectTypes.Add(ProjectType.Create(projectTypeCreateParam)); uow.Projects.Add(Project.Create(projectCreateParam)); uow.Complete(); var project = uow.Projects.GetAll().First(p => p.Name == "New project"); var assignmentCreateParam = new AssignmentCreateParam { Name = "TestAssignment", DateDue = DateTime.Now.AddDays(1), DatePlanned = DateTime.Now, Description = "New description", DurationPlannedAsTicks = new TimeSpan(1, 0, 0).Ticks, Project = project }; uow.Assignments.Add(Assignment.Create(assignmentCreateParam)); uow.Complete(); var assignment = uow.Assignments.Load(a => a.Name == "TestAssignment").Single(); return(assignment); }
private void CreatePrerequisitesForSubtaskCreation() { var projectTypeCreateParam = new ProjectTypeCreateParam { Name = "Test", Description = "Test project type" }; uow.ProjectTypes.Add(ProjectType.Create(projectTypeCreateParam)); this.uow.Complete(); var projectType = this.uow.ProjectTypes.GetAll().First(); var projectCreateParam = new ProjectCreateParam { Description = "Project description", Name = "New project", ProjectType = projectType }; uow.Projects.Add(Project.Create(projectCreateParam)); this.uow.Complete(); var project = this.uow.Projects.GetAll().First(); var assignmentCreateParam = new AssignmentCreateParam { Name = "TestAssignment", DateDue = DateTime.Now.AddDays(1), DatePlanned = DateTime.Now, Description = "New description", DurationPlannedAsTicks = new TimeSpan(1, 0, 0).Ticks, Project = project }; uow.Assignments.Add(Assignment.Create(assignmentCreateParam)); this.uow.Complete(); }
//EXECUTE COMMANDS public static void InsertData(int choice) { if (commands.ContainsKey(choice)) { var connectionString = ConfigurationManager.ConnectionStrings["PrivateSchoolConnectionString"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { //Match user's choice with command using (SqlCommand command = new SqlCommand(commands[choice], connection)) { bool addMore = false; do { switch (choice) { case 10: Student.Create(command); break; case 11: Trainer.Create(command); break; case 12: Course.Create(command); break; case 13: Assignment.Create(command); break; case 14: StudentPerCourse.Create(command); break; case 15: TrainerPerCourse.Create(command); break; case 16: AssignmentPerStudent.Create(command); break; } try { connection.Open(); command.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { connection.Close(); } Console.WriteLine("\n\nDo you want to add more? Enter Y for yes.\nOtherwise, press any other key to return to the menu."); var answer = Console.ReadLine(); if (answer.ToUpper() == "Y") { addMore = true; } else { addMore = false; } }while (addMore); } } } }
// Use this for initialization void Start() { GetComponent <TextMesh>().text = Ligning.Create(); Svar = Ligning.correctAnswer; }
private void CreateEntries() { var projectTypeCreateParam = new ProjectTypeCreateParam { Name = "Test", Description = "Test project type" }; uow.ProjectTypes.Add(ProjectType.Create(projectTypeCreateParam)); this.uow.Complete(); var projectType = this.uow.ProjectTypes.GetAll().First(); var projectCreateParam = new ProjectCreateParam { Description = "Project description", Name = "New project", ProjectType = projectType }; uow.Projects.Add(Project.Create(projectCreateParam)); this.uow.Complete(); var project = this.uow.Projects.GetAll().First(); var assignmentCreateParam = new AssignmentCreateParam { Name = "TestAssignment", DateDue = DateTime.Now.AddDays(1), DatePlanned = DateTime.Now, Description = "New description", DurationPlannedAsTicks = new TimeSpan(1, 0, 0).Ticks, Project = project }; uow.Assignments.Add(Assignment.Create(assignmentCreateParam)); this.uow.Complete(); var assignment = this.uow.Assignments.GetAll().First(); var subtask = Subtask.Create(new SubtaskCreateParam { Name = "Test subtask", Description = "Test description", Priority = EnumDefinition.SubtaskPriority.Medium }); subtask.Assignment_Id = assignment.Id; subtask.Assignment = assignment; this.uow.Subtasks.Add(subtask); this.uow.Complete(); var entryCreateParam = new EntryCreateParam { Comment = "Test comment", Date = DateTime.Now.Date, Started = DateTime.Now.AddHours(-2), Ended = DateTime.Now.AddHours(-1), Name = "Test entry", Project = project }; for (int i = 0; i < 3; i++) { this.uow.Entries.Add(Entry.Create(entryCreateParam)); } this.uow.Complete(); }
public VHDLDocument Watermark(WatermarkOptions options) { var doc = options.WotermarikingDocument.Document; var IOBuffesLayer = new IOBuffesLayer(_document); IOBuffesLayer.Parse(); options.WatermarkSettings.ForEach(x => x.Signal = IOBuffesLayer.WhetherEquivalent(x.Signal)); options.SignatureOutputSettings.ForEach(x => x.Signal = IOBuffesLayer.WhetherEquivalent(x.Signal)); List <WatermarkBit> watermarkBits = new List <WatermarkBit>(); options.SignatureOutputSettings.ForEach(ports => { for (int j = 0; j < ports.SignatureCode.Length; j++) { if (ports.SignatureCode[j] != '-') { var newWB = new WatermarkBit() { IsOne = ports.SignatureCode[j] == '1', Signal = doc.Router.AssignmentSignal(null, ports.Signal, ports.Signal.Enumeration?.GetBit(j)) }; newWB.Signal.IsSource = false; watermarkBits.Add(newWB); } } }); //var wbit2 = watermarkBits.FirstOrDefault(); //var routes2 = doc.Router.GetRoutes(wbit2.Signal.Defenition); //var d = routes2.Signals.Where(signal => signal.IsSource == null).ToList(); //var e = routes2.Signals.Where(signal => signal.IsSource != null && !signal.IsSource.Value).ToList(); //var c = routes2.Signals.Where(signal => signal.IsSource != null && signal.IsSource.Value).ToList(); //-----------------DECODER---------------------------------------- var isWatermark = _document.Router.InserSignalDefenition("IS_WATERMARK", "STD_LOGIC"); var decoder = new Decoder(doc, isWatermark); var decoderSettings = options.WatermarkSettings.Where(x => x.IsUsed) .Select(a => new DecoderSignalCode(doc.Router.AssignmentSignal(decoder, a.Signal), a.ActivaionCode)) .ToList(); decoder.CodedSignals.AddRange(decoderSettings); _document.AddVHDLInBehaviorSection(decoder.ToString()); //-----------------DECODER---------------------------------------- //----------------------Lut work---------------------------------- /**var signatureBus = _document.Router.CreateBus("WATERMARKED_OUT"); * int i = 0; * options.WotermarikingDocument.FreeLuts.ForEach(lut => * { * ChangeLutConstIputs(lut, isWatermark, options.WotermarikingDocument.ConstValueGenerators); * ChangeLutInitVector(lut, true); * var newLutOutput = signatureBus.GetWire(i); * * InjectLutOutput(lut, newLutOutput.Defenition); * i++; * }); * var watermarkedSignalDefenition = signatureBus.BuildSignal();**/ LUTComponents components = new LUTComponents(doc); var lutForExtenion = _document.Maps .Where(map => LUT.IsLUT(map.Entity) && !options.WotermarikingDocument.FreeLuts.Contains(map)) .Select(map => MapLUT.FromMap(map)).ToList(); lutForExtenion.ForEach(lut => lut.ExtendLUT(components)); //Extends lut var freeInputs = lutForExtenion.Select(x => x.GetFreeInput()).ToList(); List <MapLUT> lutsForInsertion = new List <MapLUT>(lutForExtenion); //Merge all luts //lutsForInsertion.AddRange(); //AddFreeLut lutsForInsertion.ForEach(lut => { var watermarkBit = watermarkBits.FirstOrDefault(wb => wb.LUT == null); if (watermarkBit != null) { var port = lut.GetFreeInput(); //TODO lut.AddLutAssigment(Assignment.Create(lut, port, isWatermark)); lut.ConstValuePort(port, watermarkBit.IsOne); watermarkBit.LUT = lut; } }); //----------------------------------------------------------------------------------------- watermarkBits.GroupBy(x => x.Signal.Defenition).ToList().ForEach(def => { var ficitonSignal = _document.Router .InserSignalDefenition( "FO" + Helper.NewGuidName(), def.Key.ValueType, def.Key.Enumeration?.CloneEnumeration()); doc.Router.RedirectAllSources(def.Key, ficitonSignal); def.ToList().ForEach(wbit => { wbit.RealSignal = doc.Router.GetRoutes(ficitonSignal) .Signals.FirstOrDefault(x => (x.Enumeration == null && wbit.Signal.Enumeration == null) || (x.Enumeration == null && wbit.Signal.Enumeration == null && x.Enumeration.IsSameBus(wbit.Signal.Enumeration))); Mux mux = new Mux(); mux.To = wbit.Signal; mux.Condition = doc.Router.AssignmentSignal(mux, isWatermark) + " = '1'"; mux.Else = wbit.RealSignal; mux.Then = wbit.LUT.GetOutput(); mux.Insert(_document); }); }); return(_document); }