Inheritance: MonoBehaviour
        //public override void OnActionExecuting(ActionExecutingContext filterContext)
        //{
        //    HttpSessionStateBase session = filterContext.HttpContext.Session;
        //    UserMasters user = (UserMasters)session[Constants.Session.USER];
        //    string text = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower();
        //    string viewname = filterContext.ActionDescriptor.ActionName;
        //    string absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
        //    string mailurl = HttpContext.Current.Request.Url.ToString();
        //    bool urlreffrer = HttpContext.Current.Request.Url.IsAbsoluteUri;
        //    Uri urlreffref = HttpContext.Current.Request.UrlReferrer;
        //    UrlHelper urlHelper = new UrlHelper(filterContext.RequestContext);
        //    string url = string.Empty;
        //    url = urlHelper.Content(mailurl);
        //    HttpBrowserCapabilities httpBrowser = HttpContext.Current.Request.Browser;
        //    if (!text.Contains("Account") && ((user == null && !session.IsNewSession) || session.IsNewSession))
        //    {
        //        if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest())
        //        {
        //            filterContext.HttpContext.Response.Redirect("~/Account/SessionLogin", true);

        //        }
        //        else
        //            filterContext.HttpContext.Response.Redirect(url, true);

        //    }
        //}
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            str = new StringBuilder();
            var model = (BaseModel)filterContext.Controller.ViewData.Model;

            if (model != null)
            {
                #region Get All Permitted Menu List
                ChannelFactory <ICommonSrv> CF = new ChannelFactory <ICommonSrv>("COMMON");
                ICommonSrv CSvc = (ICommonSrv)CF.CreateChannel();
                var        ALLMENUPERMISSION = CSvc.GetAllMenuListByUserId(WebSecurity.CurrentUserId);
                var        USERINFO          = CSvc.GetUserInfoByuserId(WebSecurity.CurrentUserId);
                CF.Close();
                #endregion Get All Permitted Menu List
                HttpSessionStateBase session = filterContext.HttpContext.Session;
                // List<MenuMaster> MenuList = (List<MenuMaster>)session[Constants.Session.MENUPERMISSION];
                menulist = ALLMENUPERMISSION;
                string     absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
                MenuMaster reqMenu      = (from s in menulist
                                           where s.URL == absolutePath
                                           select s).FirstOrDefault();
                model.PermissionNameList = new List <string>();
                model.PermissionNameList.Add("Default");// its only for null checking
                if (reqMenu != null && reqMenu.PermissionNameList != null)
                {
                    model.PermissionNameList = reqMenu.PermissionNameList;
                }

                model.BaseUserInfo = USERINFO;
                model.usermenu     = GetUserMenuList(menulist);
            }
        }
        public string GetChildMenu(MenuMaster menumaster)
        {
            if (IsChildExist(menumaster.MENU_ID))
            {
                var childelementlist = menulist.Where(x => x.PARENTMENUID == menumaster.MENU_ID);
                //<a href="#"><i class="fa fa-users"></i> <span> Student Management</span> <i class="fa fa-angle-left pull-right"> </i> <span class="label label-primary pull-right">14</span></a>
                str.Append("<li class='treeview'>");
                str.Append("<a href='#" + menumaster.URL + "' ><i class='" + menumaster.icon + "'></i> <span>" + FirstCharToUpper(menumaster.MENUNAME) + "</span> <i class='fa fa-angle-left pull-right'> </i> <span class='label label-primary pull-right'>" + childelementlist.Count().ToString() + "</span></a>");
                //  str.Append("<li class='treeview'><a href='#" + menumaster.URL + "' title='" + menumaster.MENUNAME + "' data-toggle='collapse'><em class='icon-layers'></em><span>" + menumaster.MENUNAME + "</span><span class='caret'></span></a>");



                str.Append("<ul class='treeview-menu' id='" + menumaster.URL + "'>");
                foreach (var childelement in childelementlist)
                {
                    GetChildMenu(childelement);
                }
                str.Append("</ul>");
                str.Append("</li>");
            }
            else
            {
                str.Append("<li class=' '><a href=" + menumaster.URL + " title='" + menumaster.MENUNAME + "'><i class='" + menumaster.icon + "'></i> <span>" + menumaster.MENUNAME + "</span></a></li>");
            }
            return(str.ToString());
        }
Beispiel #3
0
    private void Start()
    {
        Debug.Log("the menu is being initialized");
        if (menuMaster)
        {
            Destroy(menuMaster);
            menuMaster = this;
        }
        else
        {
            menuMaster = this;
        }

        if (startHidden)
        {
            gameObject.SetActive(false);
        }

        if (transform.childCount > 0)
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                Transform child = transform.GetChild(i);
                if (child.GetComponent <UIMenu>())
                {
                    openMenus.Add(child.GetComponent <UIMenu>());
                }
            }
        }
    }
Beispiel #4
0
        public ActionResult AddMenu(FormCollection frm, HttpPostedFileBase file)
        {
            try
            {
                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                MenuMaster menu        = new MenuMaster();
                var        newFileName = "";
                if (file != null)
                {
                    string   pic           = System.IO.Path.GetFileName(file.FileName);
                    FileInfo fi            = new FileInfo(pic);
                    string   fileextension = fi.Extension.Substring(1).ToUpper();
                    newFileName = Convert.ToString(Guid.NewGuid()) + "." + fileextension;
                    var FolderPath = "~/Images/";
                    var Imgpath    = Path.Combine(Server.MapPath(FolderPath), newFileName);
                    file.SaveAs(Imgpath);
                    newFileName = FolderPath + newFileName;
                }

                menu.Name        = Convert.ToString(frm["Name"]);
                menu.Description = Convert.ToString(frm["Description"]);
                menu.Image       = Convert.ToString(frm["Image"]);
                menu.Price       = Convert.ToDecimal(frm["Price"]);
                menu.Image       = newFileName;
                Entity.MenuMasters.Add(menu);
                Entity.SaveChanges();


                return(RedirectToAction("Admin", "Admin"));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public MenuMasterViewModels(MenuMaster MMast)
 {
     MenuId       = MMast.MenuId;
     MenuName     = MMast.MenuName;
     MenuUrl      = MMast.MenuUrl;
     MenuParentId = MMast.MenuParentId;
 }
        public static void MenuMasterNew()
        {
            MenuMaster item = new MenuMaster();

            item.Id             = Guid.NewGuid();
            PSCDialog.DataShare = new MenuMasterArgs(item, false);
        }
Beispiel #7
0
        /// <summary>
        /// used to remove category
        /// </summary>
        /// <param name="categoryId"></param>
        /// <returns></returns>
        public ActionResult RemoveCategory(int categoryId)
        {
            var removeCategoryData = NewsIndiaBAL.CategoryManager.RemoveCategory(categoryId);

            MenuMaster.LoadMenu();
            return(Json(new { IsCategoryRemoved = removeCategoryData }, JsonRequestBehavior.AllowGet));
        }
Beispiel #8
0
        public ActionResult SaveCategoryInfo(int categoryId, string categoryName, bool isVisible)
        {
            var saveCategoryData = NewsIndiaBAL.CategoryManager.SaveCategoryInfo(categoryId, categoryName, isVisible);

            MenuMaster.LoadMenu();
            return(Json(new { CategorySaved = saveCategoryData }, JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public static void TopicMakeMenu()
        {
            MenuMaster mm = new MenuMaster();

            mm.Id = Guid.NewGuid();
            PSCDialog.DataShare = new MenuMasterArgs(mm, false);
        }
Beispiel #10
0
 private void cmdAddUpdate_execute(object obj)
 {
     if (paramVal == 1)
     {
         objMenu.ID       = 0;
         objMenu.Name     = grName;
         objMenu.ParentID = 0;
         objMenu.ScreenID = 0;
     }
     if (paramVal == 2)
     {
         objMenu.ID       = 0;
         objMenu.Name     = gucName;
         objMenu.ParentID = 0;
         objMenu.ScreenID = gucScreenID;
     }
     if (paramVal == 3)
     {
         objMenu.Name = grName;
     }
     if (paramVal == 5)
     {
         objMenu.ID       = 0;
         objMenu.Name     = grName;
         objMenu.ParentID = ctxID;
         objMenu.ScreenID = 0;
     }
     if (paramVal == 6)
     {
         objMenu.ID       = 0;
         objMenu.Name     = gucName;
         objMenu.ParentID = ctxID;
         objMenu.ScreenID = gucScreenID;
     }
     try
     {
         MenuMaster pxyMenu = new MenuMaster
         {
             ID       = objMenu.ID,
             IsActive = true,
             Name     = objMenu.Name,
             ParentID = objMenu.ParentID,
             ScreenID = objMenu.ScreenID
         };
         if (pxy.InsertUpdateMenuMaster(pxyMenu))
         {
             IMSLibrary.UI.UIHelper.ShowMessage("Menu Modified");
         }
     }
     catch (FaultException ex)
     {
         IMSLibrary.UI.UIHelper.ShowErrorMessage(ex.Message);
     }
     grName          = string.Empty;
     gucName         = string.Empty;
     gucScreenID     = 0;
     gridRoot        = System.Windows.Visibility.Collapsed;
     gridUserControl = System.Windows.Visibility.Collapsed;
     GetMenuData();
 }
Beispiel #11
0
        public async Task <int> AddMenus(string menuItem)
        {
            dynamic data = JsonConvert.DeserializeObject(menuItem);

            foreach (dynamic item in data)
            {
                if (item != null)
                {
                    dynamic actionList = item.actionList;
                    foreach (var action in actionList)
                    {
                        MenuMaster menu = new MenuMaster();
                        menu.ControllerName = item.controllerName;
                        if (action != null)
                        {
                            menu.ActionName        = action.actionName;
                            menu.ActionId          = action.actionId;
                            menu.ActionDisplayName = action.displayName;
                            menu.CreatedDate       = DateTime.Now;
                            _securityDbContext.MenuMaster.Add(menu);
                        }
                    }
                }
            }
            await _securityDbContext.SaveChangesAsync();

            return(await _securityDbContext.SaveChangesAsync());
        }
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            str = new StringBuilder();
            var model = (BaseModel)filterContext.Controller.ViewData.Model;

            if (model != null)
            {
                BALCommon CSvc = new BALCommon(ConStr);
                #region Get All Permitted Menu List
                SessionInfo _SessionInfo     = CSvc.GetSessionDetails(WebSecurity.CurrentUserName, DateTime.Now);
                int         _OrgnisationID   = Convert.ToInt32(_SessionInfo.SchoolID);
                int         _Financialyearid = Convert.ToInt32(_SessionInfo.FinancialYearID);


                var ALLMENUPERMISSION = CSvc.GetAllMenuListByUserId(WebSecurity.CurrentUserId, _OrgnisationID);
                var USERINFO          = CSvc.GetUserInfoByuserId(WebSecurity.CurrentUserId, _OrgnisationID);
                #endregion Get All Permitted Menu List
                menulist = ALLMENUPERMISSION;
                string     absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
                MenuMaster reqMenu      = (from s in menulist
                                           where s.URL.ToLower() == absolutePath.ToLower()
                                           select s).FirstOrDefault();
                model.PermissionNameList = new List <string>();
                model.PermissionNameList.Add("Default");// its only for null checking
                if (reqMenu != null && reqMenu.PermissionNameList != null)
                {
                    model.PermissionNameList = reqMenu.PermissionNameList;
                }
                model.BaseSessionInfo = _SessionInfo;
                model.BaseUserInfo    = USERINFO;
                model.usermenu        = GetUserMenuList(menulist);
            }
        }
Beispiel #13
0
 public ActionResult EditMenu(MenuMaster menuinfo, HttpPostedFileBase file)
 {
     try
     {
         Chatpata_dabbaEntities1 EntityFile = new Chatpata_dabbaEntities1();
         var newFileName = "";
         if (file != null)
         {
             string   pic           = System.IO.Path.GetFileName(file.FileName);
             FileInfo fi            = new FileInfo(pic);
             string   fileextension = fi.Extension.Substring(1).ToUpper();
             newFileName = Convert.ToString(Guid.NewGuid()) + "." + fileextension;
             var FolderPath = "~/Images/";
             var Imgpath    = Path.Combine(Server.MapPath(FolderPath), newFileName);
             file.SaveAs(Imgpath);
             newFileName = FolderPath + newFileName;
         }
         menuinfo.Image = newFileName;
         EntityFile.Entry(menuinfo).State = System.Data.Entity.EntityState.Modified;
         EntityFile.SaveChanges();
         return(RedirectToAction("ViewMenu"));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Beispiel #14
0
        private void btnDatabase_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            MenuMaster menuMaster = new MenuMaster();

            this.Hide();
            menuMaster.Show();
        }
 public MenuMasterViewModels ConvertFromManu(MenuMaster MMast)
 {
     MenuId       = MMast.MenuId;
     MenuName     = MMast.MenuName;
     MenuUrl      = MMast.MenuUrl;
     MenuParentId = MMast.MenuParentId;
     return(this);
 }
Beispiel #16
0
    void Start()
    {
        _instance = this;

        loadingText?.SetActive(true);

        ChangeMenu("start");
        loadingText?.SetActive(false);
    }
Beispiel #17
0
        public MasterDetailPageMenu()
        {
            InitializeComponent();

            masterMenu  = new MenuMaster();
            Master      = masterMenu;
            Detail      = new NavigationPage((Page)Activator.CreateInstance(typeof(FirstPage)));
            IsPresented = false;
        }
        public async Task <MenuMaster> Create(MenuMaster menuMaster)
        {
            using (_unitOfWork)
            {
                await _db.MenuMasters.AddAsync(menuMaster);

                _db.SaveChanges();
                return(menuMaster);
            }
        }
        public ActionResult Create(MenuMasterViewModel menuvm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (_iMenu.CheckMenuNameExists(menuvm.MenuName, menuvm.RoleId, menuvm.MenuCategoryId))
                    {
                        ModelState.AddModelError("", CommonMessages.MenuNameAlreadyExistsMessages);
                        menuvm.AllActiveRoles     = _role.GetAllActiveRoles();
                        menuvm.ListofMenuCategory = new List <SelectListItem>()
                        {
                            new SelectListItem()
                            {
                                Value = "",
                                Text  = "-----Select-----"
                            }
                        };
                        return(View(menuvm));
                    }

                    MenuMaster menuMaster = new MenuMaster()
                    {
                        UserId         = Convert.ToInt64(_sessionHandler.UserId),
                        MenuName       = menuvm.MenuName,
                        Status         = menuvm.Status,
                        ActionMethod   = menuvm.ActionMethod,
                        ControllerName = menuvm.ControllerName,
                        MenuId         = 0,
                        CategoryId     = menuvm.MenuCategoryId,
                        RoleId         = menuvm.RoleId,
                        CreateDate     = DateTime.Now
                    };

                    _iMenu.AddMenu(menuMaster);
                    TempData["MenuSuccessMessages"] = CommonMessages.MenuSuccessMessages;
                    return(RedirectToAction("Create"));
                }

                menuvm.AllActiveRoles     = _role.GetAllActiveRoles();
                menuvm.ListofMenuCategory = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                };
                return(View(menuvm));
            }
            catch (Exception)
            {
                throw;
            }
        }
 public bool SaveMenu(MenuModel menus)
 {
     try
     {
         var menuTbl = new MenuMaster();
         if (menus.MenuId == 0)
         {
             menuTbl.MenuName = menus.MenusName;
             if (menus.ControllerName != null)
             {
                 menuTbl.ControllerName = menus.ControllerName.Trim();
             }
             if (menus.ActionName != null)
             {
                 menuTbl.ActionName = menus.ActionName.Trim();
             }
             menuTbl.ParentId   = menus.ParentId;
             menuTbl.OrderBy    = menus.OrderBy;
             menuTbl.MenuIcon   = menus.MenuIcon;
             menuTbl.IsActive   = true;
             menuTbl.IsDeleted  = false;
             menuTbl.CreatedBy  = Convert.ToInt32(HttpContext.Current.Session["UserId"]);
             menuTbl.CreatedOn  = DateTime.Now;
             menuTbl.ModifiedBy = Convert.ToInt32(HttpContext.Current.Session["UserId"]);
             menuTbl.ModifiedOn = DateTime.Now;
             db.MenuMasters.Add(menuTbl);
         }
         else
         {
             var menu = db.MenuMasters.Find(menus.MenuId);
             db.Entry(menu).State = EntityState.Modified;
             menu.ModifiedOn      = DateTime.Now;
             menu.ModifiedBy      = Convert.ToInt32(HttpContext.Current.Session["UserId"]);
             menu.MenuName        = menus.MenusName;
             if (menus.ControllerName != null)
             {
                 menu.ControllerName = menus.ControllerName.Trim();
             }
             if (menus.ActionName != null)
             {
                 menu.ActionName = menus.ActionName.Trim();
             }
             menu.ParentId = menus.ParentId;
             menu.OrderBy  = menus.OrderBy;
             menu.MenuIcon = menus.MenuIcon;
         }
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public JsonResult Add(MenuMasterViewModels model)
        {
            var mmast = new MenuMaster();

            mmast.MenuName     = model.MenuName;
            mmast.MenuUrl      = model.MenuUrl;
            mmast.MenuParentId = model.MenuParentId;
            mmast.IsActive     = true;
            db.MenuMasters.Add(mmast);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        // GET: MenuMasters/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MenuMaster menuMaster = _iMenu.GetMenuById(id);

            if (menuMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(menuMaster));
        }
Beispiel #23
0
 public void DeleteMenu(int?menuId)
 {
     try
     {
         MenuMaster menuMaster = _context.MenuMaster.Find(menuId);
         if (menuMaster != null)
         {
             _context.MenuMaster.Remove(menuMaster);
         }
         _context.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
 }
        public static void MenuMasterAdd()
        {
            MenuMaster menuMaster = ((MenuMasterArgs)PSCDialog.DataShare).MenuMaster;

            MenuMasterList.AddDB(menuMaster);
            // check subdomain
            Guid subId = SessionHelper.GetSession(SessionKey.SubDomain) == string.Empty ? Guid.Empty : new Guid(SessionHelper.GetSession(SessionKey.SubDomain));

            if (!(subId == Guid.Empty))
            {
                SubDomainInMenuMaster sim = new SubDomainInMenuMaster();
                sim.MenuMasterId = menuMaster.Id;
                sim.SubDomainId  = subId;
                sim.AddDB();
            }
        }
 public ActionResult Edit([Bind(Include = "MenuId,ControllerName,ActionMethod,MenuName,Status,CreateDate,IsCache")] MenuMaster menuMaster)
 {
     try
     {
         if (ModelState.IsValid)
         {
             menuMaster.UserId = Convert.ToInt32(Session["UserID"]);
             _iMenu.UpdateMenu(menuMaster);
             return(RedirectToAction("Index"));
         }
         return(View(menuMaster));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #26
0
 public void DeleteMenu(int?menuId)
 {
     try
     {
         MenuMaster menuMaster = _context.MenuMaster.Find(menuId);
         if (menuMaster != null)
         {
             menuMaster.Status = false;
         }
         _context.Entry(menuMaster).State = EntityState.Modified;
         _context.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
 }
        public MainPageMaster()
        {
            InitializeComponent();

            instance = this;

            MenuModel[] menu = new MenuModel[] { new MenuModel("menuIcon_home", "Home", "HomeView"),
                                                 new MenuModel("menuIcon_account", "Account", "AccountView"),
                                                 new MenuModel("menuIcon_company", "Company", new string[] { "History", "Products", "Staff" }, new string[] { "HistoryView", "ProductsView", "StaffView" }),
                                                 new MenuModel("menuIcon_finances", "Finances", "FinancesView"),
                                                 new MenuModel("menuIcon_music", "Music", "MusicView"),
                                                 new MenuModel("menuIcon_settings", "Settings", new string[] { "Language", "Theme" }, new string[] { "LanguageView", "ThemeView" }),
                                                 new MenuModel("menuIcon_shopping", "Shopping", "ShoppingView"),
                                                 new MenuModel("menuIcon_about", "About", "AboutView"), };

            Content = MenuMaster.CreateMenu(menu);
        }
        public ActionResult Emp_Login(string Username, string Password)
        {
            if (Username != null && Password != null)
            {
                Session["user_name"] = Username.ToString();
                Session["Passsword"] = Password.ToString();
                dict.Clear();
                dict.Add("@UserName", Username);
                dict.Add("@Password", Password);
            }
            else
            {
                dict.Clear();
                dict.Add("@UserName", Session["user_name"].ToString());
                dict.Add("@Password", Session["Passsword"].ToString());
            }

            dict.Add("@mode", "Emp_login");
            DataTable         dt        = common_Class.return_datatable(dict, "proc_employee");
            int               j         = Convert.ToInt32(dt.Rows.Count);
            List <MenuMaster> menu_list = new List <MenuMaster>();

            menu_list.Clear();
            if (j > 0)
            {
                for (int i = 0; i <= j - 1; i++)
                {
                    MenuMaster menu = new MenuMaster();
                    menu.NodeID      = Convert.ToInt32(dt.Rows[i]["nodeId"].ToString());
                    menu.ParentID    = Convert.ToInt32(dt.Rows[i]["parentId"].ToString());
                    menu.NodeName    = dt.Rows[i]["nodeName"].ToString();
                    menu.destination = dt.Rows[i]["destination"].ToString();
                    menu_list.Add(menu);
                }

                ViewBag.MenuList      = menu_list;
                Session["Permission"] = menu_list;
                return(View(menu_list));
            }
            else
            {
                return(JavaScript("\"Check User Name And Password\""));
            }
        }
Beispiel #29
0
        public int?AddMenu(MenuMaster menuMaster)
        {
            try
            {
                int?result = -1;

                if (menuMaster != null)
                {
                    _context.MenuMaster.Add(menuMaster);
                    _context.SaveChanges();
                    result = menuMaster.MenuId;
                }
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #30
0
        public MenuMasterCollection GetMenuMastersBelongTo()
        {
            PSCPortal.Framework.Database database = new PSCPortal.Framework.Database("PSCPortalConnectionString");
            MenuMasterCollection         result   = new MenuMasterCollection();

            using (DbConnection connection = database.GetConnection())
            {
                DbCommand command = GetMenuMastersBelongToCommand(database);
                command.Connection = connection;
                connection.Open();
                DbDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    MenuMaster item = new MenuMaster(reader);
                    result.Add(item);
                }
            }
            return(result);
        }