﻿using System.Data.OleDb;

namespace ParadiseFuneralServices.Classes
{
    class Offline
    {

        private static OleDbConnectionStringBuilder csb = null;
        private static string DatabaseName = "PFS-System.mdb";

        internal static OleDbConnection GetConnection()
        {
            if (csb == null)
            {
                csb = new OleDbConnectionStringBuilder();
                csb.DataSource = "|DataDirectory|/" + DatabaseName;
                csb.Provider = "Microsoft.ACE.OLEDB.12.0";
                csb.PersistSecurityInfo = true;
                csb.Add("Jet OLEDB:Database Password", "PFS-SYSTEM");
            }
            return new OleDbConnection(csb.ConnectionString);
        }

    }
}
