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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
| using System;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
nbheureanTextBox.Enabled = false ;
utilisateurTextBox.Enabled = false;
ModifierButton.Enabled = false;
//-------------trouver le nom de l'utilisateur----------------\\
String TestLogin = System.Web.HttpContext.Current.User.Identity.Name.ToString();
String login = TestLogin.Substring(TestLogin.IndexOf('\\') + 1);
string[] lastmane_User = login.Split('-');
utilisateurTextBox.Text = Convert.ToString(lastmane_User[0]);
//---------------------------------------------------------\\
/*
string MyConstring = "Data Source=PROD007\\SQLEXPRESS;uid=PROD007\\fraces-thomas;pwd=niouniou;Initial Catalog='C:\\BASE DE DONNÉES\\STAGE_PROJET.MDF';Integrated Security=True";
SqlConnection con = new SqlConnection(MyConstring);
string queryString = "SELECT Classe.group_name FROM Dispenser INNER JOIN Formateur ON Dispenser.num_secu = Formateur.num_secu INNER JOIN Classe ON Dispenser.code_group = Classe.code_group WHERE (Formateur.teacher_lastname = '" + classeDropDownList.SelectedValue + "')";
con.Open();
SqlCommand command = new SqlCommand(queryString, con);
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable("Classe");
da.Fill(dt);
classeDropDownList.DataSource = dt;
classeDropDownList.DataValueField = "group_name";
classeDropDownList.DataTextField = "group_name";
classeDropDownList.DataBind();
con.Close();
//-------------------------------------------------\\
string MyConstring1 = "Data Source=PROD007\\SQLEXPRESS;uid=PROD007\\fraces-thomas;pwd=niouniou;Initial Catalog='C:\\BASE DE DONNÉES\\STAGE_PROJET.MDF';Integrated Security=True";
SqlConnection con1 = new SqlConnection(MyConstring1);
string queryString1 = "SELECT Matiere.course FROM Dispenser INNER JOIN Matiere ON Dispenser.code_course = Matiere.code_course INNER JOIN Formateur ON Dispenser.num_secu = Formateur.num_secu INNER JOIN Classe ON Dispenser.code_group = Classe.code_group WHERE (Classe.group_name = '" +classeDropDownList .SelectedValue +"')";
con1.Open();
SqlCommand command1 = new SqlCommand(queryString1, con1);
SqlDataAdapter da1 = new SqlDataAdapter(command1);
DataTable dt1 = new DataTable("Matiere");
da1.Fill(dt1);
classeDropDownList.DataSource = dt1;
classeDropDownList.DataValueField = "course";
classeDropDownList.DataTextField = "course";
classeDropDownList.DataBind();
con1.Close();
*/
}
protected void nomprofDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void okButton_Click(object sender, EventArgs e)
{
resultatLabel.Text = "Emploi du temps de " + utilisateurTextBox.Text + " pour la classe des " + classeDropDownList.Text + " en " + matiereDropDownList.Text;
calendrier.Visible = true;
string MyConstring = "Data Source=PROD007\\SQLEXPRESS;uid=PROD007\\fraces-thomas;pwd=niouniou;Initial Catalog='C:\\BASE DE DONNÉES\\STAGE_PROJET.MDF';Integrated Security=True";
SqlConnection con = new SqlConnection(MyConstring);
/*
try
{
con.Open();
SqlCommand MyCommand = new SqlCommand();
MyCommand.Connection = con;
MyCommand.CommandText = "INSERT INTO Formateur ( num_secu,teacher_lastname) values ('8677845789','moitoimoimoi')";
//SqlDataReader MyDataReader;
/*MyDataReader = */
// MyCommand.ExecuteReader();
// while (MyDataReader.Read())
//{
// lblClasse.Text = MyDataReader.GetString(1);
// }
// con.Close();
// }
// catch (Exception ex)
// {
// Response.Write("<body><script>alert(\" " + ex.Message + "\");</script></body>");
//}
nbheureTextBox.Enabled = false;
nbsemaineTextBox.Enabled = false;
matiereDropDownList.Enabled = false;
classeDropDownList.Enabled = false;
utilisateurTextBox.Enabled = false;
refDropDownList.Enabled = false;
refnewTextBox.Enabled = false;
diplomeDropDownList.Enabled = false;
ouiRadioButton.Enabled = false;
nonRadioButton.Enabled = false;
ModifierButton.Enabled = true;
int resheurean = int.Parse(nbheureTextBox.Text) * int.Parse(nbsemaineTextBox.Text);
nbheureanTextBox.Text = resheurean.ToString();
}
protected void nbheureTextBox_TextChanged(object sender, EventArgs e)
{
Panel panel = new Panel();
for (int i = 0; i < Convert.ToInt32(nbheureTextBox.Text); ++i)
{
TextBox modele = new TextBox();
modele.ID = "text_box_child" + i;
modele.Text = "Heure n° " + (i + 1);
panel.Controls.Add(modele);
modele.Width = 450;
modele.Height = 30;
}
form1.Controls.Add(panel);
}
protected void nonRadioButton_CheckedChanged(object sender, EventArgs e)
{
if
(nonRadioButton.Checked == true)
{
refLabel.Visible = false;
refDropDownList.Visible = false;
refnewLabel.Visible = true;
refnewTextBox.Visible = true;
réfCompareValidator.Visible = false;
refnewRequiredFieldValidator.Visible = true;
}
}
protected void ouiRadioButton_CheckedChanged(object sender, EventArgs e)
{
if
(ouiRadioButton.Checked == true)
{
refLabel.Visible = true;
refDropDownList.Visible = true;
refnewLabel.Visible = false;
refnewTextBox.Visible = false;
refnewRequiredFieldValidator.Visible = false;
réfCompareValidator.Visible = true;
}
}
protected void calendrier_SelectionChanged(object sender, EventArgs e)
{
dateLabel.Text = "Semaine du " + calendrier.SelectedDate.ToLongDateString();
}
protected void ModifierButton_Click(object sender, EventArgs e)
{
nbheureTextBox.Enabled = true ;
nbsemaineTextBox.Enabled = true;
matiereDropDownList.Enabled = true;
classeDropDownList.Enabled = true;
utilisateurTextBox.Enabled = true;
refDropDownList.Enabled = true;
refnewTextBox.Enabled = true;
diplomeDropDownList.Enabled = true;
ouiRadioButton.Enabled = true;
nonRadioButton.Enabled = true;
}
} |