public bool Update(TagsFoodType tft) { string sql = "UPDATE TagsFoodType SET "; sql += string.Format("TagId={0}, ", tft.TagID); sql += string.Format("FoodTypeId='{0}' ", tft.FoodTypeID); sql += string.Format(" WHERE ID={0}", tft.ID); return(DB.Update(sql)); }
public bool InsertOrUpdate(TagsFoodType tft) { if (tft.IsNew) { this.Insert(tft); return(true); } else { return(this.Update(tft)); } }
private TagsFoodType getDataObject(DataRow row) { TagsFoodType f = new TagsFoodType(); f.ID = Convert.ToInt32(row["ID"].ToString()); f.TagID = Convert.ToInt32(row["TagID"].ToString()); f.FoodTypeID = row["FoodTypeID"].ToString(); DataTable dt = DB.Retrieve("select TypeName from FoodType where TypeID='" + f.FoodTypeID + "'"); f.FoodTypeName = dt.Rows[0]["TypeName"].ToString(); dt = DB.Retrieve("select TagName from Tags where ID=" + f.TagID); f.TagName = dt.Rows[0]["TagName"].ToString(); return(f); }
//private void ulvTagList_Click(object sender, EventArgs e) //{ // if (ulvTagList.SelectedItems.Count <= 0) return; // // // string itemkey = ulvTagList.SelectedItems[0].Key; // CurrTag = (Tag)ulvTagList.SelectedItems[0].Tag; // // // LoadTaggedFoodTypes(CurrTag.ID); //} private void ucFoodTypes_TreeViewIDChanged(object sender, UCTreeView.TreeViewEventArgs e) { // if Food Type is not already in the tag list, add it TagsFoodType tftreturn = TagsFoodTypeList.Find( delegate(TagsFoodType tft) { return(tft.FoodTypeID == e.ID); } ); if (tftreturn == null) { // Food Type doesn't already exist - add it TagsFoodType tftnew = new TagsFoodType(); tftnew.FoodTypeID = e.ID; tftnew.FoodTypeName = e.Name; tftnew.TagID = CurrTag.ID; tftnew.TagName = CurrTag.TagName; int idret = TagsFoodTypeDAO.DAO.Insert(tftnew); LoadTaggedFoodTypes(tftnew.TagID); } ulvTagList.Focus(); }
public int Insert(TagsFoodType tft) { return(this.Insert(tft.TagID, tft.FoodTypeID)); }
public bool Delete(TagsFoodType ffs) { return(this.Delete(ffs.ID)); }