using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace _02trade
{

    class DataBase
    {
        SqlConnection sqlconnection = new SqlConnection(@"Data Source=(localdb)\02Stroimaterial; Initial Catalog=trade02;Integrated Security=True");
        public void OpenConnection()
        {
            if (sqlconnection.State == System.Data.ConnectionState.Closed)
            {
                sqlconnection.Open();
            }
        }
        public void CloseConnection()
        {
            if (sqlconnection.State == System.Data.ConnectionState.Open)
            {
                sqlconnection.Close();
            }
        }
        public SqlConnection GetConnection()
        {
            return sqlconnection;
        }
    }
}
