예제 #1
0
        public ObservableCollection <Historique> GetAllData()
        {
            ObservableCollection <Historique> result = new ObservableCollection <Historique>();

            try
            {
                using (var bdd = new AcoreDBEntities())
                {
                    List <Historique> historiques = bdd.Historique.ToList();
                    foreach (Historique his in historiques)
                    {
                        if (his.IdRecette != null)
                        {
                            his.Recette2 = RecetteService.GetRecetteFromId((int)his.IdRecette);
                        }
                        result.Add(his);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e);
            }
            return(result);
        }
예제 #2
0
        public Redresseur(DataService.Redresseur red)
        {
            ValuesA = new ChartValues <double> {
                0
            };
            ValuesB = new ChartValues <double> {
                0
            };
            Id              = red.Id;
            IdProcess       = red.IdProcess;
            IpAdresse       = red.IpAdresse;
            OnOff           = red.OnOff;
            MiseSousTension = red.MiseSousTension;
            Etat            = (MODES)Enum.Parse(typeof(MODES), red.Etat);
            Type            = (TYPEREDRESSEUR)Enum.Parse(typeof(TYPEREDRESSEUR), red.Type);
            UMax            = red.UMax;
            IMax            = red.IMax;
            ConsigneV       = red.ConsigneV;
            ConsigneA       = red.ConsigneA;
            LectureV        = red.LectureV;
            LectureA        = red.LectureA;
            Temperature     = red.Temperature;
            AH              = red.AH;
            CompteurAH      = red.CompteurAH;
            CalibreAH       = (CALIBRE)Enum.Parse(typeof(CALIBRE), red.CalibreAH);
            Pulse           = red.Pulse;
            Temporisation   = red.Temporisation;
            TempsOn         = red.TempsOn;
            TempsOff        = red.TempsOff;
            DureeTempo      = DateTime.Parse(red.DureeTempo.ToString());
            DureeRestante   = DateTime.Parse(red.DureeRestante.ToString());
            Rampe           = red.Rampe;
            DureeRampe      = DateTime.Parse(red.DureeRampe.ToString());
            Defaut          = red.Defaut;

            Options               = OptionsService.GetAllOptionsFromTableId(Id, "Id" + this.GetType().Name);
            Registres             = Registre.GetAllRegisterFromRedresseurId(Id);
            ListRecette           = RecetteService.GetListRecetteFromProcessId(IdProcess);
            RedresseurPoolingTask = new Thread(RedresseurPooling);
            RedresseurPoolingTask.Start();
        }
예제 #3
0
        public ObservableCollection <Process> GetAllData()
        {
            ObservableCollection <Process> result = new ObservableCollection <Process>();

            try
            {
                using (var bdd = new AcoreDBEntities())
                {
                    List <Process> processes = bdd.Process.ToList();
                    foreach (Process pro in processes)
                    {
                        pro.Recettes = RecetteService.GetListRecetteFromProcessId(pro.Id);
                        pro.Options  = OptionsService.GetAllOptionsFromTableId(pro.Id, "Id" + pro.GetType().Name);
                        result.Add(pro);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e);
            }
            return(result);
        }
예제 #4
0
        public Redresseur(SqlDataReader reader)
        {
            ValuesA = new ChartValues <double> {
                0
            };
            ValuesB = new ChartValues <double> {
                0
            };
            Id              = (int)reader["Id"];
            IdProcess       = (int)reader["IdProcess"];
            IpAdresse       = (string)reader["IpAdresse"];
            OnOff           = (bool)reader["OnOff"];
            MiseSousTension = (bool)reader["MiseSousTension"];
            Etat            = (MODES)Enum.Parse(typeof(MODES), (string)reader["Etat"]);
            Type            = (TYPEREDRESSEUR)Enum.Parse(typeof(TYPEREDRESSEUR), (string)reader["Type"]);
            UMax            = (int)reader["UMax"];
            IMax            = (int)reader["IMax"];
            ConsigneV       = (int)reader["ConsigneV"];
            ConsigneA       = (int)reader["ConsigneA"];
            LectureV        = (int)reader["LectureV"];
            LectureA        = (int)reader["LectureA"];
            Temperature     = (int)reader["Temperature"];
            AH              = (bool)reader["AH"];
            CompteurAH      = (int)reader["CompteurAH"];
            CalibreAH       = (CALIBRE)Enum.Parse(typeof(CALIBRE), (string)reader["CalibreAH"]);
            Pulse           = (bool)reader["Pulse"];
            Temporisation   = (bool)reader["Temporisation"];
            TempsOn         = (int)reader["TempsOn"];
            TempsOff        = (int)reader["TempsOff"];
            DureeTempo      = DateTime.Parse(reader["DureeTempo"].ToString());
            DureeRestante   = DateTime.Parse(reader["DureeRestante"].ToString());
            Rampe           = (bool)reader["Rampe"];
            DureeRampe      = DateTime.Parse(reader["DureeRampe"].ToString());
            Defaut          = (bool)reader["Defaut"];
            //OrdreFabrication = (string)reader["OrdreFabrication"];
            //EtatFin = (ETATFIN)Enum.Parse(typeof(ETATFIN), (string)reader["EtatFin"]);

            Options     = OptionsService.GetAllOptionsFromTableId(Id, "Id" + this.GetType().Name);
            Registres   = Registre.GetAllRegisterFromRedresseurId(Id);
            ListRecette = RecetteService.GetListRecetteFromProcessId(IdProcess);

            switch (Etat)
            {
            case MODES.LocalManuel:
                if (onOff)
                {
                    EtatImageSource = "../Resources/liasonOkLocal.png";
                }
                else
                {
                    EtatImageSource = "../Resources/liasonPas.png";
                }
                break;

            case MODES.LocalRecette:
                if (onOff)
                {
                    EtatImageSource = "../Resources/liasonOkRecette.png";
                }
                else
                {
                    EtatImageSource = "../Resources/liasonPas.png";
                }
                break;

            case MODES.RemoteManuel:
                if (onOff)
                {
                    EtatImageSource = "../Resources/liasonOkRemote.png";
                }
                else
                {
                    EtatImageSource = "../Resources/liasonPas.png";
                }
                break;

            case MODES.RemoteRecette:
                EtatImageSource = "../Resources/liasonPas.png";
                break;

            case MODES.Supervision:
                if (onOff)
                {
                    EtatImageSource = "../Resources/supervision.png";
                }
                else
                {
                    EtatImageSource = "../Resources/supervisionPas.png";
                }
                break;
            }



            RedresseurPoolingTask = new Thread(RedresseurPooling);
            RedresseurPoolingTask.Start();
        }