public void ReorganiserFiche(Presence presence) { if (presence != null ? presence.Id > 0 : false) { string adresse = Constantes.SOCIETE.AdresseIp; if (Dao.RequeteLibre("delete from yvs_grh_pointage where presence = " + presence.Id, adresse)) { List <DateTime> times = new List <DateTime>(); foreach (Pointage po in presence.Pointages) { if ((po.HeureEntree != null) ? po.HeureEntree.ToString() != "01/01/0001 00:00:00" : false) { times.Add(po.HeureEntree); } if ((po.HeureSortie != null) ? po.HeureSortie.ToString() != "01/01/0001 00:00:00" : false) { times.Add(po.HeureSortie); } } times.Sort(); presence.HeureDebut = Utils.TimeStamp(presence.DateDebut, presence.HeureDebut); presence.HeureFin = Utils.TimeStamp(presence.DateFin, presence.HeureFin); foreach (DateTime current_time in times) { Fonctions.OnSavePointage(presence, current_time, null, 0, adresse); } LoadOnView(presence); Messages.Succes(); } } }
public async Task GetOne_WhenCalledWithId_ReturnFonctionModelResult_Async() { // Arrange Fonctions etudiant = new Fonctions { Id = 5, Nom = "Etudiant" }; _mockUow .Setup(r => r.GetRepository <Fonctions>().GetAsync(etudiant.Id)).Returns(Task.FromResult(etudiant)); var controller = new FonctionController( _mockLogger.Object, _mapper, _mockUow.Object, _mockLinkGenerator.Object); // Act var result = await controller.GetOne(etudiant.Id); // Assert Assert.IsNotNull(result); Assert.IsAssignableFrom(typeof(ActionResult <FonctionModel>), result); Assert.That(result.Value.Nom, Is.EqualTo((_mapper.Map <FonctionModel>(etudiant).Nom))); }
public void BackupLog() { ObjectThread o = new ObjectThread(Constantes.PBAR_WAIT); o.UpdateMaxBar(0); Fonctions.BackupLogData(lIO, currentPointeuse.Ip, true); }
private static void AfficherAdditionAléatoire() { var random = new Random(); int n1 = random.Next(100); int n2 = random.Next(100); Console.WriteLine( $"{n1} + {n2} = {Fonctions.Additionner(n1, n2)}"); }
public void SynchroniseFichePresence(List <IOEMDevice> logs, Pointeuse y, Presence p) { Employe emp = p.Employe; Thread thread = new Thread(delegate() { Fonctions.SynchroniseServer(logs, y.Ip, false, emp, true, p.DateDebut, p.DateFin, false); }); thread.Start(); if (thread.IsAlive) { thread.Join(); } LoadPresence(dtp_date.Value, emp); Utils.WriteLog("-- Synchronisation des logs de l'employe " + emp.NomPrenom + " terminée"); }
private void Dial_Insert_Pointage_Load(object sender, EventArgs e) { if (parent != null) { string adresse = Constantes.SOCIETE.AdresseIp; IOEMDevice current = parent.currentPointage; employe = EmployeBLL.OneById(current.idwSEnrollNumber); txt_id.Text = employe.Id.ToString(); txt_matricule.Text = employe.Matricule; txt_noms.Text = employe.NomPrenom; txt_poste.Text = employe.Poste.Poste.Intitule; try { current_time = new DateTime(current.idwYear, current.idwMonth, current.idwDay, current.idwHour, current.idwMinute, current.idwSecond); dtp_decalage.Value = current_time; time_decalage = current_time; Presence presence = Fonctions.GetPresence(employe, current_time, true, adresse); if (presence != null ? presence.Id > 0 : false) { dtp_date_debut.Value = presence.DateDebut; dtp_date_fin.Value = presence.DateFinPrevu; dtp_heure_debut.Value = presence.HeureDebut; dtp_heure_fin.Value = presence.HeureFinPrevu; box_fich_exit.Image = global::ZK_Lymytz.Properties.Resources.vu; } else { Planning planning = Fonctions.GetPlanning(employe, new DateTime(current_time.Year, current_time.Month, current_time.Day, 0, 0, 0), adresse); dtp_date_debut.Value = planning.DateDebut; dtp_date_fin.Value = planning.DateFin; dtp_heure_debut.Value = planning.HeureDebut; dtp_heure_fin.Value = planning.HeureFin; } } catch (Exception ex) { } this.Text += " [" + current_time.ToShortTimeString() + "]"; } else { this.Dispose(); } }
static void Main(string[] args) { Console.WriteLine("Bonjour !"); Console.WriteLine("Debut du calcul"); Console.WriteLine("Fin du calcul"); double resultatDivision = 0.0d; try { resultatDivision = Fonctions.Divise(6, 0); } catch (Exception e) { Console.WriteLine("Erreur : " + e.Message); Console.WriteLine("Type Exception : " + e.GetType()); } Console.WriteLine("Resultat : " + resultatDivision); Console.ReadKey(true); }
private void Synchrone() { ObjectThread o = new ObjectThread(Constantes.PBAR_WAIT); o.UpdateMaxBar(empreintes.Count); Utils.WriteLog("-- Début de la synchronisation des empreintes"); if (IS_INFOS) { foreach (Pointeuse p in destinations) { Utils.WriteLog("---- Début de la synchronisation sur l'appareil " + p.Ip); Fonctions.SynchroniseInfosServeur(p, empreintes); Utils.WriteLog("---- Fin de la synchronisation sur l'appareil " + p.Ip); Constantes.LoadPatience(false); } } else { if (IS_DIGITAL) { foreach (Pointeuse p in destinations) { Utils.WriteLog("---- Début de la synchronisation sur l'appareil " + p.Ip); Fonctions.SynchroniseTmpOneServeur(p, empreintes); Utils.WriteLog("---- Fin de la synchronisation sur l'appareil " + p.Ip); Constantes.LoadPatience(false); } } else { foreach (Pointeuse p in destinations) { Utils.WriteLog("---- Début de la synchronisation sur l'appareil " + p.Ip); Fonctions.SynchroniseFaceOneServeur(p, empreintes); Utils.WriteLog("---- Fin de la synchronisation sur l'appareil " + p.Ip); Constantes.LoadPatience(false); } } } Utils.WriteLog("-- Fin de la synchronisation des empreintes"); Constantes.LoadPatience(true); }
/// <summary> /// Cherhcer les informations d'un vendeur d'après son numéro /// </summary> /// <param name="numVen"></param> /// <returns></returns> public Vendeur RechercheUnVendeur(String numVen) { String mysql; DataTable dt; sErreurs er = new sErreurs("Erreur sur recherche d'un vendeur.", "Vendeur.RechercheUnVendeur()"); try { mysql = "SELECT NO_VEND_CHEF_EQ, NOM_VEND, PRENOM_VEND,"; mysql += "DATE_EMBAU, VILLE_VEND, SALAIRE_VEND, COMMISSION "; mysql += "FROM VENDEUR WHERE NO_VENDEUR='" + numVen + "'"; dt = DbInterface.Lecture(mysql, er); if (dt.IsInitialized) { DataRow dataRow = dt.Rows[0]; this.noVendeur = numVen; this.noChef = dataRow[0].ToString(); this.nomVend = dataRow[1].ToString(); this.prenomVend = dataRow[2].ToString(); this.dateEmbau = Fonctions.StringToDate(dataRow[3].ToString()); this.villeVend = dataRow[4].ToString(); this.salaireVend = double.Parse(dataRow[5].ToString()); this.commission = double.Parse(dataRow[6].ToString()); return(this); } else { return(null); } } catch (MySqlException e) { throw new MonException(er.MessageUtilisateur(), er.MessageApplication(), e.Message); } }
public void Divise_par_0_Doit_Lever_Exception() { Assert.ThrowsException <Exception>( () => Fonctions.Divise(6, 0) ); }
public void Divise_6_par_2_Doit_Faire_3() { double resutatDivision = Fonctions.Divise(6, 2); Assert.AreEqual(3, resutatDivision); }
public void Multiplie_2_Et_3_Doit_Faire_6() { int resutatMultiplication = Fonctions.Multiplie(2, 3); Assert.AreEqual(6, resutatMultiplication); }
public void Additionne_2_Et_3_Doit_Faire_5() { int resutatAddition = Fonctions.Additionne(2, 3); Assert.AreEqual(5, resutatAddition); }
//------------------------------------------------------ public CFonctionDynamique GetFonctionDynamique(string strIdFonction) { return(Fonctions.FirstOrDefault(f => f.IdFonction == strIdFonction)); }
static void Main(string[] args) { //Assigne la taille à la fenêtre de la console Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight); ShowWindow(ThisConsole, MAXIMIZE); #region Stock dans des variables la boutique string a = " _______________________________"; string b = " [=U=U=U=U=U=U=U=U=U=U=U=U=U=U=U=]"; string c = " |.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.|"; string d = " | +-+-+-+-+-+-+-+ |"; string e = " | | BOUTIQUE | |"; string f = " | +-+-+-+-+-+-+-+ |"; string g = " |.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.|"; string h = " | _________ __ __ _________ |"; string i = " _ | |___ _ ||[]|[]|| _ | | _"; string j = " (!)||OPEN|_(!)_|| ,| ,||_(!)_____| |(!)"; string k = " .T~T|:.....:T~T.:|__|__|:.T~T.:....:|T~T."; string l = " ||_||||||||||_|||||||||||||_||||||||||_||"; string m = " ~\\=/~~~~~~~~\\=/~~~~~~~~~~~\\=/~~~~~~~~\\=/~"; string n = " | -------- | ----------- | -------- | "; string o = " ~ |~^ ^~~^ ~~| ~^ ~~ ^~^~ |~ ^~^ ~~^ |^~ \n\n"; string p = " APPUYER SUR ENTRER POUR ENTRER DANS LA BOUTIQUE"; #endregion #region Affiche toutes les variables Console.WriteLine("\n\n\n\n\n\n\n\n\n"); Console.SetCursorPosition((Console.WindowWidth - a.Length) / 2, Console.CursorTop); Console.WriteLine(a); Console.SetCursorPosition((Console.WindowWidth - b.Length) / 2, Console.CursorTop); Console.WriteLine(b); Console.SetCursorPosition((Console.WindowWidth - c.Length) / 2, Console.CursorTop); Console.WriteLine(c); Console.SetCursorPosition((Console.WindowWidth - d.Length) / 2, Console.CursorTop); Console.WriteLine(d); Console.SetCursorPosition((Console.WindowWidth - e.Length) / 2, Console.CursorTop); Console.WriteLine(e); Console.SetCursorPosition((Console.WindowWidth - f.Length) / 2, Console.CursorTop); Console.WriteLine(f); Console.SetCursorPosition((Console.WindowWidth - g.Length) / 2, Console.CursorTop); Console.WriteLine(g); Console.SetCursorPosition((Console.WindowWidth - h.Length) / 2, Console.CursorTop); Console.WriteLine(h); Console.SetCursorPosition((Console.WindowWidth - i.Length) / 2, Console.CursorTop); Console.WriteLine(i); Console.SetCursorPosition((Console.WindowWidth - j.Length) / 2, Console.CursorTop); Console.WriteLine(j); Console.SetCursorPosition((Console.WindowWidth - k.Length) / 2, Console.CursorTop); Console.WriteLine(k); Console.SetCursorPosition((Console.WindowWidth - l.Length) / 2, Console.CursorTop); Console.WriteLine(l); Console.SetCursorPosition((Console.WindowWidth - m.Length) / 2, Console.CursorTop); Console.WriteLine(m); Console.SetCursorPosition((Console.WindowWidth - n.Length) / 2, Console.CursorTop); Console.WriteLine(n); Console.SetCursorPosition((Console.WindowWidth - o.Length) / 2, Console.CursorTop); Console.WriteLine(o); Console.SetCursorPosition((Console.WindowWidth - p.Length) / 2, Console.CursorTop); Console.WriteLine(p); #endregion while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } Console.Clear(); //while (Fonctions.Run) { Fonctions.MenuPrincipal(); } Console.Clear(); #region stock dans les variables string a2 = "Merci, et à bientôt !\n\n"; string b2 = " ¶¶¶¶¶¶¶¶¶¶¶¶ "; string c2 = " ¶¶ ¶¶ "; string d2 = " ¶¶¶¶¶ ¶¶ ¶¶ "; string e2 = " ¶ ¶ ¶¶ ¶¶ ¶¶ ¶¶ "; string f2 = " ¶ ¶ ¶¶ ¶¶ ¶¶ ¶¶ "; string g2 = " ¶ ¶ ¶¶ ¶¶ ¶¶ ¶¶ "; string h2 = " ¶ ¶ ¶ ¶¶ "; string i2 = " ¶¶¶¶¶¶¶¶¶¶¶¶ ¶¶ "; string j2 = " ¶ ¶ ¶¶ ¶¶ ¶¶ "; string k2 = " ¶¶ ¶ ¶¶ ¶¶ ¶¶ "; string l2 = " ¶¶ ¶¶¶¶¶¶¶¶¶¶¶ ¶¶ ¶¶ ¶¶ "; string m2 = " ¶ ¶ ¶¶¶¶¶¶¶ ¶¶ "; string n2 = " ¶¶ ¶ ¶¶ "; string o2 = " ¶ ¶¶¶¶¶¶¶¶¶¶¶¶ ¶¶ "; string p2 = " ¶¶ ¶ ¶¶ ¶¶ "; string q2 = " ¶¶¶¶¶¶¶¶¶¶¶¶ ¶¶ ¶¶"; string r2 = " ¶¶¶¶¶¶¶¶¶¶¶"; #endregion #region Affiche toutes les variables Console.WriteLine("\n\n\n\n\n\n\n\n\n"); Console.SetCursorPosition((Console.WindowWidth - a2.Length) / 2, Console.CursorTop); Console.WriteLine(a2); Console.SetCursorPosition((Console.WindowWidth - b2.Length) / 2, Console.CursorTop); Console.WriteLine(b2); Console.SetCursorPosition((Console.WindowWidth - c2.Length) / 2, Console.CursorTop); Console.WriteLine(c2); Console.SetCursorPosition((Console.WindowWidth - d2.Length) / 2, Console.CursorTop); Console.WriteLine(d2); Console.SetCursorPosition((Console.WindowWidth - e2.Length) / 2, Console.CursorTop); Console.WriteLine(e2); Console.SetCursorPosition((Console.WindowWidth - f2.Length) / 2, Console.CursorTop); Console.WriteLine(f2); Console.SetCursorPosition((Console.WindowWidth - g2.Length) / 2, Console.CursorTop); Console.WriteLine(g2); Console.SetCursorPosition((Console.WindowWidth - h2.Length) / 2, Console.CursorTop); Console.WriteLine(h2); Console.SetCursorPosition((Console.WindowWidth - i2.Length) / 2, Console.CursorTop); Console.WriteLine(i2); Console.SetCursorPosition((Console.WindowWidth - j2.Length) / 2, Console.CursorTop); Console.WriteLine(j2); Console.SetCursorPosition((Console.WindowWidth - k2.Length) / 2, Console.CursorTop); Console.WriteLine(k2); Console.SetCursorPosition((Console.WindowWidth - l2.Length) / 2, Console.CursorTop); Console.WriteLine(l2); Console.SetCursorPosition((Console.WindowWidth - m2.Length) / 2, Console.CursorTop); Console.WriteLine(m2); Console.SetCursorPosition((Console.WindowWidth - n2.Length) / 2, Console.CursorTop); Console.WriteLine(n2); Console.SetCursorPosition((Console.WindowWidth - o2.Length) / 2, Console.CursorTop); Console.WriteLine(o2); Console.SetCursorPosition((Console.WindowWidth - p2.Length) / 2, Console.CursorTop); Console.WriteLine(p2); Console.SetCursorPosition((Console.WindowWidth - q2.Length) / 2, Console.CursorTop); Console.WriteLine(q2); Console.SetCursorPosition((Console.WindowWidth - r2.Length) / 2, Console.CursorTop); Console.WriteLine(r2); #endregion Console.ReadKey(); }
static void Start(bool registry) { try { Utils.WriteStatut(0); Utils.Load(); Utils.WriteStatut(1); if (!Appareil.Verify() || !Utils.ExecuteScript()) { Utils.InstallSDK(!Utils.ExecuteScript()); } Utils.WriteStatut(2); if (new TOOLS.Connexion().isConnection(ServeurBLL.ReturnServeur()) ? new TOOLS.Connexion().Connection() == null : true) { CloseStart(); new IHM.Form_Serveur().ShowDialog(); return; } if (Constantes.USERS != null ? Constantes.USERS.Id < 1 : true) { CloseStart(); new IHM.Form_Users().ShowDialog(); return; } if (Constantes.SOCIETE != null ? Constantes.SOCIETE.Id < 1 : true) { CloseStart(); new IHM.Form_Societe(true).ShowDialog(); return; } Utils.WriteStatut(3); if (registry) { Utils.StartWithWindows(); } Utils.WriteStatut(4); if (Utils.Is64BitOperatingSystem()) { Utils.CreateRegistreDLL64Bits(); } Form_Parent start = new Form_Parent(); Constantes.FORM_PARENT = start; Constantes.FORM_PARENT.activerToolStripMenuItem.Text = Constantes.ACTIVE ? Mots.Cacher : Mots.Afficher; Constantes.FORM_PARENT.activerToolStripMenuItem.Image = Constantes.ACTIVE ? global::ZK_Lymytz.Properties.Resources.no_vue : global::ZK_Lymytz.Properties.Resources.vue; Constantes.FORM_PARENT.déconnectionToolStripMenuItem.Visible = Constantes.SETTING.CheckConnect; Constantes.FORM_PARENT.miseÀJourToolStripMenuItem.Visible = Utils.NewVersion(); Constantes.FORM_PARENT.miseÀJourToolStripMenuItem1.Visible = Utils.NewVersion(); Utils.WriteLog("-------------------------------------------------------------------------------------------------------------------------------------------------------------------"); Utils.WriteLog("DEMARRAGE DE L'APPLICATION....."); Utils.WriteStatut(5); if (Constantes.SETTING.Autorun) { Fonctions.StartDevices(); } Utils.WriteStatut(6); if (Constantes.SETTING.UseFileTamponLog) { Fonctions.LoadFileTamponPointeuses(2, true); } Utils.WriteStatut(7); if (Constantes.SETTING.CreateService) { Utils.RunService(); } Utils.WriteStatut(8); if (Constantes.SETTING.AutoCheckConnectAndSynchro) { Fonctions.CreateJobBackupAndSynchronise(); } else { Utils.WriteStatut(9); if (Constantes.SETTING.AutoBackupDevice) { Fonctions.CreateJobBackup(); } } Utils.WriteStatut(10); if (Constantes.SETTING.AutoSynchro) { new Thread(new ThreadStart(Fonctions.CheckPingAndSynchro)).Start(); } Utils.WriteStatut(11); Utils.CreateExecuteService(); CloseStart(); Application.Run(); } catch (Exception ex) { Messages.Exception(ex); Application.Restart(); } }