Example #1
0
        public void ReadCatalog()
        {
            AStatic.Catalog = new List<ALibModel>();
            string sql = "select tag, category, pyindex, pyfspell from accounts order by pyindex asc";

            ADbInteractive db = new ADbInteractive(AStatic.DbPath);
            using (SQLiteDataReader reader = db.ExecReader(sql, null))
            {
                while (reader.Read())
                {
                    AStatic.Catalog.Add(new ALibModel(reader.GetString(0),
                        reader.GetString(1), reader.GetString(2),
                        reader.GetString(3)));

                }
                reader.Close();

            }
        }
Example #2
0
        public void ReadAccount(string t)
        {
            string sql = "select * from accounts where tag='" + t + "'";
            ADbInteractive db = new ADbInteractive(AStatic.DbPath);
            using (SQLiteDataReader reader = db.ExecReader(sql, null))
            {
                while (reader.Read())
                {

                    tag = reader.GetString(1);
                    category = reader.GetString(2);
                    url = reader.GetString(3);
                    user = reader.GetString(4);
                    password = reader.GetString(5);
                    phone = reader.GetString(6);
                    mail = reader.GetString(7);
                    notes = reader.GetString(8);
                }
                reader.Close();
            }
        }
Example #3
0
        public void HtmlExport(string fname)
        {
            using (StreamReader fs = new StreamReader("share\\head.html"))
            {
                head = fs.ReadToEnd();

            }

            head += "<h2>Accounts</h2>\n";
            DateTime dt = DateTime.Now;
            head += "<p>" + dt.ToString() + "</p>\n";

            body = "<table class=\"dataintable\">\n<tbody>\n";

            body += "<tr>";
            for (int i = 1; i < 10; i++)
            {
                body += "<th>"+title[i - 1] + "</th>\n";

            }
            body += "</tr>\n";

            string sql = "select * from accounts order by pyindex asc";

            ADbInteractive db = new ADbInteractive(AStatic.DbPath);

            using (SQLiteDataReader reader = db.ExecReader(sql, null))
            {
                while (reader.Read())
                {
                    body += "<tr>\n";

                    for (int i = 1; i < 10; i++)
                    {
                        body += "<td>" + reader.GetString(i) + "</td>\n";

                    }
                    body += "</tr>\n";
                }
                reader.Close();

            }

            using (StreamWriter fw = new StreamWriter(fname, false))
            {
                fw.Write(head + body + tail);
            }
        }
Example #4
0
        public void TxtExport(string fname)
        {
            string sql = "select * from accounts order by pyindex asc";

            FileStream fs = new FileStream(fname, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);

            string result = "";
            for (int i = 1; i < 10; i++)
            {
                result += title[i - 1] + ",";

            }

            sw.Write(result + "\r\n");

            result = "";
            ADbInteractive db = new ADbInteractive(AStatic.DbPath);

            using (SQLiteDataReader reader = db.ExecReader(sql, null))
            {
                while (reader.Read())
                {
                    for (int i = 1; i < 10; i++)
                    {
                        result += reader.GetString(i) + ",";

                    }
                    result += "\r\n";
                }
                reader.Close();

            }
            sw.Write(result);

            sw.Close();
            fs.Close();
        }