protected void btnSignUp_Click(object sender, EventArgs e) { Users newUser = new Users(); UserManagement _userManagement = new UserManagement(); newUser.Email = txtemail.Value.ToString(); newUser.Password = txtpassword.Value.ToString(); newUser.FirstName = txtfirstname.Value.ToString(); newUser.LastName = txtlastname.Value.ToString(); newUser.CreationDate = DateTime.Now.Date; newUser.LastModifiedDate = DateTime.Now.Date; //newUser.CreationDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); //newUser.LastModifiedDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); try { foreach (Users item in _userManagement.GetAll()) { if (newUser.Email == item.Email) { throw new Exception(); } } _userManagement.Add(newUser); Response.Redirect("Login.aspx", false); } catch (Exception) { lblalertdanger.Visible = true; } }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { UserManagement.Add(new User() { Email = model.Email, FirstName = model.Email, LastName = model.Email, SignupDate = DateTime.Now }); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
private bool AddNewUser(User user) { if (!_userManagement.FindLogin(user.Login)) { _userManagement.Add(user); return(true); } return(false); }
protected void Button2_Click(object sender, EventArgs e)//sign up { RentACar.Model.Entities.Sales.User user = new RentACar.Model.Entities.Sales.User(); user.Sifre = passwordKO.Value; user.Mail = emailKO.Value; user.CreatedOn = DateTime.Now.Date; _userManagement.Add(user); Response.Redirect("Araclar.aspx"); }
public bool RegisterUser(User obj, string activationUrl) { bool isUserAdded = usrMgmt.Add(obj); if (isUserAdded) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add(EmailTemplateParams.ActivationUrl.ToString(), activationUrl); CommonUtils.SendEmail(EmailTemplate.UserActivation, obj.Email, obj.Firstname, obj.Lastname, parameters); } return(isUserAdded); }
private void SignInBtn_MouseDown(object sender, MouseButtonEventArgs e) { List <string> Creds = new List <string>(); foreach (ExtendedTextbox etb in MainStack.Children.OfType <ExtendedTextbox>()) { Creds.Add(etb.Text); } if (MainStack.Children.Count <= 3) { SmtpClient smtp = uAuth.Authenticate(Creds[0], Creds[1]); } else { SmtpClient smtp = uAuth.Authenticate(Creds[0], Creds[1], Creds[2], Convert.ToInt32(Creds[3])); UserManagement userManagement = new UserManagement(1, Creds[0], Creds[1], Creds[4], Creds[5], Creds[6]); userManagement.ProcessFail += FailedToAddUser; userManagement.Add(); } }
public ActionResult Registration([Bind(Exclude = "IsEmailVerified,ActivationCode")] UserData user) { bool status = false; string message = ""; if (ModelState.IsValid) { // Validate if the email address is already existed. var emailExisted = IsEmailExist(user.Email); if (emailExisted) { ModelState.AddModelError("EmailExist", "Your Email Address is already in use"); return(View(user)); } // Generate activation code var code = Guid.NewGuid().ToString("N"); user.Password = PasswordHash.CreateHash(user.Password); user.ConfirmPassword = PasswordHash.CreateHash(user.ConfirmPassword); // This is always going to be false... user.IsEmailVerified = false; UserManagement.Add(user); } else { message = "Invalid Request"; } //Password return(View(user)); }
static void Main(string[] args) { //Oyuncular oluşturuldu ve mernis kontrolü yapılıp eklendi. //isim,soyisim,doğumyılı,tcNo doğru girildiğinde çalışıyor. User user1 = new User { firstName = "Elife", lastName = "Avcı", tcNo=10426, birthDateYear=1970, }; UserManagement userManagement=new UserManagement(new UserCheckManager()); User user2 = new User { firstName = "Feyzi", lastName = "Avcı", tcNo=10664, birthDateYear=1973 }; userManagement.Add(user1); userManagement.Add(user2); //Oyunlar oluşturuldu.Ekleme,silme ve güncelleme işlemleri yapıldı. Game game1 = new Game { gameName="Need For Speed", price=199 }; Game game2 = new Game { gameName = "GTA5", price = 349 }; GameManagement gameManagement = new GameManagement(); gameManagement.Add(game1); gameManagement.Add(game2); gameManagement.Update(game1); gameManagement.Delete(game2); //Kampanyalar oluşturuldu.Ekleme,silme, güncelleme işlemleri yapıldı. Campaign campaign1 = new Campaign { campaignName = "Büyük Fırsat", campaignDisc = 80, }; Campaign campaign2 = new Campaign { campaignName = "Yüzde Elli", campaignDisc = 50, }; CampaignManagement campaignManagent = new CampaignManagement(); campaignManagent.Add(campaign1); campaignManagent.Add(campaign2); gameManagement.Update(campaign2); gameManagement.Delete(campaign1); //Satışları yapılan oyunlar ve satışa ait bilgiler yazdırıldı. Sale sales1 = new Sale() { game = game1, user = user2 }; Sale sales2 = new Sale() { game = game2, user = user1 }; SalesManager salesManager = new SalesManager(); salesManager.SaleGame(sales1); salesManager.CampaignSales(campaign2, sales1); salesManager.SaleGame(sales2); salesManager.CampaignSales(campaign1, sales2); Console.ReadKey(); }