using System;
using System.Collections.Generic;
using System.Text;
using Finisar.SQLite;
using System.Data;


namespace EmployeeManagementSystem.DataAccessLayer1
{
    public class DataAccess
    {
        private SQLiteConnection sql_con;
        private SQLiteCommand sql_cmd;
        private SQLiteDataAdapter DB;
        private DataSet DS = new DataSet();
        private DataTable DT = new DataTable();

        private void SetConnection()
        {
            sql_con = new SQLiteConnection("Data Source=Employee.db;Version=3;New=False;Compress=True;");
        }
        public bool GetDataSet1(string procedureName)
        {
            SetConnection();

            sql_con.Open();

            SQLiteCommand sqd = new SQLiteCommand(procedureName, sql_con);
            int i = sqd.ExecuteNonQuery();
            sql_con.Close();
            if (i == 0)
                return false;
            else
                return true;
        }
        public DataSet GetDataSet2(string procedureName)
        {
            SetConnection();

            sql_con.Open();

            DB = new SQLiteDataAdapter(procedureName, sql_con);
            DS.Reset();
            DB.Fill(DS);

            sql_con.Dispose();
            sql_con.Close();
            return DS;
        }
    }
}

