public static void SerializeFood(Food value, IFhirWriter writer) { writer.WriteStartRootObject("Food"); writer.WriteStartComplexContent(); // Serialize element's localId attribute if( value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents) ) writer.WriteRefIdContents(value.InternalId.Contents); // Serialize element extension if(value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach(var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if(value.Language != null) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.Language, writer); writer.WriteEndElement(); } // Serialize element text if(value.Text != null) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer); writer.WriteEndElement(); } // Serialize element contained if(value.Contained != null && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach(var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public async Task<IHttpActionResult> PutFood(Guid id, Food food) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != food.Id) { return BadRequest(); } db.Entry(food).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FoodExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public bool addFood(Food f) { if(f.getWeight() + weight > weightLimit) { return false; } else { foods.Add(f); weight += f.getWeight(); return true; } }
public Food(string Init_name, int p_price, int p_costs) { this.instance = this; this.instance.name = Init_name; this.instance.price = p_price; this.instance.costs = p_costs; }
public async Task<IHttpActionResult> PostFood(Food food) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Foods.Add(food); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (FoodExists(food.Id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = food.Id }, food); }
protected override void AddObjectToFarm(string[] inputCommands) { string type = inputCommands[1]; string id = inputCommands[2]; switch (type) { case "Grain": var food = new Food(id, ProductType.Grain, FoodType.Organic, 10, 2); this.farm.AddProduct(food); break; case "CherryTree": var cherryTree = new CherryTree(id); this.farm.Plants.Add(cherryTree); break; case "TobaccoPlant": var tobaccoPlant = new TobaccoPlant(id); this.farm.Plants.Add(tobaccoPlant); break; case "Cow": var cow = new Cow(id); this.farm.Animals.Add(cow); break; case "Swine": var swine = new Swine(id); this.farm.Animals.Add(swine); break; default: break; } }
public World(ContentManager content, Rectangle Bounds) { this.Bounds = Bounds; this.TextureCreature = content.Load<Texture2D>("Bug"); this.TexturePoint = content.Load<Texture2D>("Point"); this.TextureFood = content.Load<Texture2D>("Circle"); this.MyFont = content.Load<SpriteFont>("MyFont"); this.camera = new Camera(new Viewport(this.Bounds)); this.basicshapes = new BasicShapes(); creature = new List<Creature>(); for (int i = 0; i < NrOfCreatures; i++) { Creature c = new Creature(Bounds); creature.Add(c); } food = new List<Food>(); for (int i = 0; i < NrOfFood; i++) { Food f = new Food(Bounds); food.Add(f); } obstacle = new List<Obstacle>(); for (int i = 0; i < NrOfObstacles; i++) { Obstacle o = new Obstacle(Bounds); obstacle.Add(o); } camera = new Camera(new Viewport(0, 0, 1600, 900)); GA = new GeneticAlgorithm(60, 1); NrOfDeaths = 0; GraphValue = new double[32000]; DoDraw = true; }
public Chronic(string name, Water water, Light light, Food food) : this(name) { Water = water; Light = light; Food = food; }
public Position calculateBeta(Krill krill, Food food, HerdParameters parameters) { Position betaFood = calculateBetaFood(food,krill); Position betaBest = calculateBetaBest(krill,parameters); //Debug.Log("Food " + betaFood + " best " + betaBest); return betaFood + betaBest; }
public FoodItemViewModel(Food food) : this() { Id = food.Id; Name = food.Name; Icon = food.Icon; }
public Herd(Transform carTransform,Transform[] krillViz,Transform visualFoodTransform) { this.carTransform = carTransform; this.krillViz = krillViz; krillSetter = new CircleKrillSetter(new HerdParameters()); food = new Food(algorithmParameters,visualFoodTransform); }
public virtual void HandleFood(Food food) { // Якщо не в змозі подужати їжу, передаємо її ближчому другові if (CafeVisitor != null) { CafeVisitor.HandleFood(food); } }
public ActionResult GetFoodList() { Food food = new Food { Title = "Moe's", Description = "Mexican food" }; List<Food> foodList = new List<Food>(); foodList.Add(food); foodList.Add(new Food { Title = "5 guys", Description = "Burgers" }); return Json(JsonConvert.SerializeObject(foodList)); }
Character.Stats TasteToStats.tasteToStats(Food food) { Character.Stats statsToReturn = new Character.Stats(); statsToReturn.MaxHP += food.foodTaste.umami; statsToReturn.AttackSpeed += food.foodTaste.bitter; statsToReturn.MovementSpeed += food.foodTaste.bitter; return statsToReturn; }
public Arena(int width, int height) { Width = width; Height = height; Cells = new Food[width, height]; Snake = new SnakeModel(this); }
/// <summary> /// Feeds the specified food. /// </summary> /// <param name="food">The food.</param> /// <exception cref="System.ArgumentException">Cats can only eat CatFood</exception> public override void Feed(Food food) { if (!(food is CatFood)) { throw new ArgumentException("Cats can only eat CatFood"); } this.IsHungry = false; }
public void EditFood(int id, Food food) { Food f = db.Foods.Find(id); f.CategaryId = food.CategaryId; f.Name = food.Name; f.Price = food.Price; f.Detail = food.Detail; db.SaveChanges(); }
public void calculateForagingMotion(List<Krill> herd, HerdParameters parameters, Food food) { foreach(Krill krill in herd){ Position oldForaging = krill.getForagingMotion() * parameters.inertiaForagingWeight; Position betaPosition = betaCalculator.calculateBeta(krill,food,parameters); betaPosition = betaPosition * parameters.Vf; krill.setForagingMotion(betaPosition + oldForaging); } }
Character.Stats TasteToStats.tasteToStats(Food food) { Character.Stats statsToReturn = new Character.Stats(); statsToReturn.MaxHP += food.foodTaste.umami; statsToReturn.CurrHP += food.foodTaste.spicy; statsToReturn.AttackDamage += food.foodTaste.spicy; statsToReturn.AttackSpeed += food.foodTaste.spicy; statsToReturn.MovementSpeed += food.foodTaste.spicy; return statsToReturn; }
public override void HandleFood(Food food) { if(food.Name == "Cappuccino") { Console.WriteLine("GirlFriend: My lovely cappuccino!!!"); return; } // Базовий виклик base.HandleFood(food) для останнього обробітника-дівчини // не має сенсу, тому можна викинути ексепшин або нічого не робити }
public AddFoodViewModel() { _isCanceled = false; Participants = new ObservableCollection<IParticipant>(); SelectedParticipants = new ObservableCollection<IParticipant>(); AvailableFood = new ObservableCollection<FoodItemViewModel>(); FillFood(); Food = new Food(); SelectedFoodItem = AvailableFood[0]; InitLabels(); }
public void Food_TestMe() { Food m = new Food() { Name = Guid.NewGuid().ToString(), UnitMeasurement = Guid.NewGuid().ToString(), StoreAmount = 0.0M, Category = Guid.NewGuid().ToString(), } ; m.TestMe(); }
public void OnDrop(PointerEventData eventData) { foodServed = eventData.pointerDrag.GetComponent<Food> (); if (foodServed != null) { foodServed.parentToReturnTo = this.transform; CheckAnswer(foodServed); } }
public void AddFood(Food f) { cmd = new SqlCommand("insert into FoodTbl values(@fname,@price,@fpic,@des,@isactive)", con); cmd.Parameters.AddWithValue("@fname", f.foodname); cmd.Parameters.AddWithValue("@price", f.price); cmd.Parameters.AddWithValue("@fpic", f.foodpic); cmd.Parameters.AddWithValue("@des", f.descrip); cmd.Parameters.AddWithValue("@isactive", f.isactive); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
public void Cook() { //烹飪一道食物 Food newFood = new Food(); if (CookingSlots.Count < MaxCookingSlots) { // 還有烹飪的空位 Debug.Log ("Start new cook"); CookingSlots.Add(newFood); newFood.StartTimer(); RefreshInfoText(); } }
/// <summary> /// Feeds the specified food. /// </summary> /// <param name="food">The food.</param> public override void Feed(Food food) { // Dog's will eat anything // but only DogFood will satisfy! if(food is DogFood) { this.IsHungry = false; } else { this.IsHungry = true; } }
public void AddNewFoodAndPoison(int n) { for (int i = 0; i < n; i++) { Foods.Add(new Food()); Foods[i] = new Food(); } for (int i = 0; i < n; i++) { Poisons.Add(new Poison()); Poisons[i] = new Poison(); } }
private void Eat(Food food) { food.GetComponent<Collider>().enabled = false; Destroy(food.gameObject, 2); movement.enabled = false; aggroCollider.gameObject.SetActive(false); --consumeCount; if (consumeCount <= 0) Destroy(gameObject, 2); else Invoke("Resume", 2); }
public void RefreshInfoText(Food cookingOne = null) { if (cookingOne != null) { CookingNameText.text = cookingOne.Name; CookingTimeLeftText.text = cookingOne.TimeLeft.ToString(); CookingWaitingText.text = (CookingSlots.Count - 1).ToString(); } else { CookingNameText.text = ""; CookingTimeLeftText.text = ""; CookingWaitingText.text = ""; } StockInfoText.text = Stock.Count.ToString(); }
public Food GetClosestFood(List<Food> food, Vector2 Start) { Food ClosestFood = new Food(Bounds); double Closest = 320000; foreach (Food f in food) { if (GetDistance(Start, f.position) < Closest) { Closest = GetDistance(Start, f.position); ClosestFood = f; } } return ClosestFood; }
public void AddFood(Food data) { Debug.Log("Player --" + data.name + "scorevalue " + data.poopValue); EventManager.TriggerEvent("SCORED_PLAYER" + playerID); score = data.poopValue; }
public void Add(Food food) => Food.Add(food);
public async Task UpdateFood(Food f) { await _connection.UpdateAsync(f); }
/// <summary> /// 根据aId取对应模板的店铺表的storeId /// </summary> /// <param name="aId"></param> /// <param name="errorMsg"></param> /// <returns></returns> public int ReturnStoreIdByAId(int aId, ref string errorMsg, ref string aids, ref string userIds, string telephone = "") { aids = aId.ToString(); //店铺ID int storeId = 0; XcxAppAccountRelation xcxrelation = base.GetModel(aId); if (xcxrelation == null) { errorMsg = "未找到小程序授权资料"; return(storeId); } XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel(xcxrelation.TId); if (xcxTemplate == null) { errorMsg = "未找到小程序的模板"; return(storeId); } switch (xcxTemplate.Type) { case (int)TmpType.小程序餐饮模板: Food store_Food = FoodBLL.SingleModel.GetModel($" appId = {xcxrelation.Id} "); if (store_Food == null) { errorMsg = "还未开通店铺"; return(storeId); } storeId = store_Food.Id; break; case (int)TmpType.小程序多门店模板: FootBath store_MultiStore = FootBathBLL.SingleModel.GetModel($" appId = {xcxrelation.Id} and HomeId = 0 "); if (store_MultiStore == null) { errorMsg = "还未开通店铺"; return(storeId); } storeId = store_MultiStore.Id; break; case (int)TmpType.小程序电商模板: case (int)TmpType.小程序专业模板: Store store = StoreBLL.SingleModel.GetModelByRid(xcxrelation.Id); if (store == null) { errorMsg = "还未开通店铺"; return(storeId); } storeId = store.Id; break; case (int)TmpType.小未平台子模版: PlatStore platstore = PlatStoreBLL.SingleModel.GetModelByAId(xcxrelation.Id); if (platstore == null) { errorMsg = "还未开通店铺"; return(storeId); } storeId = platstore.Id; break; case (int)TmpType.小未平台: storeId = -999; List <PlatStore> storeList = PlatStoreBLL.SingleModel.GetXcxRelationAppids(xcxrelation.Id); if (storeList != null && storeList.Count > 0) { aids = aId + "," + string.Join(",", storeList.Select(s => s.Aid)); string appids = "'" + string.Join("','", storeList.Select(s => s.AppId)) + "'"; List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByAppIds(telephone, appids); if (userInfoList == null || userInfoList.Count <= 0) { return(storeId); } userIds += "," + string.Join(",", userInfoList.Select(s => s.Id)); } break; default: errorMsg = "还未开通店铺"; return(storeId); } return(storeId); }
//parameter food 의 가격을 리턴함 private int getFoodPrice(Food food) { return((App.foodData.listFood.Where(x => x.Name == food.Name).ToList())[0].Price); }
public EatEntry(Mobile from, Food food) : base(6135, 1) { m_From = from; m_Food = food; }
// POST values public int Post([FromBody] Food value) { return(bl.InsertOrUpdateFood(value)); }
public async Task <IActionResult> Delete([FromBody] Food food) { await _foodService.Delete(food); return(Ok()); }
public EnterNewFoodBase() { NewFood = new Food(); }
/** \endcond */ /** * \brief Set the food of this dish. * @param food: a GameObject with a Food component attached */ public void SetFood(Food food) { myFood = food; //gameObject.GetComponentsInChildren<Food>()[0]; }
public override void Eat(Food food) { this.Weight += food.Quantity * foodIncrease; this.FoodEaten += food.Quantity; }
public void BecameRottenFood(Food targetFood) { //푸드팩토리에서 음식이 상하지 않는다 //상한 식량이 생기면 신선도를 초기화 한다 targetFood.ResetFreshness(); }
public void DeleteFood(int food) { Food f = c.foods.Select(x => x).Where(x => x.FoodID == food).First(); c.foods.Remove(f); }
public override void FeedAnimal(Food food) { base.Eat(food, new List <string> { nameof(Meat) }, weightToGain); }
public void Run() { string input = string.Empty; while ((input = Console.ReadLine()) != "End") { try { string[] animalInfo = input .Split(" ", StringSplitOptions.RemoveEmptyEntries); string[] foodInfo = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string animalType = animalInfo[0]; string name = animalInfo[1]; double weight = double.Parse(animalInfo[2]); if (animalType == "Hen" || animalType == "Owl") { double wingSize = double.Parse(animalInfo[3]); animal = this.birdFactory.CreateBird(animalType, name, weight, wingSize); } else if (animalType == "Mouse" || animalType == "Dog") { string livingRegion = animalInfo[3]; animal = this.mammalFactory.CreateMammal(animalType, name, weight, livingRegion); } else if (animalType == "Cat" || animalType == "Tiger") { string livingRegion = animalInfo[3]; string breed = animalInfo[4]; animal = this.felineFactory.CreateFeline(animalType, name, weight, livingRegion, breed); } string foodType = foodInfo[0]; int foodQuantity = int.Parse(foodInfo[1]); food = this.foodFactory.CreateFood(foodType, foodQuantity); animal.ProduceSound(); animal.Eat(food); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } animals.Add(animal); } foreach (var animal in animals) { Console.WriteLine(animal); } }
public void InsertFood(Food food) { food.FoodID = c.foods.Count(); c.foods.Add(food); food.FoodID = c.foods.Count(); }
public virtual void Feed(Food food) { }
public ShoppingVoucher(Country country, HotelClass hotelClass, Food food, double price) : base(country, hotelClass, food, price) { TypeOfVoucher = TypeOfVoucher.shopping; }
public IActionResult SaveFood([FromBody] Food food) { food.Id = Guid.NewGuid().ToString(); return(this.Ok(food)); }
public async Task <int> CreateProductAsync(Food newProduct) { return(await this._productRepos.CreateProductAsync(newProduct)); }
public abstract void Eat(Food food);
public override void TimeToEat(Food food, int quantity) { this.Weight += (weightIncreaseBy * quantity); this.FoodEaten += quantity; }
public async Task DeleteFood(Food f) { await _connection.DeleteAsync(f); }
public DroppedFood(int foodHash, Food food) { this.foodHash = foodHash; this.food = food; }
public override void awakeInit() { // this.memoryFoodLocations = new Dictionary<string,Vector3>(); realFoodType = Food.getFoodTypeFromEnum(foodType); }
public Task SaveFood(Food food) { return(_elasticClient.IndexDocumentAsync <Food>(food)); }
protected override void OnInitialized() { NewFood = new Food(); base.OnInitialized(); }
private OrderLineViewModel GetExistingOrderLineByFoodId(Food food) { return(OrderViewModel.OrderLines.SingleOrDefault(ol => ol.Food == food)); }
public bool InputFood(Food targetObject) { //재료를 집어넣는 기능? throw new System.NotImplementedException(); }
public void UpdateFood(Food food) { Food f = c.foods.Where(x => x.FoodID == food.FoodID).First(); f.Name = food.Name; }