Esempio n. 1
0
        private void btnYemekSil_Click(object sender, EventArgs e)
        {
            var f = FoodNavigateBLL.GetLastOrderFoods(OrderBLL.GetLastAddedOrder(masaID).Item1.SiparisID);

            if (f.Count() > 0)
            {
                int    silinecek = (int)dgvSiparisYemekleri.CurrentRow.Cells["kayitID"].Value;
                string yemek     = dgvSiparisYemekleri.CurrentRow.Cells["yemekID"].Value.ToString();
                var    y         = FoodBLL.GetFoodByName(yemek).First();
                if (FoodNavigateBLL.DeleteFromFoodNavigate(silinecek))
                {
                    OrderBLL.UpdateOrderBill(masaID);
                    MessageBox.Show("Yemek silindi.");

                    //Yemeğin stoğunu güncelle.
                    FoodBLL.UpdateFood(y.YemekID, y.YemekAdi, y.YemekMaliyeti.ToString(), y.YemekFiyati.ToString(), y.YemekKategorisi, (y.YemekMevcutAdet + 1).ToString(), y.YemekResmi);
                }
                else
                {
                    MessageBox.Show("Yemek silinirken hata oluştu.");
                }
                ListOrderFoods(masaID);
            }
            else
            {
                MessageBox.Show("Bu siparişin silinecek yemeği yoktur!");
            }
        }
Esempio n. 2
0
        public void YemekleriDoldur()
        {
            var f = FoodBLL.GetFoods();

            cmbSecim.DataSource    = f;
            cmbSecim.DisplayMember = "YemekAdi";
            cmbSecim.ValueMember   = "YemekID";
        }
Esempio n. 3
0
        //FOOD ADD
        private void btnAddFood_Click(object sender, EventArgs e)
        {
            var mesaj = FoodBLL.AddFood(txtAdi.Text, txtMaliyeti.Text, txtFiyati.Text, (int)cmbKategori.SelectedValue, txtAdet.Text, txtResim.Text);

            MessageBox.Show(mesaj);
            ListFoods(FoodBLL.GetFoods());
            CleanTextsFood();
        }
Esempio n. 4
0
 private void tcAdmin_SelectedIndexChanged(object sender, EventArgs e)
 {
     ListUsers(UserBLL.GetUsers());
     ListEmployees(EmployeeBLL.GetEmployees());
     AddEmployeesToUser(EmployeeBLL.GetEmployees());
     AddCategoriesToFood();
     ListFoods(FoodBLL.GetFoods());
     SiparisListele(OrderBLL.GetOrders());
 }
Esempio n. 5
0
        private void FrmSiparisOlustur_Load(object sender, EventArgs e)
        {
            NesneleriOlustur(FoodBLL.GetFoods());
            ListOrderFoods(masaID);

            //YemekEkleyebilsin(OrderBLL.GetLastAddedOrder(masaID).Item1);

            //İçeride ödenmeyen sipariş yoksa bunu true yap.
            //pbSiparisOlustur.Visible = true;
        }
Esempio n. 6
0
        public IHttpActionResult Put(HUTModels.Food model)
        {
            FoodBLL bll = new FoodBLL();

            if (bll.Update(model))
            {
                return(Ok());
            }
            else
            {
                return(Content(HttpStatusCode.InternalServerError, "Problem updating food record."));
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["q"] != null)
            {
                string[]  keywords = Request.QueryString["q"].Split(' ');
                FoodBLL   foodBLL  = new FoodBLL();
                UserBLL   userBLL  = new UserBLL();
                DataTable dt       = foodBLL.Search(keywords);
                if (dt.Rows.Count == 0)
                {
                    this.masonryDiv.InnerHtml = "<h2 align=\"center\">什么都没有找到</h2>";
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    User   user     = userBLL.QueryInfoByID(dt.Rows[i][1].ToString());
                    string facePath = "";
                    if (user != null && user.FacePath != "")
                    {
                        facePath = "Static/Image/Face/face_avatar2_" + user.FacePath + ".jpg";
                    }
                    else
                    {
                        facePath = "Static/Image/face_avatar_default.png";
                    }
                    string foodTitle = dt.Rows[i]["Title"].ToString();
                    if (Encoding.Default.GetByteCount(foodTitle) > 18)
                    {
                        foodTitle = foodTitle.Substring(0, 17) + "…";
                    }
                    string foodUrl = "Foods.aspx?id=" + dt.Rows[i]["ID"];

                    this.masonryDiv.InnerHtml += "<div class=\"item thumbnail\">"
                                                 + "<img class=\"img-rounded\" src=\"Static/Image/loading.gif\" data-original=\"Static/Image/Cover/cover_"
                                                 + dt.Rows[i]["Cover"].ToString()
                                                 + "\" >"
                                                 + "<hr />"
                                                 + "<div class=\"container-fluid\" style=\"margin-top: 5px;\">"
                                                 + "<div class=\"row-fluid\" >"
                                                 + "<div class=\"col-md-2 nop\">" + "<img class=\"img-circle img-face\" src=\"" + facePath + "\" title=\""
                                                 + user.NickName + "\" >" + "</div>" E : \ web设计 \ FoodStory \ FoodStory \ Login.aspx
                                                 + "<div class=\"col-md-3 nop food-title\"><p>分享的:</p></div>"
                                                 + "<div class=\"col-md-7 nop food-title\"><a href=\"" + foodUrl + "\">" + foodTitle + "</a></div>"
                                                 + "</div></div>"
                                                 + "</div>\r\n";
                }
            }
            else
            {
                //Response.Redirect("Index.aspx");
            }
        }
Esempio n. 8
0
 private void FrmAdmin_Load(object sender, EventArgs e)
 {
     SayWelcome(um);
     tmrSaat.Enabled = true;
     ListUsers(UserBLL.GetUsers());
     ListEmployees(EmployeeBLL.GetEmployees());
     AddEmployeesToUser(EmployeeBLL.GetEmployees());
     AddCategoriesToFood();
     ListFoods(FoodBLL.GetFoods());
     PaintTables(TableBLL.GetTables());
     MasalariDoldur(TableBLL.GetTables());
     PozisyonlarıDoldur();
     SiparisListele(OrderBLL.GetOrders());
 }
Esempio n. 9
0
        public IHttpActionResult RetrieveAndUpdatePhotoURL(HUTModels.Food model)
        {
            FoodBLL bll  = new FoodBLL();
            var     food = bll.RetrieveAndUpdatePhotoURL(model);

            if (food == null)
            {
                return(Content(HttpStatusCode.NotFound, "Food or Photo URL not found in external resource."));
            }
            else
            {
                return(Ok(food));
            }
        }
Esempio n. 10
0
        public IHttpActionResult GetUnlistedFood(string foodName)
        {
            FoodBLL bll   = new FoodBLL();
            var     foods = bll.GetUnlistedFood(foodName);

            if (foods == null)
            {
                return(Content(HttpStatusCode.NotFound, "Food not found in external resource."));
            }
            else
            {
                return(Ok(foods));
            }
        }
Esempio n. 11
0
        public IHttpActionResult GetListOfFoods()
        {
            FoodBLL bll   = new FoodBLL();
            var     foods = bll.GetListOfFoods();

            if (foods == null)
            {
                return(Content(HttpStatusCode.NotFound, "List of foods do not exist."));
            }
            else
            {
                return(Ok(foods));
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userName"] != null)
            {
                FoodBLL   foodBLL     = new FoodBLL();
                UserBLL   userBLL     = new UserBLL();
                User      userMe      = userBLL.QueryInfo(Session["userName"].ToString());
                DataTable dtFarvorite = userBLL.FarvoriteTable(userMe.ID);
                for (int i = 0; i < dtFarvorite.Rows.Count; i++)
                {
                    Food food = foodBLL.Query(dtFarvorite.Rows[i]["FoodID"].ToString());

                    User   user     = userBLL.QueryInfoByID(food.UploaderID);
                    string facePath = "";
                    if (user != null && user.FacePath != "")
                    {
                        facePath = "Static/Image/Face/face_avatar2_" + user.FacePath + ".jpg";
                    }
                    else
                    {
                        facePath = "Static/Image/face_avatar_default.png";
                    }
                    string foodTitle = food.Title;
                    if (Encoding.Default.GetByteCount(foodTitle) > 18)
                    {
                        foodTitle = foodTitle.Substring(0, 17) + "…";
                    }
                    string foodUrl = "Foods.aspx?id=" + food.ID;
                    //构造html
                    this.masonryDiv.InnerHtml += "<div class=\"item thumbnail\">"
                                                 + "<img class=\"img-rounded\" src=\"Static/Image/loading.gif\" data-original=\"Static/Image/Cover/cover_"
                                                 + food.Cover
                                                 + "\" >"
                                                 + "<hr />"
                                                 + "<div class=\"container-fluid\" style=\"margin-top: 5px;\">"
                                                 + "<div class=\"row-fluid\" >"
                                                 + "<div class=\"col-md-2 nop\">" + "<img class=\"img-circle img-face\" src=\"" + facePath + "\" title=\""
                                                 + user.NickName + "\" >" + "</div>"
                                                 + "<div class=\"col-md-3 nop food-title\"><p>分享的:</p></div>"
                                                 + "<div class=\"col-md-7 nop food-title\"><a href=\"" + foodUrl + "\">" + foodTitle + "</a></div>"
                                                 + "</div></div>"
                                                 + "</div>\r\n";
                }
            }
            else
            {
                Response.Redirect("Index.aspx");
            }
        }
Esempio n. 13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Session["userName"] != null)
            {
                UserBLL userBLL = new UserBLL();
                User    user    = userBLL.QueryInfo(Session["userName"].ToString());
                if (user == null)
                {
                    LayerShow.Alert(this, "请先登录", "Login.aspx");
                    return;
                }
                FoodBLL foodBLL = new FoodBLL();
                Food    food    = new Food();
                food.UploaderID = user.ID;
                if (txtTitle.Text.Length >= 4 && txtTitle.Text.Length <= 30)
                {
                    food.Title = txtTitle.Text;
                }
                else
                {
                    LayerShow.Msg(this, "标题的长度必须为4~30个字符");
                    return;
                }
                //简单的二次过滤(仍旧不安全),我相信ckeditor的过滤...
                food.Contents = CheckStr(txtCkeditor.Value);
                //读取POST进来的图片
                HttpPostedFile file        = Request.Files[Request.Files.AllKeys[0]];
                string         fileName    = DateTime.Now.ToString("yyyyMMddhhmmssff") + CreateRandomCode(8);
                int            pos         = file.FileName.LastIndexOf(".");
                string         extName     = file.FileName.Substring(pos, file.FileName.Length - pos);
                string         virtualPath = string.Format("~/Static/Image/Cover/cover_{0}{1}", fileName, extName);
                file.SaveAs(Server.MapPath(virtualPath));
                food.Cover = fileName + extName;

                if (foodBLL.Insert(food) == true)
                {
                    LayerShow.Alert(this, "美食分享成功", "Index.aspx");
                }
                else
                {
                    LayerShow.Alert(this, "分享出错", "Share.aspx");
                }
            }
            else
            {
                LayerShow.Alert(this, "请先登录", "Login.aspx");
            }
        }
Esempio n. 14
0
        //FOOD UPDATE
        private void btnModifyFood_Click(object sender, EventArgs e)
        {
            try
            {
                int duzenlenecek = (int)dgvYemek.CurrentRow.Cells["yemekID"].Value;
                var mesaj        = FoodBLL.UpdateFood(duzenlenecek, txtAdi.Text, txtMaliyeti.Text, txtFiyati.Text, (int)cmbKategori.SelectedValue, txtAdet.Text, txtResim.Text);
                MessageBox.Show(mesaj);
                ListFoods(FoodBLL.GetFoods());
            }
            catch (Exception)
            {
                MessageBox.Show("İçeride düzenlenecek yemek yoktur.");
            }

            CleanTextsFood();
        }
Esempio n. 15
0
        //FOOD DELETE
        private void btnDeleteFood_Click(object sender, EventArgs e)
        {
            try
            {
                int silinecek = (int)dgvYemek.CurrentRow.Cells["yemekID"].Value;
                if (FoodBLL.DeleteFood(silinecek))
                {
                    MessageBox.Show("Yemek silindi.");
                }
                else
                {
                    MessageBox.Show("Yemek silinirken hata oluştu.");
                }
                ListFoods(FoodBLL.GetFoods());
            }
            catch (Exception)
            {
                MessageBox.Show("İçeride silinecek yemek yoktur.");
            }

            CleanTextsFood();
        }