コード例 #1
0
        private void txtSearchMenu_TextChanged(object sender, EventArgs e)
        {
            string  searchtxt = txtSearchMenu.Text;
            MenuDAL mncDAL    = new MenuDAL();

            dgvmenu.DataSource = mncDAL.searchMenu(searchtxt);
        }
コード例 #2
0
        private void btDeleteThucDon_Click(object sender, EventArgs e)
        {
            int     idCate = Convert.ToInt16(cbMenuCate.SelectedValue.ToString());
            MenuDAL mnDAL  = new MenuDAL();

            if (txtMaMon.TextLength == 0)
            {
                MessageBox.Show("Chưa có mã món", " Lỗi ");
            }
            else
            {
                try
                {
                    int id = Convert.ToInt16(txtMaMon.Text);
                    if (MessageBox.Show("Bạn có chắc muốn xóa món?", "Thông báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                    {
                        mnDAL.deleteMenu(id);
                        // dgvmenu.DataSource = mnDAL.LoadDSMenuByCate(idCate);
                        HienThiDSMenu();
                    }
                    else
                    {
                        MessageBox.Show(" Có lỗi khi xóa món", "Thông báo");
                    }
                }
                catch
                {
                    MessageBox.Show("Mã món không thỏa mãn", " Lỗi ");
                }
            }
        }
コード例 #3
0
        private void btSearchThucDon_Click(object sender, EventArgs e)
        {
            string  searchtxt = txtSearchMenu.Text;
            MenuDAL mnDAL     = new MenuDAL();

            dgvmenu.DataSource = mnDAL.searchMenu(searchtxt);
        }
コード例 #4
0
        public Resultado Alterar(Menu objMenu)
        {
            Resultado retorno = new Resultado();

            if (objMenu.Codigo == byte.MinValue)
            {
                retorno.Erro("Código não informado");
                return(retorno);
            }

            if (String.IsNullOrEmpty(objMenu.Nome))
            {
                retorno.Erro("Nome não informada");
                return(retorno);
            }

            if (objMenu.Link.Trim() == string.Empty && objMenu.Nivel == 4)
            {
                retorno.Erro("Link não informado");
                return(retorno);
            }

            if (objMenu.MenuPai.Codigo == int.MinValue && objMenu.Nivel > 1)
            {
                retorno.Erro("Menu pai não informado");
                return(retorno);
            }

            retorno = new MenuDAL().Alterar(objMenu);

            return(retorno);
        }
コード例 #5
0
        public Resultado Incluir(Menu objMenu)
        {
            Resultado retorno = new Resultado();

            //VALIDAÇÕES/REGRAS DE NEGÓCIO
            if (objMenu.Codigo == byte.MinValue)
            {
                retorno.Erro("Código não informado");
                return(retorno);
            }

            if (objMenu.Nome.Trim() == string.Empty)
            {
                retorno.Erro("Nome não informada");
                return(retorno);
            }

            if (objMenu.Link.Trim() == string.Empty && objMenu.Nivel == 4)
            {
                retorno.Erro("Link não informado");
                return(retorno);
            }

            if (objMenu.MenuPai.Codigo == int.MinValue && objMenu.Nivel > 1)
            {
                retorno.Erro("Menu pai não informado");
                return(retorno);
            }

            //TÉRMINO DAS VALIDAÇÕES

            retorno = new MenuDAL().Incluir(objMenu);

            return(retorno);
        }
コード例 #6
0
        private int GetAuthType(Guid authSourceFid)
        {
            int dataCnt = new MenuDAL().GetCounts("and [VALID_FLAG] <> 0 and [NEED_AUTH] = 1 and [FID] = '" + authSourceFid + "'");

            if (dataCnt > 0)
            {
                return(1);
            }
            dataCnt = new MenuActionDAL().GetCounts("and [VALID_FLAG] <> 0 and [NEED_AUTH] = 1 and [FID] = '" + authSourceFid + "'");
            if (dataCnt > 0)
            {
                return(2);
            }
            dataCnt = new ReportDAL().GetCounts("and [VALID_FLAG] <> 0 and [IS_AUTH] = 1 and [FID] = '" + authSourceFid + "'");
            if (dataCnt > 0)
            {
                return(3);
            }
            dataCnt = new ChartDAL().GetCounts("and [VALID_FLAG] <> 0 and [IS_AUTH] = 1 and [FID] = '" + authSourceFid + "'");
            if (dataCnt > 0)
            {
                return(4);
            }
            return(0);
        }
コード例 #7
0
        public ActionResult DescargarReporteFormatoPDF()
        {
            var collection = MenuDAL.ListadoReporteBasico();

            byte[] buffer = GetPDF(columnasReportesBasicos, collection.Cast <object>().ToList());

            return(File(buffer, PDFContentType, "ListadoMenu.pdf"));
        }
コード例 #8
0
        // hien thi menu theo category

        public void loadMenu(int idCategory)
        {
            MenuDAL menuDAL = new MenuDAL();

            cbMenu.DataSource    = menuDAL.getListMenuByIdCategory(idCategory);
            cbMenu.DisplayMember = "Name";
            cbMenu.ValueMember   = "Id";
        }
コード例 #9
0
        public JsonResult _GetOpcionesMenu()
        {
            List <MultiSelectJQuery> items = new List <MultiSelectJQuery>();

            items = MenuDAL.ListarMenuHijos()
                    .Select(o => new MultiSelectJQuery(o.IdMenu, o.NombreMenu, o.NombrePaginaMenu)).ToList();
            return(Json(items, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        private void btInsertThucDon_Click(object sender, EventArgs e)
        {
            int idCate = Convert.ToInt16(cbMenuCate.SelectedValue.ToString());

            ENTITY.Menu mn    = new ENTITY.Menu();
            MenuDAL     mnDAL = new MenuDAL();

            mn.IdCategory = idCate;

            if (txtMaMon.TextLength != 0)
            {
                MessageBox.Show("Không cần nhập mã món", " Lỗi ");
            }
            else
            {
                if (txtTenMon.TextLength == 0)
                {
                    MessageBox.Show("Chưa nhập tên món", " Lỗi ");
                }
                else
                {
                    mn.Name = txtTenMon.Text;

                    if (txtGia.TextLength == 0)
                    {
                        MessageBox.Show("Chưa nhập giá ", " Lỗi ");
                    }
                    else
                    {
                        mn.Price = Convert.ToInt32(txtGia.Text.ToString());
                        try
                        {
                            if (rbCon.Checked == false && rbHet.Checked == false)
                            {
                                MessageBox.Show("Chưa chọn tình trạng món ăn", " Lỗi ");
                            }
                            else
                            {
                                if (rbCon.Checked == true)
                                {
                                    mn.Status = "Còn";
                                }
                                else if (rbHet.Checked == true)
                                {
                                    mn.Status = "Hết";
                                }
                                mnDAL.insertMenu(mn);
                                // dgvmenu.DataSource = mnDAL.LoadDSMenuByCate(idCate);
                                HienThiDSMenu();
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
コード例 #11
0
ファイル: NewsController.cs プロジェクト: tnhhcmus/Projects
 public ActionResult Add()
 {
     if (!Utilities.IsLoggedUser())
     {
         return(RedirectToAction("Login", "Home"));
     }
     ViewData["ListMenu"] = MenuDAL.GetSelectList();
     return(View("AddOrEdit", new News()));
 }
コード例 #12
0
 protected override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     if (Session[Constant.ObjectModel] == null)
     {
         MenuDAL    dal   = new MenuDAL();
         IMenuModel model = dal.SelectMenu(Convert.ToInt64(User.Identity.GetUserId()));
         Session[Constant.ObjectModel] = model;
     }
 }
コード例 #13
0
        // GET: Menu
        public ActionResult BindMenu()
        {
            MenuDAL dal = new MenuDAL();

            dtMenu = dal.getMenuList();
            MenuBuild(0);
            ViewBag.strMenu = strbMenu.ToString();
            return(PartialView());
        }
コード例 #14
0
        private void GetMenu()
        {
            MenuDAL        menuDal        = new MenuDAL();
            RolePurviewDAL rolePurviewDal = new RolePurviewDAL();
            string         roleId         = CookieHelper.GetCookie("RoleIDList");
            ArrayList      purviewList    = rolePurviewDal.GetPurviewListByRoleID(roleId);

            ViewBag.LeftMenuList = menuDal.GetMyTreeMenuList(roleId, purviewList);
        }
コード例 #15
0
        public ActionResult EditMenu(MenuViewModel model)
        {
            MenuDAL dal = new MenuDAL();
            var     db  = model.CastDB(model);

            dal.Update(db);
            dal.AcceptAllChange();
            return(Content("Success"));
        }
コード例 #16
0
        public ActionResult EditMenu(string id)
        {
            MenuDAL       dal    = new MenuDAL();
            var           menu   = dal.Get(id);
            MenuViewModel Vmodel = new MenuViewModel();

            Vmodel = Vmodel.CastModel(menu);
            return(View(Vmodel));
        }
コード例 #17
0
        public void testGetData()
        {
            MenuDAL menuDal = MenuDAL.getInstance();
            menu    m       = new menu();

            m.id = 1;
            m    = menuDal.selectSingle(m);
            Assert.AreEqual(m.name, "Pizzaa");
        }
コード例 #18
0
        public List <ActionInfo> GetCommonEditActionByMenuName(string menuName, Guid roleFid)
        {
            Guid menuFid = new MenuDAL().GetFidByMenuNameInType2(menuName);

            if (menuFid == Guid.Empty)
            {
                return(new List <ActionInfo>());
            }
            return(GetActionsByMenuRoleFid(menuFid, roleFid));
        }
コード例 #19
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            WXConfigDAL wcdal = new WXConfigDAL();

            //Model.WeiXin.WXConfig wxConfig = wcdal.GetWXConfigBySiteCode("QJTV");
            //Model.WeiXin.WXConfig wxConfig = wcdal.GetWXConfigBySiteCode("KM_HLF");
            //Model.WeiXin.WXConfig wxConfig = wcdal.GetWXConfigBySiteCode("yn-zhbm");
            Model.WeiXin.WXConfig wxConfig = wcdal.GetWXConfigBySiteCode("VYIGO");
            MenuDAL.CreateWeiXinMenu(wxConfig.ID);
        }
コード例 #20
0
        public ActionResult Create()
        {
            var listado = MenuDAL.ListarMenu().Select(s => new Menu {
                IdMenu = s.IdMenu, NombreMenu = s.OpcionMenu + " ( " + s.RutaAcceso + " )"
            }).AsEnumerable();

            ViewBag.listadoMenu = new SelectList(listado, "IdMenu", "NombreMenu");

            return(View());
        }
コード例 #21
0
        public ActionResult Eliminar(int id)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RespuestaTransaccion resultado = MenuDAL.EliminarMenu(id);// await db.Cabecera.FindAsync(id);

            //return RedirectToAction("Index");
            return(Json(new { Resultado = resultado }, JsonRequestBehavior.AllowGet));
        }
コード例 #22
0
 public virtual void Update(MenuDataModel menu)
 {
     if (menu.ID > 0)
     {
         MenuDAL.Update(menu);
     }
     else
     {
         throw new Exception("Page not found");
     }
 }
コード例 #23
0
        public ActionResult AddMenu(MenuViewModel model)
        {
            MenuDAL dal = new MenuDAL();

            model.ID = Guid.NewGuid().ToString();
            var db = model.CastDB(model);

            dal.Add(db);
            dal.AcceptAllChange();
            return(ToJsonResult("Success"));
        }
コード例 #24
0
 /// <summary>
 /// Method to Get Menus.
 /// </summary>
 /// <param name="argEn">Menu Entity is an Input.MenuID is an Input Property</param>
 /// <returns>List of Menu Entity</returns>
 public MenuEn GetMenus(MenuEn argEn)
 {
     try
     {
         MenuDAL loDs = new MenuDAL();
         return(loDs.GetMenus(argEn));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #25
0
        public void testAddData()
        {
            menu m = new menu();

            m.name        = "Pizaa";
            m.description = "Pizza menu";
            m.position    = 1;

            MenuDAL menuDAL = MenuDAL.getInstance();

            menuDAL.insert(m);
        }
コード例 #26
0
        public async Task <ActionResult> Index(CancellationToken cancellationToken)
        {
            if (Session[Constant.ObjectModel] == null)
            {
                MenuDAL    dal   = new MenuDAL();
                IMenuModel model = await dal.SelectMenuAsync(Convert.ToInt64(User.Identity.GetUserId()), GetCanellationToken(cancellationToken));

                Session[Constant.ObjectModel] = model;
            }

            return(View());
        }
コード例 #27
0
        private void btEditThucDon_Click(object sender, EventArgs e)
        {
            int idCate = Convert.ToInt16(cbMenuCate.SelectedValue.ToString());

            ENTITY.Menu mn = new ENTITY.Menu();
            mn.Id = Convert.ToInt16(txtMaMon.Text);
            MenuDAL mnDAL = new MenuDAL();

            if (txtMaMon.Text != mn.Id.ToString())
            {
                MessageBox.Show("Không được sửa mã món", " Lỗi ");
            }
            else
            {
                if (txtTenMon.TextLength == 0)
                {
                    MessageBox.Show("Chưa nhập tên món", " Lỗi ");
                }

                else
                {
                    mn.Name = txtTenMon.Text;
                    if (txtGia.TextLength == 0)
                    {
                        MessageBox.Show("Chưa nhập giá ", " Lỗi ");
                    }
                    else
                    {
                        mn.Price = Convert.ToInt32(txtGia.Text.ToString());

                        if (rbCon.Checked == false && rbHet.Checked == false)
                        {
                            MessageBox.Show("Chưa chọn tình trạng món ăn", " Lỗi ");
                        }
                        else
                        {
                            if (rbCon.Checked == true)
                            {
                                mn.Status = "Còn";
                            }
                            else if (rbHet.Checked == true)
                            {
                                mn.Status = "Hết";
                            }
                            mnDAL.UpdateMenu(mn.Name, mn.Price, mn.Status, mn.Id);
                            MessageBox.Show("Bạn đã sửa món thành công", "thông báo");
                            // dgvmenu.DataSource = mnDAL.LoadDSMenuByCate(idCate);
                            HienThiDSMenu();
                        }
                    }
                }
            }
        }
コード例 #28
0
 public static List <MenuModel> GetMenus()
 {
     try
     {
         var list     = MenuDAL.GetMenus();
         var menuList = ConvertMenu(list);
         return(menuList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #29
0
        public static MenuDTO GetById(int idMenu)
        {
            Menu menuModel = MenuDAL.GetById(idMenu);

            if (menuModel != null)
            {
                MenuDTO rtn = new MenuDTO(menuModel);
                rtn.PermissionList = GetMenuPermissionByMenuId(idMenu);
                return(rtn);
            }

            return(null);
        }
コード例 #30
0
ファイル: UserDAL.cs プロジェクト: zykitzy/Com.HSJF.HEAS
        public IEnumerable <Menu> GetMenuList(string userid)
        {
            MenuDAL      md   = new MenuDAL();
            User2MenuDAL u2md = new User2MenuDAL();
            var          u2m  = u2md.GetAll().Where(o => o.UserID == userid);

            var ml = from i in md.GetAll()
                     join j in u2m
                     on i.ID equals j.MenuID
                     select i;

            return(ml.AsEnumerable());
        }
コード例 #31
0
 //  To pass 'Menu' data in MenuDAL Data Access Layer for insertion
 public int InsertMenu(string MenuName,string MenuDesc,int IsActive,int LoggedInUser, string RetMsg)
 {
     MenuDAL MenuDAL = new MenuDAL();
     try
     {
         return MenuDAL.InsertMenu(MenuName, MenuDesc, IsActive, LoggedInUser, RetMsg);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuDAL = null;
     }
 }
コード例 #32
0
 // To pass 'Menu' data in MenuDAL Data Access Layer to show Active type records
 public DataTable LoadActiveMenu(bool IsActive, int LoggedInUser, string RetMsg)
 {
     MenuDAL MenuDAL = new MenuDAL();
     try
     {
         return MenuDAL.LoadActiveMenu(IsActive, LoggedInUser, RetMsg);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuDAL = null;
     }
 }
コード例 #33
0
 // To pass 'Menu' data in MenuDAL Data Access Layer to show Active and Inactive type records
 public DataTable LoadAllMenu(int LoggedInUser, string RetMsg)
 {
     MenuDAL MenuDAL = new MenuDAL();
     try
     {
         return MenuDAL.LoadAllMenu(LoggedInUser, RetMsg);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuDAL = null;
     }
 }
コード例 #34
0
 // To pass 'Menu' data in MenuDAL Data Access Layer to show selected MenuId records
 public DataTable SelectMenuID(int MenuId, int LoggedInUser, string RetMsg)
 {
     MenuDAL MenuDAL = new MenuDAL();
     try
     {
         return MenuDAL.SelectMenuID(MenuId, LoggedInUser, RetMsg);
     }
     catch
     {
         throw;
     }
     finally
     {
         MenuDAL = null;
     }
 }