private void txtSearchMenu_TextChanged(object sender, EventArgs e) { string searchtxt = txtSearchMenu.Text; MenuDAL mncDAL = new MenuDAL(); dgvmenu.DataSource = mncDAL.searchMenu(searchtxt); }
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 "); } } }
private void btSearchThucDon_Click(object sender, EventArgs e) { string searchtxt = txtSearchMenu.Text; MenuDAL mnDAL = new MenuDAL(); dgvmenu.DataSource = mnDAL.searchMenu(searchtxt); }
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); }
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); }
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); }
public ActionResult DescargarReporteFormatoPDF() { var collection = MenuDAL.ListadoReporteBasico(); byte[] buffer = GetPDF(columnasReportesBasicos, collection.Cast <object>().ToList()); return(File(buffer, PDFContentType, "ListadoMenu.pdf")); }
// 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"; }
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)); }
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 { } } } } }
public ActionResult Add() { if (!Utilities.IsLoggedUser()) { return(RedirectToAction("Login", "Home")); } ViewData["ListMenu"] = MenuDAL.GetSelectList(); return(View("AddOrEdit", new News())); }
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; } }
// GET: Menu public ActionResult BindMenu() { MenuDAL dal = new MenuDAL(); dtMenu = dal.getMenuList(); MenuBuild(0); ViewBag.strMenu = strbMenu.ToString(); return(PartialView()); }
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); }
public ActionResult EditMenu(MenuViewModel model) { MenuDAL dal = new MenuDAL(); var db = model.CastDB(model); dal.Update(db); dal.AcceptAllChange(); return(Content("Success")); }
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)); }
public void testGetData() { MenuDAL menuDal = MenuDAL.getInstance(); menu m = new menu(); m.id = 1; m = menuDal.selectSingle(m); Assert.AreEqual(m.name, "Pizzaa"); }
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)); }
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); }
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()); }
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)); }
public virtual void Update(MenuDataModel menu) { if (menu.ID > 0) { MenuDAL.Update(menu); } else { throw new Exception("Page not found"); } }
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")); }
/// <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; } }
public void testAddData() { menu m = new menu(); m.name = "Pizaa"; m.description = "Pizza menu"; m.position = 1; MenuDAL menuDAL = MenuDAL.getInstance(); menuDAL.insert(m); }
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()); }
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(); } } } } }
public static List <MenuModel> GetMenus() { try { var list = MenuDAL.GetMenus(); var menuList = ConvertMenu(list); return(menuList); } catch (Exception ex) { throw ex; } }
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); }
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()); }
// 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; } }
// 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; } }
// 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; } }
// 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; } }