예제 #1
0
        protected void gv_Detail_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gv_Detail.SelectedRow;
            //txtNum.Text = row.Cells[1].Text;
            //lblMessage.Text = "You selected Commande numéro " + row.Cells[1].Text + ".";
            Txtcode.Text = row.Cells[2].Text;
            txtQte.Text = row.Cells[6].Text;
            txtPrix.Text = row.Cells[5].Text;
            TxtBesoin.Text = row.Cells[7].Text;

            ddlListeP.SelectedItem.Text= row.Cells[4].Text;
            BtnEnvoyer.Visible = false;

            AstreeDonnees a = new AstreeDonnees();
            serviceDB serv = a.GetServices().Where(w=>w.code_service == Convert.ToInt16(row.Cells[1].Text)).FirstOrDefault();

            if (serv.etatNotif == "N")
            {
                List<notificationDB> lstNotif = new List<notificationDB>();
                lstNotif = a.GetNotification();
                notificationDB notif = lstNotif.Where(w=>w.codeService==serv.code_service).FirstOrDefault();             
                notif.etatNotif = "L";//  LU
                a.maj_notification(notif);
                foreach (GridViewRow grvRow in gv_Detail.Rows)
                {
                    if(row.Cells[1].Text== grvRow.Cells[1].Text)
                    {
                        grvRow.ForeColor = System.Drawing.Color.Black;
                    }
                    
                }
                
            }
        }
예제 #2
0
        private void BindGrid()
        {
            AstreeDonnees         a        = new AstreeDonnees();
            List <serviceDB>      ls       = a.GetServices().Where(w => w.libelleService == "Commande" && w.codeDest == 404 && w.etat.Trim() == "A").ToList();
            List <serviceDB>      lsServ   = new List <serviceDB>();
            List <notificationDB> lstNotif = a.GetNotification();

            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);

                    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")
                        {
                            row.ForeColor = System.Drawing.Color.Red;
                        }

                        if (serv.etat.ToString().Trim() == "V")
                        {
                            cb.Checked    = true;
                            row.ForeColor = System.Drawing.Color.Black;
                        }
                    }
                }
            }
        }
        protected void gv_Commande_SelectedIndexChanged(object sender, EventArgs e)
        {
            AstreeDonnees a = new AstreeDonnees();

            GridViewRow row  = gv_Commande.SelectedRow;
            produitDB   prod = a.GetProduit().Where(w => w.LibelleProduit.Trim() == row.Cells[3].Text.ToString().Trim()).FirstOrDefault();

            Txtcode.Text             = row.Cells[2].Text;
            TxtQte.Text              = row.Cells[4].Text;
            ddlProduit.SelectedValue = prod.IdProduit.ToString();//;
            //Session["CodeServ"]
            //MessageLabel.Text = "You selected Devis numéro " + row.Cells[1].Text + ".";
            BtnEnvoyer.Visible = false;

            notificationDB notif = a.GetNotification().Where(w => w.codeService == Convert.ToInt16(row.Cells[1].Text)).FirstOrDefault();

            if (notif != null)
            {
                notif.etatNotif = "L";
                a.maj_notification(notif);
                row.ForeColor = System.Drawing.Color.Black;

                Label x = (Label)Master.FindControl("lblNotifCommandeInter") 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() == "Commande").Count().ToString();

                Label nbNotification = (Label)Master.FindControl("nbNotification") as Label;
                nbNotification.Text = lsNotification.Count().ToString();

                //Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
        }
예제 #4
0
        protected void gv_Commande_SelectedIndexChanged(object sender, EventArgs e)
        {
            AstreeDonnees a = new AstreeDonnees();
            //txtetat.Text = "";
            GridViewRow row = gv_Commande.SelectedRow;

            txtNum.Text     = row.Cells[1].Text;
            lblMessage.Text = "Vous avez séléctionner la commande numéro " + row.Cells[1].Text + ".";
            //txtProduit.Text = row.Cells[2].Text;
            //txtQuantiteDemandee.Text= row.Cells[4].Text;



            CheckBox cb = (CheckBox)row.FindControl("Accepter");

            if (cb != null && cb.Checked)
            {
                // txtetat.Text = "VALIDEE";
                Btnreponse.Visible = false;
                cb.Enabled         = false;
                notificationDB notif = a.GetNotification().Where(w => w.codeService == Convert.ToInt16(txtNum.Text)).FirstOrDefault();
                if (notif != null)
                {
                    notif.etatNotif = "L";
                    a.maj_notification(notif);
                }
                row.ForeColor = System.Drawing.Color.Black;
                Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            else
            {
                Btnreponse.Visible = true;
                //cb.Enabled = true;
            }



            List <DetailCommandeDB> ls = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == 404 && w.code_service == Convert.ToInt16(txtNum.Text)).ToList();

            if (ls.Count() > 0)
            {
                // PnlInfo.Visible = false;
                Pnl_GvDetail.Visible = true;
                gv_Detail.DataSource = ls;
                gv_Detail.DataBind();
            }

            else
            {
                Pnl_GvDetail.Visible = false;
                //PnlInfo.Visible = true;
                //msg.Text = "il n'existe aucune Demande pour cet fournisseur!";
            }
        }
        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 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 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 == "&nbsp;")
            {
                TxtPHT.Text = "0";
            }
            else
            {
                TxtPHT.Text = row.Cells[5].Text;
            }
            if (row.Cells[6].Text == "&nbsp;")
            {
                txtTaxe.Text = "0";
            }
            else
            {
                txtTaxe.Text = row.Cells[6].Text;
            }
            if (row.Cells[7].Text == "&nbsp;")
            {
                txtCP.Text = "0";
            }
            else
            {
                txtCP.Text = row.Cells[7].Text;
            }
            if (row.Cells[8].Text == "&nbsp;")
            {
                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;
            }
        }