示例#1
0
        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (AltEmailAddress != null ? AltEmailAddress.GetHashCode() : 0);
            result = (result * 397) ^ (AltTelephoneContact != null ? AltTelephoneContact.GetHashCode() : 0);
            result = (result * 397) ^ (CreatedOn != null ? CreatedOn.GetHashCode() : 0);
            result = (result * 397) ^ (DateOfBirth != null ? DateOfBirth.GetHashCode() : 0);
            result = (result * 397) ^ (EmailAddress != null ? EmailAddress.GetHashCode() : 0);
            result = (result * 397) ^ (Gender != null ? Gender.GetHashCode() : 0);
            result = (result * 397) ^ (GivenName != null ? GivenName.GetHashCode() : 0);
            result = (result * 397) ^ (HomeLanguage != null ? HomeLanguage.GetHashCode() : 0);
            result = (result * 397) ^ Id.GetHashCode();
            result = (result * 397) ^ (LastModified != null ? LastModified.GetHashCode() : 0);
            result = (result * 397) ^ (MaritalStatus != null ? MaritalStatus.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinAddress != null ? NextOfKinAddress.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinContact != null ? NextOfKinContact.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinName != null ? NextOfKinName.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinRelationship != null ? NextOfKinRelationship.GetHashCode() : 0);
            result = (result * 397) ^ (Occupation != null ? Occupation.GetHashCode() : 0);
            result = (result * 397) ^ (Organisation != null ? Organisation.GetHashCode() : 0);
            result = (result * 397) ^ (OtherName != null ? OtherName.GetHashCode() : 0);
            result = (result * 397) ^ (PermentAddress != null ? PermentAddress.GetHashCode() : 0);
            result = (result * 397) ^ (PersonOwnerType != null ? PersonOwnerType.GetHashCode() : 0);
            result = (result * 397) ^ (PlaceOfBirth != null ? PlaceOfBirth.GetHashCode() : 0);
            result = (result * 397) ^ (PostalAddress != null ? PostalAddress.GetHashCode() : 0);
            result = (result * 397) ^ (PreferredLanguage != null ? PreferredLanguage.GetHashCode() : 0);
            result = (result * 397) ^ (ProfilePhotoName != null ? ProfilePhotoName.GetHashCode() : 0);
            result = (result * 397) ^ (Religion != null ? Religion.GetHashCode() : 0);
            result = (result * 397) ^ (Surname != null ? Surname.GetHashCode() : 0);
            result = (result * 397) ^ (TelephoneContact != null ? TelephoneContact.GetHashCode() : 0);
            result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0);
            result = (result * 397) ^ (WebsiteUrl != null ? WebsiteUrl.GetHashCode() : 0);
            return(result);
        }
示例#2
0
        private static string GetUrlWithoutWWW()
        {
            WebsiteUrl = Stgs.WebRt;
            var withoutWWW = WebsiteUrl.Replace("www.", "");

            WebsiteUrlWithoutWWWLength = withoutWWW.Length;
            return(withoutWWW);
        }
示例#3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Location other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) &&
                   ((Capabilities == null && other.Capabilities == null) || (Capabilities?.Equals(other.Capabilities) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((MerchantId == null && other.MerchantId == null) || (MerchantId?.Equals(other.MerchantId) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((LanguageCode == null && other.LanguageCode == null) || (LanguageCode?.Equals(other.LanguageCode) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((BusinessName == null && other.BusinessName == null) || (BusinessName?.Equals(other.BusinessName) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((WebsiteUrl == null && other.WebsiteUrl == null) || (WebsiteUrl?.Equals(other.WebsiteUrl) == true)) &&
                   ((BusinessHours == null && other.BusinessHours == null) || (BusinessHours?.Equals(other.BusinessHours) == true)) &&
                   ((BusinessEmail == null && other.BusinessEmail == null) || (BusinessEmail?.Equals(other.BusinessEmail) == true)) &&
                   ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) &&
                   ((TwitterUsername == null && other.TwitterUsername == null) || (TwitterUsername?.Equals(other.TwitterUsername) == true)) &&
                   ((InstagramUsername == null && other.InstagramUsername == null) || (InstagramUsername?.Equals(other.InstagramUsername) == true)) &&
                   ((FacebookUrl == null && other.FacebookUrl == null) || (FacebookUrl?.Equals(other.FacebookUrl) == true)) &&
                   ((Coordinates == null && other.Coordinates == null) || (Coordinates?.Equals(other.Coordinates) == true)) &&
                   ((LogoUrl == null && other.LogoUrl == null) || (LogoUrl?.Equals(other.LogoUrl) == true)) &&
                   ((PosBackgroundUrl == null && other.PosBackgroundUrl == null) || (PosBackgroundUrl?.Equals(other.PosBackgroundUrl) == true)) &&
                   ((Mcc == null && other.Mcc == null) || (Mcc?.Equals(other.Mcc) == true)) &&
                   ((FullFormatLogoUrl == null && other.FullFormatLogoUrl == null) || (FullFormatLogoUrl?.Equals(other.FullFormatLogoUrl) == true)));
        }
示例#4
0
        protected override void Validate()
        {
            if (string.IsNullOrEmpty(FirstName))
            {
                AddBrokenRule(UserBusinessRule.UserFirstNameRequired);
            }
            if (string.IsNullOrEmpty(LastName))
            {
                AddBrokenRule(UserBusinessRule.UserLastNameRequired);
            }
            if (HomePhone != null && !string.IsNullOrEmpty(HomePhone.Number) && !IsValidPhoneNumberLength(HomePhone.Number))
            {
                AddBrokenRule(ValueObjects.ValueObjectBusinessRule.PhoneNumberMinimumLength);
            }
            if (MobilePhone != null && !string.IsNullOrEmpty(MobilePhone.Number) && !IsValidPhoneNumberLength(MobilePhone.Number))
            {
                AddBrokenRule(ValueObjects.ValueObjectBusinessRule.PhoneNumberMinimumLength);
            }
            if (WorkPhone != null && !string.IsNullOrEmpty(WorkPhone.Number) && !IsValidPhoneNumberLength(WorkPhone.Number))
            {
                AddBrokenRule(ValueObjects.ValueObjectBusinessRule.PhoneNumberMinimumLength);
            }
            if (Email != null && !string.IsNullOrEmpty(Email.EmailId) && !IsValidEmail(Email.EmailId))
            {
                AddBrokenRule(UserBusinessRule.UserPrimaryEmailRequired);
            }
            /*Validates if all the secondary emails are valid*/
            if (SecondaryEmails != null)
            {
                foreach (Email email in SecondaryEmails)
                {
                    if (!string.IsNullOrEmpty(email.EmailId) && !IsValidEmail(email.EmailId))
                    {
                        AddBrokenRule(ValueObjects.ValueObjectBusinessRule.EmailIsInvalid);
                    }
                }
            }
            /*Validates if all the emails are valid*/
            if (Emails != null)
            {
                foreach (Email email in Emails)
                {
                    if (!string.IsNullOrEmpty(email.EmailId) && !IsValidEmail(email.EmailId))
                    {
                        AddBrokenRule(ValueObjects.ValueObjectBusinessRule.EmailIsInvalid);
                    }
                }
            }

            /*Validate Facebook URL:*/
            if (!IsValidUrl(facebookUrl, "facebook.com/"))
            {
                AddBrokenRule(UserBusinessRule.UserFacebookUrlInvalid);
            }
            /*Validate Twitter URL:*/
            if (!IsValidUrl(twitterUrl, "twitter.com/"))
            {
                AddBrokenRule(UserBusinessRule.UserTwitterUrlInvalid);
            }
            /*Validate Google+ URL:*/
            if (!IsValidUrl(googlePlusUrl, "plus.google.com/"))
            {
                AddBrokenRule(UserBusinessRule.UserGooglePlusUrlInvalid);
            }
            /*Validate LinkedIn URL:*/
            if (!IsValidUrl(linkedInUrl, "linkedin.com/"))
            {
                AddBrokenRule(UserBusinessRule.UserLinkedInUrlInvalid);
            }
            /*Validate Blog URL:*/
            if (BlogUrl != null && !string.IsNullOrEmpty(BlogUrl.URL) && !BlogUrl.IsValidURL())
            {
                AddBrokenRule(UserBusinessRule.UserBlogInUrlInvalid);
            }
            /*Validate Web URL:*/
            if (WebsiteUrl != null && !string.IsNullOrEmpty(WebsiteUrl.URL) && !WebsiteUrl.IsValidURL())
            {
                AddBrokenRule(UserBusinessRule.UserWebURLInvalid);
            }
        }
        /// <summary>
        /// process test data to generate testplan
        /// </summary>
        /// <param name="testDataDto"> the test data object</param>
        /// <param name="testQueue"> the test queue object</param>
        public void ProcessTestQueueExecutableData(IEnumerable <TblTestDataDto> testDataDto, TblTestQueueDto testQueue)
        {
            if (testDataDto != null && testDataDto.Any())
            {
                foreach (var item in testDataDto)
                {
                    switch (item.LinkTestType)
                    {
                    case (int)LinkTestType.TestStep:
                    {
                        item.ExecutionSequence = this.ExecutionSequence++;
                        this.testPlan.Add(item);
                        break;
                    }

                    case (int)LinkTestType.SqlTestStep:
                    {
                        item.ExecutionSequence = this.ExecutionSequence++;
                        this.testPlan.Add(item);
                        break;
                    }

                    case (int)LinkTestType.SharedTest:
                    {
                        var sharedSteps = item.SharedTest.SharedTestDataList.Where(x => !x.IsDeleted).OrderBy(x => x.ExecutionSequence).ToList();
                        foreach (var sharedStep in sharedSteps)
                        {
                            var lnkSharedTestStep = item.SharedTestSteps.FirstOrDefault(x => x.SharedTestDataId == sharedStep.Id && x.IsDeleted != true);
                            if (lnkSharedTestStep != null)
                            {
                                if (lnkSharedTestStep.NewOrder > 0)
                                {
                                    sharedStep.ExecutionSequence = lnkSharedTestStep.NewOrder;
                                }

                                if (!string.IsNullOrEmpty(lnkSharedTestStep.NewValue))
                                {
                                    sharedStep.Value = lnkSharedTestStep.NewValue;
                                }

                                sharedStep.IsIgnored = lnkSharedTestStep.IsIgnored ?? false;
                            }
                        }

                        sharedSteps.RemoveAll(m => m.IsIgnored);
                        var  mapper = this.mapperFactory.GetMapper <TblSharedTestDataDto, TblTestDataDto>();
                        var  sharedStepMappedWithTestData = sharedSteps.Select(mapper.Map).OrderBy(x => x.ExecutionSequence).ToList();
                        long es = this.ExecutionSequence;
                        sharedStepMappedWithTestData.ForEach(x => { x.ExecutionSequence = es++; x.IsStepBelongsToSharedComponent = true; });
                        this.ExecutionSequence = es;
                        this.testPlan.AddRange(sharedStepMappedWithTestData);
                        break;
                    }

                    case (int)LinkTestType.SharedWebsiteTest:
                    {
                        var        testData = this.table.Find(x => x.TestId == item.SharedStepWebsiteTestId && !x.IsDeleted).OrderBy(x => x.ExecutionSequence).ToList();
                        var        mapper   = this.mapperFactory.GetMapper <TblTestData, TblTestDataDto>();
                        var        testDataDtoForSharedWebsiteTest = testData.Select(mapper.Map).OrderBy(x => x.ExecutionSequence).ToList();
                        var        website = this.mapperFactory.GetMapper <TblWebsite, TblWebsiteDto>().Map(testData[0].Test.Website);
                        WebsiteUrl urlData = new WebsiteUrl();
                        if (testQueue.SuiteId.HasValue)
                        {
                            var schedular = this.schedulerService.GetById(testQueue.SchedulerId.Value);
                            urlData = website.WebsiteUrlList.FirstOrDefault(m => m.Id == schedular.Item.UrlId);
                        }
                        else
                        {
                            urlData = website.WebsiteUrlList.FirstOrDefault(m => m.Id == testQueue.Settings.UrlId);
                        }

                        TblTestDataDto dummyStep = new TblTestDataDto {
                            ActionValue = this.actionService.GetById(long.Parse(ConfigurationManager.AppSettings["LoadNewUrlActionId"].ToString())).Item.Value, ActionId = long.Parse(ConfigurationManager.AppSettings["LoadNewUrlActionId"].ToString()), Value = urlData.Url, LinkTestType = (int)LinkTestType.TestStep
                        };
                        testDataDtoForSharedWebsiteTest.Insert(0, dummyStep);
                        this.ProcessTestQueueExecutableData(testDataDtoForSharedWebsiteTest, testQueue);
                        break;
                    }
                    }
                }
            }
        }
示例#6
0
        public override int GetHashCode()
        {
            int hashCode = -255518735;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Address != null)
            {
                hashCode += Address.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            if (Capabilities != null)
            {
                hashCode += Capabilities.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (MerchantId != null)
            {
                hashCode += MerchantId.GetHashCode();
            }

            if (Country != null)
            {
                hashCode += Country.GetHashCode();
            }

            if (LanguageCode != null)
            {
                hashCode += LanguageCode.GetHashCode();
            }

            if (Currency != null)
            {
                hashCode += Currency.GetHashCode();
            }

            if (PhoneNumber != null)
            {
                hashCode += PhoneNumber.GetHashCode();
            }

            if (BusinessName != null)
            {
                hashCode += BusinessName.GetHashCode();
            }

            if (Type != null)
            {
                hashCode += Type.GetHashCode();
            }

            if (WebsiteUrl != null)
            {
                hashCode += WebsiteUrl.GetHashCode();
            }

            if (BusinessHours != null)
            {
                hashCode += BusinessHours.GetHashCode();
            }

            if (BusinessEmail != null)
            {
                hashCode += BusinessEmail.GetHashCode();
            }

            if (Description != null)
            {
                hashCode += Description.GetHashCode();
            }

            if (TwitterUsername != null)
            {
                hashCode += TwitterUsername.GetHashCode();
            }

            if (InstagramUsername != null)
            {
                hashCode += InstagramUsername.GetHashCode();
            }

            if (FacebookUrl != null)
            {
                hashCode += FacebookUrl.GetHashCode();
            }

            if (Coordinates != null)
            {
                hashCode += Coordinates.GetHashCode();
            }

            if (LogoUrl != null)
            {
                hashCode += LogoUrl.GetHashCode();
            }

            if (PosBackgroundUrl != null)
            {
                hashCode += PosBackgroundUrl.GetHashCode();
            }

            if (Mcc != null)
            {
                hashCode += Mcc.GetHashCode();
            }

            if (FullFormatLogoUrl != null)
            {
                hashCode += FullFormatLogoUrl.GetHashCode();
            }

            return(hashCode);
        }
示例#7
0
        protected override void Validate()
        {
            //if (!string.IsNullOrEmpty(ImageUrl) && !this.IsValidImageType())
            //{
            //        AddBrokenRule(ContactBusinessRule.ContactImageTypeInvalid);
            //}

            if (WorkPhone != null && !string.IsNullOrEmpty(WorkPhone.Number) && !IsValidPhoneNumberLength(WorkPhone.Number))
            {
                AddBrokenRule(ValueObjects.ValueObjectBusinessRule.PhoneNumberMinimumLength);
            }

            if (!string.IsNullOrEmpty(Email.EmailId) && !IsValidEmail(Email.EmailId))
            {
                AddBrokenRule(ContactBusinessRule.ContactPrimaryEmailRequired);
            }

            foreach (Address address in Addresses)
            {
                if (!address.IsValidCountry())
                {
                    AddBrokenRule(ValueObjectBusinessRule.CountryInAddressRequired);
                }
                if (!address.IsValidState())
                {
                    AddBrokenRule(ValueObjectBusinessRule.StateInAddressRequired);
                }
                if (address.Country.Code == "US" && !string.IsNullOrEmpty(address.ZipCode) && !IsValidUSZipCode(address.ZipCode))
                {
                    AddBrokenRule(ValueObjectBusinessRule.ZipCodeFormatInvalid);
                }
                if (address.Country.Code == "CA" && !string.IsNullOrEmpty(address.ZipCode) && !IsValidCanadianPostalCode(address.ZipCode))
                {
                    AddBrokenRule(ValueObjectBusinessRule.PostalCodeFormatInvalid);
                }
            }

            //If "LastContacted" is entered manually by the user then the following validation is valid
            if (LastContacted > DateTime.Today)
            {
                AddBrokenRule(ContactBusinessRule.ContactLastContactedDateInvalid);
            }

            //Validates if all the secondary emails are valid
            if (SecondaryEmails != null)
            {
                foreach (Email email in SecondaryEmails)
                {
                    if (!string.IsNullOrEmpty(Email.EmailId) && !IsValidEmail(email.EmailId))
                    {
                        AddBrokenRule(ValueObjects.ValueObjectBusinessRule.EmailIsInvalid);
                    }
                }
            }
            //Validate Facebook URL:
            //if (FacebookUrl !=null && !string.IsNullOrEmpty(FacebookUrl.URL) && (!FacebookUrl.IsValidURL() || !this.FacebookUrl.URL.ToLower().Contains("facebook.com")))
            if (facebookUrl != null && !string.IsNullOrEmpty(facebookUrl.URL) && !IsFacebookURLValid(facebookUrl))
            {
                AddBrokenRule(ContactBusinessRule.ContactFacebookUrlInvalid);
            }

            //Validate Twitter URL:
            if (twitterUrl != null && !string.IsNullOrEmpty(twitterUrl.URL) && !IsTwitterURLValid(twitterUrl))
            {
                AddBrokenRule(ContactBusinessRule.ContactTwitterUrlInvalid);
            }

            //Validate Google+ URL:
            if (googlePlusUrl != null && !string.IsNullOrEmpty(googlePlusUrl.URL) && !IsGooglePlusURLValid(googlePlusUrl))
            {
                AddBrokenRule(ContactBusinessRule.ContactGooglePlusUrlInvalid);
            }

            //Validate LinkedIn URL:
            if (linkedInUrl != null && !string.IsNullOrEmpty(linkedInUrl.URL) && !IsLinkedInURLValid(linkedInUrl))
            {
                AddBrokenRule(ContactBusinessRule.ContactLinkedInUrlInvalid);
            }

            //Validate Blog URL:
            if (BlogUrl != null && !string.IsNullOrEmpty(BlogUrl.URL) && !BlogUrl.IsValidURL())
            {
                AddBrokenRule(ContactBusinessRule.ContactBlogInUrlInvalid);
            }

            //Validate Web URL:
            if (WebsiteUrl != null && !string.IsNullOrEmpty(WebsiteUrl.URL) && !WebsiteUrl.IsValidURL())
            {
                AddBrokenRule(ContactBusinessRule.ContactWebURLInvalid);
            }
        }