/// <summary>
        /// Editer un Modele de Vue de Type SocieteModelView
        /// </summary>
        /// <param name="societeModelView">Model de vue compose de societe et de coordonnées</param>
        /// <returns>Rien</returns>
        public async Task EditSocieteByModel(ModelViewSociete societeModelView)
        {
            try
            {
                Societe societe = await _context.Societes
                                  .Include(s => s.Coordonnee)
                                  .FirstOrDefaultAsync(s => s.Id == societeModelView.Id);

                societe.Nom = societeModelView.Nom;

                societe.Coordonnee.Adresse    = societeModelView.Adresse;
                societe.Coordonnee.SubAdresse = societeModelView.SubAdresse;
                societe.Coordonnee.CodePostal = societeModelView.CodePostal;
                societe.Coordonnee.Ville      = societeModelView.Ville;
                societe.Coordonnee.Fax        = societeModelView.Fax;
                societe.Coordonnee.Telephone  = societeModelView.Telephone;
                societe.Coordonnee.Email      = societeModelView.Email;
                _context.Update(societe);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Societe CrmData en Societe ERP
        /// </summary>
        /// <param name="CRMSociete"></param>
        /// <returns></returns>
        public static Societe toBase(this Account societe)
        {
            if (societe != null)
            {
                Societe societeERP = new Societe
                {
                    Nom               = societe.Name,
                    AdresseLigne1     = societe.Address1_Line1,
                    AdresseLigne2     = societe.Address1_Line2,
                    CodePostal        = societe.Address1_PostalCode,
                    Ville             = societe.Address1_City,
                    TelephoneStandard = societe.Address1_Telephone1,
                    SiteWeb           = societe.WebSiteURL,
                    EMail             = societe.EMailAddress1,
                    Remarque          = societe.Description,
                    Guid              = societe.Id.ToString(),
                };

                return(societeERP);
            }
            else
            {
                return(null);
            }
        }
        public Societe Put(Guid id, [FromBody] Societe societe)
        {
            // validation name
            if (string.IsNullOrEmpty(societe.Nom) || string.IsNullOrWhiteSpace(societe.Nom))
            {
                throw new BusinessException("NO_VALID_DATA", "Le nom est obligatoire");
            }

            // validation siret
            // verification not nulle
            if (string.IsNullOrEmpty(societe.Siret) || string.IsNullOrWhiteSpace(societe.Siret))
            {
                throw new BusinessException("NO_VALID_DATA", "Le numéro Siret est obligatoire");
            }
            // verification longueur 14
            if (societe.Siret.Count() != 14)
            {
                throw new BusinessException("NO_VALID_DATA", "Le numéro Siret est non valide");
            }
            // verification int
            if (!Int64.TryParse(societe.Siret, out Int64 res))
            {
                throw new BusinessException("NO_VALID_DATA", "Le numéro Siret est non valide");
            }
            // Validation de Luhn
            int total = 0;
            int digit = 0;

            for (int i = 0; i < societe.Siret.Length; i++)
            {
                /** Recherche les positions impaires : 1er, 3è, 5è, etc... que l'on multiplie par 2
                 * petite différence avec la définition ci-dessus car ici on travail de gauche à droite */

                if ((i % 2) == 0)
                {
                    digit = int.Parse(societe.Siret[i].ToString()) * 2;

                    /** si le résultat est >9 alors il est composé de deux digits tous les digits devant
                     * s'additionner et ne pouvant être >19 le calcule devient : 1 + (digit -10) ou : digit - 9 */

                    if (digit > 9)
                    {
                        digit -= 9;
                    }
                }
                else
                {
                    digit = int.Parse(societe.Siret[i].ToString());
                }
                total += digit;
            }

            /** Si la somme est un multiple de 10 alors le SIRET est valide */
            if ((total % 10) != 0)
            {
                throw new BusinessException("NO_VALID_DATA", "Le numéro Siret est non valide");
            }
            _repo.Update(societe);
            return(societe);
        }
Beispiel #4
0
        public ActionResult CreateSociete([Bind(Include = "ID,Nom,Adresse,CodePostal,Ville")] Societe societe)
        {
            if (ModelState.IsValid)
            {
                //on enregistre la nouvelle société
                db.Societes.Add(societe);

                //on crée le dossier physiquement et logiquement
                db.Dossiers.Add(new Dossier {
                    Nom = societe.Nom, EstCree = true, EstDossier = true, ParentID = 1, TypeDossier = TypeDossier.Societe
                });

                db.SaveChanges();

                //création du dossier physiquement
                try
                {
                    var path = Server.MapPath(string.Concat("~/Content/Fichiers/", societe.Nom));
                    Directory.CreateDirectory(path);
                }
                catch (Exception ex)
                {
                    Danger(string.Format("Erreur lors de la création du dossier {0} ({1}).", societe.Nom, ex.Message), true);
                }

                Success(String.Format("La société {0} a été créée avec succès.", societe.Nom), true);
                return(RedirectToAction("GereCompte"));
            }

            return(View(societe));
        }
        /// <summary>
        /// Ajout une societe ainsi que ses coordonnées
        /// </summary>
        /// <param name="societeModelView">Model de vue compose de societe et de coordonnées</param>
        /// <returns>Rien</returns>
        public async Task AddSocieteByModelView(ModelViewSociete societeModelView)
        {
            Etablissement etablissement = await _dataEtablissement.GetEtablissementByUser();

            Coordonnee coordonnee = new Coordonnee
            {
                Adresse    = societeModelView.Adresse,
                SubAdresse = societeModelView.SubAdresse,
                CodePostal = societeModelView.CodePostal,
                Ville      = societeModelView.Ville,
                Fax        = societeModelView.Fax,
                Telephone  = societeModelView.Telephone,
                Email      = societeModelView.Email
            };

            Societe societe = new Societe
            {
                Nom             = societeModelView.Nom,
                EtablissementId = etablissement.Id,
                Coordonnee      = coordonnee
            };

            _context.Add(societe);
            await _context.SaveChangesAsync();
        }
Beispiel #6
0
        public static Societe getOneSociete(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_societes where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                Societe          a      = new Societe();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id               = Convert.ToInt32(lect["id"].ToString());
                        a.AdresseSiege     = lect["adress_siege"].ToString();
                        a.CodeAbbreviation = lect["code_abreviation"].ToString();
                        a.Logo             = lect["logo"].ToString();
                        a.Designation      = lect["name"].ToString();
                        a.Telephone        = lect["tel"].ToString();
                    }
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Beispiel #7
0
        private void AddSocieteBase()
        {
            Societe societes = new Societe();

            int id_societe = 0;

            societes.nom_societe     = nom_societe;
            societes.adresse_societe = adresse_societe;
            societes.email_societe   = email_societe;
            societes.ville_societe   = ville_societe;
            societes.cp_societe      = cp_societe;
            societes.tel_societe     = tel_societe;

            using (API_Daltons.Service1Client api = new API_Daltons.Service1Client())
            {
                id_societe = api.AddSociete(societes);
            }
            if (id_societe > 0)
            {
                nom_societe     = "";
                adresse_societe = "";
                email_societe   = "";
                ville_societe   = "";
                cp_societe      = "";
                tel_societe     = "";

                RaisePropertyChanged("nom_societe");
                RaisePropertyChanged("adresse_societe");
                RaisePropertyChanged("email_societe");
                RaisePropertyChanged("ville_societe");
                RaisePropertyChanged("cp_societe");
                RaisePropertyChanged("tel_societe");
            }
            RaisePropertyChanged("DataSociete");
        }
Beispiel #8
0
        public static IEnumerable <LigneSqlView> GetLigneRubrique(Societe societe, CategorieCnss categorie, DateTime dateMin, DateTime dateMax, string etablissementNo)
        {
            var dateMinBrut1 = dateMin;
            var dateMaxBrut1 = dateMin.AddMonths(1).AddDays(-1);
            var dateMinBrut2 = dateMin.AddMonths(1);
            var dateMaxBrut2 = dateMinBrut2.AddMonths(1).AddDays(-1);
            var dateMinBrut3 = dateMinBrut2.AddMonths(1);
            var dateMaxBrut3 = dateMinBrut3.AddMonths(1).AddDays(-1);
            var query        = societe.CnssTypeMatricule == TypeMatriculCnss.Matricule ? EnteteSelectMatricule : EnteteSelectBadge;

            query = string.Format("{0} {1}", query, string.IsNullOrWhiteSpace(etablissementNo)? QueryGetByRubriqueEtabNull: QueryGetByRubrique);
            using (var con = new SqlConnection(societe.GetConnection()))
            {
                var result = con.Query <LigneSqlView>(query, new
                {
                    categorie.CodePaie,
                    dateMin,
                    dateMax,
                    etablissementNo,
                    dateMinBrut1,
                    dateMaxBrut1,
                    dateMinBrut2,
                    dateMaxBrut2,
                    dateMinBrut3,
                    dateMaxBrut3
                });

                return(result);
            }
        }
Beispiel #9
0
        public ActionResult EditSociete([Bind(Include = "ID,Nom,Adresse,CodePostal,Ville")] Societe societe)
        {
            if (ModelState.IsValid)
            {
                using (var bdd = new ApplicationDbContext())
                {
                    //on verifie sur le nom de la société a été modifié
                    Societe societeAvtModif = bdd.Societes.Find(societe.ID);
                    //si c'est le cas, on renomme le dossier physiquement et logiquement
                    if (societeAvtModif.Nom != societe.Nom)
                    {
                        var dossier = (from d in bdd.Dossiers where d.Nom == societeAvtModif.Nom select d).FirstOrDefault();

                        if (dossier != null)
                        {
                            //On renomme physiquement
                            var pathOld = Server.MapPath(string.Concat("~/Content/Fichiers/", dossier.Nom));
                            var pathNew = Server.MapPath(string.Concat("~/Content/Fichiers/", societe.Nom));
                            Directory.Move(pathOld, pathNew);

                            dossier.Nom = societe.Nom;
                            bdd.SaveChanges();
                        }
                    }
                }

                db.Entry(societe).State = EntityState.Modified;
                db.SaveChanges();

                Success(string.Format("La société {0} a été modifiée avec succès.", societe.Nom), true);

                return(RedirectToAction("GereCompte"));
            }
            return(View(societe));
        }
Beispiel #10
0
        public static Calendrier getDefault(Societe societe)
        {
            if (societe != null ? societe.Id < 1 : true)
            {
                societe = Constantes.SOCIETE;
            }

            Calendrier       bean    = new Calendrier();
            NpgsqlConnection connect = new Connexion().Connection();

            try
            {
                string           query = "select * from yvs_calendrier where defaut = true and societe = " + societe.Id + ";";
                NpgsqlCommand    Lcmd  = new NpgsqlCommand(query, connect);
                NpgsqlDataReader lect  = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        bean = Return(lect);
                    }
                }
                return(bean);
            }
            catch (Exception ex)
            {
                Messages.Exception("Calendrier (getDefault) ", ex);
                return(bean);
            }
            finally
            {
                Connexion.Close(connect);
            }
        }
        public FrmAnnexe(
            DeclarationEmployeurController <TL, TP> controller,
            Societe societe,
            Exercice exercice)
            : this()
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }
            if (societe == null)
            {
                throw new ArgumentNullException("societe");
            }
            if (exercice == null)
            {
                throw new ArgumentNullException("exercice");
            }

            _controller = controller;
            _societe    = societe;
            _exercice   = exercice;

            InitGridLignes();
            InitGridZoneValue();
            _lignesCollection = new List <TL>();
            RefreshDataSource();
        }
        /// <summary>
        /// Retourne un Model de vue incluant la societe et ses coordonnées rencherche par Id de la societe
        /// </summary>
        /// <param name="id">Id de la societe</param>
        /// <returns>Un model de vue SocieteModelView</returns>
        public async Task <ModelViewSociete> GetSocieteModelViewById(int?id)
        {
            ModelViewSociete societeModelView = null;

            try
            {
                Societe societe = await _context.Societes
                                  .Include(s => s.Coordonnee)
                                  .FirstOrDefaultAsync(s => s.Id == id);

                societeModelView = new ModelViewSociete
                {
                    Id         = societe.Id,
                    Nom        = societe.Nom,
                    Adresse    = societe.Coordonnee.Adresse,
                    SubAdresse = societe.Coordonnee.SubAdresse,
                    CodePostal = societe.Coordonnee.CodePostal,
                    Ville      = societe.Coordonnee.Ville,
                    Fax        = societe.Coordonnee.Fax,
                    Telephone  = societe.Coordonnee.Telephone,
                    Email      = societe.Coordonnee.Email
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(societeModelView);
        }
Beispiel #13
0
        public static bool Delete(SocieteManager societeManager, Societe societe)
        {
            SocieteDataAccess dataAccess = new SocieteDataAccess();
            int rowCount = dataAccess.Delete(societe);

            return(rowCount > 0);
        }
Beispiel #14
0
        public static int Create(SocieteManager societeManager, Societe societe)
        {
            SocieteDataAccess dataAccess = new SocieteDataAccess();
            int idSociete = dataAccess.Insert(societe);

            return(idSociete);
        }
Beispiel #15
0
        public List <Societe> RetrieveAllSocietes(string textItem)
        {
            List <Societe>    societes   = new List <Societe>();
            SocieteDataAccess dataAccess = new SocieteDataAccess();

            DataTable schemaTable = dataAccess.SelectAll();

            foreach (DataRow row in schemaTable.Rows)
            {
                Societe societe = new Societe
                {
                    Id  = Convert.ToInt32(row["ID_SOCIETE"]),
                    Nom = row["NOM_SOCIETE"].ToString().ToUpper()
                };

                societes.Add(societe);
            }
            Societe societeItem = new Societe
            {
                Id  = 0,
                Nom = textItem
            };

            societes.Insert(0, societeItem);
            return(societes);
        }
Beispiel #16
0
        /// <summary>
        /// Transforme le TO en Entity
        /// </summary>
        /// <param name="listeToCommande">Tranfert Object</param>
        /// <returns>The Entity</returns>
        public static Societe ToEntity(this TOSociete toSociete)
        {
            if (toSociete == null)
            {
                return(null);
            }

            Societe entity = new Societe();

            entity.Id   = toSociete.Identifiant;
            entity.Guid = toSociete.Guid;

            entity.Nom = toSociete.Nom;
            entity.TelephoneStandard = toSociete.TelephoneStandard;
            entity.AdresseLigne1     = toSociete.AdresseLigne1;
            entity.AdresseLigne2     = toSociete.AdresseLigne2;
            entity.Remarque          = toSociete.Remarque;
            entity.CodePostal        = toSociete.CodePostal;
            entity.Ville             = toSociete.Ville;
            entity.SiteWeb           = toSociete.SiteWeb;
            entity.EMail             = toSociete.EMail;



            return(entity);
        }
Beispiel #17
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Utilisateur utilisateur = await db.Utilisateurs.FindAsync(id);

            if (utilisateur.role_ == "client")
            {
                Client c = await db.Clients.FindAsync(id);

                db.Clients.Remove(c);
                db.Utilisateurs.Remove(utilisateur);
                await db.SaveChangesAsync();

                return(RedirectToAction("ClientsList", "Utilisateurs"));
            }
            else if (utilisateur.role_ == "societe")
            {
                Societe s = await db.Societes.FindAsync(id);

                db.Societes.Remove(s);
                db.Utilisateurs.Remove(utilisateur);
                await db.SaveChangesAsync();

                return(RedirectToAction("SocietesList", "Utilisateurs"));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Beispiel #18
0
        private void cmdModifier(object param)
        {
            if (SocieteSelectionnee == null)
            {
                return;
            }

            Societe socMod = OutilEF.BrsCtx.LEconomie.Find(SocieteSelectionnee.ID);

            socMod.RaisonSociale  = RaisonSociale;
            socMod.DateCreation   = DateCreation;
            socMod.NbActions      = NbActions;
            socMod.ValeurUnitaire = ValeurUnitaire;

            //ObservableCollection<Societe> listSocTmp = new ObservableCollection<Societe>();
            //foreach (Societe s in SommaireSocietes)
            //{
            //	if (s.ID == sNeo.ID)
            //		listSocTmp.Add(sNeo);
            //	else
            //		listSocTmp.Add(s);
            //}

            //societeADO.Modifier(sNeo);
            //SommaireSocietes = listSocTmp;

            SocieteSelectionnee = socMod;
            OutilEF.BrsCtx.SaveChanges();
        }
Beispiel #19
0
        public static Societe getOneById(int id)
        {
            Societe          bean    = new Societe();
            NpgsqlConnection connect = new Connexion().Connection();

            try
            {
                string query = "select y.id, y.name, y.adresse_ip, COALESCE(i.port, 0) AS port, i.users, i.password, i.domain, i.type_connexion, y.groupe, g.libelle " +
                               "from yvs_societes y left join yvs_societes_connexion i on i.societe = y.id left join yvs_base_groupe_societe g on y.groupe = g.id " +
                               "where y.id = " + id + ";";
                using (NpgsqlCommand Lcmd = new NpgsqlCommand(query, connect))
                    using (NpgsqlDataReader lect = Lcmd.ExecuteReader())
                    {
                        if (lect.HasRows)
                        {
                            while (lect.Read())
                            {
                                bean = Get(lect);
                            }
                        }
                    }
                return(bean);
            }
            catch (Exception ex)
            {
                Messages.Exception("SocieteDao (getOneById) ", ex);
                return(bean);
            }
            finally
            {
                Connexion.Close(connect);
            }
        }
Beispiel #20
0
        public frmGreen()
        {
            InitializeComponent();
            _RegionNew  = _DefaultRegion;
            _ContratNew = _DefaultContrat;
            _PosteNew   = _DefaultPoste;
            _SocieteNew = _DefaultSociete;

            _SocieteManager = new SocieteManager();
            _RegionManager  = new RegionManager();
            _PosteManager   = new PosteManager();
            _ContratManager = new ContratManager();

            this.DialogResult = DialogResult.Cancel;
            _NewOffre         = new Offre();

            this.FillingAllComboBox();

            this.FillFormulaire();

            buttonInsert.Visible = this.EnabledInsertion();

            labelTitre.Text       = "Création d'une nouvelle Offre";
            labelInsert.Text      = "Veuillez remplir les champs obligatoires";
            labelInsert.ForeColor = Color.DarkRed;
        }
Beispiel #21
0
        private static Societe Get(NpgsqlDataReader lect)
        {
            Societe bean = new Societe();

            try
            {
                bean.Id            = Convert.ToInt32(lect["id"].ToString());
                bean.Name          = lect["name"].ToString();
                bean.AdresseIp     = lect["adresse_ip"].ToString();
                bean.Port          = Convert.ToInt32(lect["port"] != null ? lect["port"].ToString() : "0");
                bean.Users         = lect["users"].ToString();
                bean.Password      = lect["password"].ToString();
                bean.Domain        = lect["domain"].ToString();
                bean.TypeConnexion = lect["type_connexion"].ToString();
                int    groupe_id      = 0;
                string groupe_libelle = "";
                try
                {
                    groupe_id = Convert.ToInt32(lect["groupe"].ToString());
                }
                catch (Exception ex) { }
                try
                {
                    groupe_libelle = lect["libelle"].ToString();
                }
                catch (Exception ex) { }
                bean.Groupe = new Groupe(groupe_id, groupe_libelle);
            }
            catch (Exception ex)
            {
                Messages.Exception(ex);
            }
            return(bean);
        }
 public void Update(Societe societe)
 {
     using (var con = new SqlConnection(ConnectionString))
     {
         con.Execute(QueryUpdate, new
         {
             societe.Activite,
             societe.Adresse,
             societe.CleEmployeur,
             societe.CodeBureau,
             societe.CodePostal,
             societe.CurrentExerciceNo,
             societe.Id,
             societe.MatriculCategorie,
             societe.MatriculCle,
             societe.MatriculCodeTva,
             societe.MatriculEtablissement,
             societe.MatriculFiscal,
             societe.NumeroEmployeur,
             societe.Pays,
             societe.RaisonSocial,
             societe.Ville,
             societe.ServerName,
             societe.DatabaseName,
             societe.User,
             societe.Password,
             societe.Type,
             societe.CnssTypeMatricule
         });
     }
 }
 public int Create(Societe societe)
 {
     using (var con = new SqlConnection(ConnectionString))
     {
         return(con.Query <int>(QueryCreate, new
         {
             societe.Activite,
             societe.Adresse,
             societe.CleEmployeur,
             societe.CodeBureau,
             societe.CodePostal,
             societe.CurrentExerciceNo,
             societe.Id,
             societe.MatriculCategorie,
             societe.MatriculCle,
             societe.MatriculCodeTva,
             societe.MatriculEtablissement,
             societe.MatriculFiscal,
             societe.NumeroEmployeur,
             societe.Pays,
             societe.RaisonSocial,
             societe.Ville,
             societe.ServerName,
             societe.DatabaseName,
             societe.User,
             societe.Password,
             societe.Type,
             societe.CnssTypeMatricule
         }).SingleOrDefault());
     }
 }
Beispiel #24
0
        private SocieteView ToView(Societe societe)
        {
            var cnxView = new ConnectionView
            {
                ServerName   = societe.ServerName,
                User         = societe.User,
                DatabaseName = societe.DatabaseName,
                Password     = societe.Password,
                Type         = societe.Type
            };

            return(new SocieteView
            {
                Activite = societe.Activite,
                Adresse = societe.Adresse,
                CodeBureau = societe.CodeBureau,
                CodePostal = societe.CodePostal,
                Id = societe.Id,
                MatriculFiscal = societe.MatriculFiscal,
                MatriculCle = societe.MatriculCle,
                MatriculCodeTva = societe.MatriculCodeTva,
                MatriculCategorie = societe.MatriculCategorie,
                MatriculEtablissement = societe.MatriculEtablissement,
                NumeroEmployeur = societe.NumeroEmployeur,
                Pays = societe.Pays,
                RaisonSocial = societe.RaisonSocial,
                Ville = societe.Ville,
                CleEmployeur = societe.CleEmployeur,
                ConnectionView = cnxView,
                CnssTypeMatricule = societe.CnssTypeMatricule
            });
        }
Beispiel #25
0
        /// <summary>
        ///     Change current exerice
        /// </summary>
        /// <param name="exercice">Exercice</param>
        public void ChangeExerciceCourant(Exercice exercice)
        {
            try
            {
                if (Societe == null)
                {
                    throw new InvalidOperationException("Societé courante invalide!");
                }
                if (exercice == null)
                {
                    throw new ArgumentNullException("exercice");
                }

                Societe societe = _societeRepository.Get(Societe.Id);
                if (societe == null)
                {
                    throw new ApplicationException("Societe invalide!");
                }

                societe.CurrentExerciceNo = exercice.Id;
                _societeRepository.Update(societe);
                Societe  = societe;
                Exercice = exercice;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #26
0
        public async Task <IActionResult> PutSociete([FromRoute] int id, [FromBody] Societe societe)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != societe.Id)
            {
                return(BadRequest());
            }

            _context.Entry(societe).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SocieteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #27
0
        public RecapAnnexe7Service(
            Societe societe,
            Exercice exercice,
            Annexe1Service annexeUnService,
            Annexe2Service annexeDeuxService,
            Annexe3Service annexeTroisService,
            Annexe4Service annexeQuatreService,
            Annexe5Service annexeCinqService,
            Annexe6Service annexeSixService)
        {
            if (societe == null)
            {
                throw new ArgumentNullException(nameof(societe));
            }

            if (exercice == null)
            {
                throw new ArgumentNullException(nameof(exercice));
            }

            if (annexeUnService == null)
            {
                throw new ArgumentNullException(nameof(annexeUnService));
            }

            if (annexeDeuxService == null)
            {
                throw new ArgumentNullException(nameof(annexeDeuxService));
            }

            if (annexeTroisService == null)
            {
                throw new ArgumentNullException(nameof(annexeTroisService));
            }

            if (annexeQuatreService == null)
            {
                throw new ArgumentNullException(nameof(annexeQuatreService));
            }

            if (annexeCinqService == null)
            {
                throw new ArgumentNullException(nameof(annexeCinqService));
            }

            if (annexeSixService == null)
            {
                throw new ArgumentNullException(nameof(annexeSixService));
            }

            _societe             = societe;
            _exercice            = exercice;
            _annexeUnService     = annexeUnService;
            _annexeDeuxService   = annexeDeuxService;
            _annexeTroisService  = annexeTroisService;
            _annexeQuatreService = annexeQuatreService;
            _annexeCinqService   = annexeCinqService;
            _annexeSixService    = annexeSixService;
        }
Beispiel #28
0
 public void SetSociete(Societe societe)
 {
     if (societe == null)
     {
         throw new ArgumentNullException("societe");
     }
     Societe = _societeRepository.Get(societe.Id);
 }
        public Societe RechercheParId(int id)
        {
            Societe s = db.Societes
                        .Where(i => i.id == id)
                        .SingleOrDefault();

            return(s);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Societe societe = db.Societes.Find(id);

            db.Societes.Remove(societe);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #31
0
        public async Task TestCommande1()
        {


            try {

                var ch = kernel.Get<ICommandeBusinessHelper<Commande>>();
                ch.DeleteAll().Wait();


                Societe s = new Societe() { Nom = "Societe test" };

                var cde = await ch.Create(CommandeType.Client);
                Assert.IsNotNull(cde);

                //cde.Numero = 1234;
                cde.Tiers = s;

                cde = await ch.Create(CommandeType.Fournisseur);
                Assert.IsNotNull(cde);

                ch.Save().Wait();
            }catch(Exception )
            {

            }
        }
        public object[] findUtilisateur(int IdUtilisateur)
        {
            string methodName = "findUtilisateur";
            object[] tabInfoUser = new object[5];
            tabInfoUser[0] = new Utilisateur();
            tabInfoUser[1] = new Adresse();
            tabInfoUser[2] = new Societe();
            tabInfoUser[3] = new Role();
            tabInfoUser[4] = new Ville();
            using (SqlConnection connexion = new SqlConnection(connectionString))
            {
                try
                {
                    connexion.Open();
                    string request = "SELECT Role.IdRole, Prenom, Nom, Identifiant, MotPasse, DateDebut, DateFin, NumeroRue, NomRue, " +
                                        "CodePostal, Ville.IdVille, NomSociete, DescriptionSociete, NumeroSiret, CodeRole, CodeVille, Societe.IdSociete " +
                                     "FROM Utilisateur, Societe, Adresse, Role, Ville " +
                                     "WHERE Utilisateur.IdSociete = Societe.IdSociete " +
                                     "AND Utilisateur.IdUtilisateur = Adresse.IdUtilisateur " +
                                     "AND Utilisateur.IdRole = Role.IdRole " +
                                     "AND Adresse.IdVille = Ville.IdVille " +
                                     "AND Utilisateur.IdUtilisateur = " + IdUtilisateur + ";";
                    SqlCommand sqlCommand = new SqlCommand(request, connexion);
                    SqlDataReader reader = sqlCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        int IdRole = Convert.ToInt32(reader[0]);
                        string Prenom = reader[1].ToString();
                        string Nom = reader[2].ToString();
                        string Identifiant = reader[3].ToString();
                        string MotPasse = reader[4].ToString();
                        DateTime DateDebut = Convert.ToDateTime(reader[5]);
                        DateTime DateFin = Convert.ToDateTime(reader[6]);
                        string NumeroRue = reader[7].ToString();
                        string NomRue = reader[8].ToString();
                        string CodePostal = reader[9].ToString();
                        int IdVille = Convert.ToInt32(reader[10]);
                        string NomSociete = reader[11].ToString();
                        string DescriptionSociete = reader[12].ToString();
                        string NumeroSiret = reader[13].ToString();
                        string CodeRole = reader[14].ToString();
                        string CodeVille = reader[15].ToString();
                        int IdSociete = Convert.ToInt32(reader[16]);

                        tabInfoUser[0] = new Utilisateur(IdUtilisateur, IdRole, Identifiant, MotPasse, DateDebut, DateFin, Prenom, Nom, IdSociete);
                        tabInfoUser[1] = new Adresse(1, NumeroRue, NomRue, CodePostal, IdVille, IdUtilisateur);
                        tabInfoUser[2] = new Societe(IdSociete, NomSociete, DescriptionSociete, NumeroSiret);
                        tabInfoUser[3] = new Role(IdRole, CodeRole, "");
                        tabInfoUser[4] = new Ville(IdVille, CodeVille, "");
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Exception : " + e.Message + ".", "Erreur lors de l'éxécution de la méthode " + methodName + ".");
                }
            }
            return tabInfoUser;
        }
Beispiel #33
0
        public async Task TestCommande2()
        {


          //  try
          //  {

                var ch = kernel.Get<ICommandeBusinessHelper<Commande>>();
                var bh = kernel.Get<IArticleBusinessHelper<Article>>();
                ch.DeleteAll().Wait();
                bh.DeleteAll().Wait();

              
                var pf = await bh.Create("PF",ArticleType.ProduitFini);
                var sf = await bh.Create("SF",ArticleType.ProduitSemiFini);
                var ssf = await bh.Create("SSF",ArticleType.ProduitSemiFini);
                
                pf.Libelle = "Libelle PF";
                sf.Libelle = "Libelle SF";
                ssf.Libelle = "Libelle SSF";
                bh.Save().Wait();

                sf.Nomenclatures.Add(new Nomenclature(ssf) { Ordre = 20, Libelle = ssf.Libelle, Quantite = 20 });
                pf.Nomenclatures.Add(new Nomenclature(sf) { Ordre = 10, Libelle = sf.Libelle, Quantite = 10 });

                 bh.Save().Wait();

                pf.Libelle = "Other Libelle PF";
                bh.Save().Wait();

                Societe s = new Societe() { Nom = "Societe test" };

                var cde = await ch.Create(CommandeType.Client);
                Assert.IsNotNull(cde);

       
                cde.Tiers = s;

                cde.Lignes.Add(new LigneCommande() { ArticleInner = pf, QuantiteCommandee = 10, Prixunitaire = new unite.Currency(15.5) });

                ch.Save().Wait();


           /* }
            catch (Exception ex)
            {
                if (Debugger.IsAttached) Debugger.Break();
            }*/
        }
 public void updateSociete(Societe societe)
 {
     string methodName = "updateSociete";
     using (SqlConnection connexion = new SqlConnection(connectionString))
     {
         try
         {
             connexion.Open();
             string request = "UPDATE Societe "
                            + "SET NomSociete = '" + societe.NomSociete + "', DescriptionSociete = '" + societe.DescriptionSociete + "', "
                                 + "NumeroSiret = '" + societe.NumeroSiret + "' "
                            + "WHERE IdSociete = " + societe.IdSociete + ";";
             SqlCommand sqlCommand = new SqlCommand(request, connexion);
             sqlCommand.ExecuteNonQuery();
         }
         catch (Exception e)
         {
             MessageBox.Show("Exception : " + e.Message + ".", "Erreur lors de l'éxécution de la méthode " + methodName + ".");
         }
     }
 }
 public void createSociete(Societe societe)
 {
     string methodName = "createSociete";
     using (SqlConnection connexion = new SqlConnection(connectionString))
     {
         try
         {
             connexion.Open();
             string request = "INSERT INTO Societe(NomSociete, DescriptionSociete, NumeroSiret) "
                            + "VALUES('" + societe.NomSociete + "', '" + societe.DescriptionSociete + "', '" + societe.NumeroSiret + "');";
             SqlCommand sqlCommand = new SqlCommand(request, connexion);
             sqlCommand.ExecuteNonQuery();
         }
         catch (Exception e)
         {
             MessageBox.Show("Exception : " + e.Message + ".", "Erreur lors de l'éxécution de la méthode " + methodName + ".");
         }
     }
 }