Ejemplo n.º 1
0
        /// <summary>
        /// Compares two AddressBookEntry objects
        /// </summary>
        public static bool operator !=(SimpleContactCard Address1, SimpleContactCard Address2)
        {
            string x, y;

            if (((object)Address1) == null)
            {
                return(((object)Address2) != null);
            }
            else if (((object)Address2) == null)
            {
                return(((object)Address1) != null);
            }

            try
            { x = Address1.ToString(); }
            catch (NullReferenceException ex)
            {
                string temp = ex.Message;
                x = "null";
            }

            try
            { y = Address2.ToString(); }
            catch (NullReferenceException ex)
            {
                string temp = ex.Message;
                y = "null";
            }

            return(x != y);
        }
        protected static void AddTestData(DbContext context)
        {
            var address1 = new Address { Street = "3 Dragons Way", City = "Meereen" };
            var address2 = new Address { Street = "42 Castle Black", City = "The Wall" };
            var address3 = new Address { Street = "House of Black and White", City = "Braavos" };

            context.Set<Person>().AddRange(
                new Person { Name = "Daenerys Targaryen", Address = address1 },
                new Person { Name = "John Snow", Address = address2 },
                new Person { Name = "Arya Stark", Address = address3 },
                new Person { Name = "Harry Strickland" });

            context.Set<Address>().AddRange(address1, address2, address3);

            var address21 = new Address2 { Id = "1", Street = "3 Dragons Way", City = "Meereen" };
            var address22 = new Address2 { Id = "2", Street = "42 Castle Black", City = "The Wall" };
            var address23 = new Address2 { Id = "3", Street = "House of Black and White", City = "Braavos" };

            context.Set<Person2>().AddRange(
                new Person2 { Name = "Daenerys Targaryen", Address = address21 },
                new Person2 { Name = "John Snow", Address = address22 },
                new Person2 { Name = "Arya Stark", Address = address23 });

            context.Set<Address2>().AddRange(address21, address22, address23);

            context.SaveChanges();
        }
Ejemplo n.º 3
0
        public void EnterAddr2(string address2)

        {
            Address2.Clear();

            Address2.SendKeys(address2);
        }
Ejemplo n.º 4
0
        public static void CRUDExample(CorrigoService service, bool isCreateUpdateDelete = false)
        {
            if (service == null)
            {
                return;
            }

            Address2 address = isCreateUpdateDelete ? Create.Execute(service) : null;


            if (address != null)
            {
                address = Read.Retrieve(service, address.Id);

                Update.Execute(service, address);

                Read.Retrieve(service, address.Id);

                Update.Restore(service, address);    // Address2 is not restorable.

                Delete.Execute(service, address.Id); // Attention : delete will exactly delete Address2 from DB.
            }

            Read.RetrieveMultiple(service);

            Read.RetrieveByQuery(service);
        }
Ejemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Address1.Length != 0)
            {
                hash ^= Address1.GetHashCode();
            }
            if (Address2.Length != 0)
            {
                hash ^= Address2.GetHashCode();
            }
            if (City.Length != 0)
            {
                hash ^= City.GetHashCode();
            }
            if (State.Length != 0)
            {
                hash ^= State.GetHashCode();
            }
            if (ZipCode.Length != 0)
            {
                hash ^= ZipCode.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 6
0
        private string serialize(Address2 addr)
        {
            var sw = new StringWriter();

            new XmlSerializer(typeof(Address2)).Serialize(sw, addr);
            return(sw.ToString());
        }
Ejemplo n.º 7
0
        private void SaveAndPop()
        {
            UserTable userChanges = new UserTable();

            userChanges = user;

            userChanges.UserName  = UserName.Trim();
            userChanges.FirstName = FirstName.Trim();
            userChanges.LastName  = LastName.Trim();
            userChanges.Email     = Email.Trim();
            userChanges.Address1  = Address1.Trim();
            if (Address2 != null)
            {
                userChanges.Address2 = Address2.Trim();
            }

            if (Address3 != null)
            {
                userChanges.Address3 = Address3.Trim();
            }

            userChanges.PostCode = PostCode.Trim();
            userChanges.City     = City.Trim();
            userChanges.Country  = Country.Trim();
            userChanges.Phone    = int.Parse(Phone.Trim());
        }
Ejemplo n.º 8
0
        public string getAddressHTMLFormat()
        {
            string Address = Name + " " + LastName + "<br>";

            if (CompanyName == null || CompanyName.Equals("") || CompanyName.Equals(" "))
            {
                Address += "";
            }
            else
            {
                Address += CompanyName + "<br>";
            }
            Address += Address1 + "<br>";

            if (Address2 == null || Address2.Equals("") || Address2.Equals(" "))
            {
                Address += "";
            }
            else
            {
                Address += Address2 + "<br>";
            }

            Address += City + ", " + Stat + " " + Zip + "<br>"
                       + Country;

            return(Address);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Compares two AddressBookEntry objects
        /// </summary>
        public static bool operator ==(AddressBookEntry Address1, AddressBookEntry Address2)
        {
            string x, y;

            if (((object)Address1) == null)
            {
                return(((object)Address2) == null);
            }
            else if (((object)Address2) == null)
            {
                return(((object)Address1) == null);
            }

            try
            { x = Address1.ToString(); }
            catch (NullReferenceException ex)
            {
                string temp = ex.Message;
                x = "null";
            }

            try
            { y = Address2.ToString(); }
            catch (NullReferenceException ex)
            {
                string temp = ex.Message;
                y = "null";
            }

            return(x == y);
        }
Ejemplo n.º 10
0
        public static void Restore(CorrigoService service, Address2 toRestore)
        {
            if (toRestore == null || service == null)
            {
                return;
            }
            Console.WriteLine();
            Console.WriteLine($"Restoring Address2 with id={toRestore.Id.ToString()}");

            var restoreResult = service.Execute(new RestoreCommand
            {
                EntitySpecifier = new EntitySpecifier {
                    Id = toRestore.Id, EntityType = EntityType.Address2
                }
            });

            if (restoreResult == null)
            {
                Console.WriteLine("Update of Address2 failed");
                return;
            }

            if (restoreResult.ErrorInfo != null && !string.IsNullOrEmpty(restoreResult.ErrorInfo.Description))
            {
                Console.WriteLine(restoreResult.ErrorInfo.Description);
                Console.WriteLine("Restore of Address2 failed");
                return;
            }

            Console.WriteLine("Address2 is restored");
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This gets the community information block
        /// </summary>
        /// <param name="CommunityNumber"></param>
        /// <returns></returns>
        public string CommunityInformationSnapIn()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" style=\"width:325px;\">");
            sb.AppendLine("<tr>");
            sb.AppendLine("<td style=\"background-color:#f7f7f7;border:3px solid #efefef;\">");
            sb.AppendFormat("<div style=\"color: #4a6d94; padding-bottom: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: bold;\">{0}</div>", CommunityName);

            sb.AppendFormat("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%;margin-bottom:5px;\">");
            sb.AppendFormat("<tbody>");
            sb.AppendFormat("<tr>");
            sb.AppendFormat("<td style=\"background-color:#FFFFFF;padding:10px;border-top:#e5e5e5 1px solid;border-bottom:#d2d2d2 1px solid;border-left:#dbdbdb 1px solid;border-right:#dbdbdb 1px solid;width: 100%;\"> ");
            sb.AppendFormat("<img src=\"../../../../../../../images/Community/{0}0.jpg\" width='120' style=\"padding:0px 7px 0px 0px;\" align='left' >", CommunityNumber);

            sb.AppendFormat("<div class=\"ContactInformation\" style=\"font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:14px;color:#999999;\">");

            if (Address1.WhenNullOrEmpty(string.Empty).Length > 0 && City.WhenNullOrEmpty(string.Empty).Length > 0)
            {
                sb.AppendLine(Address1 + "<br>");
                if (Address2.WhenNullOrEmpty(string.Empty).Length > 0)
                {
                    sb.AppendLine(Address2 + "<br>");
                }
                sb.AppendLine(City + ",");
                sb.AppendLine(State + " " + Country);
                sb.AppendLine(PostalCode + "<br>");
            }
            if (PhoneNumber1.WhenNullOrEmpty(string.Empty).Length > 0)
            {
                sb.AppendFormat("Phone: {0}<br />", PhoneNumber1);
            }
            if (FaxNumber.WhenNullOrEmpty(string.Empty).Length > 0)
            {
                sb.AppendFormat("Fax: {0}<br />", FaxNumber);
            }
            sb.AppendFormat("</div>");

            if (Region.WhenNullOrEmpty(string.Empty).Length > 0)
            {
                sb.AppendFormat("<br><div style=\"font-family:Helvetica, Arial, sans-serif;font-size:12px;font-weight:bold;color:#999999;\">Region: {0}</div>", Region.WhenNullOrEmpty("&nbsp;"));
            }
            if (Division.WhenNullOrEmpty(string.Empty).Length > 0)
            {
                sb.AppendFormat("<div style=\"font-family:Helvetica, Arial, sans-serif;font-size:12px;font-weight:bold;color:#999999;\">Division: {0}</div>", Division.WhenNullOrEmpty("&nbsp;"));
            }

            sb.AppendFormat("</td>");
            sb.AppendFormat("</tr>");
            sb.AppendFormat("</tbody>");
            sb.AppendFormat("</table>");

            sb.AppendFormat("</td>");
            sb.AppendFormat("</tr>");
            sb.AppendFormat("</tbody>");
            sb.AppendFormat("</table>");

            return(sb.ToString());
        }
Ejemplo n.º 12
0
        public static Address2 Execute(CorrigoService service)
        {
            Console.WriteLine();
            Debug.Print("Creating Address2");
            Console.WriteLine("Creating Address2");

            // Create new Employee
            Employee newEmployee = _9x.WebServices.Employees.Operations.Create.Execute(service);

            var toCreate = new Address2
            {
                ActorTypeId = ActorType.Employee,
                TypeId      = StreetAddrType.Primary,
                ActorId     = newEmployee.Id,
                Street      = "Test Street" + $".ByWSDK.{DateTime.Now.ToShortDateString()} {DateTime.Now.ToShortTimeString()}",
            };

            var resultData = service.Execute(new CreateCommand
            {
                Entity = toCreate
            });

            if (resultData == null)
            {
                Debug.Print("Creation of new Address2 failed");
                Console.WriteLine("Creation of new Address2 failed");
                Console.WriteLine();
                return(null);
            }


            var commandResponse = resultData as OperationCommandResponse;

            int?id = (commandResponse != null && commandResponse.EntitySpecifier != null) ? commandResponse.EntitySpecifier.Id : null;

            if (id.HasValue && resultData.ErrorInfo == null)
            {
                toCreate.Id = id.Value;
                Debug.Print($"Created new Address2 with Id={id.ToString()}");
                Console.WriteLine($"Created new Address2 with Id={id.ToString()}");
                Console.WriteLine();
                return(toCreate);
            }


            Debug.Print("Creation of new Address2 failed");
            Console.WriteLine("Creation of new Address2 failed");
            Console.WriteLine();
            if (resultData.ErrorInfo != null && !string.IsNullOrEmpty(resultData.ErrorInfo.Description))
            {
                Debug.Print(resultData.ErrorInfo.Description);
                Console.WriteLine(resultData.ErrorInfo.Description);
            }


            return(null);
        }
        public void Value_Object_Nullable_Guid_Property_Test()
        {
            var anAddress = new Address2(new Guid("21C67A65-ED5A-4512-AA29-66308FAAB5AF"), "Baris Manco Street", 42);
            var anotherAddress = new Address2(null, "Another street", 42);

            Assert.NotEqual(anAddress, anotherAddress);
            Assert.False(anotherAddress.Equals(anAddress));
            Assert.True(anAddress != anotherAddress);
        }
Ejemplo n.º 14
0
        public Transaction CreateTransaction(CMSDataContext Db, decimal?amount = null)
        {
            if (!amount.HasValue)
            {
                amount = AmtToPay;
            }

            decimal?amtdue = null;

            if (Amtdue > 0)
            {
                amtdue = Amtdue - (amount ?? 0);
            }

            // var ss = m.ProcessType;

            var ti = new Transaction
            {
                First              = First,
                MiddleInitial      = MiddleInitial.Truncate(1) ?? "",
                Last               = Last,
                Suffix             = Suffix,
                Donate             = Donate,
                Regfees            = AmtToPay,
                Amt                = amount,
                Amtdue             = Math.Max((amtdue ?? 0), 0),
                Emails             = Email,
                Testing            = testing,
                Description        = Description,
                OrgId              = OrgId,
                Url                = URL,
                TransactionGateway = OnlineRegModel.GetTransactionGateway(ProcessType)?.GatewayAccountName,
                Address            = Address.Truncate(50),
                Address2           = Address2.Truncate(50),
                City               = City,
                State              = State,
                Country            = Country,
                Zip                = Zip,
                DatumId            = DatumId,
                Phone              = Phone.Truncate(20),
                OriginalId         = OriginalId,
                Financeonly        = FinanceOnly,
                TransactionDate    = Util.Now,
                PaymentType        = Type,
                LastFourCC         = Type == PaymentType.CreditCard ? CreditCard.Last(4) : null,
                LastFourACH        = Type == PaymentType.Ach ? Account.Last(4) : null
            };

            CurrentDatabase.Transactions.InsertOnSubmit(ti);
            CurrentDatabase.SubmitChanges();
            if (OriginalId == null) // first transaction
            {
                ti.OriginalId = ti.Id;
            }

            return(ti);
        }
        public override string GenerateCodeString()
        {
            if (Label == null)
            {
                return("");
            }

            return($"if {Address1.ToString()} {RelOp} {Address2.ToString()} goto {Label.ToString()}");
        }
Ejemplo n.º 16
0
            protected override void Seed(PoolableDbContext context)
            {
                var address1 = new Address {
                    Street = "3 Dragons Way", City = "Meereen"
                };
                var address2 = new Address {
                    Street = "42 Castle Black", City = "The Wall"
                };
                var address3 = new Address {
                    Street = "House of Black and White", City = "Braavos"
                };

                context.Set <Person>().AddRange(
                    new Person {
                    Name = "Daenerys Targaryen", Address = address1
                },
                    new Person {
                    Name = "John Snow", Address = address2
                },
                    new Person {
                    Name = "Arya Stark", Address = address3
                },
                    new Person {
                    Name = "Harry Strickland"
                });

                context.Set <Address>().AddRange(address1, address2, address3);

                var address21 = new Address2 {
                    Id = "1", Street = "3 Dragons Way", City = "Meereen"
                };
                var address22 = new Address2 {
                    Id = "2", Street = "42 Castle Black", City = "The Wall"
                };
                var address23 = new Address2 {
                    Id = "3", Street = "House of Black and White", City = "Braavos"
                };

                context.Set <Person2>().AddRange(
                    new Person2 {
                    Name = "Daenerys Targaryen", Address = address21
                },
                    new Person2 {
                    Name = "John Snow", Address = address22
                },
                    new Person2 {
                    Name = "Arya Stark", Address = address23
                });

                context.Set <Address2>().AddRange(address21, address22, address23);

                context.SaveChanges();
            }
Ejemplo n.º 17
0
        public void EnterUserDetail()
        {
            SignInBtn.Click();
            EmailAddress.SendKeys("*****@*****.**");
            BasePage.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            CreateAcccontBtn.Click();

            // AC 4.1 create user account
            Gender.Click();
            FirstName.SendKeys("Nadeem");
            LastName.SendKeys("Digital");
            Password.SendKeys("123qwe");

            SelectElement DropDay = new SelectElement(Day);

            DropDay.SelectByValue("10");
            SelectElement DropMonth = new SelectElement(Month);

            DropMonth.SelectByValue("9");
            SelectElement DropYear = new SelectElement(Year);

            DropYear.SelectByValue("2020");

            CheckedSpecialOffer.Click();
            AddressFirstName.SendKeys("Nadeem");
            AddressLastName.SendKeys("Digital");
            Company.SendKeys("Test Digital Company");
            Address1.SendKeys("Leeds Town");
            Address2.SendKeys("LS1");
            City.SendKeys("Leeds");

            SelectElement DropDown = new SelectElement(State);

            DropDown.SelectByText("Florida");

            PostCode.SendKeys("00012");
            AdditionalInfo.SendKeys("This is first programme of testig");
            MobileNo.SendKeys("123456789");
            AddressFutureRef.SendKeys("NB_Test");
            ClickRegisterUser.Click();

            //AC 4.4 verify account namme
            Assert.AreEqual("Nadeem Digital", VerifyUser.Text);
            Console.WriteLine(VerifyUser.Text + " Displayed");


            Bpage.Imp_wait();
            //AC 4.3 verify user taken to MY ACCOUNT page
            Assert.IsTrue(Pageheading.Displayed);
            Console.WriteLine(Pageheading.Text + " Displayed");

            SignOut.Click();
        }
Ejemplo n.º 18
0
        public Task <Address> Handle(CreateAddress request, CancellationToken cancellationToken)
        {
            var address1   = Address1.Create(request.Address1);
            var address2   = Address2.Create(request.Address2);
            var city       = City.Create(request.City);
            var state      = State.Create(request.State);
            var postalCode = PostalCode.Create(request.PostalCode);

            var result = Address.Create(address1, address2, city, state, postalCode);

            return(Task.FromResult(result));
        }
Ejemplo n.º 19
0
        public string AddrCityStateZip()
        {
            var sb = new StringBuilder();

            sb.AppendLine(Address1);
            if (Address2.HasValue())
            {
                sb.AppendLine(Address2);
            }
            sb.AppendLine(Util.FormatCSZ(City, State.Value, Zip));
            return(sb.ToString());
        }
Ejemplo n.º 20
0
        public void ShouldNotHaveValidationError_should_correctly_handle_explicitly_providing_object_to_validate_and_other_property_fails_validation()
        {
            var validator = new Address2Validator();

            validator.RuleFor(x => x.StreetNumber).Equal("foo");

            var address = new Address2 {
                StreetNumber = "a",
                Street       = "b"
            };

            validator.ShouldNotHaveValidationErrorFor(a => a.Street, address);
        }
Ejemplo n.º 21
0
        public override bool Equals(object obj)
        {
            var other = obj as IAddress;

            if (other == null)
            {
                return(false);
            }

            return(PostalCode.EqualsIgnoreCase(other.PostalCode) &&
                   Phone.EqualsIgnoreCase(other.Phone) && EMail.EqualsIgnoreCase(other.EMail) &&
                   Country.EqualsIgnoreCase(other.Country) && City.EqualsIgnoreCase(other.City) && Region.EqualsIgnoreCase(other.Region) &&
                   Address1.EqualsIgnoreCase(other.Address1) && Address2.EqualsIgnoreCase(other.Address2));
        }
Ejemplo n.º 22
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Address1?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Address2?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (City?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ProvinceStateCode?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (CountryCode?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (OtherCountry?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (PostalZipCode?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Ejemplo n.º 23
0
        public async Task <IdentityResult> UpdateAddress(Address2 addr)
        {
            context.Entry(addr).State = EntityState.Modified;
            var res = await context.SaveChangesAsync();

            if (res > 0)
            {
                return(IdentityResult.Success);
            }
            return(IdentityResult.Failed(new IdentityError()
            {
                Code = "Update error"
            }));
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ReferenceNumber != null)
         {
             hashCode = hashCode * 59 + ReferenceNumber.GetHashCode();
         }
         if (FirstName != null)
         {
             hashCode = hashCode * 59 + FirstName.GetHashCode();
         }
         if (LastName != null)
         {
             hashCode = hashCode * 59 + LastName.GetHashCode();
         }
         if (Address1 != null)
         {
             hashCode = hashCode * 59 + Address1.GetHashCode();
         }
         if (Address2 != null)
         {
             hashCode = hashCode * 59 + Address2.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (State != null)
         {
             hashCode = hashCode * 59 + State.GetHashCode();
         }
         if (CountryCode != null)
         {
             hashCode = hashCode * 59 + CountryCode.GetHashCode();
         }
         if (PostalCode != null)
         {
             hashCode = hashCode * 59 + PostalCode.GetHashCode();
         }
         if (PhoneNumber != null)
         {
             hashCode = hashCode * 59 + PhoneNumber.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 25
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (Address1 != null && Address2 != null && Address2.ToLower() == Address1.ToLower())
     {
         yield return(new ValidationResult("Address 2 cannot be the same as Address 1."));
     }
     if (State != null && State.Length != 2)
     {
         yield return(new ValidationResult("Enter a 2 digit State code."));
     }
     if (Zipcode != null && Zipcode.Length != 5)
     {
         yield return(new ValidationResult("Enter a 5 digit Zipcode."));
     }
 }
Ejemplo n.º 26
0
        private void SystemTimer_Tick(object sender, EventArgs e)
        {
            byte chr;
            int  value;

            Address4.Value(Computer.Address[3]);
            Address3.Value(Computer.Address[2]);
            Address2.Value(Computer.Address[1]);
            Address1.Value(Computer.Address[0]);
            Data2.Value(Computer.Data[1]);
            Data1.Value(Computer.Data[0]);
            TapeCounter.Text = Computer.TapeDeck.TapeCounter().ToString();
            chr = Computer.TeleType.NextPrintByte();
            while (chr != 0)
            {
                TeleType.AppendText(((char)chr).ToString());
                if (tapePunch.Running)
                {
                    tapePunch.Punch(chr);
                }
                chr = Computer.TeleType.NextPrintByte();
            }
            if (tapeReader.Running)
            {
                value = tapeReader.Next();
                if (value >= 0)
                {
                    Computer.TeleType.Send((byte)value);
                }
            }
            if (Computer.cpu.Debug && !Computer.cpu.NextStep && !singleStepRead)
            {
                DebugA.Text   = Computer.cpu.ac.ToString("X2");
                DebugX.Text   = Computer.cpu.x.ToString("X2");
                DebugY.Text   = Computer.cpu.y.ToString("X2");
                DebugPC.Text  = Computer.cpu.pc.ToString("X2");
                DebugS.Text   = Computer.cpu.sp.ToString("X2");
                FlagN.Visible = ((Computer.cpu.flags & 0x80) == 0x80);
                FlagV.Visible = ((Computer.cpu.flags & 0x40) == 0x40);
                FlagB.Visible = ((Computer.cpu.flags & 0x10) == 0x10);
                FlagD.Visible = ((Computer.cpu.flags & 0x08) == 0x08);
                FlagI.Visible = ((Computer.cpu.flags & 0x04) == 0x04);
                FlagZ.Visible = ((Computer.cpu.flags & 0x02) == 0x02);
                FlagC.Visible = ((Computer.cpu.flags & 0x01) == 0x01);
                DebugOutput.AppendText(Computer.cpu.DebugOutput + "\r\n");
                singleStepRead = true;
            }
        }
        public async Task <IActionResult> Post([FromBody] CreateCustomerRequest request)
        {
            var validator = new CreateCustomerValidator();
            var result    = validator.Validate(request);

            if (!result.IsValid)
            {
                return(BadRequest(result.Errors));
            }

            var address = Address2.Create(request.Address.HouseNoOrName,
                                          request.Address.Street,
                                          request.Address.City,
                                          request.Address.County,
                                          request.Address.PostCode
                                          );

            var customer = Customer2.Create(request.CustomerId,
                                            request.FirstName,
                                            request.LastName,
                                            request.MiddleName,
                                            request.Title,
                                            address,
                                            request.DateOfBirth,
                                            request.CountryOfBirth,
                                            request.IdDocumentType,
                                            request.IdDocumentNumber,
                                            request.VatNumber,
                                            request.VatCountry);

            // wrap customer domain model
            var createCustomerCommand = new CreateCustomerCommand2(customer);

            // command handler returns response that wraps domain model
            var response = await _mediator.Send(createCustomerCommand);

            if (response.Status == OperationStatus.ValidationFailure)
            {
                return(BadRequest(response.ErrorMessages));
            }

            if (response.Status == OperationStatus.Conflict)
            {
                return(Conflict(response));
            }

            return(Ok(response.Value));
        }
Ejemplo n.º 28
0
        public void EnterInvalidDetail()
        {
            SignInBtn.Click();

            EmailAddress.SendKeys("*****@*****.**");
            BasePage.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            CreateAcccontBtn.Click();
            Gender.Click();

            // first name and last name not entered to get the error
            FirstName.SendKeys("");
            LastName.SendKeys("");
            Password.SendKeys("123qwe");

            SelectElement DropDay = new SelectElement(Day);

            DropDay.SelectByValue("10");
            SelectElement DropMonth = new SelectElement(Month);

            DropMonth.SelectByValue("9");
            SelectElement DropYear = new SelectElement(Year);

            DropYear.SelectByValue("2020");

            CheckedSpecialOffer.Click();
            AddressFirstName.SendKeys("Nadeem");
            AddressLastName.SendKeys("Digital");
            Company.SendKeys("Test Digital Company");
            Address1.SendKeys("Leeds Town");
            Address2.SendKeys("LS1");
            City.SendKeys("Leeds");

            SelectElement DropDown = new SelectElement(State);

            DropDown.SelectByText("Florida");

            PostCode.SendKeys("00012");
            AdditionalInfo.SendKeys("This is first programme of testig");
            MobileNo.SendKeys("123456789");
            AddressFutureRef.SendKeys("NB_Test");
            ClickRegisterUser.Click();

            //AC 4.2 verify the error message
            Assert.IsTrue(CreatAnAccoutError.Displayed);
            Console.WriteLine(CreatAnAccoutError.Text + " Displayed");
        }
Ejemplo n.º 29
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Address1 != null?Address1.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Address2 != null ? Address2.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Company != null ? Company.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Postcode != null ? Postcode.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0);
                return(hashCode);
            }
        }
Ejemplo n.º 30
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Address1 != null ? Address1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Address2 != null ? Address2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Company != null ? Company.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Province != null ? Province.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Zip != null ? Zip.GetHashCode() : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 31
0
 public void FillInfo(ClientInfo clientInfo)
 {
     FirstName.SendKeys(clientInfo.FirstName);
     LastName.SendKeys(clientInfo.LastName);
     Username.SendKeys(clientInfo.Username);
     Email.SendKeys(clientInfo.Email);
     Address1.SendKeys(clientInfo.Address1);
     Address2.SendKeys(clientInfo.Address2);
     Country.SelectByIndex(clientInfo.Country);
     State.SelectByIndex(clientInfo.State);
     Zip.SendKeys(clientInfo.Zip);
     CardName.SendKeys(clientInfo.CardName);
     CardNumber.SendKeys(clientInfo.CardNumber);
     CardExpiration.SendKeys(clientInfo.CardExpiration);
     CardCVV.SendKeys(clientInfo.CardCVV);
     ClickSubmitButton();
 }
        public List <string> GetList()
        {
            var list = new List <string>();

            if (!string.IsNullOrWhiteSpace(Address1))
            {
                list.Add(Address1.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(Address2))
            {
                list.Add(Address2.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(Address3))
            {
                list.Add(Address3.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(TownCity))
            {
                list.Add(TownCity.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(County))
            {
                list.Add(County.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(Country))
            {
                list.Add(Country.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(PostCode))
            {
                list.Add(PostCode.TrimI());
            }

            if (!string.IsNullOrWhiteSpace(PoBox))
            {
                list.Add(PoBox.TrimI());
            }

            return(list);
        }
Ejemplo n.º 33
0
 private string serialize(Address2 addr)
 {
     var sw = new StringWriter();
     new XmlSerializer(typeof(Address2)).Serialize(sw, addr);
     return sw.ToString();
 }
Ejemplo n.º 34
0
 private Address2 ValidateAddress(Address2 a)
 {
     var sw = new StringWriter();
     bool addrok = a.CityName.Text.HasValue() && a.StateCode.Text.HasValue();
     if (!addrok && a.ZipCode.Text.HasValue())
         addrok = true;
     if (!addrok && !a.CityName.Text.HasValue() && !a.StateCode.Text.HasValue() && !a.ZipCode.Text.HasValue())
         addrok = true;
     if (!addrok)
     {
         a.Error = "city/state required or zip required (or \"na\" in all)";
         return a;
     }
     if (a.AddressLineOne.Text.HasValue() && (a.CityName.Text.HasValue() || a.StateCode.Text.HasValue() || a.ZipCode.Text.HasValue())
         && (a.CountryName == "United States" || !a.CountryName.HasValue()))
     {
         var r = AddressVerify.LookupAddress(a.AddressLineOne.Text, a.AddressLineTwo.Text, a.CityName.Text, a.StateCode.Text, a.ZipCode.Text);
         if (r.Line1 == "error")
         {
             a.Error = r.address;
             return a;
         }
         if (r.found == false)
         {
             a.Error = r.address + ", if your address will not validate, change the country to 'USA, Not Validated'";
             return a;
         }
         if (r.Line1 != a.AddressLineOne.Text)
         {
             a.AddressLineOne.Error = $"address changed from '{a.AddressLineOne.Text}'";
             a.Error = "changes";
             a.AddressLineOne.Text = r.Line1;
         }
         if (r.Line2 != (a.AddressLineTwo.Text ?? ""))
         {
             a.AddressLineTwo.Error = $"address2 changed from '{a.AddressLineTwo.Text}'";
             a.Error = "changes";
             a.AddressLineTwo.Text = r.Line2;
         }
         if (r.City != (a.CityName.Text ?? ""))
         {
             a.CityName.Error = $"city changed from '{a.CityName.Text}'";
             a.Error = "changes";
             a.CityName.Text = r.City;
         }
         if (r.State != (a.StateCode.Text ?? ""))
         {
             a.StateCode.Error = $"state changed from '{a.StateCode.Text}'";
             a.Error = "changes";
             a.StateCode.Text = r.State;
         }
         if (r.Zip != (a.ZipCode.Text ?? ""))
         {
             a.ZipCode.Error = $"zip changed from '{a.ZipCode.Text}'";
             a.Error = "changes";
             a.ZipCode.Text = r.Zip;
         }
     }
     return a;
 }