public async Task <IActionResult> Confirmation([Bind("CustomerRegistrationId,WorkshopId,CustomerId")] CustomerRegistration customerRegistration) { var Registration = from R in _context.CustomerRegistration where ((R.WorkshopId.Equals(customerRegistration.WorkshopId)) & (R.CustomerId.Equals(customerRegistration.CustomerId))) select R; //we cheack that the specific customer is not registerd to the specific workshop if (!Registration.Any()) { if (ModelState.IsValid) { _context.Add(customerRegistration); //update availabe members counter var Workshop = from R in _context.Workshop.Include(w => w.Category).Include(w => w.Teacher) where (R.WorkshopId.Equals(customerRegistration.WorkshopId)) select R; Workshop.First().Available_Members = Workshop.First().Available_Members - 1; _context.Workshop.Update(Workshop.First()); await _context.SaveChangesAsync(); //redirect to registration index return(RedirectToAction(nameof(MyIndex))); } return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Error", "Home", new { message = "!לקוח יקר, הנך כבר רשום לסדנה זו" })); } }
private void VerifyConvertRegistrationToCustomer(CustomerRegistration registration, Customer customer) { customer.FirstName.Should().Be(registration.FirstName); customer.LastName.Should().Be(registration.LastName); customer.EmailAddress.Should().Be(registration.EmailAddress); customer.Id.Should().NotBeEmpty(); }
public List <CustomerRegistration> Receipts() { Dictionary <string, MySqlParameter> Parameter = new Dictionary <string, MySqlParameter>(); Parameter["Nam"] = new MySqlParameter("Nam", ""); Parameter["Mob"] = new MySqlParameter("Mob", ""); DataTable dt = _GenClassnew.ExecuteQuery("SP_CustomerDetails", Parameter); List <CustomerRegistration> UserList = new List <CustomerRegistration>(); foreach (DataRow row in dt.Rows) { CustomerRegistration UM = new CustomerRegistration(); UM.CustomerID = row.Field <int>("CustomerID"); UM.Name = row.Field <string>("Name"); UM.Gender = row.Field <string>("Gender"); UM.Mobile = row.Field <string>("Mobile"); UM.Email = row.Field <string>("Email"); UM.Payment = row.Field <int>("Payment"); UM.DateOfPayment = row.Field <DateTime>("DateOfPayment"); UM.ExpiryDate = row.Field <DateTime>("ExpiryDate"); UM.Source = row.Field <string>("Source"); UserList.Add(UM); } return(UserList); }
private void cadastroDeClienteToolStripMenuItem_Click(object sender, EventArgs e) { CustomerRegistration client = new CustomerRegistration(); client.Show(); this.Hide(); }
public async Task RegisterCustomerAsync_requests_proper_api() { // arrange var aRequest = new CustomerRegistration { AuthenticationNumber = "123456", CardNumber = "1234-1234-1234-1234", Expiry = "2200-12", Id = Guid.NewGuid().ToString(), PartialPassword = "******", }; var expectedResult = new IamportResponse <Customer> { HttpStatusCode = HttpStatusCode.OK, Content = new Customer { Id = aRequest.Id, InsertedTime = DateTime.UtcNow, } }; var client = GetMockClient(aRequest, expectedResult); var sut = new SubscribeApi(client); // act var result = await sut.RegisterCustomerAsync(aRequest); // assert Mock.Get(client) .Verify(mocked => mocked.RequestAsync <CustomerRegistration, Customer>( It.Is <IamportRequest <CustomerRegistration> >(req => req.Method == HttpMethod.Post && req.Content == aRequest && req.ApiPathAndQueryString.EndsWith($"subscribe/customers/{aRequest.Id}")))); }
protected void CreateUser_Click(object sender, EventArgs e) { var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); CustomerRegistration register = new CustomerRegistration(); register.CustEmail = Email.Text.Replace(" ", ""); int CustomerID = CustomerRegistrationDB.EmailRegistration(register); var signInManager = Context.GetOwinContext().Get <ApplicationSignInManager>(); var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text }; IdentityResult result = manager.Create(user, Password.Text); if (result.Succeeded) { // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 //string code = manager.GenerateEmailConfirmationToken(user.Id); //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request); //manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>."); signInManager.SignIn(user, isPersistent: false, rememberBrowser: false); IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response); } else { ErrorMessage.Text = result.Errors.FirstOrDefault(); } }
public void RegisterNewCustomer_WithValidData_ShouldSucceed() { var customerChecker = Substitute.For <ICustomerChecker>(); customerChecker.IsCustomerEmailInUse(CustomerRegistrationSampleData.Email) .Returns(false); var registration = CustomerRegistration.RegisterNewCustomer( CustomerRegistrationSampleData.Id, CustomerRegistrationSampleData.Email, CustomerRegistrationSampleData.Password, CustomerRegistrationSampleData.FirstName, CustomerRegistrationSampleData.LastName, customerChecker ); Assert.That(registration, Is.Not.Null); var domainEvent = AssertPublishedDomainEvent <NewCustomerRegisteredDomainEvent>(registration); Assert.That(domainEvent.CustomerRegistrationId, Is.EqualTo(CustomerRegistrationSampleData.Id)); Assert.That(domainEvent.Email, Is.EqualTo(CustomerRegistrationSampleData.Email)); Assert.That(domainEvent.Password, Is.EqualTo(CustomerRegistrationSampleData.Password)); Assert.That(domainEvent.FirstName, Is.EqualTo(CustomerRegistrationSampleData.FirstName)); Assert.That(domainEvent.LastName, Is.EqualTo(CustomerRegistrationSampleData.LastName)); }
public CustomerModel Create(CustomerRegistration customer) { if (customer == null) { return(null); } return(new CustomerModel() { addressLine1 = customer.AddressLine1, addressLine2 = customer.AddressLine2, city = customer.City, contactNumber = customer.ContactNumber, country = customer.Country, emailAddress = customer.EmailAddress, firstName = customer.FirstName, id = customer.Id, lastName = customer.LastName, postcode = customer.Postcode, region = customer.Region, isActive = Convert.ToBoolean(customer.IsActive), hasAgreedTC = Convert.ToBoolean(customer.HasAgreedTc), emailConfirmed = Convert.ToBoolean(customer.EmailConfirmed), VerifyCode = customer.VerifyCode }); }
public CustomerRegistrationTests() { var mapper = AutomapperConfiguration.Init(); _customerRepository = Substitute.For <ICustomerRepository>(); _creditCardGateway = Substitute.For <ICreditCardGateway>(); _mailConfirmer = Substitute.For <IMailConfirmer>(); // Default objects ('stubs') var customer = Mocks.GetCustomer(); _vm = Mocks.GetCreateCustomerViewModel(); _creditCardGatewayResponse = Mocks.GetCreditCardGatewayResponse(); // Default system under test ('sut') _sut = new CustomerRegistration(mapper, _customerRepository, _mailConfirmer, _creditCardGateway); // Default Behaviour _customerRepository.Create(Arg.Any <Customer>()).Returns(customer); _customerRepository.CreateRop(Arg.Any <Customer>()).Returns(Result.Ok(customer)); _customerRepository.UpgradeToPremium(Arg.Any <Customer>()).Returns(Result.Ok(customer)); _creditCardGateway.Charge(Arg.Any <string>()).Returns(_creditCardGatewayResponse); _creditCardGateway.ChargeRop(Arg.Any <string>()).Returns(Result.Ok(_creditCardGatewayResponse)); _creditCardGateway.RollBackLastTransactionRop(Arg.Any <Customer>()).Returns(Result.Ok(customer)); _mailConfirmer.SendWelcomeRop(Arg.Any <Customer>()).Returns(Result.Ok(customer)); }
private void VerifyCallUseCase(CustomerController controller, CustomerRegistration rego) { var useCase = (MockRegisterCustomerUseCase)controller.RegisterUseCase; useCase.WasRegisterCalled.Should().BeTrue(); useCase.PassedInRegistration.Should().BeEquivalentTo(rego); }
protected void btnlogin_Click(object sender, EventArgs e) { string userid = txuserid.Text; string psw = txpsw.Text; string utype = usertype1.SelectedValue; if (utype.Equals("ADMIN")) { string status = ShopManagerRegistration.GetShopManagerLoginStatus(userid, psw); Session.Add("USERID", userid); if (status.Equals("valid user")) { Response.Redirect("managerportal.aspx"); } else { lbStatus.Text = status; } } if (utype.Equals("USER")) { string status = CustomerRegistration.GetCustomerLoginStatus(userid, psw); Session.Add("USERID", userid); if (status.Equals("valid user")) { Response.Redirect("ProductHome.aspx"); } else { lbStatus.Text = status; } } }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,CustomerPhoneNumber,TableId")] CustomerRegistration customerRegistration) { if (id != customerRegistration.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customerRegistration); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerRegistrationExists(customerRegistration.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TableId"] = new SelectList(_context.OrderTable, "TableId", "TableId", customerRegistration.TableId); return(View(customerRegistration)); }
public ActionResult UserRegistration() { CustomerRegistration Registration = new CustomerRegistration(); BindDropDowns(); return(View(Registration)); }
private void VerifyCallRepositoryGetCustomerByEmailAddress(RegisterCustomerUseCase useCase, CustomerRegistration registration) { var repository = (MockCustomerRepository)useCase.Repository; repository.WasGetCustomerCalled.Should().BeTrue(); repository.PassedInEmailAddress.Should().Be(registration.EmailAddress); }
public async Task <int> CreateAsync(CustomerRegistration obj) { await _context.CustomerRegistration.AddAsync(obj); await _context.SaveChangesAsync(); return(obj.id); }
public async Task When_Call_Register_Then_Delegate_To_UseCase(ApiCustomerRegistration apiReg, CustomerRegistration reg) { var controller = SetupController(); await controller.Register(apiReg); VerifyCallUseCase(controller, reg); }
public ActionResult GetAllCustomers(string msg = "") { CustomerRegistration Model = new CustomerRegistration(); Model.UsersList = _service.GetAllUser("", ""); BindDropDowns(); ViewBag.renewmsg = msg; return(View(Model)); }
public async Task <Customer> Register(CustomerRegistration registration) { await Validate(registration); var customer = registration.ToCustomer(); await Repository.SaveCustomer(customer); return(customer); }
public void Given_Missing_EmailAddress_When_Call_Register_Then_Throw_MissingEmailAddress(string emailAddress) { var useCase = SetupUseCase(); var registration = new CustomerRegistration("Bob", "Smith", emailAddress); Func <Task> register = async() => { await useCase.Register(registration); }; register.Should().Throw <MissingEmailAddress>() .Where(x => x.Message == "Missing email address."); }
public void Given_Missing_LastName_When_Call_Register_Then_Throw_MissingLastName(string lastName) { var useCase = SetupUseCase(); var registration = new CustomerRegistration("Bob", lastName, "*****@*****.**"); Func <Task> register = async() => { await useCase.Register(registration); }; register.Should().Throw <MissingLastName>() .Where(x => x.Message == "Missing last name."); }
public async Task <IActionResult> UpdateUser([FromBody] UserDto user) { try { Users users = new Users(); if (user.UserType == "C") { CustomerRegistration customerRegistration = _customerRegistrationService.GetCustomer(user.Id); users = await _usersService.GetUser(customerRegistration.UsersID.Value); } else if (user.UserType == "M") { Merchant merchant = await _merchantService.GetMerchant(user.Id); users = await _usersService.GetUser(merchant.UsersID.Value); } else if (user.UserType == "N") { NaqelUsers naqelUsers = await _naqelUsersService.GetNaqelUser(user.Id); users = await _usersService.GetUser(naqelUsers.UsersID.Value); naqelUsers.FirstName = user.FirstName; naqelUsers.LastName = user.LastName; naqelUsers.Email = user.Email; naqelUsers.Address = user.Address; naqelUsers.Country = Convert.ToInt32(user.Country); naqelUsers.UserType = user.NaqelUserType; naqelUsers.Mobile = user.Mobile; await _naqelUsersService.UpdateNaqelUser(naqelUsers); string _getNaqelUsertypedec = await _lookupTypeValuesService.Getlookupdec(Convert.ToInt32(user.NaqelUserType)); await _usersService.UpdateUserType(user.Email, _getNaqelUsertypedec); } if (users != null) { users.Status = user.IsActive == "1" ? 1 : 0; } await _usersService.UpdateUser(users); return(Ok(new GenericResultDto <string> { Result = "User updated successfully" })); } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "User updated successfully" })); }
private void Handle(Register_customer c, List <object> history) { var state = new CustomerRegistration_State(history); var customers = new CustomerRegistration(state, _publish); customers.Register( c.Customer, c.Name, c.Familyname); }
private void btnAddCustomer_Click(object sender, EventArgs e) { using (HotelCrownContext db = new HotelCrownContext()) { int key = int.Parse(dgvRooms.SelectedRows[0].Cells[0].Value.ToString()); CustomerRegistration frm = new CustomerRegistration(key); frm.ChangesDone += Frm_ChangesDone; frm.ShowDialog(); } }
public ActionResult Create(CustomerRegistration customer) { if (ModelState.IsValid) { db.CustomerRegistrations.Add(customer); db.SaveChanges(); return(RedirectToAction("Success")); } return(View()); }
// POST: api/CustomerRegister public void Post([FromBody] CustomerRegistration value) { try { CustomerRegistrationDAL.Insert(value); } catch (Exception ex) { throw ex; } }
public ActionResult Registration(CustomerRegistration model) { try { if (ModelState.IsValid) { using (var db = new CuddlyWombatEntities()) { var existingUser = (from u in db.Users where u.Email == model.Email select u).FirstOrDefault(); if (existingUser != null) { ModelState.AddModelError("", "Existing Internal User."); return(View()); } else { var existingCustomer = (from c in db.Customers where c.Email == model.Email select c).FirstOrDefault(); if (existingCustomer != null) { ModelState.AddModelError("", "Existing Customer."); return(View()); } } var encryptedPassword = CustomEnrypt.Encrypt(model.Password); var customer = new Customer { Email = model.Email, Password = encryptedPassword, GivenName = model.GivenName, Surname = model.Surname, DateCreated = DateTime.Now }; db.Customers.Add(customer); db.SaveChanges(); } return(RedirectToAction("Login", "Auth")); } else { ModelState.AddModelError("", "One or more fields have been"); } } catch (Exception ex) { ModelState.AddModelError("Exception", ex.Message); } return(View()); }
public void Should_be_able_to_insert_new_registration_for_customer() { IRegistrationDataMapper mapper = CreateSUT( ); long customerId = CreateCustomerRecord( ); IRegistration expectedRegistration = new CustomerRegistration("mokhan", "password", "mo", "khan", "4036813389", "calgary"); mapper.Insert(expectedRegistration, customerId); IRegistration actualRegistration = mapper.For(customerId); Assert.AreEqual(expectedRegistration, actualRegistration); }
public async Task <Customer> Register(CustomerRegistration registration) { await Task.CompletedTask; WasRegisterCalled = true; PassedInRegistration = registration; if (ExceptionToThrow != null) { throw ExceptionToThrow; } return(CustomerToReturn); }
public ActionResult UserRegistration(CustomerRegistration Registration) { BindDropDowns(); if (!ModelState.IsValid) { return(View(Registration)); } string res = _service.CustomerRegistration(Registration); return(RedirectToAction("DashboardDetails", "User", new { msg = res })); }
public async Task <IActionResult> Create([Bind("CustomerId,CustomerName,CustomerPhoneNumber,TableId")] CustomerRegistration customerRegistration) { if (ModelState.IsValid) { _context.Add(customerRegistration); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TableId"] = new SelectList(_context.OrderTable, "TableId", "TableId", customerRegistration.TableId); return(View(customerRegistration)); }