Example #1
0
 /// <summary>
 /// 写日志文件
 /// </summary>
 /// <param name="modelType">日志的类型</param>
 /// <param name="operatorId">操作员的ID</param>
 /// <param name="modifiedId">被操作对象的ID</param>
 /// <param name="opType">操作的类型</param>
 /// <returns></returns>
 public async Task WriteOPLog(char modelType, Guid operatorId, Guid modifiedId, char opType = '1')
 {
     if (modelType == '1')
     {
         using (IAccountOperateLogService accountOperateLogService = new AccountOperateLogService())
         {
             await accountOperateLogService.CreateAsync(new Model.AccountOperateLog()
             {
                 OperatorId  = operatorId,
                 ModifiedId  = modifiedId,
                 OPerateType = opType.ToString()
             });
         }
     }
     else
     {
         using (IWebsiteOperateLogService websiteOperateLogService = new WebsiteOperateLogService())
         {
             await websiteOperateLogService.CreateAsync(new Model.WebSiteOperateLog()
             {
                 OperatorId  = operatorId,
                 WebsiteId   = modifiedId,
                 OPerateType = opType.ToString()
             });
         }
     }
 }
Example #2
0
        /// <summary>
        /// 添加网点
        /// </summary>
        /// <param name="info">网点信息</param>
        /// <param name="operatorId">操作员id</param>
        /// <returns></returns>
        public async Task CreateWebSite(DTO.WebSiteInfoDto info, Guid operatorId)
        {
            var website = new Model.WebsiteInfo()
            {
                SiteName     = info.Name,
                Province     = info.Province,
                Address      = info.Address,
                Location     = info.Location,
                ChargeMan    = info.ChargeMan,
                ChargeManTel = info.ChargeManTel,
                Type         = info.Type.Trim()
            };

            using (var websiteInfoService = new WebsiteInfoService())
            {
                await websiteInfoService.CreateAsync(website);
            }
            using (var websiteInfoLogService = new WebsiteOperateLogService())
            {
                await websiteInfoLogService.CreateAsync(new Model.WebSiteOperateLog()
                {
                    WebsiteId  = website.Id,
                    OperatorId = operatorId
                });
            }
        }
Example #3
0
        /// <summary>
        /// 查询日志
        /// </summary>
        /// <param name="type">1:account  2:file  3:notice  4:wesite</param>
        /// <returns></returns>
        public async Task <List <LogInfoDto> > GetLOg(string type)
        {
            List <LogInfoDto> logList = new List <LogInfoDto>();

            if (type == "1")
            {
                using (var accountOperateLogService = new AccountOperateLogService())
                {
                    logList = accountOperateLogService.GetAll().Include(p => p.OpStaffInfo).Include(p => p.MoStaffInfo).Select(p => new LogInfoDto()
                    {
                        CreatTime  = p.CreatTime,
                        ModifyType = p.OPerateType,
                        Operator   = p.OpStaffInfo.Name,
                        ModifyObj  = p.MoStaffInfo.Name,
                        SectionId  = p.OpStaffInfo.SectionId
                    }).ToList();
                }
            }
            else
            {
                using (var websiteOperateLogService = new WebsiteOperateLogService())
                {
                    logList = websiteOperateLogService.GetAll().Include(p => p.StaffInfo).Include(p => p.WebsiteInfo).Select(p => new LogInfoDto()
                    {
                        CreatTime  = p.CreatTime,
                        ModifyType = p.OPerateType,
                        Operator   = p.StaffInfo.Name,
                        ModifyObj  = p.WebsiteInfo.SiteName,
                        SectionId  = p.StaffInfo.SectionId
                    }).ToList();
                }
            }

            using (var sectionService = new SectionService())
            {
                foreach (var log in logList)
                {
                    log.Section = (await sectionService.GetOneById(log.SectionId)).Name;
                }
            }

            return(logList);
        }