예제 #1
0
        public int Add(Ethnicity ethnicity)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("INSERT INTO ETHNICITY (Ethnicity) VALUES ('");
            sb.Append(ethnicity.EthnicityName + "')");

            string    sql = sb.ToString();
            DBCommand db  = new DBCommand();

            return(db.ExecuteCommand(sql));
        }
예제 #2
0
        public List <Ethnicity> GetList()
        {
            List <Ethnicity> list = new List <Ethnicity>();

            DBCommand db = new DBCommand(DBCommand.TransactionType.WithoutTransaction);
            DataTable dt = db.GetDataTable("SELECT * FROM vw_Ethnicity");

            foreach (DataRow dr in dt.Rows)
            {
                Ethnicity eth = new Ethnicity
                {
                    EthnicityId   = (int)dr["EthnicityId"],
                    EthnicityName = dr["Ethnicity"].ToString()
                };
                list.Add(eth);
            }
            return(list);
        }