1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Testage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
/*--------------------------Récupération de l'identifiant (du Formateur)-----------------------------*/
string TestLogin = System.Web.HttpContext.Current.User.Identity.Name.ToString();
string login = TestLogin.Substring(TestLogin.IndexOf('\\') + 1);
lblID_user.Text = login;
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox1.Checked == true)
{
// Chaîne de connexion
string connectString = "Data Source=PROD006\\SQLEXPRESS;Initial Catalog=prototype;Integrated Security=True";
// Objet connection
SqlConnection connection = new SqlConnection(connectString);
// Ouverture
connection.Open();
// Objet Command
//SqlCommand command = new SqlCommand("UPDATE ACTIVITE set version = version + 1", connection);
SqlCommand command = new SqlCommand("INSERT INTO ACTIVITE (id_user, type_act, version, evaluation) values ('" + lblID_user.Text + "', 'freins' ,'1', 'Acquis')", connection);
// Execution
command.ExecuteNonQuery();
// Fermeture connection
connection.Close();
}
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox2.Checked == true)
{ // Chaîne de connexion
string connectString = "Data Source=PROD006\\SQLEXPRESS;Initial Catalog=prototype;Integrated Security=True";
// Objet connection
SqlConnection connection = new SqlConnection(connectString);
// Ouverture
connection.Open();
// Objet Command
SqlCommand command = new SqlCommand("INSERT INTO ACTIVITE (id_user, type_act, version, evaluation) values ('" + lblID_user.Text + "', 'freins' ,'1', 'En cours d''acquisition')", connection);
command.ExecuteNonQuery();
// Fermeture connection
connection.Close();
}
}
protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox3.Checked == true)
{ // Chaîne de connexion
string connectString = "Data Source=PROD006\\SQLEXPRESS;Initial Catalog=prototype;Integrated Security=True";
// Objet connection
SqlConnection connection = new SqlConnection(connectString);
// Ouverture
connection.Open();
// Objet Command
SqlCommand command = new SqlCommand("INSERT INTO ACTIVITE (id_user, type_act, version, evaluation) values ('" + lblID_user.Text + "', 'freins' ,'1', 'Non acquis')", connection);
command.ExecuteNonQuery();
// Fermeture connection
connection.Close();
}
}
protected void btnValider_Click(object sender, EventArgs e)
{
}
} |