From 6f34ab1ed6f8cb79a012a30a7b687e362c6f16c2 Mon Sep 17 00:00:00 2001 From: LR-20210131IOQH\Administrator <jackcold@163.com> Date: 星期四, 10 六月 2021 19:08:41 +0800 Subject: [PATCH] 打卡判断,增加前端浏览器mac获取,当mac获取为空时不判断 --- zhengcaioa/zhengcaioa/Controllers/UserController.cs | 134 ++++++++++++++++++++++---------------------- 1 files changed, 67 insertions(+), 67 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/UserController.cs b/zhengcaioa/zhengcaioa/Controllers/UserController.cs index 754ffbb..867184c 100644 --- a/zhengcaioa/zhengcaioa/Controllers/UserController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/UserController.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Transactions; using zhengcaioa.IService; @@ -171,7 +172,6 @@ } ViewBag.shenfenzheng = resultshenfenzheng; - ResultDataEntity<SysAttachmentDTO> resultshenfenzhengbeimian = new ResultDataEntity<SysAttachmentDTO>(); if (!string.IsNullOrEmpty(id)) { @@ -183,8 +183,6 @@ resultshenfenzhengbeimian = _sysAttachmentService.SearchByPaging(searchEntity); } ViewBag.shenfenzhengbeimian = resultshenfenzhengbeimian; - - ResultDataEntity<SysAttachmentDTO> resultsxuelizheng = new ResultDataEntity<SysAttachmentDTO>(); if (!string.IsNullOrEmpty(id)) @@ -226,10 +224,6 @@ } - - - - [CheckLogin] public string Get(string id = null) { @@ -258,85 +252,91 @@ ViewData["curentuser"] = curentuser; ResultEntity resultEntity = new ResultEntity(); resultEntity.Result = false; - using (TransactionScope scope = new TransactionScope()) + + string s = @"^([A-Fa-f0-9]{2}[-,:]){5}[A-Fa-f0-9]{2}$"; + Regex rStr = new Regex(s); + if (rStr.IsMatch(userdata.IpMac)) { - - userdata.RecStatus = "A"; - if (String.IsNullOrEmpty(userdata.Id)) + using (TransactionScope scope = new TransactionScope()) { - userdata.Creater = curentuser.Id; - userdata.Createtime = DateTime.Now; - } - userdata.Modifier = curentuser.Id; - userdata.Modifytime = DateTime.Now; - resultEntity = _userService.savePltUser(userdata); - if (resultEntity.Result == false) - { - return JsonConvert.SerializeObject(resultEntity); - } - string[] JiatingchengyuanId = userdata.JiatingchengyuanId; - string[] Name = userdata.Name; - string[] Guanxi = userdata.Guanxi; - string[] Gongzuodanwei = userdata.Gongzuodanwei; - - - for (int i = 0; i < JiatingchengyuanId.Length; i++) - { - PltJiatingchengyuanDTO pltJiatingchengyuanDTO = new PltJiatingchengyuanDTO(); - pltJiatingchengyuanDTO.Id = JiatingchengyuanId[i] == null ? "" : JiatingchengyuanId[i].Trim(); - pltJiatingchengyuanDTO.UserId = userdata.Id; - pltJiatingchengyuanDTO.Name = Name[i] == null ? "" : Name[i].Trim(); - pltJiatingchengyuanDTO.Guanxi = Guanxi[i] == null ? "" : Guanxi[i].Trim(); - pltJiatingchengyuanDTO.Gongzuodanwei = Gongzuodanwei[i] == null ? "" : Gongzuodanwei[i].Trim(); - pltJiatingchengyuanDTO.RecStatus = "A"; - if (String.IsNullOrEmpty(JiatingchengyuanId[i])) + userdata.RecStatus = "A"; + if (String.IsNullOrEmpty(userdata.Id)) { - pltJiatingchengyuanDTO.Creater = curentuser.Id; - pltJiatingchengyuanDTO.Createtime = DateTime.Now; + userdata.Creater = curentuser.Id; + userdata.Createtime = DateTime.Now; } - pltJiatingchengyuanDTO.Modifier = curentuser.Id; - pltJiatingchengyuanDTO.Modifytime = DateTime.Now; - resultEntity = _pltJiatingchengyuanService.save(pltJiatingchengyuanDTO); + userdata.Modifier = curentuser.Id; + userdata.Modifytime = DateTime.Now; + + resultEntity = _userService.savePltUser(userdata); if (resultEntity.Result == false) { return JsonConvert.SerializeObject(resultEntity); } - } + string[] JiatingchengyuanId = userdata.JiatingchengyuanId; + string[] Name = userdata.Name; + string[] Guanxi = userdata.Guanxi; + string[] Gongzuodanwei = userdata.Gongzuodanwei; - string[] Filepaths = userdata.Filepath; - if (Filepaths != null && Filepaths.Length > 0) - { - for (int i = 0; i < Filepaths.Length; i++) + for (int i = 0; i < JiatingchengyuanId.Length; i++) { - if (string.IsNullOrEmpty(userdata.attachmentid[i])) + PltJiatingchengyuanDTO pltJiatingchengyuanDTO = new PltJiatingchengyuanDTO(); + pltJiatingchengyuanDTO.Id = JiatingchengyuanId[i] == null ? "" : JiatingchengyuanId[i].Trim(); + pltJiatingchengyuanDTO.UserId = userdata.Id; + pltJiatingchengyuanDTO.Name = Name[i] == null ? "" : Name[i].Trim(); + pltJiatingchengyuanDTO.Guanxi = Guanxi[i] == null ? "" : Guanxi[i].Trim(); + pltJiatingchengyuanDTO.Gongzuodanwei = Gongzuodanwei[i] == null ? "" : Gongzuodanwei[i].Trim(); + pltJiatingchengyuanDTO.RecStatus = "A"; + if (String.IsNullOrEmpty(JiatingchengyuanId[i])) { - SysAttachmentDTO sysAttachmentDTO = new SysAttachmentDTO(); - //sysAttachmentDTO.Id = - sysAttachmentDTO.AttObj = userdata.AttObj[i]; - sysAttachmentDTO.AttObjid = userdata.Id; - sysAttachmentDTO.Filefullname = userdata.Filefullname[i]; - sysAttachmentDTO.Filepath = userdata.Filepath[i]; - sysAttachmentDTO.Creater = curentuser.Id; - sysAttachmentDTO.Modifier = curentuser.Id; - sysAttachmentDTO.Createtime = DateTime.Now; - sysAttachmentDTO.Modifytime = sysAttachmentDTO.Createtime; - - resultEntity = _sysAttachmentService.save(sysAttachmentDTO); - if (resultEntity.Result == false) - { - return JsonConvert.SerializeObject(resultEntity); - } + pltJiatingchengyuanDTO.Creater = curentuser.Id; + pltJiatingchengyuanDTO.Createtime = DateTime.Now; } - + pltJiatingchengyuanDTO.Modifier = curentuser.Id; + pltJiatingchengyuanDTO.Modifytime = DateTime.Now; + resultEntity = _pltJiatingchengyuanService.save(pltJiatingchengyuanDTO); + if (resultEntity.Result == false) + { + return JsonConvert.SerializeObject(resultEntity); + } } + string[] Filepaths = userdata.Filepath; + if (Filepaths != null && Filepaths.Length > 0) + { + for (int i = 0; i < Filepaths.Length; i++) + { + if (string.IsNullOrEmpty(userdata.attachmentid[i])) + { + SysAttachmentDTO sysAttachmentDTO = new SysAttachmentDTO(); + //sysAttachmentDTO.Id = + sysAttachmentDTO.AttObj = userdata.AttObj[i]; + sysAttachmentDTO.AttObjid = userdata.Id; + sysAttachmentDTO.Filefullname = userdata.Filefullname[i]; + sysAttachmentDTO.Filepath = userdata.Filepath[i]; + sysAttachmentDTO.Creater = curentuser.Id; + sysAttachmentDTO.Modifier = curentuser.Id; + sysAttachmentDTO.Createtime = DateTime.Now; + sysAttachmentDTO.Modifytime = sysAttachmentDTO.Createtime; + + resultEntity = _sysAttachmentService.save(sysAttachmentDTO); + if (resultEntity.Result == false) + { + return JsonConvert.SerializeObject(resultEntity); + } + } + } + } + scope.Complete(); } - scope.Complete(); } - + else + { + resultEntity.Message = "MAC鍦板潃鏍煎紡閿欒"; + } return JsonConvert.SerializeObject(resultEntity); } #endregion -- Gitblit v1.9.1