Beispiel #1
0
 protected void myGrid_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         bll.DeleteMenu(Convert.ToInt32(e.CommandArgument));
     }
     PageInit();
 }
Beispiel #2
0
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ResultObject resultObj;

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_MENU", out List <M_Menu> c_lstMenu))
                {
                    var m_Menu = c_lstMenu.Find(m => m.Id == id);

                    if (m_Menu == null)
                    {
                        return(NotFound());
                    }

                    m_Menu.Updated_By = await base.CurrentUserId();

                    using (var menuBll = new MenuBLL())
                    {
                        resultObj = await menuBll.DeleteMenu(m_Menu);

                        _cache.Remove("CACHE_MASTER_MENU");
                    }

                    return(Json(new { success = true, data = (M_Menu)resultObj.ObjectValue, message = "Menu Deleted." }));
                }

                using (var menuBll = new MenuBLL())
                {
                    var lstMenu = await menuBll.GetMenu(id);

                    var m_Menu = lstMenu.First();

                    if (m_Menu == null)
                    {
                        return(NotFound());
                    }

                    m_Menu.Updated_By = await base.CurrentUserId();

                    resultObj = await menuBll.DeleteMenu(m_Menu);

                    _cache.Remove("CACHE_MASTER_MENU");
                }

                return(Json(new { success = true, data = (M_Menu)resultObj.ObjectValue, message = "Menu Deleted." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
Beispiel #3
0
 public MessageResult DeleteMenu(ReqQueryInfo reqQueryInfo)
 {
     try
     {
         var result = menuBLL.DeleteMenu(reqQueryInfo.KeyIds, reqQueryInfo.TypeId);
         return(MessageResult.Success(result));
     }
     catch (Exception ex)
     {
         return(MessageResult.Fail(ex.Message));
     }
 }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.CheckAdminPower("ReadMenu", PowerCheckType.Single);
            string queryString = RequestHelper.GetQueryString <string>("Action");
            int    id          = RequestHelper.GetQueryString <int>("ID");

            this.fatherID = RequestHelper.GetQueryString <int>("FatherID");
            if (this.fatherID == -2147483648)
            {
                this.fatherID = 1;
            }
            if ((queryString != string.Empty) && (id != -2147483648))
            {
                string str2 = queryString;
                if (str2 != null)
                {
                    if (!(str2 == "Up"))
                    {
                        if (str2 == "Down")
                        {
                            base.CheckAdminPower("UpdateMenu", PowerCheckType.Single);
                            MenuBLL.MoveDownMenu(id);
                            AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Menu"), id);
                        }
                        else if (str2 == "Delete")
                        {
                            base.CheckAdminPower("DeleteMenu", PowerCheckType.Single);
                            MenuBLL.DeleteMenu(id);
                            AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Menu"), id);
                        }
                    }
                    else
                    {
                        base.CheckAdminPower("UpdateMenu", PowerCheckType.Single);
                        MenuBLL.MoveUpMenu(id);
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Menu"), id);
                    }
                }
            }
            base.BindControl(MenuBLL.ReadMenuAllNamedChildList(this.fatherID), this.RecordList);
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAdminPower("ReadMenu", PowerCheckType.Single);
            string action = RequestHelper.GetQueryString <string>("Action");
            int    menuID = RequestHelper.GetQueryString <int>("ID");

            fatherID = RequestHelper.GetQueryString <int>("FatherID");
            if (fatherID == int.MinValue)
            {
                fatherID = 1;
            }
            if (action != string.Empty && menuID != int.MinValue)
            {
                switch (action)
                {
                case "Up":
                    CheckAdminPower("UpdateMenu", PowerCheckType.Single);
                    MenuBLL.MoveUpMenu(menuID);
                    AdminLogBLL.Add(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Menu"), menuID);
                    break;

                case "Down":
                    CheckAdminPower("UpdateMenu", PowerCheckType.Single);
                    MenuBLL.MoveDownMenu(menuID);
                    AdminLogBLL.Add(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Menu"), menuID);
                    break;

                case "Delete":
                    CheckAdminPower("DeleteMenu", PowerCheckType.Single);
                    MenuBLL.DeleteMenu(menuID);
                    AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Menu"), menuID);
                    break;

                default:
                    break;
                }
            }
            BindControl(MenuBLL.ReadMenuAllNamedChildList(fatherID), RecordList);
        }