using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;

namespace etw
{
    public class etw_language
    {
        public etw_language()
        {
        }
        private int etw_id;
        private string etw_languages;
        private string etw_domain;
        private string etw_kuozhan;

        public int id
        {
            set { etw_id = value; }
            get { return etw_id; }
        }
        public string language
        {
            set { etw_languages = value; }
            get { return etw_languages; }
        }
        public string domain
        {
            set { etw_domain = value; }
            get { return etw_domain; }
        }
        public string kuozhan
        {
            set { etw_kuozhan = value; }
            get { return etw_kuozhan; }
        }
        public bool exists()
        {
            StringBuilder strsql = new StringBuilder();
            strsql.Append("select count(id) from etw_language");
            strsql.Append("where id=" + id + "");
            return DbHelperSQL.Exists(strsql.ToString());

        }
        public void Add()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into [etw_language](");
            strSql.Append("language,domain,kuozhan");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("N'" + language + "',");
            strSql.Append("N'" + domain + "',");
            strSql.Append("N'" + kuozhan + "'");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }

        public void Update()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update etw_language set ");
            strSql.Append("language=N'" + language + "',");
            strSql.Append("domain=N'" + domain + "',");
            strSql.Append("kuozhan=N'" + kuozhan + "'");
            strSql.Append(" where id=" + id + " ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }

        public void Delete()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from etw_language ");
            strSql.Append(" where id=" + id + " ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }

        public void GetModel()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  ");
            strSql.Append("[id],[language],[domain],[kuozhan]");
            strSql.Append(" from etw_language ");
            strSql.Append("where id=" + id + "");
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                language = ds.Tables[0].Rows[0]["language"].ToString();
                domain = ds.Tables[0].Rows[0]["domain"].ToString();
                kuozhan = ds.Tables[0].Rows[0]["kuozhan"].ToString();
            }
        }
        public DataSet GetList(int strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [id],[language],[domain],[kuozhan]");
            strSql.Append(" FROM etw_language ");
            if (strWhere != 0)
            {
                strSql.Append(" where  id=" + id);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }


    }
}
