Exemplo n.º 1
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            food data = (food)AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(food));
            if (data == null)
            {
                data               = ScriptableObject.CreateInstance <food> ();
                data.SheetName     = filePath;
                data.WorksheetName = sheetName;
                AssetDatabase.CreateAsset((ScriptableObject)data, assetFilePath);
                //data.hideFlags = HideFlags.NotEditable;
            }

            //data.dataArray = new ExcelQuery(filePath, sheetName).Deserialize<foodData>().ToArray();

            //ScriptableObject obj = AssetDatabase.LoadAssetAtPath (assetFilePath, typeof(ScriptableObject)) as ScriptableObject;
            //EditorUtility.SetDirty (obj);

            ExcelQuery query = new ExcelQuery(filePath, sheetName);
            if (query != null && query.IsValid())
            {
                data.dataArray = query.Deserialize <foodData>().ToArray();
                ScriptableObject obj = AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ScriptableObject)) as ScriptableObject;
                EditorUtility.SetDirty(obj);
            }
        }
    }
Exemplo n.º 2
0
    private Sprite GetSprite(food Food)
    {
        Sprite result = null;

        foreach (recipeIngredent item in accepts)
        {
            if (item.foodTYPE == Food.type && item.foosSTATUS == Food.GetStatus())
            {
                if (solutin2 == 0)
                {
                    result    = item.icon;
                    solutin2 += 1;
                    one       = item.foodTYPE;
                    resultado();
                }
                else if (solutin2 == 1)
                {
                    result    = item.icon;
                    solutin2 += 1;
                    two       = item.foodTYPE;
                    resultado2();
                }
                else if (solutin2 == 2)
                {
                    result   = item.icon;
                    solutin2 = 0;
                    three    = item.foodTYPE;
                    resultado3();
                }
                break;
            }
        }

        return(result);
    }
        private void ptbFoodNamesDelete_Click(object sender, EventArgs e)
        {
            MC = new CitiZoneDataContext();
            int    FoodID = Int32.Parse(dgvFoods.SelectedCells[0].OwningRow.Cells[2].Value.ToString());
            string Food   = dgvFoods.SelectedCells[0].OwningRow.Cells[0].Value.ToString();

            if (check(FoodID))
            {
                MessageBox.Show("You must delete all bill contains this food first", "Notification");
            }
            else
            {
                if (MessageBox.Show("Food " + FoodID + " - " + Food + " will be permanently DELETED", "Notification",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    food food = new food();
                    food.foodID = FoodID;
                    foodServices.deleteFood(food);
                    ptbFoodDelete.Visible = false;
                }
                string CategoryID = dgvCategories.SelectedCells[0].OwningRow.Cells[0].Value.ToString();
                var    dgv        = (from s in MC.foods
                                     where s.categoryID == CategoryID
                                     select new
                {
                    Food = s.foodName,
                    Price = s.price,
                    ID = s.foodID
                }).ToList();
                dgvFoods.DataSource = dgv;
            }
        }
        public ActionResult Create([Bind(Include = "id,name,category_id,text,photo")] food food, HttpPostedFileBase photo)
        {
            if (ModelState.IsValid)
            {
                if (photo.ContentType == "image/jpeg" || photo.ContentType == "image/png" || photo.ContentType == "image/gif")
                {
                    //WebImage img = new WebImage(photo.InputStream);

                    DateTime now      = DateTime.Now;
                    string   fileName = now.ToString("yyyyMdHms") + Path.GetFileName(photo.FileName);
                    string   path     = Path.Combine(Server.MapPath("~/Uploads"), fileName);
                    photo.SaveAs(path);
                    //if (img.Width > 1000)
                    //    img.Resize(500, 500);
                    //img.Save(path);
                    food.photo = fileName;
                    db.foods.Add(food);
                    db.SaveChanges();
                }
                else
                {
                    ViewBag.category_id = new SelectList(db.food_categories, "id", "category_name");
                    ViewBag.Message     = "You can only jpg,png or gif file upload";
                    return(View());
                }
            }
            else
            {
                ViewBag.category_id = new SelectList(db.food_categories, "id", "category_name");
                ViewBag.Message     = "Errorrr";
                return(View());
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        public ActionResult deliver(food f, int code)
        {
            if (Session["nav"] == null)
            {
                return(View("Login"));
            }
            resturantEntities   re = new resturantEntities();
            IQueryable <orders> or = from o in re.orders select o;
            orders order           = new orders();

            order.code           = or.First().code - 1;
            order.delivery_code  = 1;
            order.orders_time    = DateTime.Now;
            order.recieved_time  = DateTime.Now;
            order.price          = f.price * 1000;
            order.delivery_price = 1000;
            re.orders.Add(order);
            re.SaveChanges();

            ordering orderings = new ordering();

            orderings.costumer   = ((mambership)Session["nav"]).username;
            orderings.order_code = order.code;
            orderings.food       = f.code;
            orderings.rcode      = int.Parse(Session["now"].ToString());
            re.ordering.Add(orderings);
            re.SaveChanges();

            return(View());
        }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        ActivateScript.SetActive(false);
        timer = foodGivingRate;
        if (!player)
        {
            player = GameObject.FindGameObjectWithTag("Player");
            pfood  = player.GetComponent <food>();
        }

        count = 0;
        foreach (Transform i in parentToSprites.transform)
        {
            count++;
        }
        sprites = new GameObject[count];
        count   = 0;
        foreach (Transform i in parentToSprites.transform)
        {
            sprites[count] = i.gameObject;
            count++;
        }


        for (int i = 0; i < sprites.Length; i++)
        {
            sprites[i].SetActive(false);
        }
        parentToGraySprite.SetActive(false);
        parentToSprites.SetActive(false);
    }
Exemplo n.º 7
0
        public static List <food> convert()
        {
            XDocument   xdoc1  = XDocument.Load(@"C:\Code\XML\XML\Resources\Menu.xml");
            food        food_s = new food();
            List <food> foods
                = (from _food in xdoc1.Element("a").Elements("food")
                   select new food
            {
                Name = _food.Element("name").Value,
                Price = _food.Element("price").Value,
                Description = _food.Element("description").Value,

                Ingredients = (from _ingredients in _food.Elements("ingredients")
                               select new ingredients
                {
                    animalFat = _ingredients.Element("parent").Value,
                }).FirstOrDefault(),

                /*
                 * objComment = (from _cmt in _marks.Elements("comments")
                 *                       select new Comment
                 *                       {
                 *                           TeacherComment = _cmt.Element("teacher").Value,
                 *                           ParentComment = _cmt.Element("parent").Value
                 *                       }).FirstOrDefault(),
                 * */
            }).ToList();

            return(foods);
        }
Exemplo n.º 8
0
        private async void imgF_Tapped(object sender, TappedRoutedEventArgs e)
        {
            CartItem   cartItem = lvCart.SelectedItem as CartItem;
            foodDetail f        = await new foodService().todaySpecial(cartItem.foodId);
            food       food     = f.data;

            MainPage.mainFrame.Navigate(typeof(thumb2), food);
        }
Exemplo n.º 9
0
Arquivo: Form2.cs Projeto: hung58/oop
 private void timer2_Tick(object sender, EventArgs e)   //食物產生
 {
     if (iseat == true)
     {
         iseat = false;
         fo    = ieat();
     }
 }
Exemplo n.º 10
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            food = e.Parameter as food;
            foodDetail f = await service.todaySpecial(food.id);

            ButtonBack.IsEnabled = this.Frame.CanGoBack;
            food = f.data;
        }
Exemplo n.º 11
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.gameObject.tag == "food")
     {
         foodTile = collision.collider.gameObject; // connects the foodTile to this bacterium
         food     = foodTile.GetComponent <food>();
     }
 }
Exemplo n.º 12
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            food food = db.food.Find(id);

            db.food.Remove(food);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     if (!Player)
     {
         Player = GameObject.FindGameObjectWithTag("Player");
         Pfood  = Player.GetComponent <food>();
     }
 }
Exemplo n.º 14
0
        /// <summary>
        /// 丢弃不新鲜食物
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult MessageDiuqi(int id)
        {
            food fo = db.food.SingleOrDefault(f => f.id == id);

            fo.status = 1;
            db.SaveChanges();
            return(Redirect("/home/MessagePage"));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 删除食物信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult FoodDeleteRequest(int id)
        {
            food fo = db.food.SingleOrDefault <food>(f => f.id == id);

            fo.status = 1;
            db.SaveChanges();

            return(Redirect("/food/foodlistpage?p=1"));
        }
Exemplo n.º 16
0
        //thêm món mới
        public void addFood(food food)
        {
            db = new CitiZoneDataContext();
            food fd = new food();

            fd = food;
            db.foods.InsertOnSubmit(fd);
            db.SubmitChanges();
        }
Exemplo n.º 17
0
 public food Insert_food_select(int ID)
 {
     food = food.Select(ID);
     Insert_clients_served_txt.Text      = Convert.ToString(food.clients_served);
     Insert_food_voucher_number_txt.Text = Convert.ToString(food.food_voucher_number);
     Insert_date_issued_txt.Text         = Convert.ToString(food.date_issued);
     Insert_Product_id_txt.Text          = Convert.ToString(food.Product_id);
     return(food);
 }
Exemplo n.º 18
0
 private void button1_Click(object sender, EventArgs e)
 {
     f = new food()
     {
         foodname = "test"
     };
     db.foods.InsertOnSubmit(f);
     list.Add(f);
 }
        //获取膳食所有数据
        public JsonResult getFoodInfoList()
        {
            var res = new JsonResult();

            BLL.Food    _food        = new BLL.Food();
            DataTable   dt           = _food.GetFoodInfoList();
            List <food> foodInfoList = new List <food>();

            if (dt.Rows.Count >= 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    food f = new food();
                    f.id             = dt.Rows[i]["id"].ToString();
                    f.type           = dt.Rows[i]["type"].ToString();
                    f.sub_type       = dt.Rows[i]["sub_type"].ToString();
                    f.title          = dt.Rows[i]["title"].ToString();
                    f.energy_kilocal = Convert.ToDouble(dt.Rows[i]["energy_kilocal"].ToString());
                    f.ca_mg          = Convert.ToDouble(dt.Rows[i]["ca_mg"].ToString());
                    f.protein_g      = Convert.ToDouble(dt.Rows[i]["protein_g"].ToString());
                    f.riboflavin_mg  = Convert.ToDouble(dt.Rows[i]["riboflavin_mg"].ToString());
                    f.mg_mg          = Convert.ToDouble(dt.Rows[i]["mg_mg"].ToString());
                    f.fat_g          = Convert.ToDouble(dt.Rows[i]["fat_g"].ToString());
                    f.niacin_mg      = Convert.ToDouble(dt.Rows[i]["niacin_mg"].ToString());
                    f.fe_mg          = Convert.ToDouble(dt.Rows[i]["fe_mg"].ToString());
                    f.vc_mg          = Convert.ToDouble(dt.Rows[i]["vc_mg"].ToString());
                    f.mn_mg          = Convert.ToDouble(dt.Rows[i]["mn_mg"].ToString());
                    f.ve_mg          = Convert.ToDouble(dt.Rows[i]["ve_mg"].ToString());
                    f.zn_mg          = Convert.ToDouble(dt.Rows[i]["zn_mg"].ToString());
                    f.cu_mg          = Convert.ToDouble(dt.Rows[i]["cu_mg"].ToString());
                    f.k_mg           = Convert.ToDouble(dt.Rows[i]["k_mg"].ToString());
                    f.p_mg           = Convert.ToDouble(dt.Rows[i]["p_mg"].ToString());
                    f.re_ug          = Convert.ToDouble(dt.Rows[i]["re_ug"].ToString());
                    f.na_mg          = Convert.ToDouble(dt.Rows[i]["na_mg"].ToString());
                    f.se_ug          = Convert.ToDouble(dt.Rows[i]["se_ug"].ToString());

                    foodInfoList.Add(f);
                }
                res.Data = new
                {
                    success  = true,
                    backData = foodInfoList
                };
            }
            else
            {
                res.Data = new
                {
                    success = false,
                    backMsg = "膳食查询失败"
                };
            }
            res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;//允许使用GET方式获取,否则用GET获取是会报错。

            return(res);
        }
Exemplo n.º 20
0
        //xoá món
        public void deleteFood(food food)
        {
            db = new CitiZoneDataContext();
            food fd = new food();

            fd = food;
            fd = db.foods.Single(x => x.foodID == food.foodID);
            db.foods.DeleteOnSubmit(fd);
            db.SubmitChanges();
        }
 public food Delete_food_select(int ID)
 {
     food = food.Select(ID);
     Delete_food_voucher_id_txt_lbl.Text = Convert.ToString(food.food_voucher_id);
     Delete_clients_served_txt_lbl.Text = Convert.ToString(food.clients_served);
     Delete_food_voucher_number_txt_lbl.Text = Convert.ToString(food.food_voucher_number);
     Delete_date_issued_txt_lbl.Text = Convert.ToString(food.date_issued);
     Delete_Product_id_txt_lbl.Text = Convert.ToString(food.Product_id);
     return food;
 }
Exemplo n.º 22
0
 public ActionResult Edit([Bind(Include = "ID,name,details,img,price")] food food)
 {
     if (ModelState.IsValid)
     {
         db.Entry(food).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(food));
 }
Exemplo n.º 23
0
        //cập nhật món
        public void updateFood(food food)
        {
            db = new CitiZoneDataContext();
            food fd = new food();

            fd = food;
            fd = db.foods.Single(x => x.foodID == food.foodID);
            setUpdateFood(fd, food);
            db.SubmitChanges();
        }
Exemplo n.º 24
0
        /// <summary>
        /// 食物列表
        /// </summary>
        /// <returns>食物信息、分类信息、用户信息</returns>
        public ActionResult FoodListPage(int?p)
        {
            if (p == null)
            {
                p = 1;
            }

            if (p < 1)
            {
                p = 1;
            }

            user_table user = checkUser();
            var        data = from f in db.food
                              join c in db.cate
                              on f.caid equals c.id
                              join u in db.user_table
                              on f.uid equals u.id
                              where f.fid == user.fid && f.status == 0
                              orderby f.id descending
                              select new FoodModel
            {
                U = u,
                C = c,
                F = f
            };
            int count = data.Count <FoodModel>();//总数
            List <FoodModel> foods = data.Skip((p.Value - 1) * pagesize).Take(pagesize).ToList <FoodModel>();

            foreach (FoodModel fm in foods)
            {
                var eatCount = db.consume.Where(c => c.fid == fm.F.id).Select(c => c.kg).Sum();
                if (eatCount != null)
                {
                    if (eatCount.Value >= fm.F.kg.Value)
                    {
                        fm.EatCount = fm.F.kg.Value;
                        food fo = db.food.SingleOrDefault <food>(f => f.id == fm.F.id);
                        fo.status = 2;
                        db.SaveChanges();
                    }
                    else
                    {
                        fm.EatCount = eatCount.Value;
                    }
                }
                else
                {
                    fm.EatCount = 0.0;
                }
            }
            ViewData["foods"] = foods;
            ViewData["count"] = count;
            return(View());
        }
Exemplo n.º 25
0
        /// <summary>
        /// 修改食物信息业务
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="kg"></param>
        /// <param name="cid"></param>
        /// <returns></returns>
        public ActionResult FoodUpdateRequest(int id, String name, double kg, int cid)
        {
            food fo = db.food.SingleOrDefault <food>(f => f.id == id);

            fo.name = name;
            fo.kg   = kg;
            fo.caid = cid;
            db.SaveChanges();

            return(Redirect("/food/foodlistpage?p=1"));
        }
Exemplo n.º 26
0
 private void spawnFood()
 {
     tfood.Interval = 1500;
     tfood.Tick    += (s, e) =>
     {
         food ftemp = new food(this.Width, this.Height);
         foods.Add(ftemp);
         this.Refresh();
     };
     tfood.Start();
 }
 public ActionResult Edit2([Bind(Include = "id,name,category_id,text,photo")] food food)
 {
     if (ModelState.IsValid)
     {
         db.Entry(food).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.category_id = new SelectList(db.food_categories, "id", "category_name", food.category_id);
     return(View(food));
 }
Exemplo n.º 28
0
        public ActionResult Create([Bind(Include = "ID,name,details,img,price")] food food)
        {
            if (ModelState.IsValid)
            {
                db.foods.Add(food);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(food));
        }
Exemplo n.º 29
0
        public static dynamic ParseFoodToJson(food food)
        {
            dynamic jsonObject = new JObject();

            jsonObject.foodName = food.foodName;
            jsonObject.protein  = food.protein;
            jsonObject.carbs    = food.carbs;
            jsonObject.fat      = food.fat;
            jsonObject.calories = food.calories;

            return(jsonObject);
        }
Exemplo n.º 30
0
		public void mappingValue(food thisType){
			if (thisType == food.banana) {
				this.dmg = 10f;
				this.health = 60f;
			} else if (thisType == food.apple) {
				this.dmg = 8f;
				this.health = 40f;
			} else if (thisType == food.strawberry) {
				this.dmg = 5f;
				this.health = 30f; 
			}
		}
 public food food_insert()
 {
     food.clients_served = Convert.ToInt32(Insert_clients_served_txt.Text);
     food.food_voucher_number = Convert.ToInt32(Insert_food_voucher_number_txt.Text);
     food.date_issued = Convert.ToDateTime(Insert_date_issued_txt.Text);
     food.Product_id = Convert.ToInt32(Insert_Product_id_txt.Text);
     food = food.Insert(food);
     Insert_food_GridView.DataBind();
     Update_food_GridView.DataBind();
     Delete_food_GridView.DataBind();
     return food;
 }
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            string FoodName = txtFoodName.Text;
            string Price    = txtPrice.Text;
            food   food     = new food();

            food.foodID   = Int32.Parse(txtID.Text);
            food.foodName = txtFoodName.Text;
            food.price    = Int32.Parse(txtPrice.Text);
            foodServices.updateFood(food);
            MessageBox.Show("Food " + txtID.Text + " has been updated", "Notification");
        }
Exemplo n.º 33
0
 public food food_insert()
 {
     food.clients_served      = Convert.ToInt32(Insert_clients_served_txt.Text);
     food.food_voucher_number = Convert.ToInt32(Insert_food_voucher_number_txt.Text);
     food.date_issued         = Convert.ToDateTime(Insert_date_issued_txt.Text);
     food.Product_id          = Convert.ToInt32(Insert_Product_id_txt.Text);
     food = food.Insert(food);
     Insert_food_GridView.DataBind();
     Update_food_GridView.DataBind();
     Delete_food_GridView.DataBind();
     return(food);
 }
 public food food_update(int ID)
 {
     food = food.Select(ID);
     food.food_voucher_id = Convert.ToInt32(Update_food_voucher_id_txt.Text);
     food.clients_served = Convert.ToInt32(Update_clients_served_txt.Text);
     food.food_voucher_number = Convert.ToInt32(Update_food_voucher_number_txt.Text);
     food.date_issued = Convert.ToDateTime(Update_date_issued_txt.Text);
     food.Product_id = Convert.ToInt32(Update_Product_id_txt.Text);
     food.Update(food);
     Insert_food_GridView.DataBind();
     Update_food_GridView.DataBind();
     Delete_food_GridView.DataBind();
     return food;
 }
Exemplo n.º 35
0
    public void mappingValue(food thisType)
    {
        if (thisType == food.banana)
        {
            this.dmg = 1f;
            this.health = 60f;
            this.originalHealth = 60f;
			this.moneyValue = 10;
        }
        else if (thisType == food.apple)
        {
            this.dmg = 4f;
            this.health = 200f;
            this.originalHealth = 200f;
			this.moneyValue = 20;
        }
        else if (thisType == food.strawberry)
        {
            this.dmg = 1.5f;
            this.health = 30f;
            this.originalHealth = 30f;
			this.moneyValue = 15;
        }
        else if(thisType == food.Burger)
        {
            this.dmg = 2f;
            this.health = 200f;
            this.moneyValue = 200;
            this.originalHealth = 200f;

        }
        else if(thisType == food.icecream)
        {
            this.dmg = 0.5f;
            this.health = 50f;
            this.originalHealth = 50f;
            this.moneyValue = 80;
        }
    }
 protected void INSERT(object sender, EventArgs e)
 {
     food = food_insert();
 }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     food = Insert_food_select(Convert.ToInt32(Insert_food_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     food = food_update(Convert.ToInt32(Update_food_GridView.SelectedValue));
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     food = Update_food_select(Convert.ToInt32(Update_food_GridView.SelectedValue));
 }
Exemplo n.º 40
0
		public minion(food thisType){
			this.thisType = thisType;
			mappingValue (thisType);
			//should have a method to map the corresponding heal and dmg to each type
		}
Exemplo n.º 41
0
 private int costList(food foodType)
 {
     if (foodType == food.banana)
         return 50;
     else if (foodType == food.strawberry)
         return 100;
     else if (foodType == food.apple)
         return 150;
     else if (foodType == food.tower) return 300;
     return 0;
 }