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

namespace DAL
{
    public class T_Meeting
    {
        public bool insert(Models.T_Meeting meet)
        {
            string sql = "insert into T_Meeting values ( @m_meetingroom , @m_chargedept , @m_topicmeeting, @m_naturemeeting, @m_hostmeeting, @m_starttime, @m_endtime, @m_main, @m_statemeeting, @m_isdel)";
            List<SqlParameter> lists = new List<SqlParameter>();
            lists.Add(new SqlParameter("@m_meetingroom", meet.m_meetingroom));
            lists.Add(new SqlParameter("@m_chargedept", meet.m_chargedept));
            lists.Add(new SqlParameter("@m_topicmeeting", meet.m_topicmeeting));
            lists.Add(new SqlParameter("@m_naturemeeting", meet.m_naturemeeting));
            lists.Add(new SqlParameter("@m_hostmeeting", meet.m_hostmeeting));
            lists.Add(new SqlParameter("@m_starttime", meet.m_starttime));
            lists.Add(new SqlParameter("@m_endtime", meet.m_endtime));
            lists.Add(new SqlParameter("@m_main", meet.m_main));
            lists.Add(new SqlParameter("@m_statemeeting", meet.m_statemeeting));
            lists.Add(new SqlParameter("@m_isdel", meet.m_isdel));
            return DBUtility.SQLHelper.Execute(sql, lists);
        }
        public bool delete(string index)
        {
            string sql = " delete from T_Meeting where m_autoID=@m_autoID";
            List<SqlParameter> lists = new List<SqlParameter>();
            lists.Add(new SqlParameter("@m_autoID", index));
            return DBUtility.SQLHelper.Execute(sql, lists);
        }
        public bool update(Models.T_Meeting meet, int auto)
        {
            string sql = "update T_Meeting set m_statemeeting=@m_statemeeting where m_autoID=@m_autoID";
            List<SqlParameter> lists = new List<SqlParameter>();
            lists.Add(new SqlParameter("@m_statemeeting", meet.m_statemeeting));
            lists.Add(new SqlParameter("@m_autoID", auto));
            return DBUtility.SQLHelper.Execute(sql, lists);
        }
        public DataTable select(string strWhere)
        {
            string sql = "select * from T_Meeting";
            if (strWhere != "")
            {
                sql += " where " + strWhere;
            }
            return DBUtility.SQLHelper.GetDataTable(sql);
        }
    }
}
