コード例 #1
0
        /// <summary>
        /// Update Log
        /// </summary>
        /// <param name="logService">ILogService</param>
        /// <param name="unitOfWork">IUnitOfWork</param>
        /// <param name="component">ex: Projects</param>
        /// <param name="content">log content</param>
        /// <param name="action">1 is Insert, 2 is Update, 3 is Delete</param>
        /// <param name="isSuccess">true is success, false is fail</param>
        ///
        public void InsertLogActive(ILogService logService, IUnitOfWork unitOfWork, string component, string content, int action, bool isSuccess)
        {
            var _entity = new crm_Logs();

            _entity.Component       = component;
            _entity.Content         = content;
            _entity.LogTypeActionId = action;
            _entity.IsSuccess       = isSuccess;
            _entity.LoginDate       = DateTime.Now;
            _entity.LogoutDate      = DateTime.Now;
            if (browser.IsMobileDevice)
            {
                _entity.Platform = "Mobile";
            }
            else
            {
                _entity.Platform = "Desktop";
            }
            _entity.TenantId      = _userInfo.TenanID;
            _entity.UserId        = _userInfo.ID;
            _entity.DetectedIp    = GetIPHelper();
            _entity.AccessBrowser = browser.Browser;
            _entity.ComputerName  = GetComputernameHelper();

            logService.Insert(_entity);
            unitOfWork.SaveChanges();
        }
コード例 #2
0
        public static crm_Logs ToEntity(this LogModel model)
        {
            var _logEntity = new crm_Logs();

            AutoMapper.Mapper.CreateMap <LogModel, crm_Logs>();
            AutoMapper.Mapper.Map(model, _logEntity);
            return(_logEntity);
        }
コード例 #3
0
        public static LogModel ToModel(this crm_Logs entity)
        {
            var _logModel = new LogModel();

            AutoMapper.Mapper.CreateMap <crm_Logs, LogModel>();
            AutoMapper.Mapper.Map(entity, _logModel);
            return(_logModel);
        }