Ejemplo n.º 1
0
 public List<ValidationResult> validerChamps(Commande obj)
 {
     ValidationContext context = new ValidationContext(obj, null, null);
     List<ValidationResult> results = new List<ValidationResult>();
     bool isValid = Validator.TryValidateObject(obj, context, results, true);
     return results;
 }
Ejemplo n.º 2
0
        public string ModifyCommande(Commande Commande)
        {
            string Msg = "";
            List<ValidationResult> results = new List<ValidationResult>();
            results = validerChamps(Commande);
            if (results.Count == 0)
            {
                var query = from it in context.Commandes
                            where it.Id == Commande.Id
                            select it;
                foreach (Commande cmd in query)
                {
                    cmd.DateCommande = Commande.DateCommande;
                    cmd.IdDonneurOrdre = Commande.IdDonneurOrdre;
                    cmd.StatutCommande = Commande.StatutCommande;
                    // Insert any additional changes to column values.
                }
                context.SubmitChanges();
            }
            else
            {
                foreach (ValidationResult result in results)
                {
                    Msg += result.ErrorMessage + "\n";
                }
            }

            return Msg;
        }
Ejemplo n.º 3
0
 public static void AjoutCommande2(Commande commande, Client client, Adresse adresse)
 {
     using (SqlConnection conx = ConnectionDB.getConnection())
     {
         using (SqlCommand cmd = conx.CreateCommand())
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "insertion_commande2";
             SqlParameter nom_client = new SqlParameter("@nom", SqlDbType.NVarChar);
             nom_client.Direction = ParameterDirection.Input;
             nom_client.Value = client.nom;
             cmd.Parameters.Add(nom_client);
             SqlParameter adresse_client = new SqlParameter("@adresse", SqlDbType.NVarChar);
             adresse_client.Direction = ParameterDirection.Input;
             adresse_client.Value = adresse.adresse;
             cmd.Parameters.Add(adresse_client);
             SqlParameter cp_client = new SqlParameter("@codepostal", SqlDbType.NVarChar);
             cp_client.Direction = ParameterDirection.Input;
             cp_client.Value = adresse.code_postal;
             cmd.Parameters.Add(cp_client);
             SqlParameter ville_client = new SqlParameter("@ville", SqlDbType.NVarChar);
             ville_client.Direction = ParameterDirection.Input;
             ville_client.Value = adresse.ville;
             cmd.Parameters.Add(ville_client);
             SqlParameter date_commande = new SqlParameter("@date", SqlDbType.DateTime);
             date_commande.Direction = ParameterDirection.Input;
             date_commande.Value = commande.date;
             cmd.Parameters.Add(date_commande);
             cmd.Connection = conx;
             cmd.ExecuteNonQuery();
         }
     }
 }
Ejemplo n.º 4
0
 public string AddCommande(string StatutCommande, string IdDonneurOrdre, DateTime DateCommande)
 {
     Commande NouvelleCommande = new Commande();
     NouvelleCommande.StatutCommande = StatutCommande;
     NouvelleCommande.IdDonneurOrdre = IdDonneurOrdre;
     NouvelleCommande.DateCommande = DateCommande;
     return DAO.AddCommande(NouvelleCommande);
    
 }
 private void Add()
 {
     var cde = new Commande
     {
         Id = CommandesController.GetNextIdCde(),
         NumeroClient = _clientCurrent != null ? _clientCurrent.NumeroClient : String.Empty
     };
     OpenCommande(cde);
 }
Ejemplo n.º 6
0
 public bool DeleteCommande(Commande Commande)
 {
     
     var query = from it in context.Commandes
                 where it.Id == Commande.Id
                 select it;
     foreach (Commande cmd in query)
     {
         context.Commandes.DeleteOnSubmit(cmd);
     }
     
     context.SubmitChanges();
     return true;
 }
Ejemplo n.º 7
0
 public static void Save(Commande commande)
 {
     if (_commandes != null && _commandes.Any())
     {
         var cdes = _commandes.Where(c => c.Id == commande.Id);
         if (cdes.Any())
         {
             var cde = cdes.First();
             cde.NumeroClient = commande.NumeroClient;
             cde.NumeroCommande = commande.NumeroCommande;
             cde.TotalCommande = commande.TotalCommande;
         }
         else
         {
             _commandes.Add(commande);
         }
     }
 }
Ejemplo n.º 8
0
 public string AddCommande(Commande NvelleCommande)
 {
     string Msg = "";
     List<ValidationResult> results = new List<ValidationResult>();
     results = validerChamps(NvelleCommande);
     if (results.Count == 0)
     {
         context.Commandes.InsertOnSubmit(NvelleCommande);
         context.SubmitChanges();
     }
     else
     {
         foreach(ValidationResult result in results)
         {
             Msg += result.ErrorMessage + "\n";
         }
     }
     
     return Msg;
 }
Ejemplo n.º 9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Keyboard.Focus(txtEspece);
            DAL.CommandeDAO daoc = new DAL.CommandeDAO();
            DAL.PayementDAO daop = new DAL.PayementDAO();
            lblnumcmd.Content = id;
            c = daoc.getById(id);
            decimal sum = c.prixtotal - daop.getPayementByCmdId(id);

            lbldatee.Content   = c.datecommande;
            lblserveur.Content = c.idserveur;
            lblnumtab.Content  = c.NumTable;
            lbltotal.Content   = sum;
            lblDate.Content    = DateTime.Now.ToShortDateString();
            lbldatee.Content   = DateTime.Now.ToShortDateString();
            System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Tick    += timer_Tick;
            timer.Start();
            txtEspece.Text = "" + sum;
        }
Ejemplo n.º 10
0
        public IEnumerable <Personne> DonnerEnfantsSurs(int id, bool pere)
        {
            string requeteSQL = $"{CONST_PERSONNE_REQ}";

            if (pere)
            {
                requeteSQL = $"{requeteSQL} where idpere = @id";
            }
            else
            {
                requeteSQL = $"{requeteSQL} where idmere = @id";
            }

            Commande com = new Commande(requeteSQL);

            com.AjouterParametre("id", id);
            return(_connexion.ExecuterLecteur(com, j => j.VersPersonne()) //??new List<Personne>()
                   );

            throw new NotImplementedException();
        }
Ejemplo n.º 11
0
        public List <CClassements> Lire(string index)
        {
            CreerCommande("SelectionnerClassements");
            Commande.Parameters.AddWithValue("@Index", index);
            Commande.Connection.Open();
            SqlDataReader       dr  = Commande.ExecuteReader();
            List <CClassements> res = new List <CClassements>();

            while (dr.Read())
            {
                CClassements tmp = new CClassements
                {
                    ClassementId = int.Parse(dr["ClassementId"].ToString()),
                    Classement   = dr["Classement"].ToString()
                };
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
 public int Modifier(int idVoiture, int idMarque, int idModele, int idCategorie, int? anneeFabrication, int? idCarburant, int? idCouleur, int? kilometrage)
 {
     CreerCommande("ModifierStockVoiture");
        int res = 0;
        Commande.Parameters.AddWithValue("@idVoiture", idVoiture);
        Commande.Parameters.AddWithValue("@idMarque", idMarque);
        Commande.Parameters.AddWithValue("@idModele", idModele);
        Commande.Parameters.AddWithValue("@idCategorie", idCategorie);
        if(anneeFabrication == null) Commande.Parameters.AddWithValue("@anneeFabrication", Convert.DBNull);
        else Commande.Parameters.AddWithValue("@anneeFabrication", anneeFabrication);
        if(idCarburant == null) Commande.Parameters.AddWithValue("@idCarburant", Convert.DBNull);
        else Commande.Parameters.AddWithValue("@idCarburant", idCarburant);
        if(idCouleur == null) Commande.Parameters.AddWithValue("@idCouleur", Convert.DBNull);
        else Commande.Parameters.AddWithValue("@idCouleur", idCouleur);
        if(kilometrage == null) Commande.Parameters.AddWithValue("@kilometrage", Convert.DBNull);
        else Commande.Parameters.AddWithValue("@kilometrage", kilometrage);
        Commande.Connection.Open();
        Commande.ExecuteNonQuery();
        Commande.Connection.Close();
        return res;
 }
Ejemplo n.º 13
0
        public C_Personne Lire_ID(int ID)
        {
            CreerCommande("SelectionnerPersonne_ID");
            Commande.Parameters.AddWithValue("@ID", ID);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_Personne    res = new C_Personne();

            while (dr.Read())
            {
                res.ID            = int.Parse(dr["ID"].ToString());
                res.Nom           = dr["Nom"].ToString();
                res.Prenom        = dr["Prenom"].ToString();
                res.DateNaissance = DateTime.Parse(dr["DateNaissance"].ToString());
                res.Photo         = dr["Photo"].ToString();
                res.Role          = bool.Parse(dr["Role"].ToString());
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 14
0
        private void btnpayer_Click(object sender, RoutedEventArgs e)
        {
            Layouts.TK_et_FK t = new TK_et_FK(id);

            t.Show();
            this.Close();
            Commande c = new Commande();

            DAL.CommandeDAO daoc = new DAL.CommandeDAO();

            c = daoc.getById(id);

            DataSet DSreport = new DSreport();

            DSreport.Reset();
            List <Commande> lstCom = new List <Commande>();

            lstCom = daoc.getAll();
            g.dataGrid.DataContext = lstCom;
            g.PerformRefresh();
        }
Ejemplo n.º 15
0
        public ActionResult Deletem(int id)
        {
            using (iBoutiqureDBEntities4 db = new iBoutiqureDBEntities4())
            {
                {
                    Commande cmd = db.Commandes.Where(x => x.idCommande == id).FirstOrDefault <Commande>();
                    db.Commandes.Remove(cmd);
                    db.SaveChanges();
                    return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
                }



                //Commande cmd = db.Commandes.Where(x => x.idCommande == id).FirstOrDefault<Commande>();

                //iBoutiqureDBEntities2 db = new iBoutiqureDBEntities2();
                // var cmd=db.supprimer(id);

                //return Ok(cmd);
            }
        }
Ejemplo n.º 16
0
        public int Ajouter(string NomMembres, string PrenomMembres, string NationaliteMembres, DateTime DateNaissanceMembres, string FonctionMembres, string AdresseMembres, string LicenseMembres, int IdEquipe)
        {
            CreerCommande("AjouterT_Membres");
            int res = 0;

            Commande.Parameters.Add("IdMembres", SqlDbType.Int);
            Direction("IdMembres", ParameterDirection.Output);
            Commande.Parameters.AddWithValue("@NomMembres", NomMembres);
            Commande.Parameters.AddWithValue("@PrenomMembres", PrenomMembres);
            Commande.Parameters.AddWithValue("@NationaliteMembres", NationaliteMembres);
            Commande.Parameters.AddWithValue("@DateNaissanceMembres", DateNaissanceMembres);
            Commande.Parameters.AddWithValue("@FonctionMembres", FonctionMembres);
            Commande.Parameters.AddWithValue("@AdresseMembres", AdresseMembres);
            Commande.Parameters.AddWithValue("@LicenseMembres", LicenseMembres);
            Commande.Parameters.AddWithValue("@IdEquipe", IdEquipe);
            Commande.Connection.Open();
            Commande.ExecuteNonQuery();
            res = int.Parse(LireParametre("IdMembres"));
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 17
0
        public void AjouteCommande(int person, int idarticle, int qte)
        {
            DateTime localDate = DateTime.Now;

            Commande commande = new Commande();

            commande.datecmd    = localDate;
            commande.numarticle = idarticle;
            commande.numclient  = person;
            commande.qtearticle = qte;

            prj.Commandes.Add(commande);


            Article art = (from c in prj.Articles where c.numArticle == idarticle select c).SingleOrDefault();

            art.stock = art.stock - qte;
            art.vendu = art.vendu + 1;

            prj.SaveChanges();
        }
Ejemplo n.º 18
0
        public List <CSeries> Lire(string index)
        {
            CreerCommande("SelectionnerSeries");
            Commande.Parameters.AddWithValue("@Index", index);
            Commande.Connection.Open();
            SqlDataReader  dr  = Commande.ExecuteReader();
            List <CSeries> res = new List <CSeries>();

            while (dr.Read())
            {
                CSeries tmp = new CSeries
                {
                    SerieId      = int.Parse(dr["SerieId"].ToString()),
                    Denomination = dr["Denomination"].ToString()
                };
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 19
0
        public int Ajouter(string nomCat)
        {
            CreerCommande("AjouterCategorieVoiture");
            int res = 0;

            Commande.Parameters.Add("idCat", SqlDbType.Int);
            Direction("idCat", ParameterDirection.Output);
            if (nomCat == null)
            {
                Commande.Parameters.AddWithValue("@nomCat", Convert.DBNull);
            }
            else
            {
                Commande.Parameters.AddWithValue("@nomCat", nomCat);
            }
            Commande.Connection.Open();
            Commande.ExecuteNonQuery();
            res = int.Parse(LireParametre("idCat"));
            Commande.Connection.Close();
            return(res);
        }
        public List <C_PhotoEvenement> LirePhotosEvenement(int ID)
        {
            CreerCommande("SelectionnerPhotosEvenement");
            Commande.Parameters.AddWithValue("@ID", ID);
            Commande.Connection.Open();
            SqlDataReader           dr  = Commande.ExecuteReader();
            List <C_PhotoEvenement> res = new List <C_PhotoEvenement>();

            while (dr.Read())
            {
                C_PhotoEvenement tmp = new C_PhotoEvenement();
                tmp.ID          = int.Parse(dr["ID"].ToString());
                tmp.IDevenement = int.Parse(dr["ID"].ToString());
                tmp.Photo       = dr["Photo"].ToString();
                tmp.EstPicto    = bool.Parse(dr["EstPicto"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 21
0
        // validation du numéro de client
        private void textBoxNumCli_KeyDown(object sender, KeyEventArgs e)


        {
            if (e.KeyCode == Keys.Enter)
            {  // remplissage des informations clients
                if (Passerelle.convertNum(textBoxNumCli.Text) == true)
                {
                    leClient = Passerelle.getLeClientByNum(Convert.ToInt32(textBoxNumCli.Text));
                    if (leClient != null)
                    {
                        textBoxNom.Text        = leClient.getNomClient();
                        textBoxPrenom.Text     = leClient.getPrenomClient();
                        textBoxCodePostal.Text = leClient.getCpClient();
                        textBoxTelephone.Text  = leClient.getTelClient().ToString();
                        // affichage des éléments
                        TxtMessage.Visible = false;
                        panel1.Visible     = true;
                        panel3.Visible     = true;
                        textBoxReference.Focus();
                        txtMessageP.Text = "Entrez une référence et appuyez sur entrée  ";
                        // instanciation de la commande
                        laCommande = new Commande(leClient);
                        maxNum     = maxNum + 1;
                        laCommande.setNumCde(maxNum);
                        laCommande.setMontantCommandeTTC(0);
                    }
                    else
                    {
                        MessageBox.Show("Erreur numéro de client inexistant dans la  BDD");
                        textBoxNumCli.Text = "";
                    }
                }
                else
                {
                    MessageBox.Show("Erreur le numéro de client doit être numérique");
                    textBoxNumCli.Text = "";
                }
            }
        }
Ejemplo n.º 22
0
        public CommandeVM(Commande commande)
        {
            Commande = commande;

            Print = new RelayCommand(() =>
            {
                string directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\ImportManager\Assets";

                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                var fullPath = directory + @"\Commande.xlsx";
                var newFile  = directory + @"\Commande_New.xlsx";
                File.Copy(fullPath, newFile, true);

                var app      = new Microsoft.Office.Interop.Excel.Application();
                app.Visible  = false;
                var workbook = app.Workbooks.Open(newFile);
                var sheet    = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Sheets[1];
                sheet.Range["Fournisseur"].Value = IoCContainer.Get <Importation>().Fournisseur.Denomination;
                sheet.Range["NumCommande"].Value = Commande.NumFacture;
                sheet.Range["Date"].Value        = Commande.Date.ToString();
                var com = sheet.ListObjects.Item["Commande"];

                foreach (LigneCommandeVM l in Lignes)
                {
                    com.ListRows.Add();
                    com.Range[com.Range.Rows.Count, 2] = l.Designation;
                    com.Range[com.Range.Rows.Count, 3] = l.Quantite;
                }
                app.Visible = true;
                var path    = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\" + Commande.NumFacture.Replace("/", "_") + ".xlsx";
                app.Dialogs.Item[Microsoft.Office.Interop.Excel.XlBuiltInDialog.xlDialogSaveAs].Show(path);
                workbook.Save();
                workbook.Close();
                app.Quit();
            });
        }
Ejemplo n.º 23
0
        private void gridList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (gridList.SelectedRows.Count == 1)


            {
                string          IdCom = gridList.SelectedRows[0].Cells[0].Value.ToString();
                OleDbConnection cn    = new OleDbConnection();
                cn = BAL.Global.seConnecter(BAL.Global.cs);
                DAL.Commande    Cd;
                BAL.BALCommande Cb;
                Cd = new Commande();
                Cb = new BALCommande();
                int           id    = Cb.getCommandbyId(Cd, IdCom);
                string        idclt = id.ToString();
                BAL.BALClient bl;

                OleDbDataReader lect;

                lect = BAL.Global.ExecuterOleDBSelect(@"select * from Client where NumClient=" + idclt, cn);
                while (lect.Read())
                {
                    txtClient.Text  = lect.GetValue(1).ToString();
                    txtAdresse.Text = lect.GetValue(2).ToString();
                    txtVille.Text   = lect.GetValue(3).ToString();
                    txtCP.Text      = lect.GetValue(4).ToString();
                    txtTel.Text     = lect.GetValue(5).ToString();
                }
                BAL.Global.seDeconnecter(cn);
                lect.Close();
            }
            else
            {
                txtClient.Text  = "";
                txtAdresse.Text = "";
                txtVille.Text   = "";
                txtCP.Text      = "";
                txtTel.Text     = "";
            }
        }
Ejemplo n.º 24
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value.GetType() == typeof(GroupItem))
            {
                GroupItem           groupItem           = (GroupItem)value;
                CollectionViewGroup collectionViewGroup = (CollectionViewGroup)groupItem.Content;

                if (collectionViewGroup.Items.Cast <Commande>().Count(c => c.IsNonEnvoye && !c.Relicat) > 3)
                {
                    return(Brushes.Red);
                }

                if (collectionViewGroup.Items.Cast <Commande>().Any(c => c.EmergencyLevel == Commande.EMERGENCY_HIGHT))
                {
                    return(Brushes.Red);
                }

                if (collectionViewGroup.Items.Cast <Commande>().Any(c => c.EmergencyLevel == Commande.EMERGENCY_MEDIUM))
                {
                    return(Brushes.Coral);
                }
            }

            if (value.GetType() == typeof(Commande))
            {
                Commande commande = (Commande)value;

                if (commande.EmergencyLevel == Commande.EMERGENCY_HIGHT)
                {
                    return(Brushes.Red);
                }

                if (commande.EmergencyLevel == Commande.EMERGENCY_MEDIUM)
                {
                    return(Brushes.Coral);
                }
            }

            return(Brushes.Black);
        }
Ejemplo n.º 25
0
        public void Valider(string id_commande)
        {
            Connexion       connexion  = new Connexion();
            MySqlConnection connection = connexion.GetConnection();

            connection.Open();
            MySqlCommand     command = connection.CreateCommand();
            MySqlTransaction transaction;

            transaction         = connection.BeginTransaction();
            command.Connection  = connection;
            command.Transaction = transaction;

            Duree    duree    = new Duree();
            Commande commande = new Commande();

            commande.IdCommande  = Int32.Parse(id_commande);
            duree.Commande       = commande;
            duree.HeureLivraison = DateTime.Now;
            DureeDAO dureeDAO = new DureeDAO();

            try
            {
                this.ValiderCommande(command, id_commande);
                dureeDAO.UpdateDuree(command, duree, "LIVRAISON");
                if (transaction != null)
                {
                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                transaction.Rollback();
                throw exception;
            }
            finally
            {
                connexion.CloseAll(command, transaction, connection);
            }
        }
Ejemplo n.º 26
0
        private void btnModifier_Click(object sender, EventArgs e)
        {
            if (gridList.SelectedRows.Count == 1)
            {
                string Idcmd = gridList.SelectedRows[0].Cells[0].Value.ToString();

                bl = new BALCommande();
                dl = new Commande();



                Ajout f1 = new Ajout(gridList.SelectedRows[0].Cells[0].Value.ToString(), bl.getCltbyIdcmd(Idcmd).ToString());



                OleDbConnection cn = new OleDbConnection();
                OleDbDataReader lect;
                cn   = Global.seConnecter(Global.cs);
                lect = Global.ExecuterOleDBSelect(@"select * from Client where NumClient =" + Int32.Parse(bl.getCltbyIdcmd(Idcmd).ToString()), cn);
                while (lect.Read())
                {
                    f1.txtClient.Text     = lect.GetValue(1).ToString();
                    f1.txtRue.Text        = lect.GetValue(2).ToString();
                    f1.txtVille.Text      = lect.GetValue(3).ToString();
                    f1.txtCodePostal.Text = lect.GetValue(4).ToString();
                    f1.txtTel.Text        = lect.GetValue(5).ToString();
                }
                Global.seDeconnecter(cn);
                lect.Close();

                f1.ShowDialog();
            }


            else
            {
                MessageBox.Show("Selectionner le commande souhaiter" + "\n" + "Selectionner la ligne entiere.", "Erreur de selection", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Ejemplo n.º 27
0
        public ManagerVM()
        {
            manager = new ManagerBLL();

            Employes = new ObservableCollection <EmployeVM>();
            Offres   = new ObservableCollection <OffreVM>();

            ChargerDonnees();
            AttacherListeners();
            OffreSelectionnee = Offres.FirstOrDefault();

            SelectionnerOffre = new Commande(
                (obj) => OffreSelectionnee = (obj as OffreVM),
                (obj) => obj is OffreVM
                );

            AjouterInteresse = new Commande(
                (obj) =>
            {
                var employe = obj as EmployeVM;
                if (!OffreSelectionnee.EmployesInteresses.Contains(employe))
                {
                    OffreSelectionnee.EmployesInteresses.Add(employe);
                }
            },
                (obj) => obj is EmployeVM
                );

            RetirerInteresse = new Commande(
                (obj) =>
            {
                var employe = obj as EmployeVM;
                if (OffreSelectionnee.EmployesInteresses.Contains(employe))
                {
                    OffreSelectionnee.EmployesInteresses.Remove(employe);
                }
            },
                (obj) => obj is EmployeVM
                );
        }
Ejemplo n.º 28
0
        public List <C_t_medecins> Lire(string Index)
        {
            CreerCommande("Selectionnert_medecins");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader       dr  = Commande.ExecuteReader();
            List <C_t_medecins> res = new List <C_t_medecins>();

            while (dr.Read())
            {
                C_t_medecins tmp = new C_t_medecins();
                tmp.IDMed     = int.Parse(dr["IDMed"].ToString());
                tmp.NomMed    = dr["NomMed"].ToString();
                tmp.PrenomMed = dr["PrenomMed"].ToString();
                tmp.GSMMed    = int.Parse(dr["GSMMed"].ToString());
                tmp.IDSpe     = int.Parse(dr["IDSpe"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 29
0
        public C_t_travail Lire_ID(int Id_travail)
        {
            CreerCommande("Selectionnert_travail_ID");
            Commande.Parameters.AddWithValue("@Id_travail", Id_travail);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_t_travail   res = new C_t_travail();

            while (dr.Read())
            {
                res.Id_travail   = int.Parse(dr["Id_travail"].ToString());
                res.nom_travail  = dr["nom_travail"].ToString();
                res.prix_travail = double.Parse(dr["prix_travail"].ToString());
                res.date_debut   = DateTime.Parse(dr["date_debut"].ToString());
                res.date_fin     = DateTime.Parse(dr["date_fin"].ToString());
                res.id_categ     = int.Parse(dr["id_categ"].ToString());
                res.id_fact      = int.Parse(dr["id_fact"].ToString());
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
        public ActionResult Create([Bind(Include = "NumCmd,DateCmd,NumClient,NumArticle,QteArticle")] Commande commande)
        {
            if (ModelState.IsValid)
            {
                // Numero du client est recuperré a partir de la session
                commande.NumClient = Session["ConnecedClientId"] != null?Int32.Parse(Session["ConnecedClientId"].ToString()) : 0;

                commande.DateCmd = DateTime.Now.ToString();
                db.Commandes.Add(commande);

                // Mettre a jour le stock
                Article article = db.Articles.Where(a => a.NumArticle == commande.NumArticle).SingleOrDefault();

                if (article.Stock >= commande.QteArticle)
                {
                    article.Stock -= commande.QteArticle;
                    db.SaveChanges();
                }
                return(RedirectToAction("Create"));
            }
            return(View(commande));
        }
Ejemplo n.º 31
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

            EFClients rep = new EFClients();

            switch (result)
            {
            case SignInStatus.Success:
                Session["id"] = rep.FindId(model.Email);

                ////Idenification du Client en cours
                //int IDClient = new EFRepository<Client>().Lister().Where(c => c.EmailClient == model.Email).First().IdClient;
                ////Création du Panier
                Session["panier"] = new Commande {
                    DateCommande = DateTime.Today, IdClient = int.Parse(Session["id"].ToString()), DetailsCommandes = new List <DetailsCommande>()
                };

                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
Ejemplo n.º 32
0
        private void Pay()
        {
            try
            {
                float currentCredit = _usagerBusiness.GetCardCredit(UsagerWhoPay);

                if (currentCredit < Prix && UsagerWhoPay.Paiement == "Carte")
                {
                    throw new Exception("Solde Insuffisant !");
                }
                else if (UsagerWhoPay.DateFinContrat != null)
                {
                    throw new Exception("Cet utilisateur ne fait plus partie de l'entreprise");
                }
                else
                {
                    Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
                    Commande commande = new Commande(Caissier.Matricule, UsagerWhoPay.Paiement, DateTime.Today, UsagerWhoPay.Matricule, Prix);
                    _commandeBusiness.AddCommande(commande);
                    Commande lastCommande = _commandeBusiness.GetTheLastInsertedCommande();

                    foreach (Plat p in _collectionChoosenPlat)
                    {
                        _commandeBusiness.AddPlatToCommande(p, lastCommande);
                    }

                    float newCredit = currentCredit - Prix;
                    _usagerBusiness.SetCardCredit(UsagerWhoPay, newCredit);

                    DialogService.ShowSuccessWindow("Commande enregistrée avec succès");

                    Messenger.Default.Send <string>("CaisseUserControl");
                }
            }
            catch (Exception ex)
            {
                DialogService.ShowErrorWindow(ex.Message);
            }
        }
Ejemplo n.º 33
0
        public C_Personne Lire_ID(int ID)
        {
            CreerCommande("SelectionnerPersonne_ID");
            Commande.Parameters.AddWithValue("@ID", ID);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_Personne    res = new C_Personne();

            while (dr.Read())
            {
                res.ID  = int.Parse(dr["ID"].ToString());
                res.NOM = dr["NOM"].ToString();
                res.PRE = dr["PRE"].ToString();
                if (dr["NAI"] != DBNull.Value)
                {
                    res.NAI = DateTime.Parse(dr["NAI"].ToString());
                }
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 34
0
        public List <C_T_Club> Lire(string Index)
        {
            CreerCommande("SelectionnerT_Club");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader   dr  = Commande.ExecuteReader();
            List <C_T_Club> res = new List <C_T_Club>();

            while (dr.Read())
            {
                C_T_Club tmp = new C_T_Club();
                tmp.IdClub       = int.Parse(dr["IdClub"].ToString());
                tmp.NomClub      = dr["NomClub"].ToString();
                tmp.LocaliteClub = dr["LocaliteClub"].ToString();
                tmp.AdresseClub  = dr["AdresseClub"].ToString();
                tmp.ClubAdverse  = bool.Parse(dr["ClubAdverse"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 35
0
        public List <C_t_interimeur> Lire(string Index)
        {
            CreerCommande("Selectionnert_interimeur");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader         dr  = Commande.ExecuteReader();
            List <C_t_interimeur> res = new List <C_t_interimeur>();

            while (dr.Read())
            {
                C_t_interimeur tmp = new C_t_interimeur();
                tmp.id_inte        = int.Parse(dr["id_inte"].ToString());
                tmp.nom_inte       = dr["nom_inte"].ToString();
                tmp.prenom_inte    = dr["prenom_inte"].ToString();
                tmp.specialisation = dr["specialisation"].ToString();
                tmp.bonus_sal      = double.Parse(dr["bonus_sal"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
        public C_Evenement Lire_ID(int ID)
        {
            CreerCommande("SelectionnerEvenement_ID");
            Commande.Parameters.AddWithValue("@ID", ID);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_Evenement   res = new C_Evenement();

            while (dr.Read())
            {
                res.ID            = int.Parse(dr["ID"].ToString());
                res.DateDebut     = DateTime.Parse(dr["DateDebut"].ToString());
                res.DateFin       = DateTime.Parse(dr["DateFin"].ToString());
                res.Description   = dr["Description"].ToString();
                res.TypeEvenement = int.Parse(dr["TypeEvenement"].ToString());
                res.IDtitre       = int.Parse(dr["IDtitre"].ToString());
                res.IDlieu        = int.Parse(dr["IDlieu"].ToString());
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
        internal bool SaveAll(Commande commande)
        {
            try
            {
                if (!openBaseCial())
                {
                    throw new Exception("Connexion base impossible, aucun enregistrement ne sera fait. Veuillez relancer le programme.");
                }

                foreach (LigneCommande ligne in commande.Lignes)
                {
                    SaveLigne(ligne);
                }

                return(true);
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.Message);
                return(false);
            }
        }
Ejemplo n.º 38
0
        public List <C_Frais> Lire(string Index)
        {
            CreerCommande("SelectionnerFraisVoiture");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader  dr  = Commande.ExecuteReader();
            List <C_Frais> res = new List <C_Frais>();

            while (dr.Read())
            {
                C_Frais tmp = new C_Frais();
                tmp.idFrais          = int.Parse(dr["idFrais"].ToString());
                tmp.idVoiture        = int.Parse(dr["idVoiture"].ToString());
                tmp.nomFrais         = dr["nomFrais"].ToString();
                tmp.descriptionFrais = dr["descriptionFrais"].ToString();
                tmp.coutFrais        = int.Parse(dr["coutFrais"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 39
0
 public string ModifyCommande(Commande uneCommande)
 {
     return DAO.ModifyCommande(uneCommande);
 }
Ejemplo n.º 40
0
 public CommandePageViewModel(Commande commande)
 {
     CommandeCurrent = commande;
     SaveCommand = new RelayCommand(Save);
 }
Ejemplo n.º 41
0
 public void Insert(Commande cmd)
 {
 }
Ejemplo n.º 42
0
 public static void ajoutCommande2(Commande commande, Client client, Adresse adresse)
 {
     DataLayer.CrudCommande.AjoutCommande2(commande, client, adresse);
 }
 /// <summary>
 /// Permet de naviguer la page de gestion de la commande
 /// </summary>
 private void OpenCommande(Commande commande)
 {
     //Navigation vers la page CommandePage
     //this sert à indiquer que le ViewModel actuel (et donc par extension la page) sera ajouté à l'historique de navigation, afin que Navegar puisse savoir qu'il doit revenir vers cette page au Back
     //new object[]{commande} permet de passer l'objet client au constructeur du ViewModel CommandePageViewModel
     //true indique que l'on souhaite une nouvelle instance du ViewModel CommandePageViewModel
     NavigationService.NavigateTo<CommandePageViewModel>(this, new object[] { commande }, true);
 }
Ejemplo n.º 44
0
 public bool RemoveCommande(Commande uneCommande)
 {
     return DAO.DeleteCommande(uneCommande);
 }