/// <summary> /// 获取模块ID最大值 /// </summary> /// <returns></returns> public int GetMaxModuleID() { using (var db = new QYZEntity()) { int data = db.Sys_Modules.Max(p => p.ID); return(data + 1); } }
/// <summary> /// 新增系统 /// </summary> /// <param name="menu"></param> /// <returns></returns> public bool AddSystemInfo(Sys_Systems system) { using (var db = new QYZEntity()) { db.Sys_Systems.AddObject(system); db.SaveChanges(); return(true); } }
/// <summary> /// 获得系统集合 /// </summary> /// <param name="systemId"></param> /// <returns></returns> public List <Sys_Systems> GetSystemInfo() { using (var db = new QYZEntity()) { var query = from p in db.Sys_Systems select p; return(query.ToList <Sys_Systems>()); } }
/// <summary> /// 新增菜单 /// </summary> /// <param name="menu"></param> /// <returns></returns> public bool AddMenuInfo(Sys_Menus menu) { using (var db = new QYZEntity()) { db.Sys_Menus.AddObject(menu); db.SaveChanges(); return(true); } }
/// <summary> /// 新增模块信息 /// </summary> /// <param name="module"></param> /// <returns></returns> public bool InsertModuleInfo(Sys_Modules module) { using (var db = new QYZEntity()) { db.Sys_Modules.AddObject(module); db.SaveChanges(); return(true); } }
/// <summary> /// 根据系统ID获得菜单集合 /// </summary> /// <param name="systemId"></param> /// <returns></returns> public List <Sys_Menus> GetMenuInfo(int systemId) { using (var db = new QYZEntity()) { var query = from p in db.Sys_Menus where p.SystemID == systemId select p; return(query.ToList <Sys_Menus>()); } }
/// <summary> /// 删除模块信息 /// </summary> /// <param name="module"></param> /// <returns></returns> public bool DeleteModuleInfo(Sys_Modules module) { using (var db = new QYZEntity()) { Sys_Modules m = db.Sys_Modules.Where(p => p.ID == module.ID).ToList <Sys_Modules>().FirstOrDefault <Sys_Modules>(); db.Sys_Modules.DeleteObject(m); db.SaveChanges(); return(true); } }
/// <summary> /// 删除系统 /// </summary> /// <param name="menu"></param> /// <returns></returns> public bool DeleteSystemInfo(Sys_Systems system) { using (var db = new QYZEntity()) { Sys_Systems m = db.Sys_Systems.Where(p => p.ID == system.ID).ToList <Sys_Systems>().FirstOrDefault <Sys_Systems>(); db.Sys_Systems.DeleteObject(m); db.SaveChanges(); return(true); } }
/// <summary> /// 更新系统信息 /// </summary> /// <param name="menu"></param> /// <returns></returns> public bool UpdateSystemInfo(Sys_Systems system) { using (var db = new QYZEntity()) { Sys_Systems m = db.Sys_Systems.Where(p => p.ID == system.ID).ToList <Sys_Systems>().FirstOrDefault <Sys_Systems>(); m.Name = system.Name; m.Remark = system.Remark; db.SaveChanges(); return(true); } }
/// <summary> /// 删除菜单 /// </summary> /// <param name="menu"></param> /// <returns></returns> public bool DeleteMenuInfo(Sys_Menus menu) { using (var db = new QYZEntity()) { Sys_Menus m = db.Sys_Menus.Where(p => p.SystemID == menu.SystemID && p.ID == menu.ID).ToList <Sys_Menus>().FirstOrDefault <Sys_Menus>(); db.Sys_Menus.DeleteObject(m); db.SaveChanges(); return(true); } }
/// <summary> /// 更新菜单 /// </summary> /// <param name="menu"></param> /// <returns></returns> public bool UpdateMenuInfo(Sys_Menus menu) { using (var db = new QYZEntity()) { Sys_Menus m = db.Sys_Menus.Where(p => p.SystemID == menu.SystemID && p.ID == menu.ID).ToList <Sys_Menus>().FirstOrDefault <Sys_Menus>(); m.Name = menu.Name; m.ImagePath = menu.ImagePath; m.Remark = menu.Remark; db.SaveChanges(); return(true); } }
/// <summary> /// 根据菜单查询模块信息 /// </summary> /// <param name="MenuID"></param> /// <returns></returns> public List <Sys_Modules> GetModuleInfoList(int MenuID) { using (var db = new QYZEntity()) { var data = from mo in db.Sys_Modules where mo.MenuID == MenuID select mo; if (data != null) { return(new List <Sys_Modules>(data)); } return(new List <Sys_Modules>()); } }
/// <summary> /// 更新模块信息 /// </summary> /// <param name="modules"></param> /// <returns></returns> public bool UpdateModuleInfo(Sys_Modules modules) { using (var db = new QYZEntity()) { Sys_Modules module = db.Sys_Modules.Where(p => p.ID == modules.ID).ToList <Sys_Modules>().FirstOrDefault <Sys_Modules>(); module.Name = modules.Name; module.MenuID = modules.MenuID; module.ImagePath = modules.ImagePath; module.Parameter = modules.Parameter; module.Remark = modules.Remark; module.StartUpClass = modules.StartUpClass; module.DllName = modules.DllName; db.SaveChanges(); return(true); } }