public override string GetInformation()
        {
            // LOCAL VARIABLES
            int    i;                   // Counter to for().
            string s = string.Empty;

            s += "\n\t\tName: " + Name;
            s += "\n\t\tTitle: " + Title;
            s += "\n\t\tCompany: " + CompanyName;
            s += "\n\t\tCompany ID: " + CompanyId.ToString();
            s += "\n\t\tList of Languages:";
            if (_languages.Count > 0)
            {
                for (i = 0; i < _languages.Count; i++)
                {
                    s += "\n\t\t\t" + _languages[i];
                }
            }
            else
            {
                s += "\n\t\t\tNULL\n";
            }

            return(s);
        }
Пример #2
0
        public override int GetHashCode()
        {
            int hashcode = BeginDate.GetHashCode();

            hashcode = 31 * hashcode + CompanyId.GetHashCode();
            return(hashcode);
        }
Пример #3
0
        public void AddSubContract(BuildingId buildingId, CompanyId companyId)
        {
            var company = _context.Companies.Single(c => c.Id == companyId.Value);
            var admin   = _context.Users.FirstOrDefault(u =>
                                                        u.CompanyId == companyId.Value && u.CompanyRole == UserCompanyRole.Admin);

            if (company.Buildings == null)
            {
                company.Buildings = new List <BuildingCompany>();
            }

            company.Buildings.Add(new BuildingCompany
            {
                BuildingId   = buildingId.Value,
                ContractType = ContractType.SubContractor,
                Users        = new List <UserRole>(new []
                {
                    new UserRole
                    {
                        UserId           = admin.Id,
                        UserBuildingRole = UserBuildingRole.Admin
                    }
                })
            });

            _context.SaveChanges();
        }
Пример #4
0
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (CompanyId.Length != 0)
                    {
                        hash ^= CompanyId.GetHashCode();
                    }
                    if (CompanyName.Length != 0)
                    {
                        hash ^= CompanyName.GetHashCode();
                    }
                    if (Status != 0)
                    {
                        hash ^= Status.GetHashCode();
                    }
                    if (AreaCode.Length != 0)
                    {
                        hash ^= AreaCode.GetHashCode();
                    }
                    if (CreateTime.Length != 0)
                    {
                        hash ^= CreateTime.GetHashCode();
                    }
                    if (Address.Length != 0)
                    {
                        hash ^= Address.GetHashCode();
                    }
                    return(hash);
                }
Пример #5
0
        public void TestDeserialize()
        {
            Assert.AreEqual(1, CompanyId.Manipulator.InsertDataInto(TestConnection, TableName, Id1));
            CompanyId toTest = CompanyId.Manipulator.RetrieveDataWhere(TestConnection, TableName, "LegalName=\"" + Id1.LegalName + "\"")[0];

            Assert.AreEqual(Id1, toTest);
            Assert.AreEqual(1, CompanyId.Manipulator.RemoveDataWhere(TestConnection, TableName, "LegalName=\"" + Id1.LegalName + "\""));
        }
Пример #6
0
        public async Task <IQueryable <Employee> > GetAllAsync()
        {
            await Task.Yield();

            CompanyId companyId = new CompanyId(Guid.NewGuid().ToString());
            PersonId  personId  = new PersonId(Guid.NewGuid().ToString());

            return(_dbContext.Employees.Select(o => new Employee(o)));
        }
Пример #7
0
        public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);

            userIdentity.AddClaim(new Claim(nameof(CompanyId), CompanyId.ToString()));

            // Add custom user claims here
            return(userIdentity);
        }
Пример #8
0
        public void Get_NotFound_CompanyNotExists()
        {
            var companyId = new CompanyId(12);

            _companyRepository.Get(companyId).ReturnsNull();

            var response = _companyController.Get(companyId.Value);

            Assert.That(response, Is.TypeOf <NotFoundResult>());
        }
Пример #9
0
 public int CompareTo(SchedulingEntity other)
 {
     if (CompanyId == other.CompanyId)
     {
         return(DateStart.CompareTo(other.DateStart));
     }
     else
     {
         return(CompanyId.CompareTo(other.CompanyId));
     }
 }
Пример #10
0
 public int CompareTo(CompanyCalenderEntity other)
 {
     if (CompanyId == other.CompanyId)
     {
         return(DateStart.CompareTo(other.DateStart));
     }
     else
     {
         return(CompanyId.CompareTo(other.CompanyId));
     }
 }
Пример #11
0
        public override Dictionary <string, string> ToDictionary()
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("{protocol}", Protocol);
            parameters.Add("{cdn}", CDN);
            parameters.Add("{companyId}", CompanyId.ToString());
            parameters.Add("{domain}", Domain);

            return(parameters);
        }