Example #1
0
        public void add(string txt)
        {
            Mysql sql = new Mysql();
            bool  rs  = sql.Ejecutar("INSERT INTO `modelo` (`modelo`,`id_sector`) VALUES ('" + txt + "','" + Operador.sector_id + "');");

            if (rs)
            {
                try
                {
                    string modelo_url = Ingenieria.CARPETA + "" + txt;

                    List <string> lotes = Ingenieria.lotes(modelo_url);

                    if (lotes.Count >= 0)
                    {
                        List <string> pcblist   = new List <string>();
                        string        lote_path = modelo_url + @"\" + lotes[0];

                        DataTable dt = Ingenieria.leer_lote(lote_path);
                        pcblist = Ingenieria.pcb(dt);

                        libPanel npanel = new libPanel();
                        npanel.id_modelo = new_modelo(txt, Operador.sector_id);

                        foreach (string panel in pcblist)
                        {
                            npanel.add(panel);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se pudieron agregar automaticamente los paneles. Por favor ingrese paneles al modelo.");
                }

                load();
            }
            else
            {
                MessageBox.Show("Error al insertar.");
            }
        }