private void BindGrid() { AstreeDonnees a = new AstreeDonnees(); gv_Historique.DataSource = a.GetServices().Where(w => w.libelleService == "Commande".Trim() && w.codeDest == 404).OrderByDescending(w => w.dateReponse); gv_Historique.DataBind(); }
private void BindGrid() { try { AstreeDonnees a = new AstreeDonnees(); List <DetailCommandeDB> ls = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == Convert.ToInt16(Session["code_utilisateur"].ToString())).OrderBy(w => w.etat).ThenByDescending(w => w.dateDemande).ToList(); gv_Commande.DataSource = ls; gv_Commande.DataBind(); foreach (GridViewRow row in gv_Commande.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cb = (row.Cells[0].FindControl("Accepter") as CheckBox); DetailCommandeDB serv = ls.Where(w => w.code_service == Convert.ToInt16(row.Cells[1].Text.ToString().Trim())).FirstOrDefault(); if (serv != null) { if (serv.etat.ToString().Trim() == "V") { cb.Checked = true; } } } } } catch (Exception ex) { } }
//protected void DownloadFileIndexe(object sender, EventArgs e) //{ // int id = int.Parse((sender as LinkButton).CommandArgument); // byte[] bytes; // AstreeDonnees a = new AstreeDonnees(); // fichierIndexeDB F = new fichierIndexeDB(); // F = a.GetFichierIndexe().Where(w => w.code_service == id).FirstOrDefault(); // bytes = (byte[])F.DataR; // Response.Clear(); // Response.Buffer = true; // Response.Charset = ""; // Response.Clear(); // Response.Cache.SetCacheability(HttpCacheability.NoCache); // Response.AppendHeader("ContentType", "application/pdf"); // Response.AppendHeader("Content-Description", "F DOWNOALD"); // Response.AppendHeader("Content-Transfer-Encoding", "binary\n"); // Response.AppendHeader("Content-Disposition", "attachment; filename=aaa.pdf"); // //Response.TransmitFile(Server.MapPath("~/Files/Serverside.pdf")); // Response.BinaryWrite(bytes); // Response.Flush(); // Response.End(); //} protected void gv_Commande_RowDataBound(object sender, GridViewRowEventArgs e) { try { AstreeDonnees a = new AstreeDonnees(); foreach (GridViewRow row in gv_Commande.Rows) { if (row.RowType == DataControlRowType.DataRow) { serviceDB serv = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Commande") && w.codeDest == Convert.ToInt16(Session["code_utilisateur"].ToString()) && (w.code_service == Convert.ToInt32(row.Cells[1].Text))).FirstOrDefault(); if (serv != null) { if (serv.etat.Trim() == "V") { //e.Row.BackColor = System.Drawing.Color.Red; row.ForeColor = System.Drawing.Color.Green; } if (serv.etat.Trim() == "A") { row.ForeColor = System.Drawing.Color.Red; } } } } } catch (Exception ex) { } }
protected void btnRegister_Click(object sender, EventArgs e) { DataAccesDataContext dbcontext = new DataAccesDataContext(); var rech = from i in dbcontext.Utilisateur select i.login; foreach (var R in rech) { if (R.Equals(txtlogin.Text)) { AstreeDonnees a = new AstreeDonnees(); UtilisateurDB util = a.GetUser().Where(w => w.login == txtlogin.Text).FirstOrDefault(); if (txtRepeatpassword.Text == txtpassword2.Text) { util.Mdp = txtRepeatpassword.Text; a.ModifierMDP(util); Response.Redirect("Login.aspx"); } else { msgerror.Visible = true; msgerror.Text = "les deux mot de passe ne sont pas identiques"; } } } }
protected void Page_Load(object sender, EventArgs e) { try { string x = Request.Url.AbsoluteUri; string[] ls = x.Split('?'); if (ls.Length == 2) { AstreeDonnees a = new AstreeDonnees(); string rec; rec = a.GetHash(ls[1].Substring(2)); if (rec == "OK") { signup_box.Visible = true; } else { Response.Redirect("PageErreur.aspx"); } } else { Response.Redirect("PageErreur.aspx"); } } catch (Exception ex) { Response.Redirect("PageErreur.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { //if (Session["code_utilisateur"] == null) //{ // Response.Redirect("login.aspx"); //} AstreeDonnees a = new AstreeDonnees(); int NBUtil = a.GetUser().Count(); NBTotal.Text = NBUtil.ToString(); int NB = a.GetUser().Where(w => w.description_profil.Trim() == "Agent").Count(); NbAgent.Text = NB.ToString(); int NBC = a.GetUser().Where(w => w.description_profil.Trim() == "Courtier").Count(); NbCourtier.Text = NBC.ToString(); int NBF = a.GetUser().Where(w => w.description_profil.Trim() == "Fournisseur").Count(); NbFour.Text = NBF.ToString(); int NBG1 = a.GetUser().Where(w => w.code_profil == 404).Count(); int NBG2 = a.GetUser().Where(w => w.code_profil == 505).Count(); int NBG3 = a.GetUser().Where(w => w.code_profil == 606).Count(); int NBG = NBG1 + NBG2 + NBG3; NbGest.Text = NBG.ToString(); ///////// DataAccesDataContext dbcontext = new DataAccesDataContext(); List <UtilisateurDB> listeNotification = a.GetUser().Where(w => w.Etat.Trim() == "N").ToList(); int k = 1; foreach (UtilisateurDB liste in listeNotification) { string buttonName = "myBtn" + k.ToString(); string dataName = "txtDate" + k.ToString(); string code = "Code_" + liste.code_utilisateur; Pnl.Controls.Add(GetLiteral("<div id='" + code + "'>")); Pnl.Controls.Add(GetLiteral("<div id='parag'><div class='block'><div class='block_content'>")); Pnl.Controls.Add(GetLiteral(" <h2 class='title'><a>Utilisateur désactivé</a></h2>")); DateTime date = DateTime.Now; Pnl.Controls.Add(GetLiteral(" <div class='byline'><span>" + date + "</span> Compte de <a>" + liste.Nom_utilisateur + "</a></div> ")); Pnl.Controls.Add(GetLiteral("</div></div></div>")); Pnl.Controls.Add(GetLiteral("<div class='pull-right action-buttons'>")); Pnl.Controls.Add(GetLiteral("<button id='" + buttonName + "' type='button' class='btn btn-minier btn-info' value='" + liste.code_utilisateur + "' onclick='Supprimer(this.value)'><i class='ace-icon fa fa-times bigger-125 '></i></button>")); Pnl.Controls.Add(GetLiteral("</div></div><br/><hr/>")); k = k + 1; } }
protected void gv_Historique_SelectedIndexChanged(object sender, EventArgs e) { AstreeDonnees a = new AstreeDonnees(); GridViewRow row = gv_Historique.SelectedRow; List <DetailCommandeDB> ls = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == 404 && w.code_service == Convert.ToInt16(row.Cells[1].Text)).ToList(); if (ls.Count() > 0) { gv_Detail.DataSource = ls; gv_Detail.DataBind(); } else { } }
protected void Btnreponse_Click(object sender, EventArgs e) { MsgCode.Text = ""; MsgEtat.Text = ""; MsgReponse.Text = ""; try { AstreeDonnees a = new AstreeDonnees(); serviceDB lstService = a.GetServices().Where(w => w.libelleService.Trim() == "Commande" && w.code_service == Convert.ToInt16(txtcodeService.Text)).FirstOrDefault(); if (txtCode.Text == "") { MsgCode.Visible = true; MsgCode.Text = "Vous devez selectionner une commande !"; } //else if (txtEtat.Text == "") //{ // MsgEtat.Visible = true; // MsgEtat.Text = "Vous devez valider la commande !"; //} else if (txtReponse.Text == "") { MsgReponse.Visible = true; MsgReponse.Text = "Vous devez sasir votre réponse !"; } else { DetailCommandeDB detailComm = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_service == lstService.code_service && w.LibelleProduit.Trim() == txtProduit.Text.Trim()).FirstOrDefault(); if (detailComm != null) { detailComm.reponse = txtReponse.Text; detailComm.QteLivree = detailComm.Qte; a.maj_DetailCommande(detailComm); } List <DetailCommandeDB> lstDetailComm = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == Convert.ToInt16(Session["code_utilisateur"].ToString()) && w.code_service == lstService.code_service && w.QteLivree == 0).ToList(); if (lstService != null && lstDetailComm.Count == 0) { lstService.etat = "V"; lstService.dateReponse = DateTime.Now; lstService.reponse = txtReponse.Text; a.maj_Commande(lstService); Label x = (Label)Master.FindControl("lblNotifCommandeFourn") as Label; Label y = (Label)Master.FindControl("nbNotification") as Label; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && (w.codeDest == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande").Count().ToString(); y.Text = x.Text; BindGrid(); } lblMsgSucces.Visible = true; lblMsgSucces.Text = "Reponse envoyé avec succés!"; txtCode.Text = ""; txtcodeService.Text = ""; //txtEtat.Text = ""; txtReponse.Text = ""; List <DetailCommandeDB> ls = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == Convert.ToInt16(Session["code_utilisateur"].ToString())).ToList(); gv_Commande.DataSource = ls; gv_Commande.DataBind(); } } catch (Exception ex) { MsgCode.Visible = true; MsgCode.Text = "Vous devez selectionner une commande !"; } }