Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange problem with validators
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01305059
Message ID:
01305364
Views:
7
Hi Viv,

This code in Finish button event looks to me quite wrong. We don't have lots of users, but the code like this is supposed to fail in multi-user environment, do you think?

Should I leave it with TODO comments or what do you think about it?
 protected void AddUserWizard_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        ProfileCommon P = (ProfileCommon)ProfileCommon.Create(AddUserWizard.UserName);

        P.SiteID = this.Profile.SiteID;

        P.FirstName = ((TextBox)Util.FindControl(AddUserWizard, "txtbFirstName")).Text;
        P.MiddleName = ((TextBox)Util.FindControl(AddUserWizard, "txtbMiddleName")).Text;
        P.LastName = ((TextBox)Util.FindControl(AddUserWizard, "txtbLastName")).Text;
        P.JobTitle = ((TextBox)Util.FindControl(AddUserWizard, "txtbJobTitle")).Text;
        P.TelephoneNum = ((TextBox)Util.FindControl(AddUserWizard, "txtbTelephone")).Text;

        System.Data.SqlClient.SqlConnection Conn = new System.Data.SqlClient.SqlConnection(
            ConfigurationManager.ConnectionStrings["FCCMSConnectionString"].ConnectionString);
        System.Data.SqlClient.SqlCommand Command = new System.Data.SqlClient.SqlCommand();

        Command.Connection = Conn;
        Command.Connection.Open();
        Command.CommandText = "SELECT MAX(FCID) FROM dbo.AdminInfo";
        P.FCID = (int)Command.ExecuteScalar() + 1;
        Command.CommandText = "SELECT MAX(FCWebAdminID) FROM dbo.AdminInfo";
        P.FCWebAdminID = (int)Command.ExecuteScalar() + 1;

        P.Save();
        this.lblMsg.Text = "User Saved";
        lsbUsers.DataSource = GetSiteUsers();
        lsbUsers.DataBind();
    }
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform