F_PAM_0503.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PAM_0501.cs
  5. * 2.功能描述:行政奖惩
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 张国印 2014/09/24 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseControls;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. namespace Dongke.IBOSS.PRD.Client.HRModule
  23. {
  24. /// <summary>
  25. /// 行政奖惩
  26. /// </summary>
  27. public partial class F_PAM_0503 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. // 窗体的单例模式
  31. private static F_PAM_0503 _instance;
  32. //Grid当前选中的行
  33. private int _selectedRowIndex;
  34. //用户编辑的ID集合
  35. int[] _staffIDList;
  36. #endregion
  37. #region 构造函数
  38. /// <summary>
  39. /// 构造函数
  40. /// </summary>
  41. public F_PAM_0503()
  42. {
  43. InitializeComponent();
  44. this.SetFromTitleInfo();
  45. }
  46. #endregion
  47. #region 单例模式
  48. /// <summary>
  49. /// 单例模式,防止重复创建窗体
  50. /// </summary>
  51. public static F_PAM_0503 Instance
  52. {
  53. get
  54. {
  55. if (_instance == null)
  56. {
  57. _instance = new F_PAM_0503();
  58. }
  59. return _instance;
  60. }
  61. }
  62. #endregion
  63. #region 事件
  64. /// <summary>
  65. /// 窗体加载事件
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void F_HR_1101_Load(object sender, EventArgs e)
  70. {
  71. try
  72. {
  73. #region 绑定数据源
  74. this.dkStaffName.WhereCondition = "(StaffStatus = 1 Or StaffStatus = 2) AND ValueFlag = 1";
  75. this.comAdministrationType.DataSource = DataDictionaryInfo();
  76. this.comAdministrationType.DisplayMember = "DictionaryValue";
  77. this.comAdministrationType.ValueMember = "DictionaryID";
  78. #endregion
  79. FormPermissionManager.FormPermissionControl(this.Name, this,
  80. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  81. }
  82. catch (Exception ex)
  83. {
  84. // 对异常进行共通处理
  85. ExceptionManager.HandleEventException(this.ToString(),
  86. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  87. }
  88. }
  89. /// <summary>
  90. /// 窗体关闭事件
  91. /// </summary>
  92. /// <param name="sender"></param>
  93. /// <param name="e"></param>
  94. private void F_HR_1101_FormClosed(object sender, FormClosedEventArgs e)
  95. {
  96. _instance = null;
  97. }
  98. /// <summary>
  99. /// 行获取焦点事件
  100. /// </summary>
  101. /// <param name="sender"></param>
  102. /// <param name="e"></param>
  103. private void dgvStaff_CellEnter(object sender, DataGridViewCellEventArgs e)
  104. {
  105. try
  106. {
  107. if (this.dgvStaff.CurrentCell != null)
  108. {
  109. // 记录最后选择行
  110. this._selectedRowIndex = this.dgvStaff.CurrentCell.RowIndex;
  111. }
  112. }
  113. catch (Exception ex)
  114. {
  115. // 对异常进行共通处理
  116. ExceptionManager.HandleEventException(this.ToString(),
  117. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  118. }
  119. }
  120. /// <summary>
  121. /// 停用按钮事件
  122. /// </summary>
  123. /// <param name="sender"></param>
  124. /// <param name="e"></param>
  125. private void tsbtnDisable_Click(object sender, EventArgs e)
  126. {
  127. try
  128. {
  129. List<string> AdminEXAIDs = new List<string>();
  130. dgvStaff.EndEdit();
  131. foreach (DataGridViewRow item in dgvStaff.Rows)
  132. {
  133. if ("1" == item.Cells["sel"].Value.ToString())
  134. {
  135. AdminEXAIDs.Add(item.Cells["AdminEXAID"].Value.ToString());
  136. }
  137. }
  138. if (AdminEXAIDs.Count > 0)
  139. {
  140. string ids = string.Join(",", AdminEXAIDs);
  141. F_PAM_0504 fpam0504 = new F_PAM_0504(ids);
  142. fpam0504.ShowDialog();
  143. this.btnSearch_Click(null, null);
  144. }
  145. }
  146. catch (Exception ex)
  147. {
  148. // 对异常进行共通处理
  149. ExceptionManager.HandleEventException(this.ToString(),
  150. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  151. }
  152. }
  153. /// <summary>
  154. /// 自动适应列宽
  155. /// </summary>
  156. /// <param name="sender"></param>
  157. /// <param name="e"></param>
  158. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  159. {
  160. this.dgvStaff.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  161. }
  162. /// <summary>
  163. /// 关闭按钮事件
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. private void tsbtnClose_Click(object sender, EventArgs e)
  168. {
  169. this.Close();
  170. }
  171. /// <summary>
  172. /// 查询按钮事件
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. private void btnSearch_Click(object sender, EventArgs e)
  177. {
  178. try
  179. {
  180. this._staffIDList = null;
  181. this.dgvStaff.DataSource = null;
  182. // 记录当前选中行
  183. //int selectRowIndex = this._selectedRowIndex;
  184. AdminEXAEntity se = SetSearchAdminRAPEntity();
  185. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  186. {
  187. return PAMModuleProxy.Service.GetAdminEXA(se);
  188. }
  189. );
  190. if (sre.Status == Constant.ServiceResultStatus.Success)
  191. {
  192. this.dgvStaff.DataSource = sre.Data.Tables[0];
  193. }
  194. }
  195. catch (Exception ex)
  196. {
  197. // 对异常进行共通处理
  198. ExceptionManager.HandleEventException(this.ToString(),
  199. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  200. }
  201. }
  202. /// <summary>
  203. /// 清空条件
  204. /// </summary>
  205. /// <param name="sender"></param>
  206. /// <param name="e"></param>
  207. private void btnClearCondition_Click(object sender, EventArgs e)
  208. {
  209. this.dkStaffName.UserID = null;
  210. this.dkStaffName.UserCode = string.Empty;
  211. this.dkStaffName.UserName = string.Empty;
  212. this.dkStaffName.StaffEntity = null;
  213. this.comAdministrationType.SelectedIndex = 0;
  214. this.txtRemarks.Clear();
  215. }
  216. #endregion
  217. #region 私有方法
  218. /// <summary>
  219. /// 设置窗体按钮的文本信息
  220. /// </summary>
  221. private void SetFromTitleInfo()
  222. {
  223. this.Text = FormTitles.F_PAM_0503;
  224. this.tsbtnApprover.Text = ButtonText.TSBTN_AUDIT;
  225. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  226. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  227. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  228. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  229. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  230. }
  231. /// <summary>
  232. /// 获取行政考核类别数据源
  233. /// </summary>
  234. /// <returns></returns>
  235. public DataTable DataDictionaryInfo()
  236. {
  237. DataTable dtDicInfo = (DataTable)DoAsync(new AsyncMethod(() =>
  238. {
  239. return CommonModuleProxy.Service.GetDataDictionaryByType(Constant.ASE_ASE001);
  240. }));
  241. DataRow newRowDic = dtDicInfo.NewRow();
  242. newRowDic["DictionaryID"] = Constant.CBO_SELECT_ALL_VALUE;
  243. newRowDic["DictionaryValue"] = Constant.CBO_SELECT_ALL_NAME;
  244. dtDicInfo.Rows.InsertAt(newRowDic, 0);
  245. return dtDicInfo;
  246. }
  247. /// <summary>
  248. /// 根据查询条件 形成查询实体
  249. /// </summary>
  250. /// <returns></returns>
  251. public AdminEXAEntity SetSearchAdminRAPEntity()
  252. {
  253. AdminEXAEntity searchAdminRAPEntity = new AdminEXAEntity();
  254. // searchAdminRAPEntity.ValueFlag = Constant.ValueFlag.Effective.GetHashCode().ToString();
  255. if (this.dkStaffName.UserID != null)
  256. {
  257. searchAdminRAPEntity.StaffID = this.dkStaffName.UserID.Value;
  258. }
  259. if (this.comAdministrationType.SelectedValue != null
  260. && Constant.CBO_SELECT_ALL_VALUE.ToString() !=this.comAdministrationType.SelectedValue.ToString())
  261. {
  262. searchAdminRAPEntity.AdminEXATypeID = Convert.ToInt32(this.comAdministrationType.SelectedValue);
  263. }
  264. searchAdminRAPEntity.AuditStatus = 0;
  265. searchAdminRAPEntity.Remarks = this.txtRemarks.Text;
  266. return searchAdminRAPEntity;
  267. }
  268. #endregion
  269. }
  270. }