Beispiel #1
0
        /// <summary>
        /// Méthode pour insérer une commande...
        /// </summary>
        /// <param name="commande">liste des données, récupére seulement les éléments d'une commande (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool InsertCommande(SourceFormarteDonnees commande)
        {
            try
            {
                //Create COMMANDE object....
                Commande newCommande = new Commande();
                newCommande.IdUtil                  = commande.SourceFormarteUtilId;
                newCommande.ComPremierDateId        = commande.SourceFormarteComPremierDateId;
                newCommande.ComPremierDate          = commande.SourceFormarteComPremierDate;
                newCommande.ComDernierDateId        = commande.SourceFormarteComDernierDateId;
                newCommande.ComDerniereDate         = commande.SourceFormarteComDerniereDate;
                newCommande.ComPremierFactureDateId = commande.SourceFormarteComPremierFactureDateId;
                newCommande.ComPremierFactureDate   = commande.SourceFormarteComPremierFactureDate;
                newCommande.ComDernierFactureDateId = commande.SourceFormarteComDernierFactureDateId;
                newCommande.ComDerniereFactureDate  = commande.SourceFormarteComDerniereFactureDate;

                //add COMMANDE objet data to a table...
                destinationDAL.Commande.Add(newCommande);

                //if insertion is ok.
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Méthode pour insérer les noms des tables et les index associés...
        /// </summary>
        /// <param name="tableEtLigne">liste des données, récupére seulement les éléments des tables/indexes (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool InsertTableLigneIndex(SourceFormarteDonnees tableEtLigne)
        {
            try
            {
                //ajout nom table et ligne.
                for (int item = 0; item < tableEtLigne.SourceFormarteTabNom.Count(); item++)
                {
                    try
                    {
                        TableNomComptage newTableWithComptage = new TableNomComptage();
                        newTableWithComptage.IdUtil           = tableEtLigne.SourceFormarteUtilId;
                        newTableWithComptage.TabNom           = tableEtLigne.SourceFormarteTabNom[item].Trim();
                        newTableWithComptage.TabLigneComptage = Convert.ToInt32(tableEtLigne.SourceFormarteTabLigneComptage[item].Trim());
                        destinationDAL.TableNomComptage.Add(newTableWithComptage);
                        destinationDAL.SaveChanges();
                    }
                    catch
                    {
                        return(false);
                    }
                }
                //ajout index par table.
                foreach (IndexDetails tabIndex in tableEtLigne.SourceFormarteTabNomIndex)
                {
                    var tabledetails = destinationDAL.TableNomComptage.Where(nom => nom.TabNom == tabIndex.TableNom && nom.IdUtil == tableEtLigne.SourceFormarteUtilId).FirstOrDefault();

                    if (tabledetails != null)
                    {
                        foreach (string idx in tabIndex.Indexes)
                        {
                            try
                            {
                                TableIndex newTableIndexes = new TableIndex();
                                newTableIndexes.IdNcTable   = tabledetails.TableNcId;
                                newTableIndexes.TabNomIndex = idx.Trim();
                                destinationDAL.TableIndex.Add(newTableIndexes);
                            }
                            catch
                            {
                                return(false);
                            }
                        }
                    }
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Méthode pour mettre à jour la colonne de la table Donneesource...
        /// </summary>
        /// <param name="SourceDonnees">liste des données, récupére seulement les éléments d'une commande</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool UpdateSourceCopieDestination(SourceFormarteDonnees estCopie)
        {
            //DAL OBJECT
            SourceDataAccessLayer sDal = new SourceDataAccessLayer();

            try
            {
                return(sDal.UpdateSourceCopie(estCopie));
            }
            catch
            {
                return(false);
            }
        }
        public void GetAllSourceEqualObject()
        {
            SourceFormarteDonnees testItemOne = new SourceFormarteDonnees
            {
                ColId = 1,
                SourceFormarteUtilNom                 = "deiva",
                SourceFormarteUtilPrenom              = "Rajaram",
                SourceFormarteSectNom                 = "COLOMIERS",
                SourceFormarteCatalPrincipal          = "DP",
                SourceFormarteCatalAutrePrincipal     = "Par défaut",
                SourceFormarteVersNom                 = "5.3.0.0",
                SourceFormarteComPremierDateId        = 1,
                SourceFormarteComPremierDate          = Convert.ToDateTime("2018-06-27 10:23:10.000"),
                SourceFormarteComDernierDateId        = 2,
                SourceFormarteComDerniereDate         = Convert.ToDateTime("2018-06-28 10:23:10.000"),
                SourceFormarteComPremierFactureDateId = 1,
                SourceFormarteComPremierFactureDate   = Convert.ToDateTime("2018-06-25 10:23:10.000"),
                SourceFormarteComDernierFactureDateId = 2,
                SourceFormarteComDerniereFactureDate  = Convert.ToDateTime("2018-06-26 10:23:10.000"),
                SourceFormarteVisDate                 = Convert.ToDateTime("2018-06-25 10:25:01.000"),
                SourceFormarteTabNom           = new[] { "table1", "table2", "table3", "table4" },
                SourceFormarteTabLigneComptage = new[] { "1", "5", "6", "9" },
                SourceFormarteTabNomIndex      = new List <IndexDetails> {
                    new IndexDetails {
                        TableNom = "table1", Indexes = new[] { "index1", "index2" }
                    },
                    new IndexDetails {
                        TableNom = "table2", Indexes = new[] { "indexz", "indexw" }
                    }
                }
            };

            // create mock
            Mock <ILogger <DonneeSourceController> > mockloger2 = new Mock <ILogger <DonneeSourceController> >();
            // create mock dal object
            Mock <SourceDataAccessLayer> mockDalSource2 = new Mock <SourceDataAccessLayer>();

            var    testUnitaire2 = new DonneeSourceController(mockloger2.Object, mockDalSource2.Object);
            string testDate2     = DateTime.MinValue.ToShortDateString();
            SourceFormarteDonnees testItemTwo = testUnitaire2.SelectionDonneesSource(testDate2, testDate2, testDate2, testDate2, null, null, null).FirstOrDefault();

            //Initialize objects and comparer
            var comparer = new ObjectsComparer.Comparer <SourceFormarteDonnees>();

            //Compare objects
            var isEqual = comparer.Compare(testItemOne, testItemTwo, out IEnumerable <Difference> differences);

            Assert.True(isEqual);
        }
Beispiel #5
0
        /// <summary>
        /// Méthode pour insérer une date de visite...
        /// </summary>
        /// <param name="visite">liste des données, récupére seulement les éléments d'une visite (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool InsertVisite(SourceFormarteDonnees visite)
        {
            try
            {
                //Create autre catalogue object....
                Visite newVisite = new Visite();
                newVisite.IdUtil  = visite.SourceFormarteUtilId;
                newVisite.VisDate = visite.SourceFormarteVisDate;

                //add  objet data to a table...
                destinationDAL.Visite.Add(newVisite);

                //if insertion is ok.
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Méthode pour insérer la version...
        /// </summary>
        /// <param name="vers">liste des données, récupére seulement les éléments de la version (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool InsertVersion(SourceFormarteDonnees vers)
        {
            try
            {
                //Create autre catalogue object....
                Version newVers = new Version();
                newVers.IdUtil  = vers.SourceFormarteUtilId;
                newVers.VersNom = vers.SourceFormarteVersNom;

                //add  objet data to a table...
                destinationDAL.Version.Add(newVers);

                //if insertion is ok.
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Méthode pour insérer le autre catalogue...
        /// </summary>
        /// <param name="catalAutre">liste des données, récupere seulement les éléments d'autre catalogue  (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool InsertAutreCatalogue(SourceFormarteDonnees catalAutre)
        {
            try
            {
                //Create autre catalogue object....
                CatalogueAutre newCatalAutre = new CatalogueAutre();
                newCatalAutre.IdUtil = catalAutre.SourceFormarteUtilId;
                newCatalAutre.CatalAutrePrincipal = catalAutre.SourceFormarteCatalAutrePrincipal;

                //add objet data to a table...
                destinationDAL.CatalogueAutre.Add(newCatalAutre);

                //if insertion is ok.
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Méthode pour insérer le secteur...
        /// </summary>
        /// <param name="secteur">liste des données, récupere seulement les éléments de secteur (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private bool InsertSecteur(SourceFormarteDonnees secteur)
        {
            try
            {
                //Create secteur object....
                Secteur newUserSect = new Secteur();
                newUserSect.IdUtil  = secteur.SourceFormarteUtilId;
                newUserSect.SectNom = secteur.SourceFormarteSectNom;

                //add objet data to a table...
                destinationDAL.Secteur.Add(newUserSect);

                //if insertion is ok.
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Méthode pour insérer un utilisateur...
        /// </summary>
        /// <param name="user">liste des données, récupere seulement les éléments utilisateur (SourceFormarteDonnees)</param>
        /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
        private int InsertUser(SourceFormarteDonnees user)
        {
            try
            {
                //Create user object....
                Utilisateur newUser = new Utilisateur();
                newUser.SourceId   = user.ColId;
                newUser.UtilNom    = user.SourceFormarteUtilNom;
                newUser.UtilPrenom = user.SourceFormarteUtilPrenom;

                //add objet data to a table...
                destinationDAL.Utilisateur.Add(newUser);
                destinationDAL.SaveChanges(); //Insertion dans la base est obligatoire car l'id d'utilisateur est requis.
                //return generated Id
                return(newUser.UtilId);
            }
            catch
            {
                return(0);
            }
        }
Beispiel #10
0
 /// <summary>
 /// Méthode pour mettre à jour la colonne dans la table sourcedonnee...
 /// </summary>
 /// <param name="updateCopiedColumn">Qui contient la colonne à mettre à jour 'ColId'</param>
 /// <returns>retourne un booléan true/false, true si l'opération OK si non false</returns>
 public bool UpdateSourceCopie(SourceFormarteDonnees updateCopiedColumn)
 {
     try
     {
         //selection d'objet à mettre à jour....
         DonneeSource sourceToUpdate = sourceDAL.Donneesource.Where(idc => idc.ColId == updateCopiedColumn.ColId).FirstOrDefault();
         //collonne à mettre à jour
         if (sourceToUpdate != null)
         {
             sourceToUpdate.EstCopieDestination = true;
             sourceDAL.SaveChanges();
             //if update is ok.
             return(true);
         }
         return(false);
     }
     catch
     {
         return(false);
     }
 }