Ejemplo n.º 1
0
 public ActionResult Sua(Menu mn)
 {
     if (ModelState.IsValid)
     {
         var dao    = new MenuDAO();
         var result = dao.Sua(mn);
         if (result)
         {
             SetAlert("Cập nhật menu " + mn.TenMenu + " thành công!", "success");
             logger.Info("Cập nhật menu " + mn.TenMenu + " thành công!");
             if (Session["returnUrl"] == null)
             {
                 return(RedirectToAction("Them"));
             }
             else
             {
                 return(Redirect(Session["returnUrl"].ToString()));
             }
         }
         else
         {
             SetAlert("Cập nhật menu " + mn.TenMenu + " không thành công!", "error");
             logger.Error("Cập nhật menu " + mn.TenMenu + " không thành công!");
             ModelState.AddModelError("", "Sửa không thành công!");
         }
     }
     return(View());
 }
Ejemplo n.º 2
0
        public ActionResult XoaMenu(int ID)
        {
            var result = new MenuDAO().Delete(ID);

            SetAlert("Xóa thông tin thành công", "success");
            return(RedirectToAction("Index", "Menu"));
        }
Ejemplo n.º 3
0
        public ActionResult Update(int id)
        {
            var menu = new MenuDAO().GetMenuByID(id);

            SetViewBag(menu.typeID);
            return(View(menu));
        }
Ejemplo n.º 4
0
        public ActionResult UpdateMenu(int id)
        {
            var model = new MenuDAO().menuDetail(id);

            SetViewBag();
            return(View(model));
        }
        public JsonResult GetDisplayOrder(int display, string cal)
        {
            var dao = new MenuDAO();
            int res = dao.GetDisplayOrder(display, cal);

            return(Json(new { res = res }, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Edit(Menu menu, int id, string tempstatus)
 {
     SetMenuType();
     menu.MenuID = id;
     if (ModelState.IsValid)
     {
         if (tempstatus == "Kích Hoạt")
         {
             menu.Status = true;
         }
         else
         {
             menu.Status = false;
         }
         MenuDAO menuDAO = new MenuDAO();
         var     check   = menuDAO.Edit(menu);
         if (check > 0)
         {
             TempData["msg"] = MessageBox.Show("Edit successful");
             return(RedirectToAction("Index", "Menu", new { @page = priorpage }));
         }
         else
         {
         }
     }
     return(View(new { @menu = menu, @id = id }));
 }
Ejemplo n.º 7
0
 private void BindList()
 {
     this.listView.DataSource     = MenuDAO.GetHierarchyMenu(0, 0);
     this.listView.DataTextField  = "Name";
     this.listView.DataValueField = "Id";
     this.listView.DataBind();
 }
Ejemplo n.º 8
0
 public async Task <JsonResult> SaveMenu([FromBody] Menu Menu, string token)
 {
     if (await Seguranca.validaTokenAsync(token))
     {
         if (Menu.idCliente != 0)
         {
             if (MenuDAO.Save(Menu))
             {
                 return(Json("Menu salva com sucesso"));
             }
             else
             {
                 return(Json("Encontramos algum problema ao salvar o Menu. Entre em contato com o suporte"));
             }
         }
         else
         {
             return(Json("Encontramos algum problema ao salvar o Menu. Entre em contato com o suporte"));
         }
     }
     else
     {
         return(Json("Você nao tem acesso a esse plugin"));
     }
 }
Ejemplo n.º 9
0
 public MenuItemDetailVM(Page page, string restoName, MenuDAO menu)
     : base(page)
 {
     Title     = restoName;
     StoreName = restoName;
     this.Menu = menu;
 }
        public ActionResult MainMenu()
        {
            var dao   = new MenuDAO();
            var model = dao.GetListHomeCategory().Where(x => x.Status == true).OrderBy(x => x.DisplayOrder);

            return(PartialView(model));
        }
Ejemplo n.º 11
0
 public ActionResult TaoMenu(Menu model)
 {
     if (ModelState.IsValid)
     {
         SetViewBag(model.TypeID);
         if (model.TypeID == 2)
         {
             SetMenu(model.Submenu);
             model.Multilevel = false;
         }
         else
         {
             model.Submenu = null;
         }
         var kq = new MenuDAO().InsetMenu(model);
         if (kq)
         {
             SetAlert("Thêm menu thành công", "success");
             SetMenu();
             return(View());
         }
         else
         {
             ModelState.AddModelError("", "Có lỗi xảy ra!");
         }
     }
     SetMenu();
     return(View());
 }
        public ActionResult MenuRightTop()
        {
            var dao   = new MenuDAO();
            var model = dao.listMenuByMenuType(2);

            return(PartialView(model));
        }
Ejemplo n.º 13
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (MetroMessageBox.Show(this, Strings.ConfRegister, Strings.Register, MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                // Tratamento das Datas
                EntitiesContext context = new EntitiesContext();
                EventDAO        edao    = new EventDAO();
                aBeg = DateTime.Parse(mdtDateBegin.Text);
                bBeg = aBeg.ToString("dd/MM/yyyy");
                cBeg = bBeg + " " + txtTimeBegin.Text;
                aEnd = DateTime.Parse(mdtDateEnd.Text);
                bEnd = aEnd.ToString("dd/MM/yyyy");
                cEnd = bEnd + " " + txtTimeEnd.Text;

                //Tratamento da Combo Box Artista
                ArtistDAO adao = new ArtistDAO();
                idart = adao.FindIdByCb(mcbArtEvent.Text);

                //Tratamento da Combo Box Menu
                MenuDAO mdao = new MenuDAO();
                idmenu = mdao.FindIdByCb(mcbMenuEvent.Text);

                Event even = new Event()
                {
                    Name      = txtNameEvent.Text,
                    Desc      = txtDescEvent.Text,
                    TimeBegin = DateTime.Parse(cBeg),
                    TimeEnd   = DateTime.Parse(cEnd),
                    ArtistId  = idart,
                    MenuId    = idmenu
                };
                edao.Add(even);
                MetroMessageBox.Show(this, Strings.SuccessRegistered, Strings.Registered, MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
            }
        }
Ejemplo n.º 14
0
        private void ucAddEvent_Load(object sender, EventArgs e)
        {
            lblNameEvent.Text  = Strings.EventName;
            lblDescEvent.Text  = Strings.Desc;
            lblArtEvent.Text   = Strings.Artist;
            lblMenuEvent.Text  = Strings.Menu;
            lblBeginEvent.Text = Strings.Date;
            lblEndEvent.Text   = Strings.Time;
            btnRegistrer.Text  = Strings.Register;
            btnClear.Text      = Strings.ClearFields;

            ArtistDAO adao = new ArtistDAO();

            foreach (var a in adao.List())
            {
                mcbArtEvent.Items.Add(a.Id + "-" + a.Name);
            }

            MenuDAO mdao = new MenuDAO();

            foreach (var m in mdao.List())
            {
                mcbMenuEvent.Items.Add(m.Id + "-" + m.Name);
            }
        }
        public ActionResult Remove(int menuID)
        {
            MenuDAO menuDAO = new MenuDAO();

            menuDAO.Remove(menuID);
            return(RedirectToAction("Index", "Menu"));
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Usuario = Utilerias.FiltrarUsuario(Page);

            if (!IsPostBack)
            {
                List <Menu> Menus  = MenuDAO.ListarPorRol(Usuario.ClaveRol);
                List <Menu> Padres = Menu.JerarquizarMenus(Menus);

                litMenu.Text = Disenio.GenerarMenu(Padres, ResolveUrl);

                if (Usuario.EsJefeDivision)
                {
                    litRol.Text = Usuario.Division.Nombre;
                }
                else if (Usuario.EsJefeZona)
                {
                    litRol.Text = "ZONA " + Usuario.Zona.Nombre;
                }
                else if (Usuario.EsJefeArea)
                {
                    litRol.Text = "ÁREA " + Usuario.Area.Nombre;
                }
            }
        }
 public ActionResult Create(Menu menu, string tempstatus)
 {
     if (ModelState.IsValid)
     {
         if (tempstatus == "Kích Hoạt")
         {
             menu.Status = true;
         }
         else
         {
             menu.Status = false;
         }
         MenuDAO menuDAO = new MenuDAO();
         var     check   = menuDAO.Create(menu);
         if (check > 0)
         {
             TempData["msg"] = MessageBox.Show("Create Success");
             return(RedirectToAction("Create", "Menu"));
         }
         else
         {
             ModelState.AddModelError("", "Create fail");
         }
     }
     SetMenuType();
     return(View());
 }
Ejemplo n.º 18
0
        public ActionResult MainMenu()
        {
            var dao   = new MenuDAO();
            var model = dao.ListAllMenu();

            return(PartialView(model));
        }
Ejemplo n.º 19
0
        public void SetViewBags(int?selectedId = null)
        {
            var dao   = new MenuDAO();
            var menus = dao.GeList2();

            ViewBag.MenuID = new SelectList(menus, "ID", "Name", selectedId);
        }
Ejemplo n.º 20
0
        private void btCheckOut_Click(object sender, EventArgs e)
        {
            btCheckOut.Enabled = false;

            DataTable reportInfo = new DataTable();

            if (tbSelectedTable.Text != "")
            {
                string idBanAn         = tbSelectedTable.Text;
                string idHoaDonHienTai = lvBill.Tag.ToString();      // Lấy id hóa đơn hiện tại của bàn ăn;
                reportInfo = MenuDAO.GetDataReport(idHoaDonHienTai); // lấy dữ liệu report từ id hóa đơn
                HoaDonDAO.UpdateStatusHoaDon(idHoaDonHienTai, "1");  // Cập nhật status hóa đơn thành 1 (Đã thanh toán)
                // Lưu ý cập nhật hóa đơn trước vì nếu cập nhật bàn ăn trước sẽ không lấy được bill id của bàn ăn hiện tại
                BanAnDAO.ChangeTableStatus(idBanAn, "0");            // thay đổi status bàn ăn: trống

                DisplayTable();
                ShowBill(Convert.ToInt32(idBanAn));

                // tạo report
                GUI.Report.MenuBill report = new GUI.Report.MenuBill();
                report.SetDataSource(reportInfo);
                // Tiêm phụ thuộc data report
                GUI.Report.ReportViewer reportViewer = new GUI.Report.ReportViewer(report);
                reportViewer.Show();
            }
            else
            {
                MessageBox.Show("Vui lòng chọn 1 bàn để thanh toán");
            }
        }
Ejemplo n.º 21
0
        // GET: Admin/Menu
        public ActionResult Index()
        {
            var dao   = new MenuDAO();
            var model = dao.listMenu();

            return(View(model));
        }
Ejemplo n.º 22
0
        public IActionResult Index()
        {
            var claim  = HttpContext.User.Claims.First(c => c.Type == ClaimTypes.Sid);
            int idUser = int.Parse(claim.Value);

            MenuDAO dao = new MenuDAO();
            Menu    m   = dao.getLastestMenu(idUser);

            if (m == null) // falta verificar a data
            {
                return(RedirectToAction("Create", "Menu"));
            }

            DateTime date = m.StartingDate.AddDays(6);

            if (date.Date.CompareTo(DateTime.Now.Date) == -1)
            {
                return(RedirectToAction("Create", "Menu"));
            }

            Dictionary <int, byte[]> dict = new Dictionary <int, byte[]>();

            foreach (Recipe r in m.Recipes)
            {
                dict[r.Id_Recipe] = r.GetImage();
            }
            ViewBag.images = dict;

            return(View(m.OrderedRecipes()));
        }
        public JsonResult GetListHomeCategory()
        {
            var dao  = new MenuDAO();
            var data = dao.GetListHomeCategory();

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 24
0
        public ActionResult _MainMenu()
        {
            var dao   = new MenuDAO();
            var model = dao.GetMenuByMenuTypeID(2);

            return(PartialView(model));
        }
        public JsonResult DeleteHomeCategory(int Id)
        {
            var dao = new MenuDAO();
            int res = dao.DeleteHomeCategory(Id);

            return(Json(new { res = res }));
        }
Ejemplo n.º 26
0
        public ActionResult UpdateMenu(Menu mn)
        {
            GetViewBag_Session();
            if (ModelState.IsValid)
            {
                var dao = new MenuDAO();
                var id  = dao.Update(mn);

                // Written log
                var logEntity = new Log_Admin();
                logEntity.createBy    = ViewBag.Name_Session;
                logEntity.time        = DateTime.Now;
                logEntity.action      = "Cập nhật menu " + "<a href = \"/Admin/Menu/Update/" + mn.ID + "\">" + mn.ID + "</a>";
                logEntity.description = ViewBag.Name_Session + " cập nhật menu trong hệ thống";
                var wlog = new Log_AdminDAO().InsertLog(logEntity);

                if (id)
                {
                    return(RedirectToAction("Index", "Menu"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm menu thành công");
                }
            }
            ListMenuType(mn.TypeID);
            return(View("UpdateMenu"));
        }
Ejemplo n.º 27
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MetroMessageBox.Show(this, "Are you sure you want to update this register?", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                // Tratamento das Datas
                EntitiesContext context = new EntitiesContext();
                EventDAO        edao    = new EventDAO();
                aBeg = DateTime.Parse(mdtDateBegin.Text);
                bBeg = aBeg.ToString("dd/MM/yyyy");
                cBeg = bBeg + " " + txtTimeBegin.Text;
                aEnd = DateTime.Parse(mdtDateEnd.Text);
                bEnd = aEnd.ToString("dd/MM/yyyy");
                cEnd = bEnd + " " + txtTimeEnd.Text;

                //Tratamento da Combo Box Artista
                ArtistDAO adao = new ArtistDAO();
                idart = adao.FindIdByCb(mcbArtEvent.Text);

                //Tratamento da Combo Box Menu
                MenuDAO mdao = new MenuDAO();
                idmenu = mdao.FindIdByCb(mcbMenuEvent.Text);

                Event eve = edao.FindId(global.ideve);
                eve.Name      = txtNameEvent.Text;
                eve.Desc      = txtDescEvent.Text;
                eve.TimeBegin = DateTime.Parse(cBeg);
                eve.TimeEnd   = DateTime.Parse(cEnd);
                eve.ArtistId  = idart;
                eve.MenuId    = idmenu;
                edao.Update();
                MetroMessageBox.Show(this, "Register Successfully Updated", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
            }
        }
Ejemplo n.º 28
0
        public ActionResult TopMenu()
        {
            MenuDAO menuDAO = new MenuDAO();
            var     menus   = menuDAO.ListMenu(23);

            return(PartialView(menus));
        }
Ejemplo n.º 29
0
        // GET: Admin/Menu
        public ActionResult Index()
        {
            int currPage = int.Parse("0" + Request.QueryString["page"]); //Lấy page truyền vào ở View

            if (currPage == 0)
            {
                currPage = 1;                //Neu currePage la 0 thi hien thi sang 1
            }
            //string searchString=null;
            string searchString = Request.QueryString["searchString"];
            int    recordPage   = 5;     //Số bản ghi hiển thị trên 1 trang
            int    totalRecord  = 0;     //khởi tạo tổng số bản ghi là 0

            ViewBag.Total = totalRecord; //So ban ghi
            ViewBag.Page  = currPage;    //Trang hien tai

            //Lấy tổng số bản ghi, và truyền tham số phân trang
            var model = new MenuDAO().ListAll(searchString, ref totalRecord, currPage, recordPage);

            int maxPage   = 5;
            int toTalPage = 0;                                                     //Khởi tạo tổng số trang

            toTalPage = (int)Math.Ceiling((double)(totalRecord / recordPage)) + 1; //tong so trang = tong so ban ghi / so ban ghi hien thi, 16/5, neu du + 1 trang

            ViewBag.SearchString = searchString;
            //Gans sang ViewBag để hiển thị bên View
            ViewBag.TotalPage = toTalPage;
            ViewBag.MaxPage   = maxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = toTalPage;
            ViewBag.Next      = currPage + 1;
            ViewBag.Prev      = currPage - 1;

            return(View(model));
        }
Ejemplo n.º 30
0
        public ActionResult CapNhatMenu(int ID)
        {
            var model = new MenuDAO().GetByID(ID);

            DropdownMenuType(model.TypeID);

            return(View(model));
        }