username@email.com
2021-10-20 6a15d9219a9d4ebf17fa10519812029ad60239d4
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);
        }
    }
}