using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace Transport.DAL
{
    class dal_settings
    {
        // انتخاب تنظیمات برنامه از جدول settings
        public static DataTable select_app_setting()
        {
            SqlConnection con = new SqlConnection(dal_config.connection_string);
            SqlCommand com = new SqlCommand("SELECT * FROM tbl_app_settings", con);
            SqlDataAdapter adapter = new SqlDataAdapter(com);

            DataSet ds = new DataSet();
            adapter.Fill(ds);
            DataTable dataTable = new DataTable();

            if (con.State != ConnectionState.Closed)
            {
                con.Close();
            }

            try
            {
                dataTable = ds.Tables[0];
            }
            catch (SqlException e)
            {
                return null;
            }

            return dataTable;
        }
    }
}
