Ejemplo n.º 1
0
    // UpdateUser_click method
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        // start off error as false
        bool userUpdateError = false;

        // path for database
        string       tempPath = Server.MapPath("~App_Data/Programaholics.mdb");
        clsDataLayer myData   = new clsDataLayer(tempPath);

        // try to update, catch error
        try
        {
            myData.UpdateTblUser(txtFirstName.Text, txtLastName.Text,
                                 txtEmail.Text, txtPassword.Text, txtStreet.Text, txtCity.Text, txtState.Text);

            myData.UpdateTblProgram(txtFav.Text, txtLeast.Text);

            myData.UpdateTblCompleted(txtProgramLanguage.Text, txtProgramName.Text, txtDate.Text);
        } // end try
        catch (Exception error)
        {
            userUpdateError = true;
            string message = "Error updating user information! Please check your info. ";
            Master.UserFeedBack.Text = message + error.Message;
        } // end catch

        // if there is no error updating
        if (!userUpdateError)
        {
            ClearInputs(Page.Controls);
            Master.UserFeedBack.Text = "User information updated Successfully! ";
            BindUserGrid();
        }
    }
Ejemplo n.º 2
0
    /// UpdateUser information
    // updating users
    public string UpdateUser(string firstName, string lastName, string username, string password,
                             string street, string city, string state, string favLang, string least, string programName, string programLanguage, string date)
    {
        // message of success
        string resultMessage = "User Updated Successfully! ";

        // try to update, catch errors
        try
        {
            myDataLayer.UpdateTblUser(firstName, lastName, username, password, street, city, state);
            myDataLayer.UpdateTblProgram(favLang, least);
            myDataLayer.UpdateTblCompleted(programLanguage, programName, date);
        }
        catch (Exception error)
        {
            resultMessage = "Error updating customer, please check your information! ";
            resultMessage = resultMessage + error.Message;
        }
        return(resultMessage);
    }