Esempio n. 1
0
        protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)

        {
            //get the listview in the wizard
            System.Web.UI.WebControls.ListView list = (Wizard1.FindControl("sideBarList") as System.Web.UI.WebControls.ListView);
            //get the ul in the listview and change its cssclass according to the activestepindex of wizard
            HtmlGenericControl ul = list.FindControl("ul") as HtmlGenericControl;

            if (Wizard1.ActiveStepIndex == 0)
            {
                ul.Attributes.Add("class", "sidebar1");
                Wizard wizard = Wizard1;

                //get the wizardstep
                WizardStep wizardStep1 = Wizard1.FindControl("WizardStep1") as WizardStep;
                //get the div control in the wizardstep and change its class
                HtmlGenericControl step1 = wizardStep1.FindControl("step1") as HtmlGenericControl;
                step1.Attributes.Add("class", "step1 ");
            }
            else
            {
                ul.Attributes.Add("class", "sidebar2");
                WizardStep         wizardStep2 = Wizard1.FindControl("WizardStep2") as WizardStep;
                HtmlGenericControl step2       = wizardStep2.FindControl("step2") as HtmlGenericControl;
                step2.Attributes.Add("class", "step2");
            }
        }
Esempio n. 2
0
    protected void CreateNewUserButton_Click(object sender, EventArgs e)
    {
        MultiView1.SetActiveView(CreateNewUserView);
        WizardStep   AdditionalInfo = RegisterUser.FindControl("AdditionalInfo") as WizardStep;
        CheckBoxList RoleList       = AdditionalInfo.FindControl("RoleList") as CheckBoxList;

        RoleList.DataSource = Roles.GetAllRoles();
        RoleList.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Reference the SpecifyRolesStep WizardStep
            WizardStep SpecifyRolesStep = RegisterUserWithRoles.FindControl("SpecifyRolesStep") as WizardStep;

            // Reference the RoleList CheckBoxList
            CheckBoxList RoleList = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList;

            // Bind the set of roles to RoleList
            RoleList.DataSource = Roles.GetAllRoles();
            RoleList.DataBind();
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Reference the SpecifyRolesStep WizardStep
            WizardStep SpecifyRolesStep = RegisterUserWithRoles.FindControl("SpecifyRolesStep") as WizardStep;

            // Reference the RoleList CheckBoxList
            DropDownList RoleList = SpecifyRolesStep.FindControl("RoleList") as DropDownList;

            // Bind the set of roles to RoleList
            RoleList.Items.Add(new ListItem("Basic 99kr/month", "Basic"));
            RoleList.Items.Add(new ListItem("Plus 199kr/month", "Plus"));
            RoleList.Items.Add(new ListItem("Prime 499kr/month", "Prime"));
            RoleList.DataBind();
        }
    }
Esempio n. 5
0
        protected void NewUserWizard_ActiveStepChanged(object sender, EventArgs e)
        {
            // Have we JUST reached the Complete step?
            if (NewUserWizard.ActiveStep.Title == "Complete")
            {
                WizardStep UserSettings = NewUserWizard.FindControl("UserSettings") as WizardStep;

                // Programmatically reference the TextBox controls
                //TextBox HomeTown = UserSettings.FindControl("HomeTown") as TextBox;
                //TextBox HomepageUrl = UserSettings.FindControl("HomepageUrl") as TextBox;
                //TextBox Signature = UserSettings.FindControl("Signature") as TextBox;

                ///////////////////////////////////////////////////////////////////////////////
                TextBox FirstName = UserSettings.FindControl("FirstName") as TextBox;
                TextBox LastName  = UserSettings.FindControl("LastName") as TextBox;
                TextBox Mobile    = UserSettings.FindControl("Mobile") as TextBox;
                TextBox Country   = UserSettings.FindControl("Country") as TextBox;
                TextBox City      = UserSettings.FindControl("City") as TextBox;
                TextBox Address   = UserSettings.FindControl("Address") as TextBox;
                //TextBox picture = UserSettings.FindControl("picture") as TextBox;



                ///////////////////////////////////////////////////////////////////////////////


                // Update the UserProfiles record for this user
                // Get the UserId of the just-added user
                MembershipUser newUser   = Membership.GetUser(NewUserWizard.UserName);
                Guid           newUserId = (Guid)newUser.ProviderUserKey;

                // Insert a new record into UserProfiles
//                string connectionString = ConfigurationManager.ConnectionStrings["SecurityTutorialsConnectionString"].ConnectionString;
                string updateSql = "UPDATE custom_profile SET firstname=@firstname,lastname=@lastname,mobile=@mobile,country=@country,city=@city,address=@address,picture=@picture where userid='" + newUserId + "'";

                using (SqlConnection conn = Connection_Manger.getConnection())
                {
                    conn.Open();
                    SqlCommand myCommand = new SqlCommand(updateSql, conn);
                    myCommand.Parameters.AddWithValue("@firstname", FirstName.Text.Trim());
                    myCommand.Parameters.AddWithValue("@lastname", LastName.Text.Trim());
                    myCommand.Parameters.AddWithValue("@mobile", Mobile.Text.Trim());
                    myCommand.Parameters.AddWithValue("@country", Country.Text.Trim());
                    myCommand.Parameters.AddWithValue("@city", City.Text.Trim());
                    myCommand.Parameters.AddWithValue("@address", Address.Text.Trim());
                    myCommand.Parameters.AddWithValue("@picture", DBNull.Value);
                    myCommand.ExecuteNonQuery();
                    conn.Close();
                }
            }
        }
Esempio n. 6
0
 protected void RegisterUser_ActiveStepChanged(object sender, EventArgs e)
 {
     // Have we JUST reached the Complete step?
     if (RegisterUser.ActiveStep.Title == "Complete")
     {
         // Reference the SpecifyRolesStep WizardStep
         WizardStep SpecifyRolesStep = RegisterUser.FindControl("SpecifyRolesStep") as WizardStep;
         // Reference the RoleList CheckBoxList
         CheckBoxList RoleList = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList;
         // Add the checked roles to the just-added user
         foreach (ListItem li in RoleList.Items)
         {
             if (li.Selected)
             {
                 Roles.AddUserToRole(RegisterUser.UserName, li.Text);
             }
         }
     }
 }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!User.IsInRole("SysAdmin"))
        //{
        //    Response.Redirect("~/AccessDenied.aspx", true);
        //}

        if (!Page.IsPostBack)
        {
            // Reference the SpecifyRolesStep WizardStep
            WizardStep SpecifyRolesStep = RegisterUser.FindControl("SpecifyRolesStep") as WizardStep;

            // Reference the RoleList CheckBoxList
            CheckBoxList RoleList = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList;

            // Bind the set of roles to RoleList
            RoleList.DataSource = Roles.GetAllRoles();
            RoleList.DataBind();
        }
    }
Esempio n. 8
0
    protected void CreateUser_ActiveStepChanged(object sender, EventArgs e)
    {
        if (CreateUser.ActiveStep.Title == "Gotowe")
        {
            WizardStep UserInfo = CreateUser.FindControl("AdditionalInfo") as WizardStep;

            TextBox  Name         = UserInfo.FindControl("NameTB") as TextBox;
            TextBox  Town         = UserInfo.FindControl("TownTB") as TextBox;
            TextBox  Street       = UserInfo.FindControl("StreetTB") as TextBox;
            TextBox  StreetNumber = UserInfo.FindControl("StreetNumberTB") as TextBox;
            TextBox  PostalCode   = UserInfo.FindControl("PostalCodeTB") as TextBox;
            Calendar DateOfBirth  = UserInfo.FindControl("DateOfBirth") as Calendar;

            MembershipUser newUser   = Membership.GetUser(CreateUser.UserName);
            Guid           newUserId = (Guid)newUser.ProviderUserKey;

            string connectingString = ConfigurationManager.ConnectionStrings["BBB"].ConnectionString;
            string updateUrl        = "INSERT INTO UserProfiles(NameAndSurname, Town, Street, StreetNumber, PostalCode, DateOfBirth, UserId) VALUES  (@NameAndSurname, @Town, @Street, @StreetNumber, @PostalCode, @UserId)";

            using (SqlConnection myConnection = new SqlConnection(connectingString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateUrl, myConnection);
                myCommand.Parameters.AddWithValue("@NameAndSurname", Name.Text.Trim());
                myCommand.Parameters.AddWithValue("@Town", Town.Text.Trim());
                myCommand.Parameters.AddWithValue("@Street", Street.Text.Trim());
                myCommand.Parameters.AddWithValue("@StreetNumber", StreetNumber.Text.Trim());
                myCommand.Parameters.AddWithValue("@PostalCode", PostalCode.Text.Trim());
                myCommand.Parameters.AddWithValue("@DateOfBirth", DateOfBirth.SelectedDate);
                myCommand.Parameters.AddWithValue("@UserId", newUserId);
                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }

            string userName = CreateUser.UserName;
            Roles.AddUserToRole(userName, "patient");
        }
    }
Esempio n. 9
0
    protected void RegisterUser_ActiveStepChanged(object sender, EventArgs e)
    {
        if (RegisterUser.ActiveStep.Title == "Gotowe")
        {
            WizardStep   SpecifyRolesStep = RegisterUser.FindControl("AdditionalInfo") as WizardStep;
            CheckBoxList RoleList         = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList;
            string       userName         = RegisterUser.UserName;

            foreach (ListItem li in RoleList.Items)
            {
                if (li.Selected)
                {
                    Roles.AddUserToRole(userName, li.Text);
                }
            }

            if (Roles.IsUserInRole(userName, "doctor"))
            {
                string         connectingStringAddDoctor = ConfigurationManager.ConnectionStrings["BBB"].ConnectionString;
                string         addDoctorUrl = "INSERT INTO Cadre(UserId) VALUES  (@UserId)";
                MembershipUser newDoctor    = Membership.GetUser(userName);
                Guid           newDoctorId  = (Guid)newDoctor.ProviderUserKey;

                using (SqlConnection myConnection = new SqlConnection(connectingStringAddDoctor))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(addDoctorUrl, myConnection);
                    myCommand.Parameters.AddWithValue("@UserId", newDoctorId);
                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }
            }

            WizardStep UserInfo = RegisterUser.FindControl("AdditionalInfo") as WizardStep;

            TextBox Name         = UserInfo.FindControl("NameTB") as TextBox;
            TextBox Town         = UserInfo.FindControl("TownTB") as TextBox;
            TextBox Street       = UserInfo.FindControl("StreetTB") as TextBox;
            TextBox StreetNumber = UserInfo.FindControl("StreetNumberTB") as TextBox;
            TextBox PostalCode   = UserInfo.FindControl("PostalCodeTB") as TextBox;
            String  calendar     = DateOfBirth.SelectedDate.Year.ToString() + "-" + DateOfBirth.SelectedDate.Month.ToString() + "-" + DateOfBirth.SelectedDate.Day.ToString();

            MembershipUser newUser   = Membership.GetUser(RegisterUser.UserName);
            Guid           newUserId = (Guid)newUser.ProviderUserKey;

            string connectingString = ConfigurationManager.ConnectionStrings["BBB"].ConnectionString;
            string updateUrl        = "INSERT INTO UserProfiles(NameAndSurname, Town, Street, StreetNumber, PostalCode, DateOfBirth, UserId) VALUES  (@NameAndSurname, @Town, @Street, @StreetNumber, @PostalCode, @DateOfBirth, @UserId)";

            using (SqlConnection myConnection = new SqlConnection(connectingString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateUrl, myConnection);
                myCommand.Parameters.AddWithValue("@NameAndSurname", Name.Text.Trim());
                myCommand.Parameters.AddWithValue("@Town", Town.Text.Trim());
                myCommand.Parameters.AddWithValue("@Street", Street.Text.Trim());
                myCommand.Parameters.AddWithValue("@StreetNumber", Int32.Parse(StreetNumber.Text.Trim()));
                myCommand.Parameters.AddWithValue("@PostalCode", PostalCode.Text.Trim());
                myCommand.Parameters.AddWithValue("@DateOfBirth", calendar);
                myCommand.Parameters.AddWithValue("@UserId", newUserId);
                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
        }
    }
Esempio n. 10
0
    protected void RegisterUser_ActiveStepChanged(object sender, EventArgs e)
    {
        // Have we JUST reached the Complete step?
        if (RegisterUser.ActiveStep.Title == "Complete")
        {
            WizardStep ProfileData = RegisterUser.FindControl("ProfileData") as WizardStep;

            // Programmatically reference the TextBox controls
            TextBox      txtFullName          = ProfileData.FindControl("txtFullName") as TextBox;
            DropDownList ddlGender            = ProfileData.FindControl("ddlGender") as DropDownList;
            TextBox      txtAge               = ProfileData.FindControl("txtAge") as TextBox;
            TextBox      txtCareer            = ProfileData.FindControl("txtCareer") as TextBox;
            TextBox      txtCareerDescription = ProfileData.FindControl("txtCareerDescription") as TextBox;

            // Update the UserProfiles record for this user
            // Get the UserId of the just-added user
            MembershipUser newUser   = Membership.GetUser(RegisterUser.UserName);
            Guid           newUserId = (Guid)newUser.ProviderUserKey;

            // Insert a new record into UserProfiles
            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string updateSql = "UPDATE UserProfiles SET FullName = @FullName, Gender = @Gender, Age = @Age, Career = @Career, CareerDescription = @CareerDescription WHERE UserId = @UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateSql, myConnection);
                myCommand.Parameters.AddWithValue("@FullName", txtFullName.Text.Trim());
                myCommand.Parameters.AddWithValue("@Gender", ddlGender.SelectedItem.Text.Trim());
                myCommand.Parameters.AddWithValue("@Age", txtAge.Text.Trim());
                myCommand.Parameters.AddWithValue("@Career", txtCareer.Text.Trim());
                myCommand.Parameters.AddWithValue("@CareerDescription", txtCareerDescription.Text.Trim());
                myCommand.Parameters.AddWithValue("@UserId", newUserId);
                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }

            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();
            }

            //string connectionString4 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            //string insertSql3 = "INSERT INTO UserCircles(Name, UserId) VALUES(@Name, @UserId)";

            //using (SqlConnection myConnection = new SqlConnection(connectionString4))
            //{
            //    myConnection.Open();
            //    SqlCommand myCommand = new SqlCommand(insertSql3, myConnection);
            //    myCommand.Parameters.AddWithValue("@UserId", newUserId);
            //    myCommand.Parameters.AddWithValue("@Name", "All");

            //    myCommand.ExecuteNonQuery();
            //    myConnection.Close();
            //}
            //using (SqlConnection myConnection = new SqlConnection(connectionString4))
            //{
            //    myConnection.Open();
            //    SqlCommand myCommand = new SqlCommand(insertSql3, myConnection);
            //    myCommand.Parameters.AddWithValue("@UserId", newUserId);
            //    myCommand.Parameters.AddWithValue("@Name", "Friends");

            //    myCommand.ExecuteNonQuery();
            //    myConnection.Close();
            //}
            //using (SqlConnection myConnection = new SqlConnection(connectionString4))
            //{
            //    myConnection.Open();
            //    SqlCommand myCommand = new SqlCommand(insertSql3, myConnection);
            //    myCommand.Parameters.AddWithValue("@UserId", newUserId);
            //    myCommand.Parameters.AddWithValue("@Name", "Family");

            //    myCommand.ExecuteNonQuery();
            //    myConnection.Close();
            //}
            //using (SqlConnection myConnection = new SqlConnection(connectionString4))
            //{
            //    myConnection.Open();
            //    SqlCommand myCommand = new SqlCommand(insertSql3, myConnection);
            //    myCommand.Parameters.AddWithValue("@UserId", newUserId);
            //    myCommand.Parameters.AddWithValue("@Name", "Acquaintances");

            //    myCommand.ExecuteNonQuery();
            //    myConnection.Close();
            //}
        }
    }
Esempio n. 11
0
    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();
            //}
        }
    }