ClsBaseInfo.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. using CoreFS.CA06;
  7. using System.Windows.Forms;
  8. using Infragistics.Win.UltraWinEditors;
  9. using Infragistics.Win;
  10. using System.Text.RegularExpressions;
  11. namespace Core.Mes.Client.Comm.Server
  12. {
  13. /// <summary>
  14. /// 基础数据查询
  15. /// </summary>
  16. public class ClsBaseInfo
  17. {
  18. /// <summary>
  19. /// 设置UltraComboEditor中的中文和非中文统一高度。
  20. /// </summary>
  21. /// <param name="cmb"></param>
  22. public static void SetComboItemHeight(UltraComboEditor cmb)
  23. {
  24. cmb.Update();
  25. foreach (ValueListItem item in cmb.Items)
  26. {
  27. if (Regex.IsMatch(item.DisplayText.ToString2(), @"[\u4e00-\u9fa5]+"))
  28. {
  29. item.Appearance.FontData.SizeInPoints = 9.0F;
  30. }
  31. else
  32. {
  33. item.Appearance.FontData.SizeInPoints = 10.5F;
  34. }
  35. }
  36. }
  37. /// <summary>
  38. /// 获取指定分类的公用基础信息
  39. /// </summary>
  40. /// <param name="sortCode">快速索引码</param>
  41. /// <param name="ob">界面OB对象</param>
  42. /// <returns>查询数据集</returns>
  43. public static DataTable GetComBaseInfo(string sortCode, OpeBase ob)
  44. {
  45. return ServerHelper.GetData("com.steering.comm.db.ClsBaseInfo.getComBaseInfo", new object[] { sortCode }, ob);
  46. }
  47. /// <summary>
  48. /// 查询管理部门基础信息
  49. /// </summary>
  50. /// <param name="ob">界面OB对象</param>
  51. /// <returns>查询数据集</returns>
  52. public static DataTable GetDepartmentInfo(OpeBase ob)
  53. {
  54. string sortCode = "90";
  55. return GetComBaseInfo(sortCode, ob);
  56. }
  57. /// <summary>
  58. /// 加载基础数据到下拉框中
  59. /// </summary>
  60. /// <param name="cmb"></param>
  61. /// <param name="sortCode"></param>
  62. /// <param name="ob"></param>
  63. /// <param name="hasBlankLine"></param>
  64. /// <returns></returns>
  65. public static bool FillComBaseInfo(UltraComboEditor cmb, string sortCode, OpeBase ob, bool hasBlankLine)
  66. {
  67. DataTable dt = GetComBaseInfo(sortCode, ob);
  68. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  69. {
  70. DataRow dr = dt.NewRow();
  71. dt.Rows.InsertAt(dr, 0);
  72. }
  73. cmb.DataSource = dt;
  74. cmb.DisplayMember = "BASENAME";
  75. cmb.ValueMember = "BASECODE";
  76. SetComboItemHeight(cmb);
  77. return true;
  78. }
  79. /// <summary>
  80. /// 加载基础数据到下拉框中
  81. /// </summary>
  82. /// <param name="cmb"></param>
  83. /// <param name="sortCode"></param>
  84. /// <param name="ob"></param>
  85. /// <param name="hasBlankLine"></param>
  86. /// <returns></returns>
  87. public static bool FillComBaseInfo(ComboBox cmb, string sortCode, OpeBase ob, bool hasBlankLine)
  88. {
  89. DataTable dt = GetComBaseInfo(sortCode, ob);
  90. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  91. {
  92. DataRow dr = dt.NewRow();
  93. dt.Rows.InsertAt(dr, 0);
  94. }
  95. cmb.DataSource = dt;
  96. cmb.DisplayMember = "BASENAME";
  97. cmb.ValueMember = "BASECODE";
  98. return true;
  99. }
  100. /// <summary>
  101. /// 拼音助记码控件填充管理部门基础信息
  102. /// </summary>
  103. /// <param name="df">需填充的拼音助记码控件</param>
  104. /// <param name="ob">界面OB对象</param>
  105. /// <param name="hasBlankLine">是否包含空行</param>
  106. /// <returns>查询数据集</returns>
  107. public static bool FillDepartmentInfo(Control.DataFilterControl df, OpeBase ob, bool hasBlankLine)
  108. {
  109. DataTable dt = GetDepartmentInfo(ob);
  110. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  111. {
  112. DataRow dr = dt.NewRow();
  113. dt.Rows.InsertAt(dr, 0);
  114. }
  115. df.DataSource = dt;
  116. df.DisplayMember = "BASENAME";
  117. df.ValueMember = "BASECODE";
  118. df.FilterMember = "MNEMONIC_CODE";
  119. return true;
  120. }
  121. /// <summary>
  122. /// 加载品种名称
  123. /// </summary>
  124. /// <param name="cmb">需填充的控件</param>
  125. /// <param name="ob">界面OB对象</param>
  126. /// <param name="hasBlankLine">是否包含空行</param>
  127. /// <returns>是否加载成功</returns>
  128. public static bool FillProduc_StyleInfo(UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  129. {
  130. DataTable dt = GetComBaseInfo("4050", ob);
  131. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  132. {
  133. DataRow dr = dt.NewRow();
  134. dt.Rows.InsertAt(dr, 0);
  135. }
  136. cmb.DataSource = dt;
  137. cmb.DisplayMember = "BASENAME";
  138. cmb.ValueMember = "BASECODE";
  139. SetComboItemHeight(cmb);
  140. return true;
  141. }
  142. /// <summary>
  143. /// 加载品种名称
  144. /// </summary>
  145. /// <param name="cmb">需填充的控件</param>
  146. /// <param name="ob">界面OB对象</param>
  147. /// <param name="hasBlankLine">是否包含空行</param>
  148. /// <returns>是否加载成功</returns>
  149. public static bool FillProduc_StyleInfo(ComboBox cmb, OpeBase ob, bool hasBlankLine)
  150. {
  151. DataTable dt = GetComBaseInfo("4050", ob);
  152. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  153. {
  154. DataRow dr = dt.NewRow();
  155. dt.Rows.InsertAt(dr, 0);
  156. }
  157. cmb.DataSource = dt;
  158. cmb.DisplayMember = "BASENAME";
  159. cmb.ValueMember = "BASECODE";
  160. return true;
  161. }
  162. /// <summary>
  163. /// 加载标准类型
  164. /// </summary>
  165. /// <param name="cmb">需填充的控件</param>
  166. /// <param name="ob">界面OB对象</param>
  167. /// <param name="hasBlankLine">是否包含空行</param>
  168. /// <returns>是否加载成功</returns>
  169. public static bool FillStdType(UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  170. {
  171. DataTable dt = new DataTable();
  172. DataColumn[] dc = new DataColumn[]{new DataColumn("NAME"), new DataColumn("CODE")};
  173. dt.Columns.AddRange(dc);
  174. dt.Rows.Add(new object[] { "订货标准", "G" });
  175. dt.Rows.Add(new object[] {"协议标准", "X"});
  176. dt.Rows.Add(new object[] {"Alpha", "K"});
  177. dt.Rows.Add(new object[] {"内控", "N"});
  178. dt.Rows.Add(new object[]{"试验标准", "S"});
  179. dt.Rows.Add(new object[]{"成分偏差标准", "P"});
  180. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  181. {
  182. DataRow dr = dt.NewRow();
  183. dt.Rows.InsertAt(dr, 0);
  184. }
  185. cmb.DataSource = dt;
  186. cmb.DisplayMember = "NAME";
  187. cmb.ValueMember = "CODE";
  188. SetComboItemHeight(cmb);
  189. return true;
  190. }
  191. /// <summary>
  192. /// 加载冶金规范项目
  193. /// </summary>
  194. /// <param name="cmb">需填充的控件</param>
  195. /// <param name="ob">界面OB对象</param>
  196. /// <param name="hasBlankLine">是否包含空行</param>
  197. /// <returns>是否加载成功</returns>
  198. public static bool FillMscItem(ComboBox cmb, OpeBase ob, bool hasBlankLine)
  199. {
  200. DataTable dt = GetComBaseInfo("4030", ob);
  201. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  202. {
  203. DataRow dr = dt.NewRow();
  204. dt.Rows.InsertAt(dr, 0);
  205. }
  206. cmb.DataSource = dt;
  207. cmb.DisplayMember = "BASENAME";
  208. cmb.ValueMember = "BASECODE";
  209. return true;
  210. }
  211. /// <summary>
  212. /// 加载冶金规范项目
  213. /// </summary>
  214. /// <param name="cmb">需填充的控件</param>
  215. /// <param name="ob">界面OB对象</param>
  216. /// <param name="hasBlankLine">是否包含空行</param>
  217. /// <returns>是否加载成功</returns>
  218. public static bool FillMscItem(UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  219. {
  220. DataTable dt = GetComBaseInfo("4030", ob);
  221. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  222. {
  223. DataRow dr = dt.NewRow();
  224. dt.Rows.InsertAt(dr, 0);
  225. }
  226. cmb.DataSource = dt;
  227. cmb.DisplayMember = "BASENAME";
  228. cmb.ValueMember = "BASECODE";
  229. SetComboItemHeight(cmb);
  230. return true;
  231. }
  232. /// <summary>
  233. /// 加载管理部门
  234. /// </summary>
  235. /// <param name="cmb">需填充的控件</param>
  236. /// <param name="ob">界面OB对象</param>
  237. /// <param name="hasBlankLine">是否包含空行</param>
  238. /// <returns>是否加载成功</returns>
  239. public static bool FillDepartment(UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  240. {
  241. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getDepartment",
  242. new object[]{}, ob);
  243. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  244. {
  245. DataRow dr = dt.NewRow();
  246. dt.Rows.InsertAt(dr, 0);
  247. }
  248. cmb.DataSource = dt;
  249. cmb.DisplayMember = "DEPARTNAME";
  250. cmb.ValueMember = "DEPARTID";
  251. SetComboItemHeight(cmb);
  252. return true;
  253. }
  254. /// <summary>
  255. /// 加载管理部门
  256. /// </summary>
  257. /// <param name="cmb">需填充的控件</param>
  258. /// <param name="ob">界面OB对象</param>
  259. /// <param name="hasBlankLine">是否包含空行</param>
  260. /// <returns>是否加载成功</returns>
  261. public static bool FillDepartment(ComboBox cmb, OpeBase ob, bool hasBlankLine)
  262. {
  263. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getDepartment",
  264. new object[]{}, ob);
  265. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  266. {
  267. DataRow dr = dt.NewRow();
  268. dt.Rows.InsertAt(dr, 0);
  269. }
  270. cmb.DataSource = dt;
  271. cmb.DisplayMember = "DEPARTNAME";
  272. cmb.ValueMember = "DEPARTID";
  273. return true;
  274. }
  275. /// <summary>
  276. /// 通过管理部门ID加载科室
  277. /// </summary>
  278. /// <param name="cmb">需填充的控件</param>
  279. /// <param name="ob">界面OB对象</param>
  280. /// <param name="hasBlankLine">是否包含空行</param>
  281. /// <returns>是否加载成功</returns>
  282. public static bool FillSectionByDepartId(string departmentId, ComboBox cmb, OpeBase ob, bool hasBlankLine)
  283. {
  284. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getSection",
  285. new object[]{}, ob);
  286. dt.DefaultView.RowFilter = "PID = '"+ departmentId +"'";
  287. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  288. {
  289. DataRow dr = dt.NewRow();
  290. dt.Rows.InsertAt(dr, 0);
  291. }
  292. cmb.DataSource = dt;
  293. cmb.DisplayMember = "DEPARTNAME";
  294. cmb.ValueMember = "DEPARTID";
  295. return true;
  296. }
  297. /// <summary>
  298. /// 通过管理部门ID加载科室
  299. /// </summary>
  300. /// <param name="cmb">需填充的控件</param>
  301. /// <param name="ob">界面OB对象</param>
  302. /// <param name="hasBlankLine">是否包含空行</param>
  303. /// <returns>是否加载成功</returns>
  304. public static bool FillSectionByDepartId(string departmentId, UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  305. {
  306. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getSection",
  307. new object[]{}, ob);
  308. dt.DefaultView.RowFilter = "PID = '"+ departmentId +"'";
  309. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  310. {
  311. DataRow dr = dt.NewRow();
  312. dt.Rows.InsertAt(dr, 0);
  313. }
  314. cmb.DataSource = dt;
  315. cmb.DisplayMember = "DEPARTNAME";
  316. cmb.ValueMember = "DEPARTID";
  317. SetComboItemHeight(cmb);
  318. return true;
  319. }
  320. /// <summary>
  321. /// 加载所有管理科室
  322. /// </summary>
  323. /// <param name="cmb">需填充的控件</param>
  324. /// <param name="ob">界面OB对象</param>
  325. /// <param name="hasBlankLine">是否包含空行</param>
  326. /// <returns>是否加载成功</returns>
  327. public static bool FillSection(UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  328. {
  329. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getSection",
  330. new object[]{}, ob);
  331. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  332. {
  333. DataRow dr = dt.NewRow();
  334. dt.Rows.InsertAt(dr, 0);
  335. }
  336. cmb.DataSource = dt;
  337. cmb.DisplayMember = "DEPARTNAME";
  338. cmb.ValueMember = "DEPARTID";
  339. SetComboItemHeight(cmb);
  340. return true;
  341. }
  342. /// <summary>
  343. /// 加载所有管理科室
  344. /// </summary>
  345. /// <param name="cmb">需填充的控件</param>
  346. /// <param name="ob">界面OB对象</param>
  347. /// <param name="hasBlankLine">是否包含空行</param>
  348. /// <returns>是否加载成功</returns>
  349. public static bool FillSection(ComboBox cmb, OpeBase ob, bool hasBlankLine)
  350. {
  351. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getSection",
  352. new object[]{}, ob);
  353. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  354. {
  355. DataRow dr = dt.NewRow();
  356. dt.Rows.InsertAt(dr, 0);
  357. }
  358. cmb.DataSource = dt;
  359. cmb.DisplayMember = "DEPARTNAME";
  360. cmb.ValueMember = "DEPARTID";
  361. return true;
  362. }
  363. /// <summary>
  364. /// 加载水压公式
  365. /// </summary>
  366. /// <param name="cmb">需填充的控件</param>
  367. /// <param name="ob">界面OB对象</param>
  368. /// <param name="hasBlankLine">是否包含空行</param>
  369. /// <returns>是否加载成功</returns>
  370. public static bool FillWtrExpress(ComboBox cmb, OpeBase ob, bool hasBlankLine)
  371. {
  372. DataTable dt = GetComBaseInfo("4053", ob);
  373. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  374. {
  375. DataRow dr = dt.NewRow();
  376. dt.Rows.InsertAt(dr, 0);
  377. }
  378. cmb.DataSource = dt;
  379. cmb.DisplayMember = "BASENAME";
  380. cmb.ValueMember = "BASECODE";
  381. return true;
  382. }
  383. /// <summary>
  384. /// 加载水压公式
  385. /// </summary>
  386. /// <param name="cmb">需填充的控件</param>
  387. /// <param name="ob">界面OB对象</param>
  388. /// <param name="hasBlankLine">是否包含空行</param>
  389. /// <returns>是否加载成功</returns>
  390. public static bool FillWtrExpress(UltraComboEditor cmb, OpeBase ob, bool hasBlankLine)
  391. {
  392. DataTable dt = GetComBaseInfo("4053", ob);
  393. if (hasBlankLine && dt != null && dt.Rows.Count > 0)
  394. {
  395. DataRow dr = dt.NewRow();
  396. dt.Rows.InsertAt(dr, 0);
  397. }
  398. cmb.DataSource = dt;
  399. cmb.DisplayMember = "BASENAME";
  400. cmb.ValueMember = "BASECODE";
  401. return true;
  402. }
  403. /// <summary>
  404. /// 通过科室查找对应的部门
  405. /// </summary>
  406. /// <param name="sectionName">科室ID</param>
  407. /// <param name="ob"></param>
  408. /// <returns>部门名称</returns>
  409. public static string GetDepartBySectionId(string sectionId, OpeBase ob)
  410. {
  411. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getDeptBySection", new object[]{sectionId}, ob);
  412. if (dt.Rows.Count > 0)
  413. {
  414. return dt.Rows[0]["DEPARTNAME"].ToString();
  415. }
  416. else
  417. {
  418. return "";
  419. }
  420. }
  421. /// <summary>
  422. /// 通过科室查找对应的部门 将国内贸易部国外贸易部改成销售总公司
  423. /// </summary>
  424. /// <param name="sectionName">科室ID</param>
  425. /// <param name="ob"></param>
  426. /// <returns>部门名称</returns>
  427. public static string GetDepartBySectionIdChangeSale(string sectionId, OpeBase ob)
  428. {
  429. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getDeptBySection", new object[] { sectionId }, ob);
  430. if (dt.Rows.Count > 0)
  431. {
  432. if (sectionId.StartsWith("002001042001") || sectionId.StartsWith("002001042002") || sectionId.StartsWith("002001042003"))
  433. {
  434. return "销售总公司" ;
  435. }
  436. else
  437. {
  438. return dt.Rows[0]["DEPARTNAME"].ToString();
  439. }
  440. }
  441. else
  442. {
  443. return "";
  444. }
  445. }
  446. /// <summary>
  447. /// 通过科室查找对应的部门
  448. /// </summary>
  449. /// <param name="sectionName">科室ID</param>
  450. /// <param name="ob"></param>
  451. /// <returns>部门ID</returns>
  452. public static string GetDepartIdBySectionId(string sectionId, OpeBase ob)
  453. {
  454. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getDeptBySection", new object[]{sectionId}, ob);
  455. if (dt.Rows.Count > 0)
  456. {
  457. return dt.Rows[0]["DEPARTID"].ToString();
  458. }
  459. else
  460. {
  461. return "";
  462. }
  463. }
  464. public static List<String> GetListByValid(string[] arr)
  465. {
  466. List<string> list = new List<string>();
  467. foreach (String DeptID in arr)
  468. {
  469. if (DeptID.StartsWith("002001042001"))
  470. {
  471. if (!list.Contains("100101"))
  472. list.Add("100101");
  473. }
  474. if (DeptID.StartsWith("002001042002"))
  475. {
  476. if (!list.Contains("100102"))
  477. list.Add("100102");
  478. }
  479. if (DeptID.StartsWith("002023"))
  480. {
  481. if (!list.Contains("100101"))
  482. list.Add("100101");
  483. if (!list.Contains("100105"))
  484. list.Add("100105");
  485. }
  486. }
  487. return list;
  488. }
  489. public static string[] GetArrByValid(string[] arr)
  490. {
  491. string[] list = new string[4];
  492. int index = 0;
  493. foreach (String DeptID in arr)
  494. {
  495. if (DeptID.StartsWith("002001042001"))
  496. {
  497. if (!list.Contains("100101"))
  498. {
  499. list[index] = "100101";
  500. index++;
  501. }
  502. }
  503. if (DeptID.StartsWith("002001042002"))
  504. {
  505. if (!list.Contains("100102"))
  506. {
  507. list[index] = "100102";
  508. index++;
  509. }
  510. }
  511. if (DeptID.StartsWith("002023"))
  512. {
  513. if (!list.Contains("100105"))
  514. list[index] = "100105";
  515. index++;
  516. }
  517. }
  518. return list;
  519. }
  520. public static ValueList GetSaleOrgByValid(string[] arr)
  521. {
  522. List<string> list = GetListByValid(arr);
  523. ValueListItem[] items = new ValueListItem[list.Count];
  524. ValueList valueList = new ValueList();
  525. int index = 0;
  526. foreach (string saleorg in list)
  527. {
  528. ValueListItem listItem = new ValueListItem();
  529. if (saleorg.Equals("100101"))
  530. listItem = new ValueListItem("100101", "国内贸易部");
  531. else if (saleorg.Equals("100102"))
  532. listItem = new ValueListItem("100102", "国际贸易部");
  533. else if (saleorg.Equals("100105"))
  534. listItem = new ValueListItem("100105", "天淮公司");
  535. items[index] = listItem;
  536. index++;
  537. }
  538. if (list.Count <= 0)
  539. {
  540. ValueListItem listItem = new ValueListItem();
  541. listItem = new ValueListItem("NONE", "");
  542. items[1] = listItem;
  543. }
  544. valueList.ValueListItems.AddRange(items);
  545. return valueList;
  546. }
  547. public static string GetSaleOrg(string DeptID)
  548. {
  549. if (DeptID.IndexOf("002001042001") >= 0)
  550. {
  551. return "100101";
  552. }
  553. if (DeptID.IndexOf("002001042002") >= 0)
  554. {
  555. return "100102";
  556. }
  557. if (DeptID.IndexOf("002023") >= 0)
  558. {
  559. return "100105";
  560. }
  561. return "NONE";
  562. }
  563. /// <summary>
  564. /// 根据部门表的主键获取描述
  565. /// </summary>
  566. /// <param name="departId"></param>
  567. /// <param name="ob"></param>
  568. /// <returns></returns>
  569. public static string GetDepartmentDescByDepartid(string departId, OpeBase ob)
  570. {
  571. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getDepartDescByDepartId",
  572. new object[]{departId}, ob);
  573. if (dt.Rows.Count > 0)
  574. {
  575. return dt.Rows[0][0].ToString();
  576. }
  577. return "";
  578. }
  579. /// <summary>
  580. /// 通过用户ID获取科室
  581. /// </summary>
  582. /// <param name="userId"></param>
  583. /// <param name="ob"></param>
  584. /// <returns></returns>
  585. public static string[] GetUnitByUser(string userId, OpeBase ob)
  586. {
  587. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getUnitByUser",
  588. new object[] { userId }, ob);
  589. if (dt.Rows.Count > 0)
  590. {
  591. return new string[] { dt.Rows[0]["DEPTID"].ToString(), dt.Rows[0]["DEPARTNAME"].ToString() };
  592. }
  593. return new string[] { "", "" };
  594. }
  595. /// <summary>
  596. /// 通过用户名称获取科室
  597. /// </summary>
  598. /// <param name="userId"></param>
  599. /// <param name="ob"></param>
  600. /// <returns></returns>
  601. public static string[] GetUnitByUserName(string userName, OpeBase ob, params string[] department)
  602. {
  603. DataTable dt = ServerHelper.GetData("com.steering.comm.data.ComBaseInfo.getUnitByUserName",
  604. new object[] { userName, department }, ob);
  605. if (dt.Rows.Count > 0)
  606. {
  607. return new string[] { dt.Rows[0]["DEPTID"].ToString(), dt.Rows[0]["DEPARTNAME"].ToString() };
  608. }
  609. if (userName == "admin")
  610. {
  611. return new string[] { "admin", "admin" };
  612. }
  613. return new string[]{"", ""};
  614. }
  615. }
  616. }