示例#1
0
文件: PLC.cs 项目: Lapicher/SIMEPLC
        private List<Linea> CargarLinea()
        {
            Conexion conexion = new Conexion();
            List<Linea> lineas = new List<Linea>();
            int numCampos=2;
            List<string> resultados = conexion.Consulta("select Nombre_linea, idLinea from linea where l_estatus=1", numCampos);
            for (int i = 0; i < resultados.Count; i += numCampos)
            {
                Linea linea = new Linea();
                linea.Nombre_linea = resultados[i];
                linea.idLinea = Convert.ToInt32(resultados[i + 1]);
                lineas.Add(linea);
            }

            return lineas;
        }
示例#2
0
文件: PLC.cs 项目: Lapicher/SIMEPLC
 private List<Estacion> CargarEstacion()
 {
     Conexion conexion = new Conexion();
     List<Estacion> estaciones = new List<Estacion>();
     int numCampos=3;
     List<string> resultados = conexion.Consulta("select nombreEstacion,idestacion,url from estacion where linea_idlinea="+((Linea)cboxL.SelectedItem).idLinea, numCampos);
     for (int i = 0; i < resultados.Count; i += numCampos)
     {
         Estacion estacion = new Estacion();
         estacion.NombreEstacion = resultados[i];
         estacion.idEstacion = Convert.ToInt32(resultados[i + 1]);
         estacion.URL = resultados[i + 2];
         estaciones.Add(estacion);
     }
     return estaciones;
 }
示例#3
0
        private void CargarVariables()
        {
            Conexion conexion = new Conexion();
            //List<VariablesPLC> variables = new List<VariablesPLC>();
            int numCampos = 3;
            int y = 10;
            List<string> resultados = conexion.Consulta("select distinct(idregistro),tag,v.descripcion from linea inner join Estacion on Linea_idLinea=idlinea and e_estatus=1 and l_estatus=1 inner join registro on registro.Estacion_idestacion=idestacion and r_estatus=1 inner join variables v on v.Registro_idRegistro=idregistro and v_estatus=1 where idEstacion=" + est.idEstacion + " and v.idvariable not in(select Variables_idVariable from combinacion)", numCampos);
            for (int i = 0; i < resultados.Count; i += numCampos)
            {
                Label l = new Label();
                TextBox tb = new TextBox(); //instanciamos nuestro nuevo TextBox
                l.Location = new System.Drawing.Point(30, y);
                l.AutoSize = true;
                tb.Location = new System.Drawing.Point(115, y);
                l.Text = resultados[i + 2] + ": ";

                tb.Tag = resultados[i];
                pnl_variables.Controls.Add(l);
                pnl_variables.Controls.Add(tb); //finalmente lo agregamos a nuestro Form
                y = y + 40;
            }
        }
示例#4
0
        private List<Socket> CargarTag()
        {
            Conexion conexion = new Conexion();
            List<Socket> tags = new List<Socket>();
            int numCampos = 5;
            List<String> resultados = conexion.Consulta("select idregistro,tag,tipor,acceso,clasificacion from registro inner join tiporeg on idregistro=Registro_idregistro where Estacion_idEstacion=" + est.idEstacion + " and r_estatus=1 order by clasificacion,idRegistro", numCampos);
            for (int i = 0; i < resultados.Count; i += numCampos)
            {
                Socket tag = new Socket(est.URL);
                tag.IdRegistro = Convert.ToInt32(resultados[i]);
                tag.Tag = resultados[i + 1];
                tag.Url += tag.Tag;
                tag.TipoR = resultados[i + 2];
                tag.Acceso = resultados[i + 3];
                tag.Clasificacion = resultados[i + 4];

                tags.Add(tag);
            }
            return tags;
        }