123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using MySystem.BsModels;
- namespace MySystem
- {
- public class RelationClass
- {
- public static string GetColInfo(string key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- Col item = db.Col.FirstOrDefault(m => m.ColId == key);
- if (item != null)
- {
- return item.ColName;
- }
- }
- return "";
- }
- public static string GetColInfo(int key)
- {
- using (BsModels.WebCMSEntities db = new BsModels.WebCMSEntities())
- {
- BsModels.Col item = db.Col.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.ColName;
- }
- }
- return "";
- }
- public static string GetMsgTemplateInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- MsgTemplate item = db.MsgTemplate.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Title;
- }
- }
- return "";
- }
- public static string GetMsgPlacardInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- MsgPlacard item = db.MsgPlacard.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Title;
- }
- }
- return "";
- }
- public static string GetColList(string keys)
- {
- string[] IdList = keys.Split(',');
- List<int> List = new List<int>();
- foreach (string key in IdList)
- {
- List.Add(int.Parse(key));
- }
- string result = "";
- using (WebCMSEntities db = new WebCMSEntities())
- {
- var items = db.Col.Select(m => new { m.Id, m.ColName }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.ColName + ",";
- }
- }
- return result.TrimEnd(',');
- }
- public static string GetPageUpdateInfoList(string keys)
- {
- string[] ModulePathList = keys.Split(',');
- List<string> List = new List<string>();
- foreach (string key in ModulePathList)
- {
- List.Add(key);
- }
- string result = "";
- using (WebCMSEntities db = new WebCMSEntities())
- {
- var items = db.PageUpdateInfo.Select(m => new { m.ModulePath, m.Title }).Where(m => List.Contains(m.ModulePath));
- foreach (var item in items)
- {
- result += item.Title + ",";
- }
- }
- return result.TrimEnd(',');
- }
- public static string GetSysAdminRoleInfo(int key)
- {
- using (BsModels.WebCMSEntities db = new BsModels.WebCMSEntities())
- {
- BsModels.SysAdminRole item = db.SysAdminRole.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetSysAdminRoleNewInfo(int key)
- {
- using (BsModels.WebCMSEntities db = new BsModels.WebCMSEntities())
- {
- BsModels.SysAdminRoleNew item = db.SysAdminRoleNew.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- }
- }
|