protected void RegisterUser_CreatedUser(object sender, EventArgs e) { FormsAuthentication.SetAuthCookie(RegisterUser.UserName, createPersistentCookie: false); string email = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Email")).Text; int dept = Convert.ToInt32(((DropDownList)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Dept")).SelectedValue); int prefix = Convert.ToInt32(((DropDownList)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Prefix")).SelectedValue); string firstName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("FirstName")).Text; string lastName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("LastName")).Text; User x = new User(); x.UserName = RegisterUser.UserName; x.Email = email; x.DeptId = dept; x.PrefixId = prefix; x.FirstName = firstName; x.LastName = lastName; x.StatusId = 0; x.UserLevelId = 2; db.Users.InsertOnSubmit(x); db.SubmitChanges(); var q = (from p in usm.aspnet_Roles where p.RoleName == "Professor" select p.RoleId).First(); var uName = (from p in usm.aspnet_Users where p.UserName == RegisterUser.UserName select p.UserId).First(); aspnet_UsersInRole ro = new aspnet_UsersInRole(); ro.RoleId = q; ro.UserId = uName; usm.aspnet_UsersInRoles.InsertOnSubmit(ro); usm.SubmitChanges(); string continueUrl = RegisterUser.ContinueDestinationPageUrl; if (!OpenAuth.IsLocalUrl(continueUrl)) { continueUrl = "~/"; } Response.Redirect(continueUrl); }
private void attach_Users(User entity) { this.SendPropertyChanging(); entity.Department = this; }
private void detach_Users(User entity) { this.SendPropertyChanging(); entity.Department = null; }
partial void UpdateUser(User instance);
partial void DeleteUser(User instance);
partial void InsertUser(User instance);
private void detach_Users(User entity) { this.SendPropertyChanging(); entity.Prefix = null; }
private void attach_Users(User entity) { this.SendPropertyChanging(); entity.Prefix = this; }
private void attach_Users(User entity) { this.SendPropertyChanging(); entity.UserLevel = this; }
private void detach_Users(User entity) { this.SendPropertyChanging(); entity.UserStatus = null; }