Ejemplo n.º 1
0
    public void LoadMachines()
    {
        _MainClass helper = new _MainClass();
        string     query  = "SELECT * from Machine_Code";
        DataTable  tbl    = new DataTable();

        tbl = helper.PkSelect(query, "NOYConnectionString");


        List <int> ClearedId = new List <int>();

        foreach (DataRow item in tbl.Rows)
        {
            foreach (Panel p in form1.Controls.OfType <Panel>())
            {
                foreach (Label l in p.Controls.OfType <Label>())
                {
                    string tooltip = Convert.ToString(item[0]);
                    string newID   = Convert.ToString(item[1]);
                    try
                    {
                        string dataAttr = l.Attributes["data-possition"].ToString();
                        if (dataAttr.Length <= 4)
                        {
                            if ((dataAttr).Equals(tooltip))
                            {
                                l.Attributes.Add("data-machine", newID);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        continue;
                    }
                }
            }
        }
    }