protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { TextBox TextBoxNume = CreateUserWizard1.FindControl("TextBoxNume") as TextBox; if (TextBoxNume != null) { Profile.Nume = TextBoxNume.Text; } TextBox TextBoxPrenume = CreateUserWizard1.FindControl("TextBoxPrenume") as TextBox; if (TextBoxPrenume != null) { Profile.Prenume = TextBoxPrenume.Text; } TextBox TextBoxOras = CreateUserWizard1.FindControl("TextBoxOras") as TextBox; if (TextBoxOras != null) { Profile.Oras = TextBoxOras.Text; } RadioButtonList RadioButtonListSex = CreateUserWizard1.FindControl("RadioButtonListSex") as RadioButtonList; if (RadioButtonListSex != null) { Profile.Sex = Int32.Parse(RadioButtonListSex.SelectedValue); } TextBox TextBoxDataNasterii = CreateUserWizard1.FindControl("TextBoxDataNasterii") as TextBox; if (TextBoxDataNasterii != null) { Profile.DataNasterii = DateTime.Parse(TextBoxDataNasterii.Text); } }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { InfoControl.Web.Security.MembershipManager mManager = new InfoControl.Web.Security.MembershipManager(this); InfoControl.Web.Security.DataEntities.User user = mManager.GetUserByName(CreateUserWizard1.UserName.ToString()); Profile profile = new Profile(); ProfileManager pManager = new ProfileManager(this); profile.Name = (CreateUserWizard1.FindControl("txtName") as TextBox).Text; profile.CPF = (CreateUserWizard1.FindControl("txtCPF") as TextBox).Text; //profile.Address = (CreateUserWizard1.FindControl("txtAddress") as TextBox).Text; profile.Phone = (CreateUserWizard1.FindControl("txtPhone") as TextBox).Text; //profile.Neighborhood = (CreateUserWizard1.FindControl("txtNeighborhood") as TextBox).Text; profile.PostalCode = (CreateUserWizard1.FindControl("txtPostalCode") as TextBox).Text; profile.ModifiedDate = DateTime.Now; //profile.UserId = user.UserId; //profile.StateId = (CreateUserWizard1.FindControl("cboState") as DropDownList).SelectedValue; try { pManager.Insert(profile); } catch (Exception ex) { if (ex != null) { return; } } Context.Items.Add("UserId", user.UserId); Server.Transfer("User.aspx"); }
protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { TextBox t = CreateUserWizard1.FindControl("TBFirstName") as TextBox; if (t != null) { Profile.FirstName = t.Text; } t = CreateUserWizard1.FindControl("TBLastName") as TextBox; if (t != null) { Profile.LastName = t.Text; } t = CreateUserWizard1.FindControl("TBBirthday") as TextBox; if (t != null) { Profile.Birthday = DateTime.Parse(t.Text); } Profile.JoinDate = DateTime.Now; sqlQuery = "Update Users SET FirstName = '" + Profile.FirstName + "', LastName = '" + Profile.LastName + "', DOB = '" + Profile.Birthday + "' where Username = '******';"; command = new SqlCommand(sqlQuery, connection); connection.Open(); command.ExecuteNonQuery(); connection.Close(); }
protected void CreateUserWizard1_FinishButtonClick(object sender, LoginCancelEventArgs e) { var myuserID = System.Web.Security.Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey; //make sure there is no user with that email address using (var db = new textbookbasicEntitiesContext()) { var email = (CreateUserWizard1.FindControl("Email") as Literal).Text; if (db.sellers.Any(y => y.email == email)) { e.Cancel = true; CreateUserWizard1.FinishDestinationPageUrl = String.Empty; } //insert info into database db.sellers.Add( new seller() { userID = (Guid)myuserID, firstName = (CreateUserWizard1.FindControl("firstname") as Literal).Text, lastName = (CreateUserWizard1.FindControl("lastname") as Literal).Text, campus = Convert.ToInt32((CreateUserWizard1.FindControl("campus") as DropDownList).SelectedValue), userType = 1, email = (CreateUserWizard1.FindControl("Email") as Literal).Text, prefContact = Convert.ToInt32((CreateUserWizard1.FindControl("prefcontact") as DropDownList).SelectedValue), contactInfo = (CreateUserWizard1.FindControl("contactinfo") as Literal).Text, }); db.SaveChanges(); } }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { string createdUsername = CreateUserWizard1.UserName; string createdPassword = CreateUserWizard1.Password; //dynamic profile = ProfileBase.Create(createdUsername); CreateUserWizardStep step1 = (CreateUserWizardStep)CreateUserWizard1.FindControl("Step1"); DropDownList k1 = (DropDownList)step1.ContentTemplateContainer.FindControl("ddlDept"); DropDownList k2 = (DropDownList)step1.ContentTemplateContainer.FindControl("ddlRole"); TextBox k3 = (TextBox)step1.ContentTemplateContainer.FindControl("tbxName"); TextBox k4 = (TextBox)step1.ContentTemplateContainer.FindControl("UserName"); TextBox tbxTitle = (TextBox)step1.ContentTemplateContainer.FindControl("tbxTitle"); TextBox tbxEmail = (TextBox)step1.ContentTemplateContainer.FindControl("tbxEmail"); TextBox tbxHRMS = (TextBox)step1.ContentTemplateContainer.FindControl("tbxHRMS"); Roles.AddUserToRole(createdUsername, k2.Text); //profile.dept = k1.Text; //profile.role = k2.SelectedItem.Text; //profile.name = k3.Text; //profile.username = k4.Text; //profile.Save(); string encryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(createdPassword, "MD5"); try { Employee emp = new Employee(); if (tbxHRMS.Text != "") { emp.HRMS = tbxHRMS.Text; } emp.Name = k3.Text; emp.Title = tbxTitle.Text; emp.HRMS = tbxHRMS.Text; emp.Department = k1.Text; emp.UserName = createdUsername; emp.Password = encryptedPassword; emp.Email = tbxEmail.Text; emp.Role = k2.SelectedItem.Text; context.Employees.Add(emp); context.SaveChanges(); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Diagnostics.Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack && !string.IsNullOrEmpty(this.Request.QueryString["Email"])) { Email = this.Request.QueryString["Email"]; CreateUserWizard1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Roles.IsUserInRole("admin")) { Response.Write("<script>alert('You dont have permission')</script>"); Response.Redirect("./index.aspx"); } var test = CreateUserWizard1.FindControl("dateselect") as Calendar; }
private void ResetWarning() { Label warning = new Label(); //check staff if (CreateUserWizard1.ActiveStepIndex == 4) warning = (Label)CreateUserWizard1.FindControl("lblWarningStaff"); //check service else if (CreateUserWizard1.ActiveStepIndex == 5) warning = (Label)CreateUserWizard1.FindControl("lblWarningService"); //reset warning label warning.Text = ""; }//end ResetWarning
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e) { Bairro = CreateUserWizard1.FindControl <TextBox>("txtBairro"); Email = CreateUserWizard1.FindControl <TextBox>("UserName"); Nome = CreateUserWizard1.FindControl <TextBox>("Email"); CPF = CreateUserWizard1.FindControl <TextBox>("txtCPF"); Telefone = CreateUserWizard1.FindControl <TextBox>("txtTelefone"); CEP = CreateUserWizard1.FindControl <TextBox>("txtCEP"); Estado = CreateUserWizard1.FindControl <TextBox>("txtEstado"); Cidade = CreateUserWizard1.FindControl <TextBox>("txtCidade"); Senha = CreateUserWizard1.FindControl <TextBox>("Password"); Endereco = CreateUserWizard1.FindControl <TextBox>("txtEndereco"); e.Cancel = true; }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { string createdUsername = CreateUserWizard1.UserName; string createdPassword = CreateUserWizard1.Password; //dynamic profile = ProfileBase.Create(createdUsername); CreateUserWizardStep step1 = (CreateUserWizardStep)CreateUserWizard1.FindControl("Step1"); //DropDownList k1 = (DropDownList)step1.ContentTemplateContainer.FindControl("ddlDept"); DropDownList k2 = (DropDownList)step1.ContentTemplateContainer.FindControl("ddlRole"); TextBox k3 = (TextBox)step1.ContentTemplateContainer.FindControl("tbxName"); TextBox k4 = (TextBox)step1.ContentTemplateContainer.FindControl("UserName"); TextBox tbxEmail = (TextBox)step1.ContentTemplateContainer.FindControl("tbxEmail"); Roles.AddUserToRole(createdUsername, k2.Text); // string encryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(createdPassword, "MD5"); //try //{ QHSEQuiz.Model.Hub hub = new QHSEQuiz.Model.Hub(); hub.Name = k3.Text; hub.UserName = createdUsername; //.Password = encryptedPassword; if (tbxEmail.Text != "") { hub.Email = tbxEmail.Text; } else { hub.Email = "N/A"; } hub.Role = k2.SelectedItem.Text; context.Hubs.Add(hub); context.SaveChanges(); //} //catch (DbEntityValidationException dbEx) //{ // foreach (var validationErrors in dbEx.EntityValidationErrors) // { // foreach (var validationError in validationErrors.ValidationErrors) // { // System.Diagnostics.Trace.TraceInformation("Property: {0} Error: {1}", // validationError.PropertyName, // validationError.ErrorMessage); // } // } //} }
protected void Page_Load(object sender, EventArgs e) { CreateUserWizard1.MoveTo(CreateUserWizardStep1); DropDownList Year = (DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Year"); for (int i = 2003; i >= 1950; i--) { ListItem item = new ListItem(i + "", i + ""); Year.Items.Add(item); } if (IsPostBack) { } }
protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { Label lbl = (Label)CreateUserWizard1.CompleteStep.Controls[0].FindControl("lblSubscriptionList"); CheckBoxList chk = (CheckBoxList)CreateUserWizard1.FindControl("chkSubscription"); string selection = ""; foreach (ListItem item in chk.Items) { if (item.Selected) { selection += "<br /> " + item.Text; } } lbl.Text = selection; }
private void ShowWarning(bool isUserControlValid, int curStepIndex, WizardNavigationEventArgs e) { try { int itemAdded = 0; Label warning = new Label(); //get userControl validation switch (curStepIndex) { case 4://check staff itemAdded = AddStaffUserControl1.GetStaffDetails().Count(); break; case 5://check service itemAdded = AddServicesUserControl1.GetServiceDetails().Count(); break; default: System.Diagnostics.Debug.Print("ShowWarning, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Unknown wizard step!"); break; } //check service or staff has been added if (isUserControlValid && itemAdded == 0) { switch (curStepIndex) { case 4://staff warning msg //find warning label warning = (Label)CreateUserWizard1.FindControl("lblWarningStaff"); warning.Text = "Please click on add to include at least one member of staff."; break; case 5://service warning msg //find warning label warning = (Label)CreateUserWizard1.FindControl("lblWarningService"); warning.Text = "Please click on add to include at least one service."; break; default: System.Diagnostics.Debug.Print("ShowWarning, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Unknown wizard step!"); break; }//inner switch //dont allow wizard to move to next slide e.Cancel = true; }//endif } catch (Exception ex) { System.Diagnostics.Debug.Print("<h2>Register.aspx, PolulateInstallation()</h2>\n" + ex.ToString() + "\n" + ex.InnerException + "\n" + ex.Message); // Log the exception and notify system operators ExceptionUtility.LogException(ex, "Register.aspx, PolulateInstallation()"); ExceptionUtility.NotifySystemOps(ex); } }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { var myuserID = System.Web.Security.Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey; //make sure there is no user with that email address using (var db = new textbookbasicEntitiesContext()) //includes try/catch { var email = (TextBox)(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email")); string emailadd = email.Text; if (db.sellers.Any(y => y.email == emailadd)) { System.Web.Security.Membership.DeleteUser(CreateUserWizard1.UserName); (CreateUserWizard1.FindControl("complete") as Literal).Text = "there was an error"; } //get data var userID = (Guid)myuserID; TextBox firstNametxt = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("firstname") as TextBox; TextBox lastNametxt = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("lastname") as TextBox; DropDownList campusd = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("campus") as DropDownList; DropDownList prefContactd = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("prefcontact") as DropDownList; TextBox contactInfotxt = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("contactinfo") as TextBox; if (userID == null || firstNametxt == null || lastNametxt == null || campusd == null || prefContactd == null || contactInfotxt == null) { throw new Exception("something didnt casrt right"); } //insert info into database db.sellers.Add( new seller() { userID = (Guid)myuserID, firstName = firstNametxt.Text, lastName = lastNametxt.Text, campus = Convert.ToInt32(campusd.SelectedValue), userType = 1, email = emailadd, prefContact = Convert.ToInt32(prefContactd.SelectedValue), contactInfo = contactInfotxt.Text, }); db.SaveChanges(); } }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { string username = CreateUserWizard1.UserName; string password = CreateUserWizard1.Password; Roles.AddUserToRole(username, "User"); CreateUserWizardStep step1 = (CreateUserWizardStep)CreateUserWizard1.FindControl("Step1"); TextBox k1 = (TextBox)step1.ContentTemplateContainer.FindControl("Phone"); TextBox k2 = (TextBox)step1.ContentTemplateContainer.FindControl("Email"); ProfileCommon profile = Profile.GetProfile(username); profile.Phone = k1.Text; profile.Email = k2.Text; profile.Save(); if (Membership.ValidateUser(username, password)) { FormsAuthentication.SetAuthCookie(username, false); Response.Redirect("~/priv/MyProperty.aspx"); } }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { string username = CreateUserWizard1.UserName; string password = CreateUserWizard1.Password; Roles.AddUserToRole(username, "agent"); CreateUserWizardStep step1 = (CreateUserWizardStep)CreateUserWizard1.FindControl("Step1"); TextBox Email = (TextBox)step1.ContentTemplateContainer.FindControl("Email"); TextBox PhoneNumber = (TextBox)step1.ContentTemplateContainer.FindControl("PhoneNumber"); ProfileCommon profile = Profile.GetProfile(username); //get profile of the user being created and assign it to the profile profile.Email = Email.Text; profile.PhoneNumber = PhoneNumber.Text; profile.Save(); //whenever browser shows cookie, it will be authenticated. enable autologin after creating new user if (Membership.ValidateUser(username, password)) { FormsAuthentication.SetAuthCookie(username, false); Response.Redirect("~/priv/Default.aspx"); } }
protected void CreateUserWizard1_CreatedUser1(object sender, EventArgs e) { MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName); Guid newUserID = (Guid)newUser.ProviderUserKey; TextBox dob1 = (TextBox)CreateUserWizard1.FindControl("dob1"); TextBox fnam = (TextBox)CreateUserWizard1.FindControl("fname"); TextBox lname = (TextBox)CreateUserWizard1.FindControl("lname"); InternshipProgramEntities ipm = new InternshipProgramEntities(); User_Details newUserDets = new User_Details(); Response.Redirect("./continue.aspx?userid=" + newUserID); /*newUserDets.DoB = Convert.ToDateTime("1996-1-1"); * newUserDets.First_Name = fnam.Text; * newUserDets.Last_Name = lname.Text; * System.Diagnostics.Debug.WriteLine(newUserID); * newUserDets.UserID = newUserID; * ipm.User_Details.Add(newUserDets); * ipm.SaveChanges(); * //Response.Write("<script>alert('" + newUserID.ToString() + "')</script>"); * Response.Write("<script>alert('hi')</script>");*/ }
protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { try { TextBox t; string FName = "", LName = "", Phone = "", Website = ""; DateTime BirthDate = DateTime.Now; DateTime date = DateTime.Now; t = CreateUserWizard1.FindControl("FName") as TextBox; if (t != null) { FName = t.Text; } t = CreateUserWizard1.FindControl("LName") as TextBox; if (t != null) { LName = t.Text; } t = CreateUserWizard1.FindControl("BirthDate") as TextBox; if (t != null) { BirthDate = Convert.ToDateTime(t.Text); } t = CreateUserWizard1.FindControl("Phone") as TextBox; if (t != null) { Phone = t.Text; } t = CreateUserWizard1.FindControl("WebSite") as TextBox; if (t != null) { Website = t.Text; } String query = "insert into UserProfileData(FName,LName,BirthDate,JoinDate,Phone,Website,UserId) values (@fn,@ln,@bd,@jd,@ph,@web,(select UserId from Users where UserName = @username)) " + " insert into Options(UserId,EditOp,DeleteOp,AddOp,AcceptOp,CommentOp) values((select UserId from Users where UserName = @username),0,0,1,1,1)"; SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Alexandru\Documents\BazaDeStiri.mdf;Integrated Security=True;Connect Timeout=30"); try { con.Open(); SqlCommand qcom = new SqlCommand(query, con); qcom.Parameters.AddWithValue("fn", FName); qcom.Parameters.AddWithValue("ln", LName); qcom.Parameters.AddWithValue("bd", BirthDate); qcom.Parameters.AddWithValue("jd", date); qcom.Parameters.AddWithValue("ph", Phone); qcom.Parameters.AddWithValue("web", Website); qcom.Parameters.AddWithValue("username", username); try { qcom.ExecuteNonQuery(); //LRaspuns.Text = "OK"; } catch (System.Data.SqlClient.SqlException se) { LRaspuns.Text = "Eroare selectearea din baza de date " + se.Message; con.Close(); } con.Close(); } catch (System.InvalidOperationException ioe) { LRaspuns.Text = "Eroare la deschidere BD." + ioe.Message + " "; } catch (System.Data.SqlClient.SqlException se) { LRaspuns.Text = "Eroare la deschidere BD." + se.Message + " "; } catch (Exception ex) { LRaspuns.Text = "Eroare la convertirea datelor." + ex.Message + " "; } finally { //LRaspuns.Text = "User " +username + " " +FName; } } finally { } }
protected void Page_Load(object sender, EventArgs e) { lblError.Text = ""; CreateUserWizard1.Focus(); }
protected void CreateUserWizard1_ActiveStepChanged(object sender, EventArgs e) { if (CreateUserWizard1.ActiveStep.Title == "Your Photo") { WizardStep ProfileData = CreateUserWizard1.FindControl("ProfileData") as WizardStep; // Update the UserProfiles record for this user // Get the UserId of the just-added user MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName); Guid newUserId = (Guid)newUser.ProviderUserKey; // Insert a new record into UserProfiles string connectionString = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string updateSql = "UPDATE UserProfiles SET City = @City, Hometown = @Hometown, School_College = @School_College, University = @University, Career = @Career, CareerDescription = @CareerDescription WHERE UserId = @UserId"; using (SqlConnection myConnection = new SqlConnection(connectionString)) { myConnection.Open(); SqlCommand myCommand = new SqlCommand(updateSql, myConnection); myCommand.Parameters.AddWithValue("@City", ((TextBox)ProfileData.FindControl("City")).Text); myCommand.Parameters.AddWithValue("@Hometown", ((TextBox)ProfileData.FindControl("Hometown")).Text); myCommand.Parameters.AddWithValue("@School_College", ((TextBox)ProfileData.FindControl("School_College")).Text); myCommand.Parameters.AddWithValue("@University", ((TextBox)ProfileData.FindControl("University")).Text); myCommand.Parameters.AddWithValue("@Career", ((TextBox)ProfileData.FindControl("Career")).Text); myCommand.Parameters.AddWithValue("@CareerDescription", ((TextBox)ProfileData.FindControl("CareerDescription")).Text); myCommand.Parameters.AddWithValue("@UserId", newUserId); myCommand.ExecuteNonQuery(); myConnection.Close(); } if (CreateUserWizard1.ActiveStep.Title == "Complete") { } //string connectionString2 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; //string insertSql = "INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; //using (SqlConnection myConnection = new SqlConnection(connectionString2)) //{ // myConnection.Open(); // SqlCommand myCommand = new SqlCommand(insertSql, myConnection); // myCommand.Parameters.AddWithValue("@UserId", newUserId); // myCommand.Parameters.AddWithValue("@Name", "ProfilePictures"); // myCommand.ExecuteNonQuery(); // myConnection.Close(); //} //string connectionString3 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; //string insertSql2 = "INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; //using (SqlConnection myConnection = new SqlConnection(connectionString3)) //{ // myConnection.Open(); // SqlCommand myCommand = new SqlCommand(insertSql2, myConnection); // myCommand.Parameters.AddWithValue("@UserId", newUserId); // myCommand.Parameters.AddWithValue("@Name", "CoverPhotos"); // myCommand.ExecuteNonQuery(); // myConnection.Close(); //} } }