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;
public partial class IntraAdmin_CollAuteurs_EcritsLanaudois : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
///
/// Enregistrer un auteur avec les informations
///
///
///
protected void cmdEnregistrer_Click(object sender, EventArgs e)
{
//Si le genre ou le style n'est pas sélectionner, affiché 0
string Genre = (lstoptGenre.SelectedIndex == -1)? "0" : lstoptGenre.SelectedValue ;
string style = (lstoptStyle.SelectedIndex == -1) ? "0" : lstoptStyle.SelectedValue;
//Créer la commande d'insertion et l'exécuter
DataSourceBD.InsertCommand = "INSERT INTO Auteurs(Nom, Prénom, DateNaissance, SexeF, Adresse, MunResidence, CodePostal, MunOrigine, Courriel, SiteWeb, Titre, LieuEdition, AnnéeEdition, NbrPages, NomEditeur, PublierCpteAuteur, NoISBN, DepotLegal, GenreLitt, StyleLitt, Autres, Descr, [Prix/Mentions], Biographie) VALUES "+
"(\"" + txtNom.Text + "\",\"" + txtPrénom.Text + "\",#" + txtAnNaiss.Text + "/" + txtMoisNaiss.Text +"/" + txtJourNaiss.Text + "#," + lstoptSexe.SelectedValue + ",\"" + txtAdresse.Text + "\",\"" + txtMunResid.Text + "\",\"" + txtCodePostal.Text + "\",\"" + txtMunOrigine.Text + "\",\"" + txtCourriel.Text + "\",\"" +
txtSiteWeb.Text + "\",\"" + txtTitre.Text + "\",\"" + txtLieuEdit.Text + "\"," + txtAnnée.Text + "," + txtNbPages.Text + ",\"" + txtNomEdit.Text + "\"," + cchComptAuteur.Checked + ",\"" + txtNoISBN.Text + "\"," + cchDepotLagal.Checked + "," + Genre + "," + style +
",\"" + txtAutres.Text + "\",\"" + txtDescript.Text + "\",\"" + txtPrix.Text + "\",\"" + txtBiogr.Text + "\")";
DataSourceBD.Insert();
//Rediriger la page sur page "Les écrites lanaudois"
Page.Response.Redirect("~/../Les_ecrits_lanaudois.htm");
}
///
/// Faire la vérification que la description ne dépasse pas 250 caractère
///
///
///
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
try
{
args.IsValid = txtDescript.Text.Length <= 250;
}
catch
{
args.IsValid = false;
}
}
}