F_HR_0202.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_HR_0202.cs
  5. * 2.功能描述:新建/编辑员工入职
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2014/09/12 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.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. using Dongke.IBOSS.PRD.WCF.Proxys.HRModuleService;
  21. namespace Dongke.IBOSS.PRD.Client.HRModule
  22. {
  23. /// <summary>
  24. /// 新建/编辑员工入职
  25. /// </summary>
  26. public partial class F_HR_0202 : FormBase
  27. {
  28. #region 成员变量
  29. // 页面传过来员工ID
  30. private int _staffID;
  31. // 页面传过来员工编码
  32. private string _staffCode;
  33. // 性别
  34. private string _gender;
  35. // 婚姻情况
  36. private string _maritalstatus;
  37. // 民族
  38. private string _nationalname;
  39. // 学历
  40. private string _educational;
  41. // 编辑状态
  42. private Constant.FormMode _editStatus;
  43. // 新建的员工ID集合
  44. private List<int> _staffIDList = new List<int>();
  45. // 时间戳
  46. private DateTime _optimestamp;
  47. //组织机构
  48. private string _organizationcode;
  49. // 员工履历实体类
  50. private StaffRecordEntity _staffRecordEntity;
  51. // 员工履历表ID
  52. private int _staffrecordID;
  53. // 图片字节集
  54. private List<byte[]> _PicByte = new List<byte[]>();
  55. // 缩略图节集
  56. private List<byte[]> _smallByte = new List<byte[]>();
  57. // 图片实体集合
  58. private List<StaffPhotoEntity> _imgList = new List<StaffPhotoEntity>();
  59. #endregion
  60. #region 构造函数
  61. public F_HR_0202()
  62. {
  63. InitializeComponent();
  64. }
  65. /// <summary>
  66. /// 构造函数
  67. /// </summary>
  68. /// <param name="frmStatus">窗体状态</param>
  69. public F_HR_0202(Constant.FormMode frmStatus)
  70. {
  71. InitializeComponent();
  72. _editStatus = frmStatus;
  73. this.dkStaffName.WhereCondition = "StaffStatus in(0,3) and ValueFlag=1";
  74. this.dkApplicant.WhereCondition = "StaffStatus in(0,3) and ValueFlag=1";
  75. // 设置窗口标题,当为新建状态时显示新建员工,当为编辑状态时显示编辑员工
  76. if (frmStatus == Constant.FormMode.Add)
  77. {
  78. this.Text = FormTitles.F_HR_0202_ADD;
  79. }
  80. else if (frmStatus == Constant.FormMode.Edit)
  81. {
  82. this.Text = FormTitles.F_HR_0202_EDIT;
  83. }
  84. // 工具栏按钮文本赋值
  85. this.btnSave.Text = ButtonText.BTN_SAVE;
  86. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  87. }
  88. #endregion
  89. #region 属性
  90. /// <summary>
  91. /// 页面传过来的员工ID
  92. /// </summary>
  93. public int StaffID
  94. {
  95. get
  96. {
  97. return this._staffID;
  98. }
  99. set
  100. {
  101. this._staffID = value;
  102. }
  103. }
  104. /// <summary>
  105. /// 页面传过来的员工ID
  106. /// </summary>
  107. public string StaffCode
  108. {
  109. get
  110. {
  111. return this._staffCode;
  112. }
  113. set
  114. {
  115. this._staffCode = value;
  116. }
  117. }
  118. /// <summary>
  119. /// 性别
  120. /// </summary>
  121. public string Gender
  122. {
  123. get
  124. {
  125. return this._gender;
  126. }
  127. set
  128. {
  129. this._gender = value;
  130. }
  131. }
  132. /// <summary>
  133. /// 婚姻状况
  134. /// </summary>
  135. public string MaritalStatus
  136. {
  137. get
  138. {
  139. return this._maritalstatus;
  140. }
  141. set
  142. {
  143. this._maritalstatus = value;
  144. }
  145. }
  146. /// <summary>
  147. /// 民族
  148. /// </summary>
  149. public string NationalName
  150. {
  151. get
  152. {
  153. return this._nationalname;
  154. }
  155. set
  156. {
  157. this._nationalname = value;
  158. }
  159. }
  160. /// <summary>
  161. /// 学历
  162. /// </summary>
  163. public string Educational
  164. {
  165. get
  166. {
  167. return this._educational;
  168. }
  169. set
  170. {
  171. this._educational = value;
  172. }
  173. }
  174. /// <summary>
  175. /// 时间戳
  176. /// </summary>
  177. public DateTime OPTimeStamp
  178. {
  179. get
  180. {
  181. return _optimestamp;
  182. }
  183. set
  184. {
  185. _optimestamp = value;
  186. }
  187. }
  188. /// <summary>
  189. /// 当前用户组织机构Code
  190. /// </summary>
  191. public string OrganizationCode
  192. {
  193. get
  194. {
  195. return _organizationcode;
  196. }
  197. set
  198. {
  199. _organizationcode = value;
  200. }
  201. }
  202. /// <summary>
  203. /// 员工履历表ID
  204. /// </summary>
  205. public int StaffRecordID
  206. {
  207. get
  208. {
  209. return this._staffrecordID;
  210. }
  211. set
  212. {
  213. this._staffrecordID = value;
  214. }
  215. }
  216. /// <summary>
  217. /// 员工ID集合
  218. /// </summary>
  219. public List<int> StaffIDList
  220. {
  221. get
  222. {
  223. return _staffIDList;
  224. }
  225. set
  226. {
  227. _staffIDList = value;
  228. }
  229. }
  230. #endregion
  231. #region 事件
  232. /// <summary>
  233. /// 窗体加载事件
  234. /// </summary>
  235. /// <param name="sender"></param>
  236. /// <param name="e"></param>
  237. private void F_HR_0104_Load(object sender, EventArgs e)
  238. {
  239. try
  240. {
  241. // 加载权限
  242. FormPermissionManager.FormPermissionControl(this.Name, this,
  243. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  244. #region 绑定工种职务数据源
  245. this.dropJobs.DisplayMember = "JOBSNAME";
  246. this.dropJobs.ValueMember = "JOBSID";
  247. this.dropJobs.DataSource = (DataTable)DoAsync(new BaseAsyncMethod(this.GetJobsData));
  248. this.droppost.DisplayMember = "POSTNAME";
  249. this.droppost.ValueMember = "POSTID";
  250. this.droppost.DataSource = (DataTable)DoAsync(new BaseAsyncMethod(this.GetPostData));
  251. #endregion
  252. #region 获取员工履历表数据, 编辑的时候去查,新增的时候不会调用
  253. if (this._editStatus == Constant.FormMode.Edit)
  254. {
  255. DataSet dsStaffRecord = (DataSet)DoAsync(new BaseAsyncMethod(this.GetStaffRecorsRowData));
  256. if (dsStaffRecord != null && dsStaffRecord.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  257. {
  258. this.dkStaffName.UserID = Convert.ToInt32(dsStaffRecord.Tables[0].Rows[0]["StaffID"]);
  259. this.dkStaffName.UserCode = dsStaffRecord.Tables[0].Rows[0]["StaffCode"].ToString();
  260. this.dkStaffName.Text = dsStaffRecord.Tables[0].Rows[0]["StaffName"].ToString();
  261. //this.dkOrganizationSearch.Text = dsStaffRecord.Tables[0].Rows[0]["organizationname"].ToString();
  262. //this.dkOrganizationSearch.OrganizationID = Convert.ToInt32(dsStaffRecord.Tables[0].Rows[0]["OriginalOrganizationID"]);
  263. scbOrganization.InitValue(dsStaffRecord.Tables[0].Rows[0]["organizationname"].ToString().Trim()
  264. , Convert.ToInt32(dsStaffRecord.Tables[0].Rows[0]["OriginalOrganizationID"]));
  265. this.dropJobs.SelectedValue = dsStaffRecord.Tables[0].Rows[0]["OriginalJobs"].ToString();
  266. this.droppost.SelectedValue = dsStaffRecord.Tables[0].Rows[0]["OriginalPost"].ToString();
  267. this.txtPause.Text = dsStaffRecord.Tables[0].Rows[0]["Reason"].ToString();
  268. this.txtSuggestion.Text = dsStaffRecord.Tables[0].Rows[0]["Suggestion"].ToString();
  269. string ExProbationEndDate = dsStaffRecord.Tables[0].Rows[0]["ExProbationEndDate"].ToString();
  270. this.OPTimeStamp = Convert.ToDateTime(dsStaffRecord.Tables[0].Rows[0]["OPTimeStamp"]);
  271. if (ExProbationEndDate != string.Empty)
  272. {
  273. chkExProbationEndDate.Checked = true;
  274. dateExProbationEndDate.Value = Convert.ToDateTime(dsStaffRecord.Tables[0].Rows[0]["ExProbationEndDate"]);
  275. }
  276. this.txtRecordRemarks.Text = dsStaffRecord.Tables[0].Rows[0]["Remarks"].ToString();
  277. this.dkApplicant.Text = dsStaffRecord.Tables[0].Rows[0]["ApplicantName"].ToString();
  278. this.dkApplicant.UserID = Convert.ToInt32(dsStaffRecord.Tables[0].Rows[0]["Applicant"]);
  279. string ApprovalStatus = dsStaffRecord.Tables[0].Rows[0]["ApprovalStatus"].ToString();
  280. if (ApprovalStatus != Constant.INT_IS_ZERO.ToString())//非待审批
  281. {
  282. //设置非待审核的履历控件禁用
  283. SetControlEnable();
  284. }
  285. }
  286. else
  287. {
  288. //设置非待审核的履历控件禁用
  289. SetControlEnable();
  290. }
  291. }
  292. #endregion
  293. }
  294. catch (Exception ex)
  295. {
  296. // 对异常进行共通处理
  297. ExceptionManager.HandleEventException(this.ToString(),
  298. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  299. }
  300. }
  301. /// <summary>
  302. /// 试用选择按钮事件
  303. /// </summary>
  304. /// <param name="sender"></param>
  305. /// <param name="e"></param>
  306. private void chkExProbationEndDate_CheckedChanged(object sender, EventArgs e)
  307. {
  308. if (chkExProbationEndDate.Checked)
  309. {
  310. dateExProbationEndDate.Enabled = true;
  311. }
  312. else
  313. {
  314. dateExProbationEndDate.Enabled = false;
  315. }
  316. }
  317. /// <summary>
  318. /// 保存按钮事件
  319. /// </summary>
  320. /// <param name="sender"></param>
  321. /// <param name="e"></param>
  322. private void btnSave_Click(object sender, EventArgs e)
  323. {
  324. try
  325. {
  326. // 验证输入是否正确
  327. if (!this.CheckInputValidity())
  328. {
  329. return;
  330. }
  331. this._staffRecordEntity = this.SetStaffRecordEntity();//获取员工履历实体
  332. if (this._editStatus == Constant.FormMode.Add)
  333. {
  334. // 新建员工入职
  335. this.btnSave.Enabled = false;
  336. this.btnCancel.Enabled = false;
  337. HRResultEntity returnStaff = (HRResultEntity)DoAsync(new BaseAsyncMethod(this.AddStaffRecord));
  338. this.btnSave.Enabled = true;
  339. this.btnCancel.Enabled = true;
  340. if (returnStaff.OperateStatus > Constant.INT_IS_ZERO)
  341. {
  342. // 提示信息
  343. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新建员工入职", "保存"),
  344. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  345. this._staffIDList.Add(returnStaff.HRStaffRecordID);
  346. this.Close();
  347. this.InitializationForm();//清空输入项
  348. }
  349. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_ONE)
  350. {
  351. // 提示信息
  352. MessageBox.Show(string.Format(Messages.MSG_HR_W006, "新建员工入职", "保存"),
  353. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  354. }
  355. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_TWO)
  356. {
  357. // 提示信息
  358. MessageBox.Show(string.Format(Messages.MSG_HR_W007, "新建员工入职", "保存"),
  359. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  360. }
  361. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_THREE)
  362. {
  363. // 提示信息
  364. MessageBox.Show(string.Format(Messages.MSG_HR_W007, "新建员工入职", "保存"),
  365. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  366. }
  367. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_FOUR)
  368. {
  369. // 提示信息
  370. MessageBox.Show(string.Format(Messages.MSG_HR_W008, "预试用结束日期"),
  371. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  372. }
  373. else
  374. {
  375. // 提示信息
  376. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "新建员工入职", "保存"),
  377. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  378. }
  379. }
  380. else
  381. {
  382. // 编辑员工入职
  383. this.btnSave.Enabled = false;
  384. this.btnCancel.Enabled = false;
  385. this._staffRecordEntity.StaffRecordID = StaffRecordID;
  386. HRResultEntity returnStaff = (HRResultEntity)DoAsync(new BaseAsyncMethod(this.EditStaffRecord));
  387. this.btnSave.Enabled = true;
  388. this.btnCancel.Enabled = true;
  389. if (returnStaff.OperateStatus > Constant.INT_IS_ZERO)
  390. {
  391. // 提示信息
  392. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "编辑员工入职", "保存"),
  393. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  394. this._staffIDList.Add(returnStaff.HRStaffRecordID);
  395. this.DialogResult = DialogResult.OK;
  396. this.Close();
  397. }
  398. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_ONE)
  399. {
  400. // 提示信息
  401. MessageBox.Show(string.Format(Messages.MSG_HR_W006, "编辑员工入职", "保存"),
  402. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  403. }
  404. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_TWO)
  405. {
  406. // 提示信息
  407. MessageBox.Show(string.Format(Messages.MSG_HR_W007, "编辑员工入职", "保存"),
  408. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  409. }
  410. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_THREE)
  411. {
  412. // 提示信息
  413. MessageBox.Show(string.Format(Messages.MSG_HR_W007, "编辑员工入职", "保存"),
  414. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  415. }
  416. else if (returnStaff.OperateStatus == Constant.INT_IS_NEGATIE_FOUR)
  417. {
  418. // 提示信息
  419. MessageBox.Show(string.Format(Messages.MSG_HR_W008, "预试用结束日期"),
  420. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  421. }
  422. else
  423. {
  424. // 提示信息
  425. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "编辑员工入职", "保存"),
  426. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  427. }
  428. }
  429. }
  430. catch (Exception ex)
  431. {
  432. this.btnSave.Enabled = true;
  433. this.btnCancel.Enabled = true;
  434. // 对异常进行共通处理
  435. ExceptionManager.HandleEventException(this.ToString(),
  436. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  437. }
  438. }
  439. /// <summary>
  440. /// 取消按钮
  441. /// </summary>
  442. /// <param name="sender"></param>
  443. /// <param name="e"></param>
  444. private void btnCancel_Click(object sender, EventArgs e)
  445. {
  446. if (this._staffIDList != null && this._staffIDList.Count > 0)
  447. {
  448. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  449. }
  450. else
  451. {
  452. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  453. }
  454. }
  455. #endregion
  456. #region 私有方法
  457. /// <summary>
  458. /// 获取员工基本数据
  459. /// </summary>
  460. /// <returns></returns>
  461. private DataSet GetRowData()
  462. {
  463. DataSet returnRowData = null;
  464. try
  465. {
  466. returnRowData = HRModuleProxy.Service.GetRowData(StaffID);
  467. }
  468. catch (Exception ex)
  469. {
  470. // 对异常进行共通处理
  471. ExceptionManager.HandleEventException(this.ToString(),
  472. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  473. }
  474. return returnRowData;
  475. }
  476. /// <summary>
  477. /// 获取工种数据
  478. /// </summary>
  479. /// <returns></returns>
  480. private DataTable GetJobsData()
  481. {
  482. DataTable returntJobsData = null;
  483. try
  484. {
  485. returntJobsData = SystemModuleProxy.Service.GetJobsData(0).Tables[0];
  486. }
  487. catch (Exception ex)
  488. {
  489. // 对异常进行共通处理
  490. ExceptionManager.HandleEventException(this.ToString(),
  491. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  492. }
  493. return returntJobsData;
  494. }
  495. /// <summary>
  496. /// 获取职务数据
  497. /// </summary>
  498. /// <returns></returns>
  499. private DataTable GetPostData()
  500. {
  501. DataTable returntPostData = null;
  502. try
  503. {
  504. returntPostData = SystemModuleProxy.Service.GetPostData(0).Tables[0];
  505. }
  506. catch (Exception ex)
  507. {
  508. // 对异常进行共通处理
  509. ExceptionManager.HandleEventException(this.ToString(),
  510. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  511. }
  512. return returntPostData;
  513. }
  514. /// <summary>
  515. /// 获取当前职工基本数据
  516. /// </summary>
  517. /// <returns></returns>
  518. private DataSet GetUserRowData()
  519. {
  520. DataSet returntUserRowData = null;
  521. try
  522. {
  523. returntUserRowData = SystemModuleProxy.Service.GetUserRowData(LogInUserInfo.CurrentUser.CurrentUserEntity.UserID);
  524. }
  525. catch (Exception ex)
  526. {
  527. // 对异常进行共通处理
  528. ExceptionManager.HandleEventException(this.ToString(),
  529. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  530. }
  531. return returntUserRowData;
  532. }
  533. /// <summary>
  534. /// 获取当前职工履历基本数据
  535. /// </summary>
  536. /// <returns></returns>
  537. private DataSet GetStaffRecorsRowData()
  538. {
  539. DataSet returntStaffRecorsRowData = null;
  540. try
  541. {
  542. returntStaffRecorsRowData = HRModuleProxy.Service.GetStaffRecorsRowData(StaffRecordID);
  543. }
  544. catch (Exception ex)
  545. {
  546. // 对异常进行共通处理
  547. ExceptionManager.HandleEventException(this.ToString(),
  548. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  549. }
  550. return returntStaffRecorsRowData;
  551. }
  552. /// <summary>
  553. /// 验证输入格式是否正确
  554. /// </summary>
  555. /// <returns></returns>
  556. private bool CheckInputValidity()
  557. {
  558. //入职员工
  559. if (this.dkStaffName.UserID == null)
  560. {
  561. // 提示信息
  562. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "员工姓名"),
  563. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  564. this.dkStaffName.Focus();
  565. return false;
  566. }
  567. //所属部门
  568. if (this.scbOrganization.SearchedPKMember == 0)
  569. {
  570. // 提示信息
  571. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "所属部门"),
  572. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  573. this.scbOrganization.Focus();
  574. return false;
  575. }
  576. //申请人
  577. if (this.dkStaffName.UserID == null)
  578. {
  579. if (this.dkApplicant.UserID == null)
  580. {
  581. // 提示信息
  582. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "申请人"),
  583. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  584. this.dkApplicant.Focus();
  585. return false;
  586. }
  587. }
  588. //工号
  589. //if (this.dkOriginalUserCode.UserID == null)
  590. //{
  591. // this.dkOriginalUserCode.Focus();
  592. // return false;
  593. //}
  594. //工种
  595. if (this.dropJobs.SelectedValue == null || this.dropJobs.SelectedValue.ToString() == string.Empty)
  596. {
  597. // 提示信息
  598. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "工种"),
  599. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  600. this.dropJobs.Focus();
  601. return false;
  602. }
  603. //职务
  604. if (this.droppost.SelectedValue == null || this.droppost.SelectedValue.ToString() == string.Empty)
  605. {
  606. // 提示信息
  607. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "职务"),
  608. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  609. this.droppost.Focus();
  610. return false;
  611. }
  612. if (this.txtPause.Text.Trim() == string.Empty)
  613. {
  614. // 提示信息
  615. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "申请原因"),
  616. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  617. this.txtPause.Focus();
  618. return false;
  619. }
  620. if (this.txtSuggestion.Text.Trim() == string.Empty)
  621. {
  622. // 提示信息
  623. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "部门意见"),
  624. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  625. this.txtSuggestion.Focus();
  626. return false;
  627. }
  628. return true;
  629. }
  630. /// <summary>
  631. /// 根据页面输入值,给员工对象实体赋值
  632. /// </summary>
  633. /// <returns></returns>
  634. private StaffRecordEntity SetStaffRecordEntity()
  635. {
  636. StaffRecordEntity staffRecordEntity = new StaffRecordEntity();
  637. //员工ID
  638. staffRecordEntity.StaffID = Convert.ToInt32(this.dkStaffName.UserID);
  639. //员工Code
  640. staffRecordEntity.StaffCode = this.dkStaffName.UserCode; ;
  641. //履历类别 1入职
  642. staffRecordEntity.RecordType = 1;
  643. //如果实习,添加预结束实习日期
  644. if (chkExProbationEndDate.Checked)
  645. staffRecordEntity.ExProbationEndDate = Convert.ToDateTime(dateExProbationEndDate.Value.ToString("yyyy-MM-dd"));
  646. //履历日期
  647. staffRecordEntity.RecordDate = DateTime.Now;
  648. //原工号
  649. //staffRecordEntity.OriginalUserID =this.dkOriginalUserCode.UserID;
  650. //原工号编码
  651. //staffRecordEntity.OriginalUserCode = this.dkOriginalUserCode.UserCode;
  652. //原员工状态 0未入职
  653. staffRecordEntity.OriginalStaffStatus = 0;
  654. //原工种
  655. staffRecordEntity.OriginalJobs = Convert.ToInt32(dropJobs.SelectedValue);
  656. //所属部门
  657. staffRecordEntity.OriginalOrganizationID = scbOrganization.SearchedPKMember;
  658. //原职务
  659. staffRecordEntity.OriginalPost = Convert.ToInt32(droppost.SelectedValue);
  660. //调整后的工号
  661. staffRecordEntity.TargetUserID = this.dkOriginalUserCode.UserID;
  662. //调整后工号编码
  663. staffRecordEntity.TargetUserCode = this.dkOriginalUserCode.UserCode;
  664. //调整后员工状态 0未入职
  665. staffRecordEntity.TargetStaffStatus = chkExProbationEndDate.Checked ? 1 : 2;
  666. //调整后工种
  667. staffRecordEntity.TargetJobs = Convert.ToInt32(dropJobs.SelectedValue);
  668. //调整后所属部门
  669. staffRecordEntity.TargetOrganizationID = scbOrganization.SearchedPKMember;
  670. //调整后职务
  671. staffRecordEntity.TargetPost = Convert.ToInt32(droppost.SelectedValue);
  672. //申请原因
  673. staffRecordEntity.Reason = txtPause.Text.Trim();
  674. //审批状态0 待审批
  675. // MODIFY 员工入职直接审批通过 BY 付斌 2018-3-31
  676. staffRecordEntity.ApprovalStatus = 3;
  677. //部门原因
  678. staffRecordEntity.Suggestion = txtSuggestion.Text;
  679. //有效标识
  680. staffRecordEntity.ValueFlag = 1;
  681. //时间戳
  682. staffRecordEntity.OPTimeStamp = OPTimeStamp;
  683. //申请人
  684. staffRecordEntity.Applicant = Convert.ToInt32(this.dkApplicant.UserID == null ? this.dkStaffName.UserID : this.dkApplicant.UserID);
  685. //备注
  686. staffRecordEntity.Remarks = txtRecordRemarks.Text;
  687. return staffRecordEntity;
  688. }
  689. /// <summary>
  690. /// 添加员工档案
  691. /// </summary>
  692. /// <returns></returns>
  693. private HRResultEntity EditStaffRecord()
  694. {
  695. try
  696. {
  697. return HRModuleProxy.Service.EditStaffRecord(_staffRecordEntity);
  698. }
  699. catch (Exception ex)
  700. {
  701. throw ex;
  702. }
  703. }
  704. /// <summary>
  705. /// 编辑员工档案
  706. /// </summary>
  707. /// <returns></returns>
  708. private HRResultEntity AddStaffRecord()
  709. {
  710. try
  711. {
  712. return HRModuleProxy.Service.AddStaffRecord(_staffRecordEntity);
  713. }
  714. catch (Exception ex)
  715. {
  716. throw ex;
  717. }
  718. }
  719. /// <summary>
  720. /// 清空输入项
  721. /// </summary>
  722. private void InitializationForm()
  723. {
  724. this.scbOrganization.ClearValue();
  725. this.txtPause.Text = "";
  726. this.dropJobs.Text = "";
  727. this.dropJobs.SelectedValue = null;
  728. this.dropJobs.SelectedText = null;
  729. this.droppost.Text = "";
  730. this.droppost.SelectedValue = null;
  731. this.droppost.SelectedText = null;
  732. this.chkExProbationEndDate.Checked = false;
  733. this.txtSuggestion.Text = "";
  734. this.dkStaffName.UserID = null;
  735. this.dkApplicant.UserID = null;
  736. this.txtRecordRemarks.Text = "";
  737. }
  738. //设置非待审核的履历控件禁用
  739. private void SetControlEnable()
  740. {
  741. this.scbOrganization.Enabled = false;
  742. this.dropJobs.Enabled = false;
  743. this.droppost.Enabled = false;
  744. this.txtPause.Enabled = false;
  745. this.txtSuggestion.Enabled = false;
  746. this.chkExProbationEndDate.Enabled = false;
  747. this.btnSave.Enabled = false;
  748. }
  749. /// <summary>
  750. /// 获取员工图片
  751. /// </summary>
  752. /// <returns></returns>
  753. private DataSet GetImageByStaffId()
  754. {
  755. DataSet returnImageByStaffId = null;
  756. try
  757. {
  758. returnImageByStaffId = HRModuleProxy.Service.GetImageByStaffId(StaffID);
  759. }
  760. catch (Exception ex)
  761. {
  762. // 对异常进行共通处理
  763. ExceptionManager.HandleEventException(this.ToString(),
  764. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  765. }
  766. return returnImageByStaffId;
  767. }
  768. #endregion
  769. }
  770. }