public List<FoodEntity> GetFoodEntityList(FoodEntity condition_entity) { GenericWhereEntity<FoodEntity> where_entity = new GenericWhereEntity<FoodEntity>(); if (condition_entity.FOOD_ID != null) where_entity.Where(n => (n.FOOD_ID == condition_entity.FOOD_ID)); if (condition_entity.RESTAURANT_ID != null) where_entity.Where(n => (n.RESTAURANT_ID == condition_entity.RESTAURANT_ID)); return EntityExecution.SelectAll(where_entity); }
private void Save() { try { IFood biz = new FoodBiz(); var entity = new FoodEntity(); entity.FOOD_NAME = this.tFoodName.Value; entity.RESTAURANT_ID = base.ParseInt(this.ddlRestaurant.SelectedValue); entity.FOOD_TYPE_ID = base.ParseInt(this.ddlFoodType.SelectedValue); entity.FOOD_TASTE = this.ddlTaste.SelectedValue; entity.DESCRIPTION = this.tDescription.InnerText; decimal temp = 0; if (!decimal.TryParse(this.hPrice.Value, out temp)) { this.lMsg.InnerText = "保存失败,原因:单价必须为数字!"; return; } entity.PRICE = temp; string imgUrl, imgUrl_Nail; var foodImagePath = ConfigHelper.GetConfigString("FOOD_IMAGE_PATH"); // 图片1 imgUrl = null; imgUrl_Nail = null; if (!SetRestaurantMap(this.fileMap1, this.img1, this.hDeleteImg.Value, foodImagePath, ref imgUrl, ref imgUrl_Nail)) return; entity.FOOD_IMAGE1 = imgUrl; entity.FOOD_IMAGE_NAIL1 = imgUrl_Nail; // 图片2 imgUrl = null; imgUrl_Nail = null; if (!SetRestaurantMap(this.fileMap2, this.img2, this.hDeleteImg.Value, foodImagePath, ref imgUrl, ref imgUrl_Nail)) return; entity.FOOD_IMAGE2 = imgUrl; entity.FOOD_IMAGE_NAIL2 = imgUrl_Nail; // 图片3 imgUrl = null; imgUrl_Nail = null; if (!SetRestaurantMap(this.fileMap3, this.img3, this.hDeleteImg.Value, foodImagePath, ref imgUrl, ref imgUrl_Nail)) return; entity.FOOD_IMAGE3 = imgUrl; entity.FOOD_IMAGE_NAIL3 = imgUrl_Nail; // 图片4 imgUrl = null; imgUrl_Nail = null; if (!SetRestaurantMap(this.fileMap4, this.img4, this.hDeleteImg.Value, foodImagePath, ref imgUrl, ref imgUrl_Nail)) return; entity.FOOD_IMAGE4 = imgUrl; entity.FOOD_IMAGE_NAIL4 = imgUrl_Nail; if (CurOperation == "add") { entity.CREATE_TIME = DateTime.Now; entity.CREATE_PERSON = base.CurEmployeeEntity.EMPLOYEE_ID; biz.InsertFoodEntity(entity); } else if (CurOperation == "edit") { entity.FOOD_ID = CurId; entity.UPDATE_TIME = DateTime.Now; entity.UPDATE_PERSON = base.CurEmployeeEntity.EMPLOYEE_ID; biz.UpdateFoodEntity(entity); } AlertAndTransfer("保存成功!", base.UrlReferrer); } catch (Exception ex) { this.lMsg.InnerText = "保存失败,原因:" + ex.ToString(); } }
public void UpdateFoodEntity(FoodEntity condition_entity) { condition_entity.Update(); }
public void InsertFoodEntity(FoodEntity condition_entity) { condition_entity.Insert(); }
public void DeleteFoodEntity(FoodEntity condition_entity) { condition_entity.Delete(); }