Beispiel #1
0
        private static List <WebMenu> SetWebMenuList(DataTable WebModuleTable)
        {
            try
            {
                List <WebMenu> WebMenuList = new List <WebMenu>();

                foreach (DataRow dr in WebModuleTable.Rows)
                {
                    WebMenu theWebMenu = new WebMenu();

                    theWebMenu.WebMenuID                 = int.Parse(dr["WebMenuID"].ToString());
                    theWebMenu.MenuDisplayText           = dr["MenuDisplayText"].ToString();
                    theWebMenu.MenuToolTip               = dr["MenuToolTip"].ToString();
                    theWebMenu.MenuValueText             = dr["MenuValueText"].ToString();
                    theWebMenu.NavigationURL             = dr["NavigationURL"].ToString();
                    theWebMenu.ParentWebMenuID           = (dr["ParentWebMenuID"].ToString() == string.Empty)? -1 : int.Parse(dr["ParentWebMenuID"].ToString());
                    theWebMenu.ImageURL                  = dr["ImageURL"].ToString();
                    theWebMenu.DisplayOrder              = (dr["DisplayOrder"].ToString() == string.Empty) ? -1 : int.Parse(dr["DisplayOrder"].ToString());
                    theWebMenu.CanRedirectAfterUserLogin = (dr["CH_FIELD1"].ToString() == "Y" ? "YES" : "NO");
                    WebMenuList.Add(theWebMenu);
                }

                return(WebMenuList);
            }
            catch (Exception ex)
            {
                throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
            }
        }
Beispiel #2
0
        private static List <WebMenu> SetWebMenuPermissonList(DataTable WebModuleTable)
        {
            try
            {
                List <WebMenu> RoleWebMenuList = new List <WebMenu>();

                foreach (DataRow dr in WebModuleTable.Rows)
                {
                    WebMenu objWebMenu = new WebMenu();

                    objWebMenu.WebRolePermissionID = int.Parse(dr["RolePermissionID"].ToString());
                    objWebMenu.FormOrMenuID        = int.Parse(dr["FormOrMenuID"].ToString());
                    objWebMenu.WebMenuID           = int.Parse(dr["FormOrMenuID"].ToString());
                    objWebMenu.MenuDisplayText     = dr["MenuDisplayText"].ToString();
                    objWebMenu.PermissionID        = int.Parse(dr["PermissionID"].ToString());
                    objWebMenu.RoleID                = int.Parse(dr["RoleID"].ToString());
                    objWebMenu.RoleDescription       = dr["RoleDescription"].ToString();
                    objWebMenu.PermissionDescription = dr["PermissionDescription"].ToString();
                    objWebMenu.FormOrMenu            = dr["FormOrMenu"].ToString();

                    RoleWebMenuList.Add(objWebMenu);
                }
                return(RoleWebMenuList);
            }
            catch (Exception ex)
            {
                throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
            }
        }
        public ActionResult AddOrEditWebMenu(int menuID)
        {
            List <WebMenu> menuList = webMenuService.GetWebMenuList();
            WebMenu        rootMenu = new WebMenu()
            {
                EnglishName = "All",
                IsDisplay   = false,
                ParentID    = 0,
                ParentName  = "一级栏目",
                WebMenuName = "一级栏目",
                AddOn       = DateTime.Now,
                FlagDelete  = 0
            };

            menuList.Add(rootMenu);
            IEnumerable <SelectListItem> parentMenus = menuList.Select(m => new SelectListItem {
                Value = m.WebMenuID.ToString(), Text = m.WebMenuName
            });

            ViewBag.ParentMenus = parentMenus;
            WebMenu menu = webMenuService.GetMenuByID(menuID);

            if (menu == null)
            {
                menu = new WebMenu();
            }
            return(View(menu));
        }
        private int Save_MenuItems()
        {
            int ProcReturnValue = 0;

            WebMenu TheWebMenu = new WebMenu();

            TheWebMenu.MenuDisplayText = txt_MenuDisplayText.Text;
            TheWebMenu.NavigationURL   = txt_NavigationUrl.Text;
            TheWebMenu.MenuToolTip     = txt_MenuToolTip.Text;
            if (!string.IsNullOrEmpty(txt_DisplayOrder.Text))
            {
                TheWebMenu.DisplayOrder = int.Parse(txt_DisplayOrder.Text.ToString());
            }
            if (!ddl_SubMenu.SelectedValue.Equals(MicroConstants.DROPDOWNLIST_DEFAULT_ITEMTEXT))
            {
                TheWebMenu.ParentWebMenuID = int.Parse(ddl_SubMenu.SelectedValue);
            }
            else
            {
                TheWebMenu.ParentWebMenuID = int.Parse(ddl_MenuHead.SelectedValue);
            }
            ProcReturnValue = WebMenuManagement.GetInstance.InsertMenuItems(TheWebMenu);

            return(ProcReturnValue);
        }
 public int UpdateWebMenu(WebMenu webMenu)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         if (webMenu != null)
         {
             WebMenu originalMenu = context.WebMenu.Find(webMenu.WebMenuID);
             if (originalMenu != null)
             {
                 originalMenu.EditOn      = DateTime.Now;
                 originalMenu.EnglishName = webMenu.EnglishName;
                 originalMenu.ImageUrl    = webMenu.ImageUrl;
                 originalMenu.IsDisplay   = webMenu.IsDisplay;
                 originalMenu.ParentID    = webMenu.ParentID;
                 originalMenu.ParentName  = webMenu.ParentName;
                 originalMenu.ShowOrder   = webMenu.ShowOrder;
                 originalMenu.ShowUrl     = webMenu.ShowUrl;
                 originalMenu.Style       = webMenu.Style;
                 originalMenu.WebMenuName = webMenu.WebMenuName;
                 context.SaveChanges();
                 return(1);
             }
             else
             {
                 return(0);
             }
         }
         else
         {
             return(0);
         }
     }
 }
    private static List <WebMenu> GetDepartmentsList(int parentID)
    {
        List <WebMenu>    ChildSubMenuItems = new List <WebMenu>();
        List <Department> deptList          = new List <Department>();

        deptList = Micro.BusinessLayer.ICAS.STAFFS.DepartmentManagement.GetInstance.GetDepartmentsList();

        int ctr = 80000;

        foreach (Department d in deptList)
        {
            //if (d.DepartmentDescription.ToString().ToUpper().Equals("MANAGEMENT"))
            //{
            //    continue;
            //}
            WebMenu m = new WebMenu();
            m.WebMenuID       = ctr; ctr++;
            m.ParentWebMenuID = parentID;
            m.MenuDisplayText = d.DepartmentDescription;
            m.NavigationURL   = string.Format("about-department-{0}", d.DepartmentDescription.ToString().ToLower());
            m.MenuToolTip     = string.Format("Click here to learn about the {0} department.", d.DepartmentDescription);
            ChildSubMenuItems.Add(m);
        }
        return(ChildSubMenuItems);
    }
Beispiel #7
0
        public static WebMenu GetWebMenuByWebMenuID(int WebMenuID)
        {
            DataRow TheWebMenuRow = WebMenuDataAccess.GetInstance.GetWebMenuByWebMenuID(WebMenuID);

            WebMenu TheWebMenu = DataRowToObject(TheWebMenuRow);

            return(TheWebMenu);
        }
        private int DeleteRecord()
        {
            WebMenu objWebMenu = new WebMenu();

            objWebMenu.WebMenuID = int.Parse(PageVariables.SubWebMenuID);
            int ProcReturnValue = WebMenuManagement.GetInstance.DeleteMenuItems(objWebMenu);

            return(ProcReturnValue);
        }
Beispiel #9
0
        public ActionResult SaveContent(WebMenu input)
        {
            var temp = _context.FindDetail <WebMenu>(input.Id);

            temp.Content     = input.Content;
            temp.UpdatedDate = DateTime.Now;
            _context.SaveChange();
            return(RedirectToAction <WebMenuController>(d => d.Index(temp.LanguageId)));
        }
Beispiel #10
0
        public int PutWebGroup(WebGroupDTO obj)
        {
            int result = 0;

            SessionManager.DoWork(session =>
            {
                WebGroup webGroup = new WebGroup();
                webGroup.Id       = obj.Id;
                webGroup.Name     = obj.Name;
                webGroup.WebMenus = new List <WebMenu>();
                List <Guid> temp  = new List <Guid>();
                //Check menu con lấy menu cha
                foreach (Guid t in obj.WebMenuIds)
                {
                    WebMenu menu = session.Query <WebMenu>().Where(p => p.Id == t).SingleOrDefault();
                    temp.Add(menu.Id);
                    if (menu.ParentMenu != null)
                    {
                        temp.Add(menu.ParentMenu.Id);
                    }
                }
                obj.WebMenuIds = temp.Distinct().ToList();
                foreach (Guid w in obj.WebMenuIds)
                {
                    //Add menu con của hồ sơ, quá trình, đoàn thể
                    if ((w.ToString() == "00000000-0000-0000-0000-000000000017") || (w.ToString() == "00000000-0000-0000-0000-000000000018") || (w.ToString() == "00000000-0000-0000-0000-000000000020"))
                    {
                        WebMenu web = new WebMenu()
                        {
                            Id = w
                        };
                        webGroup.WebMenus.Add(web);
                        List <Guid> childList = ChildrenMenuIds(w);
                        foreach (Guid c in childList)
                        {
                            WebMenu cw = new WebMenu()
                            {
                                Id = c
                            };
                            webGroup.WebMenus.Add(cw);
                        }
                    }
                    else
                    {
                        WebMenu web = new WebMenu()
                        {
                            Id = w
                        };
                        webGroup.WebMenus.Add(web);
                    }
                }
                session.Update(webGroup);
                result = 1;
            });
            return(result);
        }
Beispiel #11
0
        public async Task <WebMenuDTO> GetWebMenuInfoAsync([Required(ErrorMessage = "唯一标识不能为空")] Guid id)
        {
            WebMenu webMenuFromDB = await _webMenuRepository.FirstOrDefaultAsync(id);

            if (webMenuFromDB == null)
            {
                throw new InvalidOperationException("网页菜单权限不存在");
            }
            return(_mapper.Map <WebMenuDTO>(webMenuFromDB));
        }
 public CPApiController(ILogs logs, IConfiguration configuration)
 {
     _configuration          = configuration;
     _logs                   = logs;
     _menu                   = new WebMenu();
     _templateDetailsService = new SysTemplateDetailsService();
     _templateService        = new SysTemplateService();
     _menuService            = new CPMenuService();
     _propertyService        = new SysPropertyService();
     currentLang             = StartUp.CurrentLang;
 }
 public int UpdateWebRolePermission(WebMenu objWebMenu)
 {
     try
     {
         return(WebMenuIntegration.UpdateWebRolePermission(objWebMenu));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
Beispiel #14
0
 public static int DeleteWebRolePermission(WebMenu objWebMenu)
 {
     try
     {
         return(WebMenuDataAccess.GetInstance.DeleteWebRolePermission(objWebMenu));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
        public int Delete(WebMenu m)
        {
            string sql = "delete from WebMenu where Id=@Id";

            SqlParameter[] param =
            {
                new SqlParameter("@Id", m.Id)
            };

            return(SqlHelper.ExecuteNonQuery(sql, param));
        }
        private void PopulatePageFields(int theWebMenuId)
        {
            WebMenu TheWebMenu = WebMenuManagement.GetInstance.GetWebMenuByWebMenuID(theWebMenuId);

            txt_MenuDisplayText.Text = TheWebMenu.MenuDisplayText;
            txt_MenuToolTip.Text     = TheWebMenu.MenuToolTip;
            txt_NavigationUrl.Text   = TheWebMenu.NavigationURL;

            txt_DisplayOrder.Text = TheWebMenu.DisplayOrder.ToString();


            ChangeBackColor(view_MenuItemEntry);
        }
        public int Add(WebMenu m)
        {
            string sql = "insert into WebMenu(Title,Link,ParentId) values(@Title,@Link,@ParentId)";

            SqlParameter[] param =
            {
                new SqlParameter("@Title",    m.Title),
                new SqlParameter("@Link",     m.Link),
                new SqlParameter("@ParentId", m.ParentId)
            };

            return(SqlHelper.ExecuteNonQuery(sql, param));
        }
Beispiel #18
0
        public async Task EditWebMenuAsync(EditWebMenuModel model)
        {
            WebMenu webMenuFromDB = await _webMenuRepository.FirstOrDefaultAsync(model.ID);

            if (webMenuFromDB == null)
            {
                throw new InvalidOperationException("网页菜单权限不存在");
            }
            model.CopyProperties(webMenuFromDB);
            webMenuFromDB.UpdateTime = DateTime.Now;
            _authorityUnitOfWork.RegisterEdit(webMenuFromDB);
            await _authorityUnitOfWork.CommitAsync();
        }
        private void PopulateSubMenu(int theWebMenuId)
        {
            WebMenu TheWebMenu = WebMenuManagement.GetInstance.GetWebMenuByWebMenuID(theWebMenuId);

            ddl_SubMenuHead.SelectedIndex = GetSelecteIndex(ddl_SubMenuHead, TheWebMenu.WebMenuID);

            txt_SubMenuDisplayText.Text   = TheWebMenu.MenuDisplayText;
            txt_SubMenuToolTip.Text       = TheWebMenu.MenuToolTip;
            txt_SubMenuNavigationURL.Text = TheWebMenu.NavigationURL;

            txt_SubMenuDisplayOrder.Text = TheWebMenu.DisplayOrder.ToString();

            ChangeBackColor(view_InputControlChildMenu);
        }
Beispiel #20
0
        public WebMenuDTO GetObject(Guid id)
        {
            WebMenuDTO result = new WebMenuDTO();

            SessionManager.DoWork(session =>
            {
                WebMenu webmenu = session.Query <WebMenu>().Where(w => w.Id == id).SingleOrDefault();
                result.Id       = webmenu.Id;
                result.Name     = webmenu.Name;
                result.Index    = webmenu.Index;
                result.ParentId = webmenu.ParentMenu != null ? webmenu.ParentMenu.Id : Guid.Empty;
            });
            return(result);
        }
        public int Edit(WebMenu m)
        {
            string sql = "update WebMenu set Title=@Title,Link=@Link,ParentId=@ParentId where Id=@Id";

            SqlParameter[] param =
            {
                new SqlParameter("@Title",    m.Title),
                new SqlParameter("@Link",     m.Link),
                new SqlParameter("@ParentId", m.ParentId),
                new SqlParameter("@Id",       m.Id)
            };

            return(SqlHelper.ExecuteNonQuery(sql, param));
        }
 public DataTable GetWebMenuByRoleID(int RoleID)
 {
     try
     {
         WebMenu    TheWebMenu = new WebMenu();
         SqlCommand SqlCmd     = new SqlCommand();
         SqlCmd.CommandType = CommandType.StoredProcedure;
         SqlCmd.Parameters.Add(GetParameter("RoleID", SqlDbType.Int, (RoleID == -1 ? Micro.Commons.Connection.LoggedOnUser.RoleId : RoleID)));
         SqlCmd.CommandText = "pADM_MenuItemsPermission_SelectByRoleID";
         return(ExecuteGetDataTable(SqlCmd));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
        public JsonResult AddOrEditWebMenu(WebMenu menu)
        {
            int     result     = 0;
            WebMenu parentMenu = webMenuService.GetMenuByID(menu.ParentID);

            menu.ParentName = parentMenu != null ? parentMenu.WebMenuName : string.Empty;
            if (menu.WebMenuID > 0)
            {
                result = webMenuService.UpdateWebMenu(menu);
            }
            else
            {
                result = webMenuService.AddWebMenu(menu);
            }
            return(Json(new { RetCode = 1 }));
        }
Beispiel #24
0
 public int AddWebMenu(WebMenu webMenu)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         if (webMenu != null)
         {
             context.WebMenu.Add(webMenu);
             context.SaveChanges();
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
        public JsonResult AddOrEditWebNews1(WebNews news)
        {
            IWebNews newsService = new WebNewsService();
            int      result      = 0;
            WebMenu  parentMenu  = webMenuService.GetMenuByID(news.ClassID);

            news.ClassName = parentMenu != null ? parentMenu.WebMenuName : string.Empty;
            if (news.ContentID > 0)
            {
                result = newsService.updateWebNews(news);
            }
            else
            {
                result = newsService.AddWebNews(news);
            }
            return(Json(new { RetCode = result }));
        }
        private int UpdateSubMenuRecord()
        {
            WebMenu theMenu = new WebMenu();

            theMenu.MenuDisplayText = txt_SubMenuDisplayText.Text;
            theMenu.MenuToolTip     = txt_SubMenuToolTip.Text;
            theMenu.NavigationURL   = txt_SubMenuNavigationURL.Text;
            if (!string.IsNullOrEmpty(txt_SubMenuDisplayOrder.Text))
            {
                theMenu.DisplayOrder = int.Parse(txt_SubMenuDisplayOrder.Text);
            }
            theMenu.WebMenuID       = int.Parse(PageVariables.SubWebMenuID);
            theMenu.ParentWebMenuID = int.Parse(ddl_SubMenuHead.SelectedValue);
            int ProcReturnValue = WebMenuManagement.GetInstance.UpdateMenuItems(theMenu);

            return(ProcReturnValue);
        }
        public int DeleteMenuItem(WebMenu theWebMenu)
        {
            int ReturnValue = 0;

            using (SqlCommand DeleteCommand = new SqlCommand())
            {
                DeleteCommand.CommandType = CommandType.StoredProcedure;
                DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;
                DeleteCommand.Parameters.Add(GetParameter("@WebMenuID", SqlDbType.Int, theWebMenu.WebMenuID));
                DeleteCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, theWebMenu.ModifiedBy));
                DeleteCommand.CommandText = "pADM_WebMenuItems_Delete";
                ExecuteStoredProcedure(DeleteCommand);

                ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString());

                return(ReturnValue);
            }
        }
Beispiel #28
0
 public int DeleteWebMenu(int menuID)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         WebMenu webMenu = context.WebMenu.Find(menuID);
         if (webMenu != null)
         {
             webMenu.FlagDelete = 1;
             webMenu.DeleteOn   = DateTime.Now;
             context.SaveChanges();
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
        public JsonResult AddOrEditWebFile(WebFile file)
        {
            int      result         = 0;
            IWebFile webFileService = new WebFileService();
            WebMenu  parentMenu     = webMenuService.GetMenuByID(file.ClassID);

            file.ClassName = parentMenu != null ? parentMenu.WebMenuName : string.Empty;
            file.Tags      = FileHelper.GetFileTag(file.FileName);
            if (file.FileID > 0)
            {
                result = webFileService.UpdateWebFile(file);
            }
            else
            {
                result = webFileService.AddWebFile(file);
            }
            return(Json(new { RetCode = result }));
        }
        public WebMenu GetWebMenuById(int id)
        {
            string sql = "select * from WebMenu where Id = @Id";

            SqlParameter[] param =
            {
                new SqlParameter("@Id", id)
            };
            var     dt   = SqlHelper.Query(sql, param);
            WebMenu menu = null;

            foreach (DataRow dr in dt.Rows)
            {
                menu = FileData(dr);
            }

            return(menu);
        }
Beispiel #31
0
        public void AddMenu(WebMenu menu)
        {
            try
            {
                using (var context = new AEPEntities())
                {
                    context.WebMenu.AddObject(menu);

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException.Message.Contains("23505"))
                    throw new Exception("Error: no puede asignar dos menus con el mismo nombre.");
                else
                    throw new Exception(ex.Message);
            }
        }
Beispiel #32
0
        public void UpdateMenu(WebMenu menu)
        {
            using (var context = new AEPEntities())
            {
                //WebMenu menu2 = context.WebMenu.First(i => i.WebMenuId == menu.WebMenuId);

                //menu2.Descripcion = menu.Descripcion;
                //menu2.Orden = menu.Orden;
                //menu2.Url = menu.Url;
                //menu2.Estado = menu.Estado;

                context.WebMenu.Attach(context.WebMenu.Single(i => i.WebMenuId == menu.WebMenuId));

                context.WebMenu.ApplyCurrentValues(menu);

                int inte = context.SaveChanges(SaveOptions.DetectChangesBeforeSave);

                context.SaveChanges();
            }
        }