Esempio n. 1
0
        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();
        }
Esempio n. 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;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected void gv_Commande_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            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() == "Commande") && (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)
                { }
            }
        }
        protected void gv_Devis_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gv_Devis.PageIndex  = e.NewPageIndex;
            gv_Devis.DataSource = Session["lstDevis"];
            gv_Devis.DataBind();
            gv_Devis.SelectedIndex = -1;


            AstreeDonnees    a  = new AstreeDonnees();
            List <serviceDB> ls = a.GetServices().Where(w => (w.libelleService != null) && (w.libelleService.Trim() == "Devis")).ToList();

            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() == "V")
                        {
                            cb.Checked = true;
                        }
                    }
                }
            }
        }
        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);
            }
        }
Esempio n. 6
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;
                    }
                    
                }
                
            }
        }
        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();
        }
Esempio n. 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["code_utilisateur"] == null)
     {
         Response.Redirect("login.aspx");
     }
     if (!this.IsPostBack)
     {
         AstreeDonnees a  = new AstreeDonnees();
         int           nb = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").Count();
         nbr.Text = nb.ToString();
         lundi(sender, e);
     }
 }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["code_utilisateur"] == null)
            {
                Response.Redirect("login.aspx");
            }
            if (!Page.IsPostBack)
            {
                Chart2.Visible = true;
                AstreeDonnees    a       = new AstreeDonnees();
                List <serviceDB> lstServ = a.GetServices().Where(w => w.libelleService.Trim() == "Devis").ToList();
                //string query = string.Format("select shipcity, count(orderid) from orders where shipcountry = '{0}' group by shipcity", ddlCountries.SelectedValue);
                // DataTable dt = GetData(query);
                //string[] x = new string[lstServ.Count];
                //int[] y = new int[lstServ.Count];
                //int i = 0;
                //foreach(serviceDB z in lstServ )
                //{
                //    x[i] = z.libelleBranche ;

                //    y[i] = 200;// Convert.ToDecimal(z.primeHtax);
                //}
                string[] x = new string[3];
                int[]    y = new int[3];

                x[0] = "Incendie";

                y[0] = 200;    // Convert.ToDecimal(z.primeHtax);
                x[1] = "Vol";

                y[1] = 50;// Convert.ToDecimal(z.primeHtax);
                x[2] = "Auto";

                y[2] = 500;// Convert.ToDecimal(z.primeHtax);

                Chart2.Series[0].Points.DataBindXY(x, y);
                Chart2.Series[0].ChartType = SeriesChartType.Column;
                Chart2.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
                Chart2.Legends[0].Enabled = true;
            }
        }
        protected void BtnAjoutDevis_Click(object sender, EventArgs e)
        {
            //lblMessage1.Text = "Demande envoyer avec succées";

            AstreeDonnees    ad    = new AstreeDonnees();
            serviceDB        devis = new serviceDB();
            List <serviceDB> ls    = ad.GetServices().Where(w => w.libelleService.Trim() == "Devis" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"].ToString())).ToList();

            if (ddlproduit.SelectedIndex == 0)
            {
                MsgError.Visible = true;
                MsgError.Text    = "Vous devez selectionner un produit";
            }
            else
            {
                //devis = ad.GetServices().Where(w => w.libelleService.Trim() == "Devis").FirstOrDefault();
                devis.libelleService = "Devis";
                devis.idBranche      = Convert.ToInt16(ddlproduit.SelectedValue.ToString());
                devis.idSousBranche  = Convert.ToInt16(ddlsousproduit.SelectedValue.ToString());

                devis.etat            = "A";
                devis.dateDemande     = DateTime.Now;
                devis.idType          = 5;
                devis.codeUtilisateur = Convert.ToInt16(Session["code_utilisateur"].ToString());

                serviceDB ser = ls.Where(w => (w.libelleBranche.Trim() == ddlproduit.SelectedItem.Text.Trim()) && (w.libelleSousbranche.Trim() == ddlsousproduit.SelectedItem.Text.Trim())).FirstOrDefault();
                if (ser == null)
                {
                    ad.Insertservice(devis);
                    lblMsgSucces.Visible = true;
                    lblMsgSucces.Text    = "Demande devis envoyée avec succés";
                    BindGrid();
                }
                else
                {
                    lblMsgSucces.Visible = true;
                    lblMsgSucces.Text    = "Vous avez déja envoyer cette demande";
                    BindGrid();
                }
            }
        }
        private void BindGrid()
        {
            AstreeDonnees    a  = new AstreeDonnees();
            List <serviceDB> ls = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.codeUtilisateur == Convert.ToInt16(Session["Code_utilisateur"])).OrderBy(w => w.etat).ThenByDescending(w => w.code_service).ToList();

            List <destinationDB> lstDestination = a.GetDestination();

            foreach (serviceDB serv in ls)
            {
                destinationDB dest = lstDestination.Where(w => w.codeDest == serv.codeDest).FirstOrDefault();
                if (dest != null)
                {
                    serv.libelleDest = dest.libelleDest;
                }
            }
            List <serviceDB> lsFin = ls.OrderBy(w => w.etat.Trim()).ThenByDescending(w => w.etatNotif).ThenByDescending(w => w.dateReponse).ToList();

            Session["lstReclamation"] = lsFin;
            gv_Reclamation.DataSource = lsFin;
            gv_Reclamation.DataBind();
        }
        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_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)
                    { }
                }
            }
        }
Esempio n. 14
0
        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;
            }
        }
        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 Btnreponse_Click(object sender, EventArgs e)
        {
            AstreeDonnees a = new AstreeDonnees();

            MsgTaxe.Text = "";
            MsgPH.Text   = "";
            MsgCP.Text   = "";

            lblSuccee.Text = "";
            lblerreur.Text = "";
            MsgEtat.Text   = "";
            if (txtproduit.Text != "")
            {
                List <serviceDB> lstService = a.GetServices();
                serviceDB        ser        = new serviceDB();
                ser = lstService.Where(w => w.code_service == Convert.ToInt16(txtID.Text)).FirstOrDefault();

                if (ser != null)
                {
                    if (Txtetat.Text != "VALIDEE")
                    {
                        MsgProduit.Visible = false;
                        MsgEtat.Visible    = true;
                        MsgEtat.Text       = "Vous devez valider le devis selectionné!";
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(TxtPHT.Text) || Convert.ToDecimal(TxtPHT.Text) == 0)
                        {
                            MsgPT.Visible   = false;
                            MsgTaxe.Visible = false;
                            MsgCP.Visible   = false;
                            MsgPH.Visible   = true;
                            MsgPH.Text      = "veuillez remplir le prime HT ";
                        }



                        else if (String.IsNullOrEmpty(txtTaxe.Text) || Convert.ToDecimal(txtTaxe.Text) == 0)
                        {
                            MsgCP.Visible   = false;
                            MsgPH.Visible   = false;
                            MsgPT.Visible   = false;
                            MsgTaxe.Visible = true;
                            MsgTaxe.Text    = "veuillez remplir le taxe ";
                        }
                        else if (String.IsNullOrEmpty(txtCP.Text) || Convert.ToDecimal(txtCP.Text) == 0)
                        {
                            MsgPH.Visible   = false;
                            MsgPT.Visible   = false;
                            MsgTaxe.Visible = false;
                            MsgCP.Visible   = true;
                            MsgCP.Text      = "veuillez remplir le coût police";
                        }

                        else if (MsgPH.Text != "" && MsgCP.Text != "" && MsgTaxe.Text != "")
                        {
                            lblerreur.Text = "Vous devez remplir tout les champs!";
                        }
                        else
                        {
                            try {
                                ser.etat        = "V";
                                ser.dateReponse = DateTime.Now;
                                ser.primeHtax   = Convert.ToDecimal(TxtPHT.Text);
                                ser.primeTotal  = Convert.ToDecimal(txtPT.Text);
                                ser.coutPolice  = Convert.ToDecimal(txtCP.Text);
                                ser.taxe        = Convert.ToDecimal(txtTaxe.Text);
                                a.maj_devis(ser);
                                BindGrid();
                                lblSuccee.Visible = true;
                                lblerreur.Visible = false;
                                lblSuccee.Text    = "La réponse envoyée avec succés! ";
                            }
                            catch
                            {
                                lblerreur.Visible = true;
                                lblSuccee.Visible = false;
                                lblerreur.Text    = " Les champs doivent être des entiers!";
                            }
                        }
                    }
                    Label x = (Label)Master.FindControl("lblDevis") as Label;
                    Label y = (Label)Master.FindControl("nbNotification") as Label;

                    List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList();
                    x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString();



                    y.Text = (Convert.ToInt16(y.Text.ToString()) - 1).ToString();


                    if (ser.etatNotif == "")
                    {
                        notificationDB notif = new notificationDB();
                        notif.codeService         = ser.code_service;
                        notif.contenuNotification = ser.reponse;
                        notif.etatNotif           = "N";// NON LU
                        notif.dateNotification    = ser.dateReponse;
                        a.InsertNotification(notif);

                        //lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList();
                        //x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis" ).Count().ToString();



                        //y.Text = (Convert.ToInt16(y.Text.ToString()) - 1).ToString();



                        BindGrid();
                    }
                }
            }
            else
            {
                MsgEtat.Visible    = false;
                MsgProduit.Visible = true;
                MsgProduit.Text    = "Vous devez selectionner un devis!";
            }
        }
        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);
                        }
                    }
                }
            }
        }
Esempio n. 18
0
        //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();
                        }
                    }
                }
                //}
            }
        }
Esempio n. 19
0
        protected void Btnreponse_Click(object sender, EventArgs e)
        {
            MsgNum.Text = "";
            AstreeDonnees a = new AstreeDonnees();

            //if (txtetat.Text == "VALIDEE")
            //{
            AstreeDonnees ad = new AstreeDonnees();

            if (txtNum.Text != "")
            {
                serviceDB ser = a.GetServices().Where(w => w.code_service == Convert.ToInt16(txtNum.Text)).FirstOrDefault();

                DetailCommandeDB detailComm = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == 404 && w.code_service == Convert.ToInt16(txtNum.Text) && w.LibelleProduit.Trim() == txtProduit.Text.Trim()).FirstOrDefault();
                if (txtQteLivree.Text == "")
                {
                    txtQteLivree.Text = "Vous devez remplir la quantité à livrée";
                }
                if (detailComm != null)
                {
                    detailComm.reponse   = txtReponse.Text;
                    detailComm.QteLivree = Convert.ToInt16(txtQteLivree.Text);
                    ad.maj_DetailCommande(detailComm);
                }
                List <DetailCommandeDB> lstDetailComm = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == 404 && w.code_service == Convert.ToInt16(txtNum.Text) && w.QteLivree == 0).ToList();

                if (ser != null && lstDetailComm.Count == 0)
                {
                    ser.etat         = "V";
                    ser.dateReponse  = DateTime.Now;
                    ser.reponse      = txtReponse.Text;
                    ser.code_service = Convert.ToInt16(txtNum.Text);
                    ser.QteLivree    = Convert.ToInt16(txtQteLivree.Text);
                    a.maj_Commande(ser);
                    gv_Detail.Visible = false;
                    Label x = (Label)Master.FindControl("lblNotifCommande") as Label;
                    Label y = (Label)Master.FindControl("lblNotifCommandeInterFourn") as Label;
                    Label z = (Label)Master.FindControl("nbNotification") as Label;

                    List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && w.codeDest == 404).ToList();
                    x.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.codeDest != 404 && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList();

                    y.Text = lsNotificationFourn.Count().ToString();



                    z.Text = (Convert.ToInt16(z.Text.ToString()) - 1).ToString();


                    notificationDB notif = new notificationDB();
                    notif.codeService         = ser.code_service;
                    notif.contenuNotification = ser.reponse;
                    notif.etatNotif           = "N";// NON LU
                    notif.dateNotification    = ser.dateReponse;
                    a.InsertNotification(notif);

                    //    Label x = (Label)Master.FindControl("lblNotifCommande") as Label;
                    //    Label y = (Label)Master.FindControl("lblNotifCommandeInterFourn") as Label;
                    //Label z = (Label)Master.FindControl("nbNotification") as Label;

                    //List<serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && w.codeDest == 404).ToList();
                    //    x.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.codeDest != 404 && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList();

                    //y.Text = lsNotificationFourn.Count().ToString();



                    //z.Text = (Convert.ToInt16(x.Text) + Convert.ToInt16(y.Text)).ToString();


                    BindGrid();
                }
            }
            else
            {
                MsgNum.Text = "Vous devez séléctionner une commande!";
            }
            // }
        }
        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;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 22
0
        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 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();
            }
        }
Esempio n. 24
0
        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");

            }
        }
        protected void Btnreponse_Click(object sender, EventArgs e)
        {
            AstreeDonnees a = new AstreeDonnees();

            if (txtproduit.Text != "")
            {
                List <serviceDB> lstService = a.GetServices();
                serviceDB        ser        = new serviceDB();
                ser = lstService.Where(w => w.code_service == Convert.ToInt16(txtId.Text)).FirstOrDefault();
                if (ser != null)
                {
                    if (Txtetat.Text != "VALIDEE")
                    {
                        lblMsgSucces.Visible = false;
                        MsgProduit.Visible   = false;
                        MsgEtat.Visible      = true;
                        MsgEtat.Text         = "Vous devez valider le devis selectionné!";
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(txtreponse.Text))
                        {
                            lblMsgSucces.Visible = false;
                            MsgEtat.Visible      = false;
                            Msgreponse.Visible   = true;
                            Msgreponse.Text      = "veuillez remplir la réponse ";
                        }
                        else
                        {
                            ser.etat = "V";

                            ser.dateReponse = DateTime.Now;



                            ser.reponse = txtreponse.Text;
                            a.maj_derogation(ser);
                            BindGrid();
                            MsgEtat.Visible      = false;
                            Msgreponse.Visible   = false;
                            lblMsgSucces.Visible = true;
                            lblMsgSucces.Text    = "Reponse envoyée avec succès ";

                            if (ser.etatNotif == "")
                            {
                                notificationDB notif = new notificationDB();
                                notif.codeService         = ser.code_service;
                                notif.contenuNotification = ser.reponse;
                                notif.etatNotif           = "N";// NON LU
                                notif.dateNotification    = ser.dateReponse;
                                a.InsertNotification(notif);
                                Label b = (Label)Master.FindControl("nbNotification") as Label;

                                Label x = (Label)Master.FindControl("lblNotifRemise") as Label;

                                List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList();

                                x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString();
                                //b.Text = x.Text;
                                Label y = (Label)Master.FindControl("lblNotifProrogation") as Label;

                                y.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString();
                                //b.Text = y.Text;
                                Label z = (Label)Master.FindControl("lblNotifSouscription") as Label;
                                z.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString();

                                //b.Text = z.Text;

                                b.Text = (Convert.ToInt16(b.Text.ToString()) - 1).ToString();
                            }
                        }
                    }
                }
                else
                {
                    MsgEtat.Visible    = false;
                    MsgProduit.Visible = true;
                    MsgProduit.Text    = "Vous devez selectionner un devis!";
                }
            }
        }
        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;
            }
        }