From 6a15d9219a9d4ebf17fa10519812029ad60239d4 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期三, 20 十月 2021 10:23:30 +0800 Subject: [PATCH] 社保单独维护 --- zhengcaioa/zhengcaioa/Controllers/HR/HrJibengongziController.cs | 75 +++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/HR/HrJibengongziController.cs b/zhengcaioa/zhengcaioa/Controllers/HR/HrJibengongziController.cs index 184d084..e18ff3d 100644 --- a/zhengcaioa/zhengcaioa/Controllers/HR/HrJibengongziController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/HR/HrJibengongziController.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using System.Transactions; using zhengcaioa.IService; using zhengcaioa.Models; @@ -153,5 +154,79 @@ ViewData["curentuser"] = curentuser; return new JsonResult(_hrJibengongziService.ModifyStatus(Id, curentuser.Id)); } + + + public IActionResult EditShebao() + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + var shebaoDTO = _hrJibengongziService.GetListShebao().FirstOrDefault(); + + + if (shebaoDTO == null) + { + shebaoDTO = new HrShebaoDTO(); + shebaoDTO.Shebaodanwei = 0; + shebaoDTO.Shebaogeren = 0; + } + + + + + ViewData.Model = shebaoDTO; + + + + + return View(); + } + + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + /// + [HttpPost] + public IActionResult SaveShebao(HrShebaoDTO data) + { + + ResultEntity resultEntity = new ResultEntity(); + + + + using (TransactionScope scope = new TransactionScope()) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + data.RecStatus = "A"; + + var resultDTO = _hrJibengongziService.GetListShebao().FirstOrDefault(); + if (resultDTO == null || string.IsNullOrEmpty(resultDTO.Id)) + { + resultDTO = new HrShebaoDTO(); + resultDTO.Shebaodanwei = data.Shebaodanwei; + resultDTO.Shebaogeren = data.Shebaogeren; + resultDTO.Creater = curentuser.Id; + resultDTO.Createtime = DateTime.Now; + } + else + { + resultDTO.Shebaodanwei = data.Shebaodanwei; + resultDTO.Shebaogeren = data.Shebaogeren; + } + resultDTO.Modifier = curentuser.Id; + resultDTO.Modifytime = DateTime.Now; + + resultEntity = _hrJibengongziService.saveShebao(resultDTO); + + scope.Complete(); + } + + + return new JsonResult(resultEntity); + } + } } -- Gitblit v1.9.1