コード例 #1
0
        public void IsEmpty_True()
        {
            Dictionary <string, string> syntax = new Dictionary <string, string>();
            IName n = new CompoundName(string.Empty, syntax);

            Assert.IsTrue(n.IsEmpty());
        }
コード例 #2
0
        public async Task <Unit> Handle(QuickAddCandidateCommand request, CancellationToken cancellationToken)
        {
            var user = _userAccessor.GetUser();

            var job = await _context.JobPositions.FindAsync(request.JobPositionId);

            var entity = new Candidate(CompoundName.Create(request.FirstName, request.LastName).Value, job,
                                       ContactInfo.Create(request.PhoneNumber, request.Email).Value);
            var stage = await _context.RecruitmentStages.FindAsync(request.RecruitmentStageId);

            stage.AddCandidate(entity);


            _context.RecruitmentStages.Update(stage);
            await _context.SaveChangesAsync(cancellationToken);

            // Notifications
            var notification = new CandidateCreated
            {
                PrimaryEntityId   = entity.Id,
                PrimaryEntityName = entity.Name.GetFullName,
                UserName          = user.Identity.Name
            };
            await _mediator.Publish(notification, cancellationToken);

            return(Unit.Value);
        }
コード例 #3
0
        public async Task <Unit> Handle(CreateCandidateCommand request, CancellationToken cancellationToken)
        {
            var user = _userAccessor.GetUser();

            //TODO:Import the finder extension from Renson projects
            var job = await _context.JobPositions.FindAsync(request.JobPositionId);

            var stage = await _context.RecruitmentStages.FindAsync(request.RecruitmentStageId);

            var entity = new Candidate(CompoundName.Create(request.FirstName, request.LastName).Value, job,
                                       ContactInfo.Create(request.PhoneNumber, request.Email).Value);

            var operation = stage.AddCandidate(entity);

            if (operation.IsFailure)
            {
                throw new InvalidOperationException(operation.Error);
            }

            _context.RecruitmentStages.Update(stage);
            await _context.SaveChangesAsync(cancellationToken);

            // Notifications
            var notification = new CandidateCreated
            {
                PrimaryEntityId = entity.Id,
                UserName        = user.Identity.Name
            };
            await _mediator.Publish(notification, cancellationToken);

            return(Unit.Value);
        }
コード例 #4
0
ファイル: Types.cs プロジェクト: MasterQ32/psi
 public NamedTypeLiteral(CompoundName name)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     this.Name = name;
 }
コード例 #5
0
 /// <summary>
 /// Химическое соединение
 /// </summary>
 /// <param name="name">Наименование</param>
 /// <param name="molecularMass">Молекулярная масса</param>
 /// <param name="criticalPressure">Критическое давление (МПа)</param>
 /// <param name="criticalTemperature">Критическая температура (К)</param>
 /// <param name="densityAtStandardConditions">Плотность в стандартных условиях (кг/м3)</param>
 private ChemicalCompound(CompoundName name, double molecularMass, double criticalPressure, double criticalTemperature, double densityAtStandardConditions)
 {
     Name                        = name;
     CriticalPressure            = criticalPressure;
     CriticalTemperature         = criticalTemperature;
     MolecularMass               = molecularMass;
     DensityAtStandardConditions = densityAtStandardConditions;
 }
コード例 #6
0
        public void IsEmpty_False()
        {
            Dictionary <string, string> syntax = new Dictionary <string, string>();
            IName n = new CompoundName(string.Empty, syntax);

            n.Add("item1");
            Assert.IsFalse(n.IsEmpty());
        }
コード例 #7
0
        public void Get_Success()
        {
            Dictionary <string, string> syntax = new Dictionary <string, string>();
            IName n = new CompoundName(string.Empty, syntax);

            n.Add("item1");
            n.Add("item2");
            n.Add("item3");

            Assert.AreSame("item2", n.Get(1));
        }
コード例 #8
0
        public void EndsWithName_Fail()
        {
            Dictionary <string, string> syntax = new Dictionary <string, string>();
            IName nEnd = new CompoundName("item1", syntax);

            IName n = new CompoundName(string.Empty, syntax);

            n.Add("item1");
            n.Add("item2");

            Assert.IsFalse(n.EndsWith(nEnd));
        }
コード例 #9
0
        /// <summary>
        /// Change the name of the contact
        /// </summary>
        /// <param name="newName"></param>
        /// <param name="modifiedBy"></param>
        /// <returns></returns>
        public Result UpdateContactName(CompoundName newName, Guid modifiedBy)
        {
            if (Name.Equals(newName))
            {
                return(Result.Fail("Name is identical"));
            }

            Name = newName;



            return(Result.Ok());
        }
コード例 #10
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="contactInfo"></param>
        /// <param name="organizationId"></param>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <param name="createdBy"></param>
        public ClientContact(ContactInfo contactInfo, Guid organizationId,
                             CompoundName name, Guid id, Guid createdBy)
        {
            if (organizationId == Guid.Empty)
            {
                throw new ArgumentException("Organization Id must be specified");
            }

            ContactInfo = contactInfo;
            Name        = name;

            CreateEnd(id, name.ToString(), createdBy);
        }
コード例 #11
0
        public void InsertStringAtPosition_ok()
        {
            Dictionary <string, string> syntax = new Dictionary <string, string>();
            IName n = new CompoundName(string.Empty, syntax);

            n.Insert(0, "item1");

            IEnumerable <string> r          = n.GetAll();
            IEnumerator <string> enumerator = r.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreSame("item1", enumerator.Current);

            Assert.IsFalse(enumerator.MoveNext());
        }
コード例 #12
0
ファイル: KeywayModel.cs プロジェクト: MOXFan/Keysmith
        public override bool MatchFilter(string filter)
        {
            string ucfilter = filter.ToUpper();
            string ucname   = CompoundName.ToUpper();

            if (base.MatchFilter(filter) == true)
            {
                return(true);
            }
            else if (ucname.Contains(ucfilter))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #13
0
        public void DivideNameWithSpacesBySeparator_DonotTrim_FoundCoupleNameComponents()
        {
            Dictionary <string, string> syntax = new Dictionary <string, string>()
            {
                { "separator", ";" }
            };

            IName n = new CompoundName("itemA ; itemB; itemC ", syntax);

            IEnumerable <string> r          = n.GetAll();
            IEnumerator <string> enumerator = r.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreEqual("itemA ", enumerator.Current);

            enumerator.MoveNext();
            Assert.AreEqual(" itemB", enumerator.Current);

            enumerator.MoveNext();
            Assert.AreEqual(" itemC ", enumerator.Current);

            Assert.IsFalse(enumerator.MoveNext());
        }
コード例 #14
0
 public CompilerError UnknownImport(CompoundName name) => Add($"Could not find module {name} for import.");
コード例 #15
0
 /// <summary>
 /// Create a candidate and fill in the basic required information.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="jobPosition"></param>
 /// <param name="contactInfo"></param>
 public Candidate(CompoundName name, JobPosition jobPosition, ContactInfo contactInfo)
 {
     Name        = name;
     JobPosition = jobPosition;
     ContactInfo = contactInfo;
 }
コード例 #16
0
 public Module Add(CompoundName value)
 {
     this.Imports.Add(value);
     return(this);
 }
コード例 #17
0
 public void CreateName_ok()
 {
     Dictionary <string, string> syntax = new Dictionary <string, string>();
     IName n = new CompoundName(string.Empty, syntax);
 }