public TownVO GetByID(int id) { TownVO vo = new TownVO(); DataTable dt = Select("ID=" + id + ""); if (dt.Rows.Count > 0) { vo = b.ConvertObj(dt.Rows[0], new TownVO()) as TownVO; } return(vo); }
public TownVO GetIDByName(string Name) { TownVO vo = new TownVO(); DataTable dt = Select("Town=N'" + Name + "'"); if (dt.Rows.Count > 0) { vo = b.ConvertObj(dt.Rows[0], new TownVO()) as TownVO; } return(vo); }
public int Create(TownVO vo) { int id = 0; if (!dao.isExist(vo.Id.ToString())) { id = dao.Insert(vo); } else { id = dao.Update(vo); } return(id); }
public int Insert(TownVO vo) { int lastInsertId = 0; try { lastInsertId = b.Insert("Town", b.ConvertColName(vo), b.ConvertValueList(vo)); } catch (SqlException ex) { throw ex; } return(lastInsertId); }
public int Update(TownVO vo) { int townID = 0; try { b.Update("Town", vo.Id.ToString(), b.ConvertColName(vo), b.ConvertValueList(vo)); townID = vo.Id; } catch (SqlException ex) { throw ex; } return(townID); }