RelationClass.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MySystem.PxcModels;
  5. namespace MySystem
  6. {
  7. public class RelationClass
  8. {
  9. public static string GetUserLevelSetInfo(int key)
  10. {
  11. using (WebCMSEntities db = new WebCMSEntities())
  12. {
  13. UserLevelSet item = db.UserLevelSet.FirstOrDefault(m => m.Id == key);
  14. if (item != null)
  15. {
  16. return item.Name;
  17. }
  18. }
  19. return "";
  20. }
  21. public static string GetUserGroupList(string keys)
  22. {
  23. string[] IdList = keys.Split(',');
  24. List<int> List = new List<int>();
  25. foreach (string key in IdList)
  26. {
  27. List.Add(int.Parse(key));
  28. }
  29. string result = "";
  30. using (WebCMSEntities db = new WebCMSEntities())
  31. {
  32. var items = db.UserGroup.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
  33. foreach (var item in items)
  34. {
  35. result += item.Name + ",";
  36. }
  37. }
  38. return result.TrimEnd(',');
  39. }
  40. public static string GetColInfo(int key)
  41. {
  42. using (WebCMSEntities db = new WebCMSEntities())
  43. {
  44. Col item = db.Col.FirstOrDefault(m => m.Id == key);
  45. if (item != null)
  46. {
  47. return item.ColName;
  48. }
  49. }
  50. return "";
  51. }
  52. public static string GetColList(string keys)
  53. {
  54. string[] IdList = keys.Split(',');
  55. List<int> List = new List<int>();
  56. foreach (string key in IdList)
  57. {
  58. List.Add(int.Parse(key));
  59. }
  60. string result = "";
  61. using (WebCMSEntities db = new WebCMSEntities())
  62. {
  63. var items = db.Col.Select(m => new { m.Id, m.ColName }).Where(m => List.Contains(m.Id));
  64. foreach (var item in items)
  65. {
  66. result += item.ColName + ",";
  67. }
  68. }
  69. return result.TrimEnd(',');
  70. }
  71. public static string GetProductFareTempInfo(int key)
  72. {
  73. using (WebCMSEntities db = new WebCMSEntities())
  74. {
  75. ProductFareTemp item = db.ProductFareTemp.FirstOrDefault(m => m.Id == key);
  76. if (item != null)
  77. {
  78. return item.Name;
  79. }
  80. }
  81. return "";
  82. }
  83. public static string GetMerchantClassInfo(int key)
  84. {
  85. using (WebCMSEntities db = new WebCMSEntities())
  86. {
  87. MerchantClass item = db.MerchantClass.FirstOrDefault(m => m.Id == key);
  88. if (item != null)
  89. {
  90. return item.ColName;
  91. }
  92. }
  93. return "";
  94. }
  95. public static string GetMerchantColInfo(string key)
  96. {
  97. using (WebCMSEntities db = new WebCMSEntities())
  98. {
  99. MerchantCol item = db.MerchantCol.FirstOrDefault(m => m.ColId == key);
  100. if (item != null)
  101. {
  102. return item.ColName;
  103. }
  104. }
  105. return "";
  106. }
  107. public static string GetUsersInfo(int key)
  108. {
  109. using (WebCMSEntities db = new WebCMSEntities())
  110. {
  111. Users item = db.Users.FirstOrDefault(m => m.Id == key);
  112. if (item != null)
  113. {
  114. return item.MakerCode;
  115. }
  116. }
  117. return "";
  118. }
  119. public static string GetErpCompanysInfo(string key)
  120. {
  121. using (WebCMSEntities db = new WebCMSEntities())
  122. {
  123. ErpCompanys item = db.ErpCompanys.FirstOrDefault(m => m.Name == key);
  124. if (item != null)
  125. {
  126. return item.Name;
  127. }
  128. }
  129. return "";
  130. }
  131. public static string GetMerchantsInfo(int key)
  132. {
  133. using (WebCMSEntities db = new WebCMSEntities())
  134. {
  135. Merchants item = db.Merchants.FirstOrDefault(m => m.Id == key);
  136. if (item != null)
  137. {
  138. return item.Name;
  139. }
  140. }
  141. return "";
  142. }
  143. public static string GetOrderRefundReasonInfo(int key)
  144. {
  145. using (WebCMSEntities db = new WebCMSEntities())
  146. {
  147. OrderRefundReason item = db.OrderRefundReason.FirstOrDefault(m => m.Id == key);
  148. if (item != null)
  149. {
  150. return item.Name;
  151. }
  152. }
  153. return "";
  154. }
  155. public static string GetMerchantsList(string keys)
  156. {
  157. string[] IdList = keys.Split(',');
  158. List<int> List = new List<int>();
  159. foreach (string key in IdList)
  160. {
  161. List.Add(int.Parse(key));
  162. }
  163. string result = "";
  164. using (WebCMSEntities db = new WebCMSEntities())
  165. {
  166. var items = db.Merchants.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
  167. foreach (var item in items)
  168. {
  169. result += item.Name + ",";
  170. }
  171. }
  172. return result.TrimEnd(',');
  173. }
  174. public static string GetProductsList(string keys)
  175. {
  176. string[] IdList = keys.Split(',');
  177. List<int> List = new List<int>();
  178. foreach (string key in IdList)
  179. {
  180. List.Add(int.Parse(key));
  181. }
  182. string result = "";
  183. using (WebCMSEntities db = new WebCMSEntities())
  184. {
  185. var items = db.Products.Select(m => new { m.Id, m.ProductName }).Where(m => List.Contains(m.Id));
  186. foreach (var item in items)
  187. {
  188. result += item.ProductName + ",";
  189. }
  190. }
  191. return result.TrimEnd(',');
  192. }
  193. public static string GetCouponsList(string keys)
  194. {
  195. string[] IdList = keys.Split(',');
  196. List<int> List = new List<int>();
  197. foreach (string key in IdList)
  198. {
  199. List.Add(int.Parse(key));
  200. }
  201. string result = "";
  202. using (WebCMSEntities db = new WebCMSEntities())
  203. {
  204. var items = db.Coupons.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
  205. foreach (var item in items)
  206. {
  207. result += item.Name + ",";
  208. }
  209. }
  210. return result.TrimEnd(',');
  211. }
  212. public static string GetKqProductsInfo(int key)
  213. {
  214. using (WebCMSEntities db = new WebCMSEntities())
  215. {
  216. KqProducts item = db.KqProducts.FirstOrDefault(m => m.Id == key);
  217. if (item != null)
  218. {
  219. return item.Name;
  220. }
  221. }
  222. return "";
  223. }
  224. public static string GetMerchantInfoInfo(int key)
  225. {
  226. using (WebCMSEntities db = new WebCMSEntities())
  227. {
  228. MerchantInfo item = db.MerchantInfo.FirstOrDefault(m => m.Id == key);
  229. if (item != null)
  230. {
  231. return item.Name;
  232. }
  233. }
  234. return "";
  235. }
  236. public static string GetKqProductBrandList(string keys)
  237. {
  238. string[] IdList = keys.Split(',');
  239. List<int> List = new List<int>();
  240. foreach (string key in IdList)
  241. {
  242. List.Add(int.Parse(key));
  243. }
  244. string result = "";
  245. using (WebCMSEntities db = new WebCMSEntities())
  246. {
  247. var items = db.KqProductBrand.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
  248. foreach (var item in items)
  249. {
  250. result += item.Name + ",";
  251. }
  252. }
  253. return result.TrimEnd(',');
  254. }
  255. public static string GetStoreHouseInfo(int key)
  256. {
  257. using (WebCMSEntities db = new WebCMSEntities())
  258. {
  259. StoreHouse item = db.StoreHouse.FirstOrDefault(m => m.Id == key);
  260. if (item != null)
  261. {
  262. return item.StoreName;
  263. }
  264. }
  265. return "";
  266. }
  267. public static string GetActivityInfoInfo(int key)
  268. {
  269. using (WebCMSEntities db = new WebCMSEntities())
  270. {
  271. ActivityInfo item = db.ActivityInfo.FirstOrDefault(m => m.Id == key);
  272. if (item != null)
  273. {
  274. return item.ActName;
  275. }
  276. }
  277. return "";
  278. }
  279. public static string GetKqProductBrandInfo(int key)
  280. {
  281. using (WebCMSEntities db = new WebCMSEntities())
  282. {
  283. KqProductBrand item = db.KqProductBrand.FirstOrDefault(m => m.Id == key);
  284. if (item != null)
  285. {
  286. return item.Name;
  287. }
  288. }
  289. return "";
  290. }
  291. public static string GetUserBackKindInfo(int key)
  292. {
  293. using (WebCMSEntities db = new WebCMSEntities())
  294. {
  295. UserBackKind item = db.UserBackKind.FirstOrDefault(m => m.Id == key);
  296. if (item != null)
  297. {
  298. return item.Name;
  299. }
  300. }
  301. return "";
  302. }
  303. public static string GetPageUpdateInfoList(string keys)
  304. {
  305. string[] ModulePathList = keys.Split(',');
  306. List<string> List = new List<string>();
  307. foreach (string key in ModulePathList)
  308. {
  309. List.Add(key);
  310. }
  311. string result = "";
  312. using (WebCMSEntities db = new WebCMSEntities())
  313. {
  314. var items = db.PageUpdateInfo.Select(m => new { m.ModulePath, m.Title }).Where(m => List.Contains(m.ModulePath));
  315. foreach (var item in items)
  316. {
  317. result += item.Title + ",";
  318. }
  319. }
  320. return result.TrimEnd(',');
  321. }
  322. public static string GetTeamApplyInfo(int key)
  323. {
  324. using (WebCMSEntities db = new WebCMSEntities())
  325. {
  326. TeamApply item = db.TeamApply.FirstOrDefault(m => m.Id == key);
  327. if (item != null)
  328. {
  329. return item.TeamNo;
  330. }
  331. }
  332. return "";
  333. }
  334. public static string GetProfitObjectsActivesInfo(int key)
  335. {
  336. using (WebCMSEntities db = new WebCMSEntities())
  337. {
  338. ProfitObjectsActives item = db.ProfitObjectsActives.FirstOrDefault(m => m.Id == key);
  339. if (item != null)
  340. {
  341. return item.Name;
  342. }
  343. }
  344. return "";
  345. }
  346. public static string GetProfitObjectsActivesList(string keys)
  347. {
  348. string[] IdList = keys.Split(',');
  349. List<int> List = new List<int>();
  350. foreach (string key in IdList)
  351. {
  352. List.Add(int.Parse(key));
  353. }
  354. string result = "";
  355. using (WebCMSEntities db = new WebCMSEntities())
  356. {
  357. var items = db.ProfitObjectsActives.Select(m => new { m.Id, m.Name }).Where(m => List.Contains(m.Id));
  358. foreach (var item in items)
  359. {
  360. result += item.Name + ",";
  361. }
  362. }
  363. return result.TrimEnd(',');
  364. }
  365. public static string GetProductsInfo(int key)
  366. {
  367. using (WebCMSEntities db = new WebCMSEntities())
  368. {
  369. Products item = db.Products.FirstOrDefault(m => m.Id == key);
  370. if (item != null)
  371. {
  372. return item.ProductName;
  373. }
  374. }
  375. return "";
  376. }
  377. public static string GetAppVideoInfo(int key)
  378. {
  379. using (WebCMSEntities db = new WebCMSEntities())
  380. {
  381. AppVideo item = db.AppVideo.FirstOrDefault(m => m.Id == key);
  382. if (item != null)
  383. {
  384. return item.Name;
  385. }
  386. }
  387. return "";
  388. }
  389. }
  390. }