public prgfilename(String param_file)
        {
            Prgfilename = param_file;

            conn = new SqliteConnect();

            if (conn.Sqlite_Connect())
            {
                if (!FindPrgFile())
                {
                    DateTime      localDate = DateTime.Now;
                    string        sql       = "insert into Prgfile (file_name,creation_date,modification_date) values ('" + Prgfilename + "','" + localDate.ToString("MM/dd/yyyy HH:mm") + "','" + localDate.ToString("MM/dd/yyyy HH:mm") + "')";
                    SQLiteCommand command   = new SQLiteCommand(sql, conn.Conexion);
                    command.ExecuteNonQuery();

                    sql     = "select MAX(id) as prgid from Prgfile";
                    command = new SQLiteCommand(sql, conn.Conexion);
                    string getValue = command.ExecuteScalar().ToString();
                    if (getValue != null)
                    {
                        Prgfileid = int.Parse(getValue);
                    }
                }
                else
                {
                    string        sql      = "select id as prgid from Prgfile where file_name ='" + Prgfilename + "'";
                    SQLiteCommand command  = new SQLiteCommand(sql, conn.Conexion);
                    string        getValue = command.ExecuteScalar().ToString();
                    if (getValue != null)
                    {
                        Prgfileid = int.Parse(getValue);
                    }
                }
            }
        }
        public Boolean Insert_point(int param_idprg, String param_lblname, String param_lbltext, int param_screenid, int param_pointx, int param_pointy, int param_type, int param_link, String param_path)
        {
            conn = new SqliteConnect();
            Boolean flag = false;

            if (conn.Sqlite_Connect())
            {
                try
                {
                    DateTime      localDate = DateTime.Now;
                    string        sql       = "INSERT INTO AtributosLabels(id_prg,lbl_name,lbl_text,screen_id,point_x,point_y,type,link,image) VALUES(" + param_idprg + ",'" + param_lblname + "','" + param_lbltext + "'," + param_screenid + "," + param_pointx + "," + param_pointy + "," + param_type + "," + param_link + ",'" + param_path + "')";
                    SQLiteCommand command   = new SQLiteCommand(sql, conn.Conexion);
                    command.ExecuteNonQuery();
                    sql     = "select MAX(id_a) as id from AtributosLabels";
                    command = new SQLiteCommand(sql, conn.Conexion);
                    string getValue = command.ExecuteScalar().ToString();
                    if (getValue != null)
                    {
                        Get_id = int.Parse(getValue);
                    }

                    flag = true;
                }
                catch (SQLiteException ex)
                {
                    flag = false;
                    System.Windows.Forms.MessageBox.Show(ex.Message, "Error !");
                }
            }

            return(flag);
        }
Ejemplo n.º 3
0
        public LoadPoint(int param_fileid, int param_screen)
        {
            Prgfileid = param_fileid;
            Screenid  = param_screen;
            string query = "SELECT id_a,lbl_name, lbl_text, point_x, point_y,type,image,link FROM AtributosLabels WHERE id_prg = " + Prgfileid + " AND screen_id =" + Screenid;

            //MessageBox.Show(query);
            conn = new SqliteConnect();

            if (conn.Sqlite_Connect())
            {
                try
                {
                    SQLiteDataAdapter adapter = new SQLiteDataAdapter(query, conn.Conexion);
                    tb = new DataTable();
                    adapter.Fill(tb);
                }
                catch (SQLiteException ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message, "Error !");
                }
            }
        }
        public Boolean Update_point(int param_id, int param_x, int param_y)
        {
            conn = new SqliteConnect();
            Boolean flag = false;

            if (conn.Sqlite_Connect())
            {
                try
                {
                    DateTime      localDate = DateTime.Now;
                    string        sql       = "UPDATE AtributosLabels SET point_x=" + param_x + ",point_y=" + param_y + " WHERE  id_a=" + param_id;
                    SQLiteCommand command   = new SQLiteCommand(sql, conn.Conexion);
                    command.ExecuteNonQuery();
                    flag = true;
                }
                catch (SQLiteException ex)
                {
                    flag = false;
                    System.Windows.Forms.MessageBox.Show(ex.Message, "Error !");
                }
            }

            return(flag);
        }
        public Boolean Update_point_image(int param_idprg, String param_image, int param_screenid)
        {
            conn = new SqliteConnect();
            Boolean flag = false;

            if (conn.Sqlite_Connect())
            {
                try
                {
                    DateTime      localDate = DateTime.Now;
                    string        sql       = "UPDATE AtributosLabels SET image='" + param_image + "' WHERE id_prg =" + param_idprg + " AND link=" + param_screenid;
                    SQLiteCommand command   = new SQLiteCommand(sql, conn.Conexion);
                    command.ExecuteNonQuery();
                    flag = true;
                }
                catch (SQLiteException ex)
                {
                    flag = false;
                    System.Windows.Forms.MessageBox.Show(ex.Message, "Error !");
                }
            }

            return(flag);
        }