protected void gv_User_SelectedIndexChanged(object sender, EventArgs e) { try { lblMessage.Text = gv_User.Rows[gv_User.SelectedIndex].Cells[1].Text; AstreeDonnees ad = new AstreeDonnees(); string ret = ad.maj_user(gv_User.Rows[gv_User.SelectedIndex].Cells[1].Text); Label x = (Label)Master.FindControl("lblNotifCompteDesactive") as Label; Label y = (Label)Master.FindControl("nbNotification") as Label; List <UtilisateurDB> lsNotification = ad.GetUser().Where(w => w.Etat.Trim() == "N").ToList(); x.Text = lsNotification.Count().ToString(); y.Text = lsNotification.Count().ToString(); if (ret == "Active") { lblMessage.Text = "Traitement fait avec succès!!"; this.BindGrid(); //gv_User.SelectedIndex = -1; UtilisateurDB S = ad.GetUser().Where(w => w.login == gv_User.Rows[gv_User.SelectedIndex].Cells[1].Text).FirstOrDefault(); partenaireDB part2 = ad.GetPartenair().Where(w => w.code_partenaire == S.code_partenaire).FirstOrDefault(); adresseDB adr = ad.GetAdresse().Where(w => w.code_adresse == part2.code_adresse).FirstOrDefault(); string chaine = "Le compte de votre utilisateur =" + S.Nom_utilisateur + " est activé"; MailMessage o = new MailMessage("*****@*****.**", adr.email, "Activation du compte", chaine); NetworkCredential netCred = new NetworkCredential("*****@*****.**", "HA_ouma147896321"); SmtpClient smtpobj = new SmtpClient("smtp.gmail.com", 25); smtpobj.EnableSsl = true; smtpobj.Credentials = netCred; smtpobj.Send(o); } else if (ret == "Desactive") { lblMessage.Text = "Traitement fait avec succès!!"; this.BindGrid(); // gv_User.SelectedIndex = -1; UtilisateurDB S = ad.GetUser().Where(w => w.login == gv_User.Rows[gv_User.SelectedIndex].Cells[1].Text).FirstOrDefault(); partenaireDB part2 = ad.GetPartenair().Where(w => w.code_partenaire == S.code_partenaire).FirstOrDefault(); adresseDB adr = ad.GetAdresse().Where(w => w.code_adresse == part2.code_adresse).FirstOrDefault(); string chaine = "Le compte de votre utilisateur =" + S.Nom_utilisateur + " est désaactivé"; MailMessage o = new MailMessage("*****@*****.**", adr.email, "Désactivation du compte", chaine); NetworkCredential netCred = new NetworkCredential("*****@*****.**", "HA_ouma147896321"); SmtpClient smtpobj = new SmtpClient("smtp.gmail.com", 25); smtpobj.EnableSsl = true; smtpobj.Credentials = netCred; smtpobj.Send(o); } else { lblMessage.Text = ret; } } catch (Exception ex) { //Response.Redirect("PageErreur.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["code_utilisateur"] == null) { Response.Redirect("login.aspx"); } if (!IsPostBack) { if (Session["code_utilisateur"] != null) { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); adresseDB adr = a.GetAdresse(user).FirstOrDefault(); //img=ConvertbyteToImage(user.Image); Txttel.Text = adr.tel; Txtgouvernerat.Text = adr.gouvernerat; TxtVille.Text = adr.ville; TxTUserProfil.Text = user.description_profil; } else { Response.Redirect("login.aspx"); } } importerF.Attributes.Add("onclick", "document.getElementById('" + FileUpload1.ClientID + "').click();return false;"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["code_utilisateur"] == null) { Response.Redirect("login.aspx"); } if (!IsPostBack) { // bind chart type names to ddl ddlChartType.DataSource = Enum.GetNames(typeof(SeriesChartType)); ddlChartType.DataBind(); foreach (ListItem ite in ddlChartType.Items) { if (ite.Text == "Column") { ite.Selected = true; } } AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <statistiquesDB> lsStat = a.GetStatistiques().Where(w => w.Agence == user.code_partenaire.ToString()).ToList(); Session["lstStat"] = lsStat; gv_statistiques.DataSource = lsStat; gv_statistiques.DataBind(); //DataBind(); getAnnee(); getBranche(); getCharte(); } }
private void BindGrid() { AstreeDonnees a = new AstreeDonnees(); gv_User.DataSource = a.GetUser(); gv_User.DataBind(); }
private void BindGrid() { AstreeDonnees a = new AstreeDonnees(); //sachant que 303 est le code profil effectuer aux fournisseurs gv_EnvoyerCommande.DataSource = a.GetUser().Where(w => w.code_profil == 303); gv_EnvoyerCommande.DataBind(); }
private void BindGrid() { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <serviceDB> ls = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Derogation") && (w.libelleType.Trim() == "Remise") && (w.codeUtilisateur == user.code_utilisateur)).OrderBy(w => w.etat).ThenByDescending(w => w.code_service).ToList(); foreach (serviceDB x in ls) { if (x.libelleBranche.Trim() == "Choisir") { x.libelleBranche = ""; } if (x.libelleSousbranche.Trim() == "Choisir") { x.libelleSousbranche = ""; } } Session["lstremise"] = ls; gv_Derogation.DataSource = ls; gv_Derogation.DataBind(); List <serviceDB> lss = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Derogation") && (w.libelleType.Trim() == "Prorogation") && (w.codeUtilisateur == user.code_utilisateur)).OrderBy(w => w.etat).ThenByDescending(w => w.code_service).ToList(); foreach (serviceDB x in lss) { if (x.libelleBranche.Trim() == "Choisir") { x.libelleBranche = ""; } if (x.libelleSousbranche.Trim() == "Choisir") { x.libelleSousbranche = ""; } } Session["lstproro"] = lss; gvProrogation.DataSource = lss; gvProrogation.DataBind(); List <serviceDB> lsss = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Derogation") && (w.libelleType.Trim() == "Souscription") && (w.codeUtilisateur == user.code_utilisateur)).OrderBy(w => w.etat).ThenByDescending(w => w.code_service).ToList(); foreach (serviceDB x in lsss) { if (x.libelleBranche.Trim() == "Choisir") { x.libelleBranche = ""; } if (x.libelleSousbranche.Trim() == "Choisir") { x.libelleSousbranche = ""; } } Session["lstsouscrip"] = lsss; gvSouscription.DataSource = lsss; gvSouscription.DataBind(); }
protected void Unnamed_ServerClick(object sender, EventArgs e) { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); if ((user.code_profil == 101) || (user.code_profil == 202)) { Response.Redirect("DemanderReclamation.aspx"); } else { Response.Redirect("AfficherReclamation.aspx"); } }
protected void Btnsave_Click(object sender, EventArgs e) { if (Txtpsw.Text == "") { txtPasse2.Text = ""; MsgPasse.Text = "Vous devez saisir votre mot de passe!"; Txtpsw.Focus(); } else if (txtpsw2.Text == "") { txtpsw2.Focus(); MsgPasse.Text = ""; txtPasse2.Text = "Vous devez retaper votre mot de passe"; } else if (txtpsw2.Text.Trim() != Txtpsw.Text.Trim()) { txtpsw2.Focus(); txtpsw2.Text = ""; MsgPasse.Text = ""; txtPasse2.Text = "Les deux mot de passe ne sont pas identique!"; } else { System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream); System.Drawing.Image imag = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream); txtPasse2.Text = ""; MsgPasse.Text = ""; AstreeDonnees astrDonnes = new AstreeDonnees(); UtilisateurDB usr = astrDonnes.GetUser(Convert.ToInt16(Session["code_utilisateur"])); adresseDB adr = astrDonnes.GetAdresse(usr).FirstOrDefault(); adr.ville = TxtVille.Text; adr.tel = Txttel.Text; adr.gouvernerat = Txtgouvernerat.Text; usr.Mdp = Txtpsw.Text; byte[] tab = ConvertImageToByteArray(imag, System.Drawing.Imaging.ImageFormat.Jpeg);; usr.Image = tab; astrDonnes.modifierUtilisateur(usr); astrDonnes.modifierAdresse(adr); //lblMsgSucces.Visible = true; //lblMsgSucces.Text = "Modification Terminée"; } }
protected void gv_Reclamation_SelectedIndexChanged(object sender, EventArgs e) { Btnsave.Visible = false; AstreeDonnees a = new AstreeDonnees(); GridViewRow row = gv_Reclamation.SelectedRow; serviceDB serv = a.GetServices().Where(w => w.code_service == Convert.ToInt32(row.Cells[1].Text)).FirstOrDefault(); UtilisateurDB user = a.GetUser(Convert.ToInt16(serv.codeUtilisateur)); TxtCode.Text = serv.codeUtilisateur.ToString(); List <destinationDB> lstDestination = a.GetDestination(); destinationDB dest = lstDestination.Where(w => w.codeDest == Convert.ToInt16(row.Cells[5].Text.Trim())).FirstOrDefault(); if (dest != null) { ddlDest.SelectedItem.Text = dest.libelleDest; } TxtCommentaire.Text = row.Cells[4].Text.Trim(); notificationDB notif = a.GetNotification().Where(w => w.codeService == serv.code_service).FirstOrDefault(); if (notif != null) { if (notif.etatNotif == "N") { notif.etatNotif = "L"; a.maj_notification(notif); row.ForeColor = System.Drawing.Color.Black; Label x = (Label)Master.FindControl("lblNotifReclamation") as Label; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Reclamation").Count().ToString(); Label nbNotification = (Label)Master.FindControl("nbNotification") as Label; nbNotification.Text = (Convert.ToInt16(nbNotification.Text) - 1).ToString(); } } BindGrid(); }
private void getAnnee() { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <statistiquesDB> lsStat = a.GetStatistiques().Where(w => w.Agence == user.code_partenaire.ToString()).ToList(); var lst = lsStat.Select(w => w.Annee); List <double?> lstAnnee = lst.Distinct().ToList(); List <ListItem> itemsAnnee = new List <ListItem>(); itemsAnnee.Add(new ListItem("--Choisir", "--Choisir")); foreach (int x in lstAnnee) { itemsAnnee.Add(new ListItem(x.ToString(), x.ToString())); } ddlAnnee.Items.AddRange(itemsAnnee.ToArray()); }
private void getBranche() { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <statistiquesDB> lsStat = a.GetStatistiques().Where(w => w.Agence == user.code_partenaire.ToString()).ToList(); var lst2 = lsStat.Select(w => w.Branche); List <string> lstBranche = lst2.Distinct().ToList(); List <ListItem> itemsBranche = new List <ListItem>(); itemsBranche.Add(new ListItem("--Choisir--", "--Choisir--")); foreach (string x in lstBranche) { itemsBranche.Add(new ListItem(x, x)); } ddlBranche.Items.AddRange(itemsBranche.ToArray()); }
protected void Page_Load(object sender, EventArgs e) { if (Session["code_utilisateur"] == null) { Response.Redirect("login.aspx"); } if (!this.IsPostBack) { this.BindGrid(); AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); profilDB P = a.Getprofil(Convert.ToInt32(user.code_profil)); // if (Session["code_profil"].Equals("505")) if (user.code_profil == 505) { Btnreponse.Visible = true; } } }
protected void ddlBranche_SelectedIndexChanged(object sender, EventArgs e) { ddlSousBranche.Items.Clear(); AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <statistiquesDB> lsStat = a.GetStatistiques().Where(w => w.Agence == user.code_partenaire.ToString()).ToList(); var lst = lsStat.Where(w => w.Branche == ddlBranche.SelectedValue).Select(w => w.SousBranche); List <string> lstSousBranche = lst.Distinct().ToList(); List <ListItem> itemsSousBranche = new List <ListItem>(); itemsSousBranche.Add(new ListItem("--Choisir--", "--Choisir--")); foreach (string x in lstSousBranche) { itemsSousBranche.Add(new ListItem(x, x)); } ddlSousBranche.Items.AddRange(itemsSousBranche.ToArray()); getCharte(); }
private void BindGrid() { //afficher just les devis !! AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <serviceDB> ls = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis") && (w.codeUtilisateur == user.code_utilisateur)).OrderBy(w => w.etat).OrderByDescending(w => w.code_service).ToList(); foreach (serviceDB x in ls) { if (x.libelleBranche.Trim() == "Choisir") { x.libelleBranche = ""; } if (x.libelleSousbranche.Trim() == "Choisir") { x.libelleSousbranche = ""; } } Session["lstDevis"] = ls; gv_Devis.DataSource = ls; gv_Devis.DataBind(); }
protected void gv_Devis_SelectedIndexChanged1(object sender, EventArgs e) { AstreeDonnees a = new AstreeDonnees(); Txtetat.Text = ""; GridViewRow row = gv_Devis.SelectedRow; txtID.Text = row.Cells[1].Text; txtproduit.Text = row.Cells[2].Text; txtsousproduit.Text = row.Cells[3].Text; // txtdatedemande.Text = row.Cells[4].Text; if (row.Cells[5].Text == " ") { TxtPHT.Text = "0"; } else { TxtPHT.Text = row.Cells[5].Text; } if (row.Cells[6].Text == " ") { txtTaxe.Text = "0"; } else { txtTaxe.Text = row.Cells[6].Text; } if (row.Cells[7].Text == " ") { txtCP.Text = "0"; } else { txtCP.Text = row.Cells[7].Text; } if (row.Cells[8].Text == " ") { txtPT.Text = "0"; } else { txtPT.Text = row.Cells[8].Text; } MessageLabel.Text = "You selected Devis numéro " + row.Cells[1].Text + "."; serviceDB ser = a.GetServices().Where(w => w.code_service == Convert.ToInt16(row.Cells[1].Text)).FirstOrDefault(); CheckBox cb = (CheckBox)row.FindControl("Accepter"); if (cb != null && cb.Checked) { Txtetat.Text = "VALIDEE"; if (ser.etat.Trim() == "V") { Btnreponse.Visible = false; } cb.Enabled = false; notificationDB notif = a.GetNotification().Where(w => w.codeService == Convert.ToInt16(txtID.Text)).FirstOrDefault(); if (notif != null) { if (notif.etatNotif == "N") { UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); if (user.code_profil == 101 || user.code_profil == 202) { notif.etatNotif = "L"; a.maj_notification(notif); row.ForeColor = System.Drawing.Color.Black; Label x = (Label)Master.FindControl("lblDevis") as Label; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString(); Label nbNotification = (Label)Master.FindControl("nbNotification") as Label; nbNotification.Text = lsNotification.Count().ToString(); } } } } else { UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); // if (Session["code_profil"].Equals("505")) if (user.code_profil == 505) { Btnreponse.Visible = true; } cb.Enabled = true; //gestionnaire if (user.code_profil != 101 && user.code_profil != 202) { serviceDB serv = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis") && (w.code_service == Convert.ToInt16(txtID.Text))).FirstOrDefault(); if (serv != null) { if (serv.etat.Trim() == "A") { //e.Row.BackColor = System.Drawing.Color.Red; //row.ForeColor = System.Drawing.Color.Black; // serv.etat = "L"; // a.maj_devis(serv); BindGrid(); // Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); } } } } }
protected void gvSouscription_SelectedIndexChanged(object sender, EventArgs e) { pnlDerogation.Visible = true; AstreeDonnees a = new AstreeDonnees(); Txtetat.Text = ""; GridViewRow row = gvSouscription.SelectedRow; txtId.Text = row.Cells[1].Text; txttype.Text = row.Cells[2].Text; txtproduit.Text = row.Cells[3].Text; txtsousproduit.Text = row.Cells[4].Text; // txtdatedemande.Text = row.Cells[5].Text; //txtnumcontrat.Text = row.Cells[6].Text; serviceDB serv = a.GetServices().Where(w => w.code_service == Convert.ToInt16(row.Cells[1].Text)).FirstOrDefault(); CheckBox cb = (CheckBox)row.FindControl("AccepterSouscription"); if (cb != null && cb.Checked) { Txtetat.Text = "VALIDEE"; if (serv.etat.Trim() == "V") { Btnreponse.Visible = false; } cb.Enabled = false; notificationDB notif = a.GetNotification().Where(w => w.codeService == Convert.ToInt16(txtId.Text)).FirstOrDefault(); if (notif != null) { if (notif.etatNotif == "N") { UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); if (user.code_profil == 101 || user.code_profil == 202) { notif.etatNotif = "L"; a.maj_notification(notif); row.ForeColor = System.Drawing.Color.Black; // Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); Label x = (Label)Master.FindControl("lblNotifSouscription") as Label; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString(); Label nbNotification = (Label)Master.FindControl("nbNotification") as Label; nbNotification.Text = lsNotification.Count().ToString(); } } } } else { UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); profilDB P = a.Getprofil(Convert.ToInt32(user.code_profil)); // if (Session["code_profil"].Equals("505")) if (user.code_profil == 606) { Btnreponse.Visible = true; } cb.Enabled = true; } }
protected void gvSouscription_PageIndexChanging(object sender, GridViewPageEventArgs e) { gvSouscription.PageIndex = e.NewPageIndex; gvSouscription.DataSource = Session["lstsouscrip"]; gvSouscription.DataBind(); gvSouscription.SelectedIndex = -1; AstreeDonnees a = new AstreeDonnees(); List <serviceDB> lsss = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Derogation") && (w.libelleType.Trim() == "Souscription")).ToList(); foreach (GridViewRow row in gvSouscription.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cb = (row.Cells[0].FindControl("AccepterSouscription") as CheckBox); serviceDB serv = lsss.Where(w => w.code_service == Convert.ToInt16(row.Cells[1].Text.ToString().Trim())).FirstOrDefault(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); if (serv != null) { if (serv.etat.ToString().Trim() == "A") { //Gestionnaire if (user.code_profil != 101 && user.code_profil != 202) { row.ForeColor = System.Drawing.Color.Red; } //Agent ou Courtier else { row.ForeColor = System.Drawing.Color.Black; } } if (serv.etat.ToString().Trim() == "V") { cb.Checked = true; //Gestionnaire if (user.code_profil != 101 && user.code_profil != 202) { row.ForeColor = System.Drawing.Color.Black; } //Agent ou Courtier else { if (serv.etatNotif.ToString().Trim() == "N") { row.ForeColor = System.Drawing.Color.Green; } if (serv.etatNotif.ToString().Trim() == "L") { row.ForeColor = System.Drawing.Color.Black; } } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["code_utilisateur"] == null) { Response.Redirect("login.aspx"); } //ddltype.SelectedIndex = -1; if (!this.IsPostBack) { pnlDerogation.Visible = false; AstreeDonnees a = new AstreeDonnees(); ddltype.DataSource = a.GetTypeService().Where(w => w.famille_type.Trim() == "Derogation").ToList(); ddltype.DataBind(); if (Session["remise"] == null) { } else { if (Session["remise"].ToString() == "0") { ddltype.SelectedIndex = 0; pnlTaux.Visible = true; pnlDuree.Visible = false; gvRemise.Visible = true; gvSouscription.Visible = false; gvProrogation.Visible = false; } } if (Session["prorogation"] == null) { } else { if (Session["prorogation"].ToString() == "1") { ddltype.SelectedIndex = 1; pnlTaux.Visible = false; pnlDuree.Visible = true; gvRemise.Visible = false; gvSouscription.Visible = false; gvProrogation.Visible = true; } } if (Session["souscription"] == null) { } else { if (Session["souscription"].ToString() == "2") { ddltype.SelectedIndex = 2; pnlTaux.Visible = false; pnlDuree.Visible = false; gvRemise.Visible = false; gvSouscription.Visible = true; gvProrogation.Visible = false; } } UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); profilDB P = a.Getprofil(Convert.ToInt32(user.code_profil)); // if (Session["code_profil"].Equals("505")) if (user.code_profil == 606) { Btnreponse.Visible = true; } this.BindGrid(); if (ddltype.SelectedIndex == 0) { pnlTaux.Visible = true; pnlDuree.Visible = false; gvRemise.Visible = true; gvSouscription.Visible = false; gvProrogation.Visible = false; } if (ddltype.SelectedIndex == 1) { pnlTaux.Visible = false; pnlDuree.Visible = true; gvRemise.Visible = false; gvSouscription.Visible = false; gvProrogation.Visible = true; } if (ddltype.SelectedIndex == 2) { pnlTaux.Visible = false; pnlDuree.Visible = false; gvRemise.Visible = false; gvSouscription.Visible = true; gvProrogation.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { //li //li AstreeDonnees a = new AstreeDonnees(); List <serviceDB> lsNotification1 = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); liCommandeInter.Visible = false; liCommande.Visible = false; liCommandeFournisseur.Visible = false; accueil.Visible = false; Commande.Visible = false; EnvoiCommande.Visible = false; liCommandeRepondreInter.Visible = false; liCommandeFour.Visible = false; liCommandeRepondreFour.Visible = false; liCommandeConsultInter.Visible = false; liHistorique.Visible = false; liCommandeConsultFour.Visible = false; liDerogation.Visible = false; liEnvoiDero.Visible = false; liafficherDeroInter.Visible = false; liConsulterDero.Visible = false; liafficherDeroGest.Visible = false; Devis.Visible = false; liDemanderDevis.Visible = false; liafficherDevisInter.Visible = false; liTraiterDevis.Visible = false; liaffixherDevisGest.Visible = false; liReclamation.Visible = false; liEnvoyerReclamation.Visible = false; liaffiherReclamation.Visible = false; liConsulterStatistiques.Visible = false; liGestUser.Visible = false; liGestProfil.Visible = false; liGestPermission.Visible = false; //Notification liDevis.Visible = false; //liRepIndermidiaire.Visible = false; liRemise.Visible = false; liProrogatin.Visible = false; liSouscripton.Visible = false; liCommande.Visible = false; liCompteDesactive.Visible = false; liCommandeInter.Visible = false; liCommandeFournisseur.Visible = false; liCommandeInterFourn.Visible = false; liAfficheReclamation.Visible = false; // yjini erreur ! if (Session["code_utilisateur"] == null) { Response.Redirect("login.aspx"); } UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); profilDB P = a.Getprofil(Convert.ToInt32(user.code_profil)); TxtUserProfil.Text = user.Nom_utilisateur; TxtTitre.Text = P.libelle; // if (Session["code_profil"].Equals("101")) //Agent if (user.code_profil == 101) { //Li liConsulterStatistiques.Visible = true; Commande.Visible = true; EnvoiCommande.Visible = true; liCommandeConsultInter.Visible = false; liDerogation.Visible = true; liEnvoiDero.Visible = true; liafficherDeroInter.Visible = false; liReclamation.Visible = true; liEnvoyerReclamation.Visible = true; liDevis.Visible = false; liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; liConsulterStatistiques.Visible = true; liAfficheReclamation.Visible = true; liCommandeInter.Visible = true; // List<notificationDB> lsNotification = a.GetNotification().Where(w => w.etatNotif == "N" && w.codeUtilisateur== Convert.ToInt16(Session["code_utilisateur"])).ToList(); List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); //int nb = lsNotification.Count(); //if (nb>0) { nbNotification.Visible = true; } lblNotifRemise.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString(); lblNotifProrogation.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString(); lblNotifSouscription.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString(); lblDevis.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString(); lblNotifCommandeInter.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).Count().ToString(); List <serviceDB> lstNotifReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etatNotif.Trim() == "N" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); lblNotifReclamation.Text = lstNotifReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblDevis.Text) + Convert.ToInt16(lblNotifRemise.Text) + Convert.ToInt16(lblNotifProrogation.Text) + Convert.ToInt16(lblNotifReclamation.Text) + Convert.ToInt16(lblNotifCommandeInter.Text) + Convert.ToInt16(lblNotifSouscription.Text)).ToString(); } //Courtier else if (user.code_profil == 202) { //LI Commande.Visible = true; EnvoiCommande.Visible = true; liCommandeConsultInter.Visible = false; liDerogation.Visible = true; liEnvoiDero.Visible = true; liafficherDeroInter.Visible = false; Devis.Visible = true; liDemanderDevis.Visible = true; liafficherDevisInter.Visible = false; liReclamation.Visible = true; liEnvoyerReclamation.Visible = true; // notification liCommandeInter.Visible = true; liDevis.Visible = true; liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; liConsulterStatistiques.Visible = false; liAfficheReclamation.Visible = true; nbNotification.Visible = true; // List<notificationDB> lsNotification = a.GetNotification().Where(w => w.etatNotif == "N" && w.codeUtilisateur== Convert.ToInt16(Session["code_utilisateur"])).ToList(); List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); //nbNotification.Text = lsNotification.Count().ToString(); int nb = lsNotification.Count(); if (nb <= 0) { nbNotification.Visible = false; } lblNotifRemise.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString(); lblNotifProrogation.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString(); lblNotifSouscription.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString(); lblDevis.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString(); lblNotifCommandeInter.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande").Count().ToString(); List <serviceDB> lstNotifReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etatNotif.Trim() == "N" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); lblNotifReclamation.Text = lstNotifReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblDevis.Text) + Convert.ToInt16(lblNotifRemise.Text) + Convert.ToInt16(lblNotifProrogation.Text) + Convert.ToInt16(lblNotifReclamation.Text) + Convert.ToInt16(lblNotifCommandeInter.Text) + Convert.ToInt16(lblNotifSouscription.Text)).ToString(); } //Fournisseur else if (user.code_profil == 303) { Commande.Visible = true; liCommandeRepondreFour.Visible = true; liCommandeConsultFour.Visible = false; //notification liCommandeFournisseur.Visible = true; liCommandeFournisseur.Visible = true; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.codeDest == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); lsNotification = lsNotification.Where(w => w.etat.Trim() == "A").ToList(); lblNotifCommandeFourn.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande").Count().ToString(); nbNotification.Text = lsNotification.Count().ToString(); } //Gestionnaire Commande else if (user.code_profil == 404) { //Li Commande.Visible = true; liHistorique.Visible = true; liCommandeFour.Visible = true; liCommandeRepondreInter.Visible = true; liReclamation.Visible = true; liaffiherReclamation.Visible = true; //notification liCommandeInterFourn.Visible = true; liCommandeInter.Visible = false; liCommande.Visible = true; liAfficheReclamation.Visible = true; // List<notificationDB> lsNotification = a.GetNotification().Where(w => w.etatNotif == "N" && w.codeUtilisateur== Convert.ToInt16(Session["code_utilisateur"])).ToList(); List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && w.codeDest == 404).ToList(); lblNotifCommande.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande" && w.etat.Trim() == "A" && w.codeDest == 404).Count().ToString(); List <serviceDB> lsNotificationFourn = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "V") && w.etatNotif.Trim() != "L" && w.codeDest != 404 && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); lblNotifCommandeInterFourn.Text = lsNotificationFourn.Count().ToString(); //lblNotifCommandeInterFourn.Text = lsNotificationFourn.Where(w => w.libelleService.Trim() == "Commande").Count().ToString(); List <destinationDB> lstDestination = a.GetDestination(); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); List <serviceDB> lstReclamationFin = new List <serviceDB>(); foreach (serviceDB recl in lstReclamation) { if (lstDestination.Where(w => w.codeDest == recl.codeDest && w.codeProfil == user.code_profil).Count() > 0) { lstReclamationFin.Add(recl); } } lstReclamation = lstReclamationFin; lblNotifReclamation.Text = lstReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblNotifCommandeInterFourn.Text) + Convert.ToInt16(lblNotifCommande.Text) + Convert.ToInt16(lblNotifReclamation.Text)).ToString(); } //Gestionnaire Devis else if (user.code_profil == 505) { //LI Devis.Visible = true; liTraiterDevis.Visible = true; liaffixherDevisGest.Visible = true; liReclamation.Visible = true; liaffiherReclamation.Visible = true; //notification liDevis.Visible = true; liAfficheReclamation.Visible = true; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList(); lblDevis.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString(); List <destinationDB> lstDestination = a.GetDestination(); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); List <serviceDB> lstReclamationFin = new List <serviceDB>(); foreach (serviceDB recl in lstReclamation) { if (lstDestination.Where(w => w.codeDest == recl.codeDest && w.codeProfil == user.code_profil).Count() > 0) { lstReclamationFin.Add(recl); } } lstReclamation = lstReclamationFin; lblNotifReclamation.Text = lstReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblDevis.Text) + Convert.ToInt16(lblNotifReclamation.Text)).ToString(); } //Gestionnaire Dérogations else if (user.code_profil == 606) { //LI liDerogation.Visible = true; liConsulterDero.Visible = true; liafficherDeroGest.Visible = false; liReclamation.Visible = true; liaffiherReclamation.Visible = true; //notification liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; // IntermidiaireProfil.Visible = true; liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; liAfficheReclamation.Visible = true; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList(); lblNotifRemise.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString(); lblNotifProrogation.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString(); lblNotifSouscription.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString(); List <destinationDB> lstDestination = a.GetDestination(); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); List <serviceDB> lstReclamationFin = new List <serviceDB>(); foreach (serviceDB recl in lstReclamation) { if (lstDestination.Where(w => w.codeDest == recl.codeDest && w.codeProfil == user.code_profil).Count() > 0) { lstReclamationFin.Add(recl); } } lstReclamation = lstReclamationFin; lblNotifReclamation.Text = lstReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblNotifReclamation.Text) + Convert.ToInt16(lblNotifRemise.Text) + Convert.ToInt16(lblNotifProrogation.Text) + Convert.ToInt16(lblNotifSouscription.Text)).ToString(); } //Admin else if (user.code_profil == 808) { //LI accueil.Visible = true; liGestUser.Visible = true; liGestProfil.Visible = true; liGestPermission.Visible = true; // IntermidiaireProfil.Visible = true; //notification liCompteDesactive.Visible = true; liGestUser.Visible = true; liGestProfil.Visible = true; List <UtilisateurDB> lsNotification = a.GetUser().Where(w => w.Etat.Trim() == "N").ToList(); nbNotification.Text = lsNotification.Count().ToString(); lblNotifCompteDesactive.Text = lsNotification.Count().ToString(); } }
protected void BtnEnvoyer_Click(object sender, EventArgs e) { try { MsgCodeF.Text = ""; MsgObser.Text = ""; MsgPrix.Text = ""; MsgProduit.Text = ""; MsgQte.Text = ""; lblMsgSuccee.Text = ""; AstreeDonnees a = new AstreeDonnees(); UtilisateurDB User = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); serviceDB S = new serviceDB(); S.libelleService = "Commande"; S.etat = "A"; if (Txtcode.Text == "") { MsgCodeF.Visible = true; MsgCodeF.Text = "Vous devez selectionner un fournisseur!"; } else { S.dateDemande = DateTime.Now; S.codeDest = Convert.ToInt16(Txtcode.Text); S.codeUtilisateur =Convert.ToInt16(Session["code_utilisateur"].ToString()); a.Insertservice(S); List<serviceDB> lstService = a.GetServices(); serviceDB serv = lstService.Where(w => w.codeUtilisateur == User.code_utilisateur).LastOrDefault(); notificationDB notif = new notificationDB(); notif.codeService = serv.code_service; notif.contenuNotification = serv.reponse; notif.etatNotif = "N";// NON LU notif.dateNotification = serv.dateReponse; a.InsertNotification(notif); DetailCommandeDB Detail = new DetailCommandeDB(); if (gv_listeCommande.Rows.Count > 0) { try { foreach (GridViewRow row in gv_listeCommande.Rows) { Detail.code_service = serv.code_service; Detail.Id_produit = Convert.ToInt16(row.Cells[0].Text); Detail.Qte = Convert.ToInt16(row.Cells[2].Text); Detail.PU = Convert.ToInt16(row.Cells[3].Text); if (TxtBesoin.Text == "" || TxtBesoin.Text == null) { MsgObser.Visible = true; MsgObser.Text = "Vous devez saisir une observation!"; } else { Detail.Observation = TxtBesoin.Text; a.Inserer_Commande(Detail); } } if (TxtBesoin.Text == "" || TxtBesoin.Text == null) { MsgObser.Visible = true; MsgObser.Text = "Vous devez saisir une observation!"; } else { lblMsgSuccee.Visible = true; lblMsgSuccee.Text = "Commande envoyé avec succés!"; Txtcode.Text = ""; txtPrix.Text = ""; txtQte.Text = ""; TxtBesoin.Text = ""; // lblMsgSuccee.Text = ""; } Session["lstCommande"] = null; } catch (Exception ex) { Response.Redirect("PageErreur.aspx"); } } else { MsgCodeF.Text = ""; txterror.Visible = true; txterror.Text = "aucun article dans le panier!"; } } } catch (Exception ex) { Response.Redirect("PageErreur.aspx"); } }
private void getCharte() { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <statistiquesDB> lsStat = a.GetStatistiques().Where(w => w.Agence == user.code_partenaire.ToString()).ToList(); string annee = ""; if (ddlAnnee.SelectedIndex == 0) { } else { annee = ddlAnnee.SelectedValue; if (ddlBranche.SelectedIndex > 0) { lsStat = a.GetStatistiques().Where(w => (w.Agence == user.code_partenaire.ToString()) && (w.Branche == ddlBranche.SelectedValue) && w.Annee == Convert.ToInt16(annee)).ToList(); } else { lsStat = a.GetStatistiques().Where(w => (w.Annee == Convert.ToInt16(annee) && (w.Agence == user.code_partenaire.ToString()))).ToList(); } gv_statistiques.DataSource = lsStat; gv_statistiques.DataBind(); } string branch = ""; if (ddlBranche.SelectedIndex == 0) { } else { branch = ddlBranche.SelectedValue; if (ddlAnnee.SelectedIndex > 0) { lsStat = a.GetStatistiques().Where(w => (w.Agence == user.code_partenaire.ToString()) && (w.Branche == branch.ToString()) && (w.Annee == Convert.ToInt16(annee))).ToList(); } else { lsStat = a.GetStatistiques().Where(w => (w.Agence == user.code_partenaire.ToString()) && (w.Branche == branch.ToString())).ToList(); } string sousBranch = ""; if (ddlSousBranche.SelectedIndex <= 0) { } else { lsStat = a.GetStatistiques().Where(w => (w.Agence == user.code_partenaire.ToString()) && (w.Branche == branch.ToString()) && (w.SousBranche == ddlSousBranche.SelectedValue.ToString().Trim()) && (w.Annee == Convert.ToInt16(annee))).ToList(); gv_statistiques.DataSource = lsStat; gv_statistiques.DataBind(); } gv_statistiques.DataSource = lsStat; gv_statistiques.DataBind(); } int i = 0; string[] x = new string[lsStat.Count]; decimal[] y = new decimal[lsStat.Count]; decimal[] z = new decimal[lsStat.Count]; decimal[] u = new decimal[lsStat.Count]; decimal[] o = new decimal[lsStat.Count]; string[] b = new string[lsStat.Count]; foreach (statistiquesDB t in lsStat) { if (t.Mois == 1) { x[i] = "Janvier"; } if (t.Mois == 2) { x[i] = "Février"; } if (t.Mois == 3) { x[i] = "Mars"; } if (t.Mois == 4) { x[i] = "Avril"; } if (t.Mois == 5) { x[i] = "Mai"; } if (t.Mois == 6) { x[i] = "Juin"; } if (t.Mois == 7) { x[i] = "Juillet"; } if (t.Mois == 8) { x[i] = "Aout"; } if (t.Mois == 9) { x[i] = "Septembre"; } if (t.Mois == 10) { x[i] = "Octobre"; } if (t.Mois == 11) { x[i] = "Novembre"; } if (t.Mois == 12) { x[i] = "Décembre"; } y[i] = Convert.ToDecimal(t.Sinistre); i = i + 1; //if (ddlAnnee.SelectedValue.) //{ //} chartSinistre.Series["serieSinistre"].Points.DataBindXY(x, y); //chartSinistre.Series["serieSinistre"].ChartType = SeriesChartType.Column; chartSinistre.Series["serieSinistre"].ChartTypeName = ddlChartType.SelectedValue; chartSinistre.ChartAreas["ChartAreaSinistre"].Area3DStyle.Enable3D = cbUse3D.Checked; chartSinistre.ChartAreas["ChartAreaSinistre"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); chartSinistre.Legends["Default"].Enabled = true; } ////Prime i = 0; foreach (statistiquesDB t in lsStat) { // x[i] = t.Mois; z[i] = Convert.ToDecimal(t.Prime); i = i + 1; chartPrime.Series["seriePrime"].Points.DataBindXY(x, z); //chartPrime.Series["seriePrime"].ChartType = SeriesChartType.Column; chartPrime.Series["seriePrime"].ChartTypeName = ddlChartType.SelectedValue; chartPrime.ChartAreas["ChartAreaPrime"].Area3DStyle.Enable3D = cbUse3D.Checked; chartPrime.ChartAreas["ChartAreaPrime"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); chartPrime.Legends["Default"].Enabled = true; } ////Comission i = 0; foreach (statistiquesDB t in lsStat) { u[i] = Convert.ToDecimal(t.Comission); i = i + 1; chartComission.Series["serieComission"].Points.DataBindXY(x, u); //chartPrime.Series["seriePrime"].ChartType = SeriesChartType.Column; chartComission.Series["serieComission"].ChartTypeName = ddlChartType.SelectedValue; chartComission.ChartAreas["ChartAreaComission"].Area3DStyle.Enable3D = cbUse3D.Checked; chartComission.ChartAreas["ChartAreaComission"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); chartComission.Legends["Default"].Enabled = true; } ////SP i = 0; foreach (statistiquesDB t in lsStat) { //x[i] = t.Mois; o[i] = Convert.ToDecimal(t.SP); i = i + 1; chartSP.Series["serieSP"].Points.DataBindXY(x, o); //chartSP.Series["serieSP"].ChartType = SeriesChartType.Column; chartSP.Series["serieSP"].ChartTypeName = ddlChartType.SelectedValue; chartSP.ChartAreas["ChartAreaSP"].Area3DStyle.Enable3D = cbUse3D.Checked; chartSP.ChartAreas["ChartAreaSP"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); chartSP.Legends["Default"].Enabled = true; } // // // // // // // // // // // // // // // // // // // // // // //Sinistre // i = 0; // foreach (statistiquesDB t in lsStat) // { // b[i] = t.Branche; // y[i] = Convert.ToDecimal(t.Sinistre); // i = i + 1; // chartSinistre.Series["serieSinistre"].Points.DataBindXY(b, y); // //chartSinistre.Series["serieSinistre"].ChartType = SeriesChartType.Column; // chartSinistre.Series["serieSinistre"].ChartTypeName = ddlChartType.SelectedValue; // chartSinistre.ChartAreas["ChartAreaSinistre"].Area3DStyle.Enable3D = cbUse3D.Checked; // chartSinistre.ChartAreas["ChartAreaSinistre"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); // chartSinistre.Legends["Default"].Enabled = true; // } // ////Prime // i = 0; // foreach (statistiquesDB t in lsStat) // { // b[i] = t.Branche; // z[i] = Convert.ToDecimal(t.Prime); // i = i + 1; // chartPrime.Series["seriePrime"].Points.DataBindXY(b, z); // //chartPrime.Series["seriePrime"].ChartType = SeriesChartType.Column; // chartPrime.Series["seriePrime"].ChartTypeName = ddlChartType.SelectedValue; // chartPrime.ChartAreas["ChartAreaPrime"].Area3DStyle.Enable3D = cbUse3D.Checked; // chartPrime.ChartAreas["ChartAreaPrime"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); // chartPrime.Legends["Default"].Enabled = true; // } //////Comission //i = 0; // foreach (statistiquesDB t in lsStat) // { // b[i] = t.Branche; // u[i] = Convert.ToDecimal(t.Comission); // i = i + 1; // chartComission.Series["serieComission"].Points.DataBindXY(b, u); // //chartPrime.Series["seriePrime"].ChartType = SeriesChartType.Column; // chartComission.Series["serieComission"].ChartTypeName = ddlChartType.SelectedValue; // chartComission.ChartAreas["ChartAreaComission"].Area3DStyle.Enable3D = cbUse3D.Checked; // chartComission.ChartAreas["ChartAreaComission"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); // chartComission.Legends["Default"].Enabled = true; // } // ////SP // i = 0; // foreach (statistiquesDB t in lsStat) // { // b[i] = t.Branche; // o[i] = Convert.ToDecimal(t.SP); // i = i + 1; // chartSP.Series["serieSP"].Points.DataBindXY(b, o); // //chartSP.Series["serieSP"].ChartType = SeriesChartType.Column; // chartSP.Series["serieSP"].ChartTypeName = ddlChartType.SelectedValue; // chartSP.ChartAreas["ChartAreaSP"].Area3DStyle.Enable3D = cbUse3D.Checked; // chartSP.ChartAreas["ChartAreaSP"].Area3DStyle.Inclination = Convert.ToInt32(rblInclinationAngle.SelectedValue); // chartSP.Legends["Default"].Enabled = true; // } }
protected void lundi(object sender, EventArgs e) { AstreeDonnees a = new AstreeDonnees(); List <destinationDB> lstDestination = a.GetDestination(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); DataAccesDataContext dbcontext = new DataAccesDataContext(); List <serviceDB> lstReclamationFin = new List <serviceDB>(); foreach (serviceDB recl in lstReclamation) { if (lstDestination.Where(w => w.codeDest == recl.codeDest && w.codeProfil == user.code_profil).Count() > 0) { lstReclamationFin.Add(recl); } } lstReclamation = lstReclamationFin; int nb = lstReclamation.Count(); nbr.Text = nb.ToString(); var listedemande = from i in dbcontext.service select i.libelleService; //foreach (var Demande in listedemande) int k = 1; foreach (serviceDB Demande in lstReclamation) { string buttonName = "myBtn" + k.ToString(); string dataName = "txtDate" + k.ToString(); Pnl.Controls.Add(GetLiteral("<div class='itemdiv dialogdiv'>")); Pnl.Controls.Add(GetLiteral(" <div class='body'>")); Pnl.Controls.Add(GetLiteral("<br/><div class='name'>")); string Nom = "name_" + Demande.code_service; Pnl.Controls.Add(GetLiteral("<a href=# style='color:blue' id='" + Nom + "'>" + Demande.NomUtilisateur + "</a>")); Pnl.Controls.Add(GetLiteral("</div><br/>")); Pnl.Controls.Add(GetLiteral("<div class='time'> ")); Pnl.Controls.Add(GetLiteral("<i class='ace-icon fa fa-clock-o'></i>")); string date = "txtDate_" + Demande.code_service; Pnl.Controls.Add(GetLiteral("<span id='" + date + "' class='green'>" + Demande.dateDemande + "</span>")); Pnl.Controls.Add(GetLiteral("</div><br/>")); string rec = "txtcontenu_" + Demande.code_service; Pnl.Controls.Add(GetLiteral("<div class='text' id='" + rec + "'> " + Demande.contenuReclamation + "</div>")); Pnl.Controls.Add(GetLiteral("<div class='pull-right'><button id='" + buttonName + "' type='button' class='btn btn-minier btn-info' value='" + Demande.code_service + "' onclick='mercredi(this.value)' ><i class='icon-only ace-icon fa fa-share'></i></button></div>")); Pnl.Controls.Add(GetLiteral("</div></div><br/> <hr/>")); k = k + 1; } }
protected void btnLogin_Click(object sender, EventArgs e) { DataAccesDataContext dbcontext = new DataAccesDataContext(); AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = new UtilisateurDB(); adresseDB adr = new adresseDB(); user = a.GetUser(txtUsername.Text, txtpassword.Text); UtilisateurDB user1 = a.GetUser().Where(w => w.login.Trim() == txtUsername.Text.Trim()).FirstOrDefault(); int i = 0; if (Session["nbreTentative"] == null) { i = 0; } else { i = Convert.ToInt32(Session["nbreTentative"]); } Session["nbreTentative"] = i + 1; if (user == null) { msgerror.Visible = true; msgerror.Text = "login ou Mot de passe incorrect"; PnlMdp.Visible = true; if (i > 3) { if (user1 != null) { if (txtUsername.Text != "") { if (user1.login == txtUsername.Text) { user1.Etat = "N"; a.modifierEtat(user1); msgerror.Text = "Votre compte est désactivé!"; } else { msgerror.Text = "Vous n'avez pas un compte!"; } } } } } else { Session["code_profil"] = Convert.ToString(user.code_profil);// creation session Session["code_utilisateur"] = user.code_utilisateur.ToString(); if (user.code_profil == 101) { Response.Redirect("Statistique.aspx"); } else if (user.code_profil == 202) { Response.Redirect("DemanderDevis.aspx"); } else if (user.code_profil == 303) { Response.Redirect("RepondreCommandeFournisseur.aspx"); } else if (user.code_profil == 404) { Response.Redirect("RepondreCommandeIntermidiaire.aspx"); } else if (user.code_profil == 505) { Response.Redirect("AfficherDevis.aspx"); } else if (user.code_profil == 606) { Response.Redirect("AfficherDerogation.aspx"); } else if (user.code_profil == 808) { Response.Redirect("index.aspx"); } } }
private void BindGrid() { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <serviceDB> ls = new List <serviceDB>(); //Gestionnaire if (user.code_profil != 101 && user.code_profil != 202) { ls = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis")).OrderBy(w => w.etat).ToList(); } //Agent et courtier else { ls = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis") && (w.codeUtilisateur == user.code_utilisateur)).OrderByDescending(w => w.etatNotif).ToList(); } List <serviceDB> lsServ = new List <serviceDB>(); List <notificationDB> lstNotif = a.GetNotification(); Session["lstDevis"] = ls; gv_Devis.DataSource = ls; gv_Devis.DataBind(); foreach (GridViewRow row in gv_Devis.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cb = (row.Cells[0].FindControl("Accepter") as CheckBox); serviceDB serv = ls.Where(w => w.code_service == Convert.ToInt16(row.Cells[1].Text.ToString().Trim())).FirstOrDefault(); if (serv != null) { if (serv.etat.ToString().Trim() == "A") { //Gestionnaire if (user.code_profil != 101 && user.code_profil != 202) { row.ForeColor = System.Drawing.Color.Red; } //Agent ou Courtier else { row.ForeColor = System.Drawing.Color.Black; } } if (serv.etat.ToString().Trim() == "V") { cb.Checked = true; //Gestionnaire if (user.code_profil != 101 && user.code_profil != 202) { row.ForeColor = System.Drawing.Color.Black; } //Agent ou Courtier else { if (serv.etatNotif.ToString().Trim() == "N") { row.ForeColor = System.Drawing.Color.Green; } if (serv.etatNotif.ToString().Trim() == "L") { row.ForeColor = System.Drawing.Color.Black; } } } } } } }
protected void BtnEnvoyer_Click(object sender, EventArgs e) { try { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB User = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); serviceDB S = new serviceDB(); if (ddlProduit.SelectedIndex == 0) { MsgQte.Visible = false; MsgProduit.Text = "Vous devez séléctionner un produit!"; } else if (TxtQte.Text == "") { MsgProduit.Visible = false; MsgQte.Text = "Vous devez donner la quantité!"; MsgQte.Visible = true; } else { // description.Visible = true; // description.Text = "Vous devez remplir tout les champs! "; S.libelleService = "Commande"; S.etat = "A"; // 1 c'est le code du bureau d'ordre S.codeDest = 404; S.dateDemande = DateTime.Now; S.codeUtilisateur = User.code_utilisateur; a.Insertservice(S); List <serviceDB> lstService = a.GetServices().Where(w => w.codeUtilisateur == User.code_utilisateur && w.libelleService.Trim() == "Commande").ToList(); serviceDB serv = lstService.OrderByDescending(w => w.code_service).FirstOrDefault(); DetailCommandeDB Detail = new DetailCommandeDB(); try { foreach (GridViewRow row in gv_listeCommande.Rows) { Detail.code_service = serv.code_service; Detail.Id_produit = Convert.ToInt16(row.Cells[0].Text); //Detail.code_dest = serv.codeDest; Detail.Qte = Convert.ToInt16(row.Cells[2].Text); Detail.PU = 0; Detail.Observation = ""; a.Inserer_Commande(Detail); description.Visible = true; description.Text = "Commande envoyé avec succée"; BindGrid(); } Session["lstPanier"] = null; } catch (Exception ex) { } } } catch (Exception ex) { string msg = ex.Message; } }
protected void gv_Devis_RowDataBound(object sender, GridViewRowEventArgs e) { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); if (user.code_profil == 101 || user.code_profil == 102) { if (e.Row.RowType == DataControlRowType.DataRow) { try { //AstreeDonnees a = new AstreeDonnees(); GridViewRow row = e.Row; serviceDB serv = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis") && (w.code_service == Convert.ToInt32(row.Cells[1].Text))).FirstOrDefault(); if (serv != null) { if (serv.etatNotif == "N") { //e.Row.BackColor = System.Drawing.Color.Red; e.Row.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { } } } else { if (e.Row.RowType == DataControlRowType.DataRow) { try { //AstreeDonnees a = new AstreeDonnees(); GridViewRow row = e.Row; serviceDB serv = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis") && (w.code_service == Convert.ToInt32(row.Cells[1].Text))).FirstOrDefault(); if (serv != null) { if (serv.etat.Trim() == "A") { //e.Row.BackColor = System.Drawing.Color.Red; e.Row.ForeColor = System.Drawing.Color.Red; } else { e.Row.ForeColor = System.Drawing.Color.Black; } } } catch (Exception ex) { } } } }
//protected void BtnAjoutDerogation_Click(object sender, EventArgs e) //{ // lblMessage1.Text = ""; // if (String.IsNullOrEmpty(ddltype.Text)) // { // lblMessage1.Visible = true; // lblMessage1.Text = "veuillez choisir le type "; // } // else if (String.IsNullOrEmpty(ddlproduit.Text)) // { // lblMessage1.Visible = true; // lblMessage1.Text = "veuillez choisir le produit"; // } // else if (String.IsNullOrEmpty(ddlsousproduit.Text)) // { // lblMessage1.Visible = true; // lblMessage1.Text = "veuillez spécifier le produit"; // } // else if (String.IsNullOrEmpty(txtnumcontrat.Text)) // { // lblMessage1.Visible = true; // lblMessage1.Text = "veuillez remplir votre numéro du contrat"; // } // else if (ddltype.SelectedIndex == 0) // { // if ((String.IsNullOrEmpty(txttaux.Text)) || (Convert.ToInt16(txttaux.Text) > 15))//n7eb tst taux mayfoutech 15% // { // lblMessage1.Visible = true; // lblMessage1.Text = "veuillez remplir le taux"; // txtduree.Text = "0"; // } // } // else if (ddltype.SelectedIndex == 1) // { // if (String.IsNullOrEmpty(txtduree.Text)) // { // lblMessage1.Visible = true; // lblMessage1.Text = "veuillez remplir la durée"; // txttaux.Text = "0"; // } // } // if (lblMessage1.Text == "") // { // lblMessage1.Visible = false; // AstreeDonnees ad = new AstreeDonnees(); // serviceDB drg = new serviceDB(); // drg.numContrat = Convert.ToInt16(txtnumcontrat.Text); // if (txttaux.Text == "") // { // drg.taux = 0; // } // else // { // drg.taux = Convert.ToInt16(txttaux.Text); // } // drg.idSousBranche = Convert.ToInt16(ddlsousproduit.SelectedValue.ToString()); // drg.idType = Convert.ToInt16(ddltype.SelectedValue.ToString()); // drg.etat = "A"; // drg.dateDemande = DateTime.Now; // if (txtduree.Text == "") // { // drg.duree = 0; // } // else // { // drg.duree = Convert.ToInt16(txtduree.Text); // } // drg.libelleService = "Derogation"; // drg.codeUtilisateur = Convert.ToInt16(Session["code_utilisateur"].ToString()); // ad.Insertservice(drg); // lblMsgSucces.Visible = true; // lblMsgSucces.Text = "Dérogation envoyée avec succés"; // BindGrid(); // //////Notification // //notificationDB notif = new notificationDB(); // //notif.codeService = drg.code_service; // //notif.contenuNotification = drg.reponse; // //notif.etat = "N";// NON LU // //notif.dateNotification = drg.dateReponse; // //ad.InsertNotification(notif); // } //} protected void BtnAjoutDerogation_Click(object sender, EventArgs e) { lblMsg.Text = ""; MsgddlType.Text = ""; MsgddlP.Text = ""; MsgddlSP.Text = ""; MsgDuree.Text = ""; MsgTaux.Text = ""; MsgContrat.Text = ""; string typeDerogation = "Remise"; if (ddltype.SelectedIndex == 1) { typeDerogation = "Prorogation"; } if (ddltype.SelectedIndex == 2) { typeDerogation = "Souscription"; } AstreeDonnees a = new AstreeDonnees(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <serviceDB> ls = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Derogation") && (w.libelleType.Trim() == typeDerogation) && (w.codeUtilisateur == user.code_utilisateur)).ToList(); if (String.IsNullOrEmpty(ddltype.Text)) { MsgddlType.Visible = true; MsgddlType.Text = "veuillez choisir le type "; } else if (String.IsNullOrEmpty(ddlproduit.Text) || ddlproduit.SelectedIndex == 0) { MsgddlP.Visible = true; MsgddlP.Text = "veuillez choisir le produit"; } else if (String.IsNullOrEmpty(ddlsousproduit.Text)) { MsgddlSP.Visible = true; MsgddlSP.Text = "veuillez spécifier le produit"; } else if (String.IsNullOrEmpty(txtnumcontrat.Text)) { if (ddltype.SelectedIndex != 2) { MsgContrat.Visible = true; MsgContrat.Text = "veuillez remplir votre numéro du contrat"; } } else if (ddltype.SelectedIndex == 0) { if ((String.IsNullOrEmpty(txttaux.Text)) || (Convert.ToInt16(txttaux.Text) > 15))//n7eb tst taux mayfoutech 15% { MsgTaux.Visible = true; MsgTaux.Text = "veuillez remplir le taux"; txtduree.Text = "0"; } //else if ((Convert.ToInt16(txttaux.Text).GetType()!= typeof(int))) { // MsgTaux.Text = "le taux doit étre un entier"; //} } else if (ddltype.SelectedIndex == 1) { if (String.IsNullOrEmpty(txtduree.Text)) { MsgDuree.Visible = true; MsgDuree.Text = "veuillez remplir la durée"; txttaux.Text = "0"; } } if (MsgddlType.Text == "" && MsgddlP.Text == "" && MsgddlSP.Text == "" && MsgDuree.Text == "" && MsgTaux.Text == "" && MsgContrat.Text == "" && lblMsg.Text == "") { MsgddlType.Visible = false; MsgddlP.Visible = false; MsgddlSP.Visible = false; MsgDuree.Visible = false; MsgTaux.Visible = false; MsgContrat.Visible = false; AstreeDonnees ad = new AstreeDonnees(); serviceDB drg = new serviceDB(); try { if (ddltype.SelectedIndex != 2) { drg.numContrat = Convert.ToInt16(txtnumcontrat.Text); } else { drg.numContrat = 0; } } catch (Exception ex) { MsgContrat.Visible = true; MsgContrat.Text = "le N° contrat doit etre un entier"; } if (txttaux.Text == "") { drg.taux = 0; } else { try { drg.taux = Convert.ToInt16(txttaux.Text); } catch { MsgTaux.Visible = true; MsgTaux.Text = "Le taux doit étre un entier"; } } drg.idSousBranche = Convert.ToInt16(ddlsousproduit.SelectedValue.ToString()); drg.idType = Convert.ToInt16(ddltype.SelectedValue.ToString()); drg.etat = "A"; drg.dateDemande = DateTime.Now; if (txtduree.Text == "") { drg.duree = 0; } else { try { drg.duree = Convert.ToInt16(txtduree.Text); } catch { MsgDuree.Visible = true; MsgDuree.Text = "la durée doit étre un entier"; } } drg.libelleService = "Derogation"; drg.codeUtilisateur = Convert.ToInt16(Session["code_utilisateur"].ToString()); int nb = 0; if (ddltype.SelectedIndex != 2) { nb = ad.GetServices().Where(w => w.numContrat == drg.numContrat).Count(); } else { nb = 0; } //if (nb > 0) //{ // lblMsgSucces.Text = "Vous avez déja envoyer une demande pour ce N° de contrat!"; //} //else //{ if (MsgDuree.Text != "" || MsgTaux.Text != "" || MsgContrat.Text != "" || MsgddlP.Text != "" || MsgddlSP.Text != "") { lblMsgSucces.Visible = true; lblMsgSucces.Text = "Impossible d'envoyer la demande! Vérifiez les champs"; } else { serviceDB ser = new serviceDB(); if (ddltype.SelectedIndex != 2) { ser = ls.Where(w => w.numContrat == drg.numContrat).FirstOrDefault(); if (ser == null) { ad.Insertservice(drg); lblMsgSucces.Visible = true; lblMsgSucces.Text = "Dérogation envoyée avec succés"; BindGrid(); } else { lblMsgSucces.Visible = true; lblMsgSucces.Text = "Demande déjà envoyée pour ce contrat"; BindGrid(); } } else if (ddltype.SelectedIndex == 2) { int nb1 = ad.GetServices().Where(w => w.idBranche == ser.idBranche && w.idSousBranche == ser.idSousBranche && w.idType == 3).Count(); if (nb1 > 1) { lblMsg.Visible = true; lblMsg.Text = "Vous avez déja envoyé une souscription pour ce produit "; } else { ad.Insertservice(drg); lblMsgSucces.Visible = true; lblMsgSucces.Text = "Dérogation envoyée avec succés"; BindGrid(); } } } //} } }
protected void BtnRepondre_Click(object sender, EventArgs e) { try { AstreeDonnees a = new AstreeDonnees(); serviceDB reclam = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A" && w.code_service == Convert.ToInt16(myCode.Text)).FirstOrDefault(); DataAccesDataContext dbcontext = new DataAccesDataContext(); if (reclam != null) { if (String.IsNullOrEmpty(message.Text)) { msgerror.Visible = true; msgerror.Text = "veuillez remplir la réponse "; lundi(sender, e); } else { reclam.dateReponse = DateTime.Now; reclam.etat = "V"; reclam.reponse = message.Text; a.maj_reclamation(reclam); message.Text = "écrivez votre réponse ici..."; lundi(sender, e); if (reclam.etatNotif == "") { notificationDB notif = new notificationDB(); notif.codeService = reclam.code_service; notif.contenuNotification = reclam.reponse; notif.etatNotif = "N";// NON LU notif.dateNotification = reclam.dateReponse; a.InsertNotification(notif); } UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <destinationDB> lstDestination = a.GetDestination(); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); List <serviceDB> lstReclamationFin = new List <serviceDB>(); foreach (serviceDB recl in lstReclamation) { if (lstDestination.Where(w => w.codeDest == recl.codeDest && w.codeProfil == user.code_profil).Count() > 0) { lstReclamationFin.Add(recl); } } lstReclamation = lstReclamationFin; Label y = (Label)Master.FindControl("nbNotification") as Label; Label x = (Label)Master.FindControl("lblNotifReclamation") as Label; x.Text = lstReclamation.Count().ToString(); y.Text = (Convert.ToInt16(y.Text.ToString()) - 1).ToString(); } } } catch (Exception ex) { lundi(sender, e); msgerror.Visible = true; msgerror.Text = "Il n'existe aucunne réclamation selectionner"; } }
protected void btnajout(object sender, EventArgs e) { MsgProfil.Text = ""; MsgNom.Text = ""; MsgLogin.Text = ""; MsgPsw.Text = ""; lblMessage.Visible = false; lblMessage.Visible = false; Msgemail.Text = ""; bool ajouter = false; if (String.IsNullOrEmpty(txtnom.Text)) { //lblMessage1.Visible = true; //lblMessage1.Text = "veuillez remplir votre nom"; MsgNom.Text = "veuillez remplir le nom"; } else if (String.IsNullOrEmpty(txtlogin.Text)) { //lblMessage1.Visible = true; //lblMessage1.Text = "veuillez remplir votre login"; MsgLogin.Text = "veuillez remplir le login!"; } else if (String.IsNullOrEmpty(txtpassword.Text)) { //lblMessage1.Visible = true; //lblMessage1.Text = "veuillez remplir votre Password"; MsgPsw.Text = "veuillez remplir le Password!"; } else if (Convert.ToInt16(ddlprofil1.SelectedValue) == 0) { MsgProfil.Text = "Vous devez selectionner le profil!"; } else if (String.IsNullOrEmpty(txtemail.Text)) { Msgemail.Text = "Vous devez saisir l'email"; } else { lblMessage1.Visible = false; AstreeDonnees a = new AstreeDonnees(); List <UtilisateurDB> lstUser = a.GetUser(); if (lstUser.Where(w => w.login == txtlogin.Text).Count() > 0) { MsgLogin.Text = "Login existant"; } else { // lblMessage1.Visible = false; ajouter = true; } } if (ajouter == true) { AstreeDonnees ad = new AstreeDonnees(); UtilisateurDB usr = new UtilisateurDB(); adresseDB adr = new adresseDB(); if (MsgNom.Text == "" && MsgLogin.Text == "" && MsgProfil.Text == "") { try { usr.Etat = "A"; usr.code_profil = Convert.ToInt16(ddlprofil1.SelectedValue.ToString()); // usr.code_partenaire = Convert.ToInt16(ddlpartenaire.SelectedValue.ToString()); usr.Nom_utilisateur = txtnom.Text; usr.login = txtlogin.Text; usr.Mdp = txtpassword.Text; int nb = ad.GetAdresse().Where(w => w.email.Trim() == txtemail.Text.Trim()).Count(); int nb1 = ad.GetPartenair().Where(w => w.code_adresse == 0 && w.code_partenaire == usr.code_partenaire).Count(); if (nb == 0 && nb1 != 0) { adr.email = txtemail.Text; ad.InsertAdresse(adr); adresseDB adr1 = ad.GetAdresse().Where(w => w.email.Trim() == txtemail.Text.Trim()).LastOrDefault(); partenaireDB part = ad.GetPartenair().Where(w => w.code_partenaire == usr.code_partenaire).FirstOrDefault(); part.code_adresse = adr1.code_adresse; ad.modifierPartenaire(part); } else if (nb1 == 0) { txtemail.Enabled = true; Msgemail.Text = "le partenaire :" + ddlpartenaire.Text + " a déja un email"; } else { txtemail.Enabled = true; Msgemail.Text = "l'email déja existe"; } ad.InsertUser(usr); partenaireDB part1 = ad.GetPartenair().Where(w => w.code_partenaire == Convert.ToInt16(ddlprofil1.SelectedValue.ToString())).FirstOrDefault(); adresseDB adr2 = ad.GetAdresse().Where(w => w.code_adresse == part1.code_adresse).FirstOrDefault(); string chaine = "le Login est =" + txtlogin.Text + " et le mot de passe est = " + txtpassword.Text + "pour l'utilisateur =" + txtnom.Text; lblMessage1.Visible = true; lblMessage1.Text = "L'utilisateur à été ajouter avec succés"; txtemail.Text = ""; txtlogin.Text = ""; txtnom.Text = ""; txtpassword.Text = ""; try { MailMessage o = new MailMessage("*****@*****.**", adr2.email, "Login et Mot de passe", chaine); NetworkCredential netCred = new NetworkCredential("*****@*****.**", ""); SmtpClient smtpobj = new SmtpClient("smtp.gmail.com", 25); smtpobj.EnableSsl = true; smtpobj.Credentials = netCred; smtpobj.Send(o); } catch { lblMessage.Visible = true; lblMessage.Text = "l'envoi de l'email n'a étét transmis ! verifiez l'adresse email!!"; } } catch (Exception ex) { lblMessage.Visible = true; lblMessage.Text = "L'ajout n'a pas été éffectuer !"; } } } DataBind(); this.BindGrid(); }