public int CreateNewMenuItem(WeixinMenuTreeEntity item) { if (item == null) { return 0; } try { using (IDbConnection dbcmd = DBFactory.OpenDbConnection()) { string sql = "insert into weiin_menu_tree(menu_name, command, status, create_time, last_changed_time) " + "values({0}, {1}, {2}, {3}, {4})".Params(item.menu_name, item.command, item.create_time, item.last_changed_time); return dbcmd.ExecuteSql(sql); } } catch (Exception e) { string err = string.Format("DataBase Exception in create WeixinMenuTreeEntity(): {0}", e.ToString()); LogUtil.Error(err); throw; } }
public int UpdateMenuItem(WeixinMenuTreeEntity item) { if (item == null) return 0; try { using (IDbConnection dbcmd = DBFactory.OpenDbConnection()) { string sql = "update weixin_menu_tree set menu_name ={0}, command = {1}, last_changed_time = {2} where Id={3}".Params (item.menu_name, item.command, item.Id, item.last_changed_time); return dbcmd.ExecuteSql(sql); } } catch (Exception e) { string err = string.Format("DataBase Exception in create UpdateMenuItem(): {0}", e.ToString()); LogUtil.Error(err); throw; } }