Example #1
0
        public List <Steels> GetlistSteelM1(int id_Sensor)
        {
            try
            {
                List <Steels> result = new List <Steels>();
                List <Steels> lv     = bd.Steels.ToList();
                for (int i = 0; i < lv.Count; i++)
                {
                    int         id_steel    = lv[i].id_steel;
                    SensorSteel sensorSteel = bd.SensorSteel.Where(o => o.id_sensor == id_Sensor && o.id_steel == id_steel).FirstOrDefault();
                    if (sensorSteel != null)
                    {
                        Steels temp = new Steels();
                        temp.id_steel   = lv[i].id_steel;
                        temp.name_steel = lv[i].name_steel;
                        result.Add(temp);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                List <Steels> result2 = new List <Steels>();
                Steels        temp    = new Steels();
                temp.id_steel   = -1;
                temp.name_steel = ex.Message;

                result2.Add(temp);
                return(null);
            }
        }
Example #2
0
 public List <SensorSteel> GetlistSensor_SteelM1(int Id_Sensors, int Id_Steel)
 {
     try
     {
         List <SensorSteel> result = new List <SensorSteel>();
         List <SensorSteel> lv     = bd.SensorSteel.Where(o => o.id_sensor == Id_Sensors && o.id_steel == Id_Steel).ToList();
         for (int i = 0; i < lv.Count; i++)
         {
             SensorSteel temp = new SensorSteel();
             temp.id_sensor_steel = lv[i].id_sensor_steel;
             temp.id_sensor       = lv[i].id_sensor;
             temp.R01             = lv[i].R01;
             temp.R02             = lv[i].R02;
             result.Add(temp);
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }