예제 #1
0
        public ResultObj Add(Driver obj)
        {
            // 获取当前登录用户名
            string _currentUserName = CommonService.GetCurrentUser(HttpContext).UserName;

            ResultObj resultObj = new ResultObj();

            if (IsExistSame(obj))
            {
                resultObj.IsSuccess = false;
                resultObj.ErrMsg    = "该名称已存在。";
                return(resultObj);
            }

            obj.CreateUser     = _currentUserName;
            obj.CreateTime     = DateTime.Now;
            obj.LastUpdateUser = _currentUserName;
            obj.LastUpdateTime = DateTime.Now;

            _context.Driver.Add(obj);
            _context.SaveChanges();

            resultObj.IsSuccess = true;
            return(resultObj);
        }
예제 #2
0
        public ResultObj Add(WorkTicket obj)
        {
            // 获取当前登录用户名
            string _currentUserName = CommonService.GetCurrentUser(HttpContext).UserName;

            ResultObj resultObj = new ResultObj();

            if (IsExistSame(obj))
            {
                resultObj.IsSuccess = false;
                resultObj.ErrMsg    = "该工单编号已存在。";
                return(resultObj);
            }
            //obj.Status = WorkTicketStatus.待接单.ToString();
            obj.Status         = WorkTicketStatus.待拉油.ToString();
            obj.IsDeleted      = false;
            obj.Description    = obj.Description + "【创建工单】操作人:" + _currentUserName + ",时间:" + DateTime.Now;
            obj.CreateUser     = _currentUserName;
            obj.CreateTime     = DateTime.Now;
            obj.LastUpdateUser = _currentUserName;
            obj.LastUpdateTime = DateTime.Now;

            _context.WorkTicket.Add(obj);
            _context.SaveChanges();

            resultObj.IsSuccess = true;
            return(resultObj);
        }