Ejemplo n.º 1
0
        public void FillForm(RegistrationFormModels user)
        {
            /* this.WaitForLoad();
             * Thread.Sleep(1000);*/
            CustomerFirstName.SendKeys(user.CustomerFirstName);
            CustomerLastName.SendKeys(user.CustomerLastName);
            CustomerPassword.SendKeys(user.CustomerPassword);
            CustomerAddress.SendKeys(user.CustomerAddress);
            SelectElement years = new SelectElement(YearDD);

            years.SelectByValue(user.Year);
            SelectElement months = new SelectElement(MonthsDD);

            months.SelectByValue(user.Month);
            SelectElement days = new SelectElement(DaysDD);

            days.SelectByValue(user.Day);
            CustomerAddress.SendKeys(user.CustomerAddress);
            CustomerCity.SendKeys(user.CustomerCity);
            CustomerState.SendKeys(user.CustomerState);
            CustomerPostCode.SendKeys(user.CustomerPostCode);
            CustomerPhoneMobile.SendKeys(user.CustomerPhoneMobile);
            CustomerGender.Click();
            FindSubmitField.Click();
        }
Ejemplo n.º 2
0
 private void CustomerInsert_Click(object sender, EventArgs e) // Customer Insert Button(When I click on insert button the data will insert in Table)
 {
     con.Open();                                               // Connection Open
     comm = new SqlCommand("insert into Customer values('" + CustomerID.Text + "','" + CustomerName.Text + "','" + CustomerLastName.Text + "','" + CustomerAddress.Text + "','" + CustomerPhone.Text + "')", con);
     try
     {
         comm.ExecuteNonQuery();
         MessageBox.Show("Customer Saved"); // Message Box (Its show the saved customers)
         con.Close();                       // Connection Close
         ShowcustRecord();
         CustomerID.Clear();
         CustomerName.Clear();
         CustomerLastName.Clear();
         CustomerAddress.Clear();
         CustomerPhone.Clear();
     }
     catch (Exception)
     {
         MessageBox.Show("Customer Not Saved");    // Message Box
     }
     finally
     {
         con.Close();    // Connection Close
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> RegisterCustomer(CustomerRegistrationDto registrationDto)
        {
            Result <CustomerFirstName>   customerFirstNameOrError = CustomerFirstName.Create(registrationDto.FirstName);
            Result <CustomerLastName>    customerLastNameOrError  = CustomerLastName.Create(registrationDto.LastName);
            Result <CustomerDateOfBirth> customerDOBOrError       = CustomerDateOfBirth.Create(registrationDto.DateOfBirth);
            Result <Email> emailOrError = Email.Create(registrationDto.Email);
            Result <PolicyReferenceNumber> policyReferenceOrError = PolicyReferenceNumber.Create(registrationDto.PolicyReferenceNumber);
            var result = Result.Combine(customerFirstNameOrError,
                                        customerLastNameOrError,
                                        customerDOBOrError,
                                        emailOrError,
                                        policyReferenceOrError);

            if (result.IsFailure)
            {
                return(BadRequest(result.Error));
            }
            var customerEntity = _mapper.Map <Customer>(registrationDto);
            await _customerRepository.AddItemAsync(customerEntity);

            await _customerRepository.SaveAsync();

            var customerToReturn = _mapper.Map <CustomerDto>(customerEntity);

            _logger.LogInformation($"a customer id {customerToReturn.Id} is registered");
            return(CreatedAtRoute("GetCustomer", new { id = customerToReturn.Id }, customerToReturn));
        }
Ejemplo n.º 4
0
 // Update Customer Button(This button used for update customer details
 private void UpdateCustomer_Click(object sender, EventArgs e)
 {
     con.Open();// Connection Open
     comm = new SqlCommand("update Customer set CId= '" + CustomerID.Text + "', FName= '" + CustomerName.Text + "', LName='" + CustomerLastName.Text + "', CAddress='" + CustomerAddress.Text + "', CPhoneNo='" + CustomerPhone.Text + "' where CId = '" + CustomerID.Text + "'", con);
     try
     {
         comm.ExecuteNonQuery();
         MessageBox.Show("Customer Updated");
         con.Close();// Connection Close
         ShowcustRecord();
         CustomerID.Clear();
         CustomerName.Clear();
         CustomerLastName.Clear();
         CustomerAddress.Clear();
         CustomerPhone.Clear();
     }
     catch (Exception)
     {
         MessageBox.Show("Customer Not Updated");
     }
     finally
     {
         con.Close();// Connection Close
     }
 }
Ejemplo n.º 5
0
 // Delete Customer Button(This button used for delete the customer)
 private void DeleteCustomer_Click(object sender, EventArgs e)
 {
     con.Open();// Connection Open
     comm = new SqlCommand("delete from Customer where CId = " + CustomerID.Text + " ", con);
     try
     {
         comm.ExecuteNonQuery();
         MessageBox.Show("Customer Deleted");
         con.Close();// Connection Close
         ShowcustRecord();
         CustomerID.Clear();
         CustomerName.Clear();
         CustomerLastName.Clear();
         CustomerAddress.Clear();
         CustomerPhone.Clear();
         CustomerID.Focus();
     }
     catch (Exception x)
     {
         MessageBox.Show("Customer Not Deleted" + x.Message);
     }
     finally
     {
         con.Close();// Connection Close
     }
 }
Ejemplo n.º 6
0
        public override string ToString()
        {
            if (CustomerLastName.Trim() != "" || CustomerName.Trim() != "")
            {
                return($"{CompanyName} - {CustomerName} {CustomerLastName}");
            }

            return($"{CompanyName}");
        }
 public void FillForm(RegistrationUser user)
 {
     RadioButtons[0].Click();
     CustomerFirstName.SendKeys(user.FirstName);
     CustomerLastName.SendKeys(user.LastName);
     Password.SendKeys(user.Password);
     Days.SelectByValue(user.Date);
     Months.SelectByValue(user.Month);
     Years.SelectByValue(user.Year);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.PostCode);
     Phone.SendKeys(user.Phone);
     RegisterButton.Click();
 }
Ejemplo n.º 8
0
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Customer>(x =>
     {
         x.Property(p => p.Email)
         .HasConversion(p => p.Value, p => Email.Create(p).Value);
         x.Property(p => p.DateOfBirth)
         .HasConversion(p => p.Value, p => CustomerDateOfBirth.Create(p).Value);
         x.Property(p => p.PolicyReferenceNumber)
         .HasConversion(p => p.Value, p => PolicyReferenceNumber.Create(p).Value);
         x.Property(p => p.FirstName)
         .HasConversion(p => p.Value, p => CustomerFirstName.Create(p).Value);
         x.Property(p => p.LastName)
         .HasConversion(p => p.Value, p => CustomerLastName.Create(p).Value);
     });
 }
        public CustomerProfile()
        {
            CreateMap <Models.CustomerRegistrationDto, Entities.Customer>()
            .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => CustomerFirstName.Create(src.FirstName).Value))
            .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => CustomerLastName.Create(src.LastName).Value))
            .ForMember(dest => dest.PolicyReferenceNumber, opt => opt.MapFrom(src => PolicyReferenceNumber.Create(src.PolicyReferenceNumber).Value))
            .ForMember(dest => dest.DateOfBirth, opt => opt.MapFrom(src => CustomerDateOfBirth.Create(src.DateOfBirth).Value))
            .ForMember(dest => dest.Email, opt => opt.MapFrom(src => Email.Create(src.Email).Value));
            CreateMap <Entities.Customer, Models.CustomerRegistrationDto>()
            .ForMember(dest => dest.DateOfBirth, opt => opt.MapFrom(src => src.DateOfBirth.Value))
            .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.Email.Value))
            .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName.Value))
            .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName.Value))
            .ForMember(dest => dest.PolicyReferenceNumber, opt => opt.MapFrom(src => src.PolicyReferenceNumber.Value));

            CreateMap <Entities.Customer, Models.CustomerDto>();
        }
 public void FillForm(User user)
 {
     RadioButtons[0].Click();
     CustomerFirstName.SendKeys(user.FirstName);
     CustomerLastName.SendKeys(user.LastName);
     Password.SendKeys(user.Password);
     Days.SelectByValue(user.Day);
     Months.SelectByValue(user.Month);
     Years.SelectByValue(user.Year);
     FirstName.SendKeys(user.AddressFirstName);
     LastName.SendKeys(user.AddressLastName);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.Postalcode);
     Phone.SendKeys(user.MobilePhone);
     Alias.SendKeys(user.Alias);
 }
Ejemplo n.º 11
0
        public List <Message> Validate()
        {
            var errors = new List <Message>();

            if (CompanyName.Trim() == "" && (CustomerName.Trim() == "" && CustomerLastName.Trim() == ""))
            {
                errors.Add(new Message("Należy podać nazwe firmy lub imię i nazwisko"));
            }
            var rgx = new Regex("^[0-9]{10}");
            var nip = Nip.Replace("-", "").Replace(" ", "").Trim();

            if (!rgx.IsMatch(nip) && Nip.Trim() != "")
            {
                errors.Add(new Message("Nip jest niepoprawny"));
            }

            return(errors);
        }
 public void FillForm(RegistrationUser user)
 {
     RadioButtons.Click();
     CustomerFirstName.Type(user.FirstName);
     CustomerLastName.Type(user.LastName);
     Password.Type(user.Password);
     //Days.SelectByText(user.Date);
     //Months.SelectByText(user.Month);
     //Years.SelectByText(user.Year);
     FirstName.Type(user.RealFirstName);
     LastName.Type(user.RealLastName);
     Address.Type(user.Address);
     City.Type(user.City);
     State.SelectByText(user.State);
     Zip.Type(user.Zip);
     Phone.Type(user.Phone);
     Alias.Type(user.Alias);
     RegisterButton.Click();
 }
Ejemplo n.º 13
0
 public void FillFormEmail(UserProperty user)
 {
     Radiobuttons[0].Click();
     CustomerFirstName.SendKeys(user.FirstName);
     CustomerLastName.SendKeys(user.LastName);
     passwordField.SendKeys(user.Password);
     Days.SelectByValue(user.Day);
     Months.SelectByValue(user.Month);
     Years.SelectByValue(user.Year);
     FirstName.SendKeys(user.AdressFirstName);
     LastName.SendKeys(user.AddressLastName);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.Postalcode);
     Phone.SendKeys(user.Phone);
     Alias.SendKeys(user.Alias);
     Email.Clear();
     RegisterButton.Click();
 }
        public void FillForm(RegistrationUser user)
        {
            Titles[user.Title].Click();
            CustomerFirstName.Type(user.CustomerFirstName);
            CustomerLastName.Type(user.CustomerLastName);
            Password.Type(user.Password);
            Days.SelectByValue(user.Day);
            Months.SelectByValue(user.Month);
            Years.SelectByValue(user.Year);
            FirstName.Type(user.FirstName);
            LastName.Type(user.LastName);
            Company.Type(user.Address);
            Address.Type(user.Address);
            Country.SelectByText(user.Country);
            State.SelectByText(user.State);
            City.Type(user.City);
            Postcode.Type(user.Postcode);
            MobilePhone.Type(user.MobilePhone);

            registerSubmit.Click();
        }
        public void FillForm(RegistrationUser user)
        {
            Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

            RadioButtons[1].Click();
            CustomerFirstName.SendKeys(user.FirstName);
            CustomerLastName.SendKeys(user.LastName);
            Password.SendKeys(user.Password);
            Days.SelectByValue(user.Date);
            Months.SelectByValue(user.Month);
            Years.SelectByValue(user.Year);
            RealFirstName.SendKeys(user.RealFirstName);
            RealLastName.SendKeys(user.RealLastName);
            Address.SendKeys(user.Address);
            City.SendKeys(user.City);
            State.SelectByText(user.State);
            PostCode.SendKeys(user.PostCode);
            Phone.SendKeys(user.Phone);
            Alias.Type(user.Alias);
            RegisterButton.Click();
        }