123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using MySystem.Models;
- namespace MySystem
- {
- public class RelationClass
- {
- public static string GetColInfo(string key)
- {
- using (Models.WebCMSEntities db = new Models.WebCMSEntities())
- {
- Models.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 (Models.WebCMSEntities db = new Models.WebCMSEntities())
- {
- MsgTemplate item = db.MsgTemplate.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Title;
- }
- }
- return "";
- }
- public static string GetMsgPlacardInfo(int key)
- {
- using (Models.WebCMSEntities db = new Models.WebCMSEntities())
- {
- MsgPlacard item = db.MsgPlacard.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Title;
- }
- }
- return "";
- }
- public static string GetUserLevelSetInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- UserLevelSet item = db.UserLevelSet.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetUserGroupList(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.UserGroup.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.Name + ",";
- }
- }
- return result.TrimEnd(',');
- }
- 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 GetProductFareTempInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- ProductFareTemp item = db.ProductFareTemp.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetMerchantClassInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- MerchantClass item = db.MerchantClass.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.ColName;
- }
- }
- return "";
- }
- public static string GetMerchantColInfo(string key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- MerchantCol item = db.MerchantCol.FirstOrDefault(m => m.ColId == key);
- if (item != null)
- {
- return item.ColName;
- }
- }
- return "";
- }
- public static string GetErpCompanysInfo(string key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- ErpCompanys item = db.ErpCompanys.FirstOrDefault(m => m.Name == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetMerchantsInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- Merchants item = db.Merchants.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetOrderRefundReasonInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- OrderRefundReason item = db.OrderRefundReason.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetMerchantsList(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.Merchants.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.Name + ",";
- }
- }
- return result.TrimEnd(',');
- }
- public static string GetProductsList(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.Products.Select(m => new { m.Id, m.ProductName }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.ProductName + ",";
- }
- }
- return result.TrimEnd(',');
- }
- public static string GetCouponsList(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.Coupons.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.Name + ",";
- }
- }
- return result.TrimEnd(',');
- }
- public static string GetKqProductBrandInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- KqProducts item = db.KqProducts.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetUsersInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- Users item = db.Users.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.RealName;
- }
- }
- return "";
- }
- public static string GetMerchantInfoInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- MerchantInfo item = db.MerchantInfo.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetKqProductBrandList(string keys)
- {
- if (string.IsNullOrEmpty(keys))
- {
- return "";
- }
- 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.KqProducts.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.Name + ",";
- }
- }
- return result.TrimEnd(',');
- }
- public static string GetActivityInfoInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- ActivityInfo item = db.ActivityInfo.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.ActName;
- }
- }
- return "";
- }
- public static string GetStoreHouseInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- StoreHouse item = db.StoreHouse.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.StoreName;
- }
- }
- return "";
- }
- public static string GetUserBackKindInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- UserBackKind item = db.UserBackKind.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- 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 GetTeamApplyInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- TeamApply item = db.TeamApply.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.TeamName;
- }
- }
- return "";
- }
- public static string GetProfitObjectsActivesInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- ProfitObjectsActives item = db.ProfitObjectsActives.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetProfitObjectsActivesList(string keys)
- {
- if(string.IsNullOrEmpty(keys)) return "";
- 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.ProfitObjectsActives.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
- foreach (var item in items)
- {
- result += item.Name + ",";
- }
- }
- 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 GetProductsInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- Products item = db.Products.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.ProductName;
- }
- }
- return "";
- }
- public static string GetAppVideoInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- AppVideo item = db.AppVideo.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetPosCouponsInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- PosCoupons item = db.PosCoupons.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.ExchangeCode;
- }
- }
- return "";
- }
- public static string GetPosMachinesTwoInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- PosMachinesTwo item = db.PosMachinesTwo.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.PosSn;
- }
- }
- return "";
- }
- public static string GetStoreMachineApplyInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- StoreMachineApply item = db.StoreMachineApply.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.ApplyNo;
- }
- }
- return "";
- }
- public static string GetKqProductsInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- KqProducts item = db.KqProducts.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.Name;
- }
- }
- return "";
- }
- public static string GetSchoolSignInTaskInfo(int key)
- {
- using (WebCMSEntities db = new WebCMSEntities())
- {
- SchoolSignInTask item = db.SchoolSignInTask.FirstOrDefault(m => m.Id == key);
- if (item != null)
- {
- return item.TaskName;
- }
- }
- return "";
- }
- }
- }
|