Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GererConnection.isAdministrateur(this);
     }
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GererConnection.isDejaAuthentifier(this);
     }
 }
Пример #3
0
 protected void SeConnecter_Click(object sender, EventArgs e)
 {
     if (GererConnection.isEtulisateurExiste(Nom.Text, password.Text))
     {
         Session["login"] = new{
             nom      = Nom.Text,
             password = password.Text
         };
         Response.Redirect("~/Acueil.aspx");
     }
     ErrorMessage.Text = "incorrect info !!!";
 }
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     GererConnection.ModifierCondidat(
         new
     {
         CodeCand   = ((Label)GridView1.Rows[e.RowIndex].FindControl("CodeCand")).Text,
         NomCand    = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("NomCand")).Text,
         DateIns    = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("DateInscription")).Text,
         NumSession = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("NumSession")).Text,
         NomSociete = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("NomSociete")).Text
     });
     GridView1.EditIndex = -1;
     GererConnection.RemplirGrid(GridView1);
 }
        protected void Ajouter_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(GererConnection.conString);

            using (connection)
            {
                connection.Open();
                if ((int)new SqlCommand($"select count(*) from Condidat where codeCand={CodeCand.Text}", connection).ExecuteScalar() == 1)
                {
                    ErrorMessage.Text = "CodeCand deja Exist";
                    return;
                }
                if ((int)new SqlCommand($"select count(*) from Session where numSession={NumSession.Text}", connection).ExecuteScalar() != 1)
                {
                    ErrorMessage.Text = "Session N'exite Pas";
                    return;
                }
                if (!new Regex(@"^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$").IsMatch(DateInscription.Text))
                {
                    ErrorMessage.Text = "date doit etre sous format aaaa-mm-jj";
                    return;
                }
                new SqlCommand($"insert into Condidat values(@code,@nom,@date,@numSession,@nmSession)", connection)
                {
                    Parameters =
                    {
                        new SqlParameter("@code",       CodeCand.Text),
                        new SqlParameter("@nom",        NomCand.Text),
                        new SqlParameter("@date",       DateInscription.Text),
                        new SqlParameter("@numSession", NumSession.Text),
                        new SqlParameter("@nmSession",  NomSociete.Text),
                    }
                }.ExecuteNonQuery();
                ErrorMessage.Text = "";
            }
            GererConnection.RemplirGrid(GridView1);
        }
 protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     GridView1.EditIndex = -1;
     GererConnection.RemplirGrid(GridView1);
 }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     GererConnection.SupprimerCondidat(((Label)GridView1.Rows[e.RowIndex].FindControl("CodeCand")).Text);
     GererConnection.RemplirGrid(GridView1);
 }
 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
 {
     GridView1.EditIndex = e.NewEditIndex;
     GererConnection.RemplirGrid(GridView1);
 }
 protected void serializerSchema_Click(object sender, EventArgs e)
 {
     GererConnection.SerializerSchema();
 }