public JsonResult BatchDeleteCategory(string Ids) { int num; string[] strArrays = Ids.Split(new char[] { '|' }); for (int i = 0; i < strArrays.Length; i++) { string str = strArrays[i]; if (!string.IsNullOrWhiteSpace(str) && int.TryParse(str, out num)) { ServiceHelper.Create <ICategoryService>().DeleteCategory(num); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("删除平台分类,Id=", num), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/Category/BatchDeleteCategory/", num), UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); } } return(Json(new { Successful = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteType(long Id) { Result result = new Result(); try { ServiceHelper.Create <ITypeService>().DeleteType(Id); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("删除平台类目,Id=", Id), IPAddress = base.Request.UserHostAddress, PageUrl = "/ProductType/DeleteTyp", UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); result.success = true; } catch (HimallException himallException) { result.msg = himallException.Message; } catch (Exception exception) { Log.Error("删除平台类目失败", exception); result.msg = "删除平台类目失败"; } return(Json(result)); }
public EntitySession(OperationContext context, EntitySessionOptions options = EntitySessionOptions.Default) { Context = context; this.Options = options; IsSecureSession = this is Vita.Entities.Authorization.SecureSession; _appEvents = Context.App.AppEvents; this.LocalLog = Context.LocalLog; // Multithreaded sessions must be readonly var isConcurrent = Options.IsSet(EntitySessionOptions.Concurrent); IsReadOnly = Options.IsSet(EntitySessionOptions.ReadOnly) || isConcurrent; _timeService = Context.App.GetService <ITimeService>(); _operationLog = Context.App.GetService <IOperationLogService>(); RecordsLoaded = new EntityRecordWeakRefTable(isConcurrent); // These two lists are not used in Readonly sessions if (!IsReadOnly) { RecordsChanged = new List <EntityRecord>(); ListsChanged = new List <IPropertyBoundList>(); RecordsToClearLists = new HashSet <EntityRecord>(); ScheduledCommands = new List <ScheduledLinqCommand>(); } _appEvents.OnNewSession(this); //These might be reset in SaveChanges NextTransactionId = Guid.NewGuid(); TransactionDateTime = _timeService.UtcNow; TransactionStart = _timeService.ElapsedMilliseconds; }
public JsonResult Auditing(long Id, int status, string comment = "") { //更新实地认证状态 ServiceHelper.Create <ICertification>().UpdateStatus(Id, (FieldCertification.CertificationStatus)status, DateTime.Now, comment); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Format("实地认证审核页面,供应商Id={0},状态为:{1}, 说明是:{2}", Id, (FieldCertification.CertificationStatus)status, comment), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/FieldCertification/Auditing/", Id), UserName = base.CurrentManager.UserName, Id = 0 }; operationLogService.AddPlatformOperationLog(logInfo); ManagerInfo Info = ServiceHelper.Create <ICertification>().GetManager(Id); if (Info != null) { UserMemberInfo userInfo = ServiceHelper.Create <IMemberService>().GetMemberByName(Info.UserName); //ServiceHelper.Create<ISiteMessagesService>().SendCertificationResultMessage(userInfo.Id, base.CurrentManager.UserName); } //更新供应商认证状态 ServiceHelper.Create <IShopService>().UpdateShopGrade(Info.ShopId, (FieldCertification.CertificationStatus)status); return(Json(new { Successful = true })); }
public JsonResult CreateCategory(string name, long pId) { if (string.IsNullOrWhiteSpace(name) || name.Length > 5) { throw new Exception(); } ShopCategoryInfo shopCategoryInfo = new ShopCategoryInfo() { Name = name, ParentCategoryId = pId, IsShow = true, DisplaySequence = ServiceHelper.Create <IShopCategoryService>().GetCategoryByParentId(pId).Count() + 1, ShopId = base.CurrentSellerManager.ShopId }; ServiceHelper.Create <IShopCategoryService>().AddCategory(shopCategoryInfo); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("创建供应商分类,父Id=", pId), IPAddress = base.Request.UserHostAddress, PageUrl = "/Category/CreateCategory", UserName = base.CurrentSellerManager.UserName, ShopId = base.CurrentSellerManager.ShopId }; operationLogService.AddSellerOperationLog(logInfo); return(Json(new { successful = true }, JsonRequestBehavior.AllowGet)); }
public ProductTypeController(ITypeService iTypeService, IOperationLogService iOperationLogService, IBrandService iBrandService) { _iTypeService = iTypeService; _iOperationLogService = iOperationLogService; _iBrandService = iBrandService; }
public void Init(EntityApp app) { _timerContext = app.CreateSystemContext(); _logService = app.GetService<IOperationLogService>(); _timer = new Timer(100); _timer.Elapsed += Timer_Elapsed; app.AppEvents.Initializing += Events_Initializing; }
public LogFileWriter(EntityApp app, string logPath) { _app = app; LogPath = logPath; _logService = app.GetService <IOperationLogService>(); _saveService = app.GetService <IBackgroundSaveService>(); _saveService.Saving += SaveService_Saving; }
public CapitalController(IMemberCapitalService iMemberCapitalService, IMemberService iMemberService, IOperationLogService iOperationLogService) { _iMemberCapitalService = iMemberCapitalService; _iMemberService = iMemberService; _iOperationLogService = iOperationLogService; }
public void Init(EntityApp app) { _app = app; _errorLog = _app.GetService <IErrorLogService>(); _operationLog = _app.GetService <IOperationLogService>(); _timerService = _app.GetService <ITimerService>(); _timerService.Elapsed1Second += TimerService_Elapsed1Second; _app.AppEvents.FlushRequested += Events_FlushRequested; }
public LogFileWriter(EntityApp app, string logPath) { _app = app; LogPath = logPath; _logService = app.GetService<IOperationLogService>(); Util.Check(_logService != null, "OperationLog service not registered, cannot attach LogFileWriter."); if (_logService != null) _logService.Saving += logService_Saving; }
public void Init(EntityApp app) { _app = app; _errorLog = _app.GetService<IErrorLogService>(); _operationLog = _app.GetService<IOperationLogService>(); _timerService = _app.GetService<ITimerService>(); _timerService.Elapsed1Second += TimerService_Elapsed1Second; _app.AppEvents.FlushRequested += Events_FlushRequested; }
public LoggingEntityApp(string schema = "log", LogModules includeModules = LogModules.All, UserSessionSettings sessionSettings = null) : base("LoggingApp", CurrentVersion) { var area = base.AddArea(schema); ActiveModules = includeModules; // DbInfo module is not shared with main app, it is local for the database var dbInfo = new DbInfoModule(area); // ErrorLog is property in EntityApp, will be set there automatically if (ActiveModules.IsSet(LogModules.ErrorLog)) { var errLog = new ErrorLogModule(area); } if (ActiveModules.IsSet(LogModules.OperationLog)) { OperationLog = new OperationLogModule(area); } if (ActiveModules.IsSet(LogModules.IncidentLog)) { IncidentLog = new IncidentLogModule(area); } if (ActiveModules.IsSet(LogModules.TransactionLog)) { TransactionLog = new TransactionLogModule(area, trackHostApp: false); //do not track changes for LoggingApp itself } if (ActiveModules.IsSet(LogModules.NotificationLog)) { NotificationLog = new NotificationLogModule(area); } if (ActiveModules.IsSet(LogModules.LoginLog)) { LoginLog = new LoginLogModule(area); } if (ActiveModules.IsSet(LogModules.DbUpgradeLog)) { DbUpgradeLog = new DbUpgradeLogModule(area); } if (ActiveModules.IsSet(LogModules.UserSession)) { SessionService = new UserSessionModule(area, sessionSettings); } if (ActiveModules.IsSet(LogModules.EventLog)) { EventLogService = new EventLogModule(area); } if (ActiveModules.IsSet(LogModules.WebCallLog)) { WebCallLog = new WebCallLogModule(area); } if (ActiveModules.IsSet(LogModules.WebClientLog)) { WebClientLogService = new WebClientLogModule(area); } }
public ShopController(IShopService iShopService, IProductService iProductService, IOperationLogService iOperationLogService, IRegionService iRegionService, ICategoryService iCategoryService, ISearchProductService iSearchProductService) { _iShopService = iShopService; _iProductService = iProductService; _iOperationLogService = iOperationLogService; _iRegionService = iRegionService; _iCategoryService = iCategoryService; _iSearchProductService = iSearchProductService; //获取当前店铺发布商品的数量 }
public EntityCache(EntityApp app, CacheSettings settings, Database database) { _app = app; Settings = settings; _dataStore = database; _sparseCache = new SparseEntityCache(Settings); var dbIsCaseInsensitive = database.Settings.Driver.Features.IsSet(Data.Driver.DbFeatures.DefaultCaseInsensitive); var caseMode = dbIsCaseInsensitive ? StringCaseMode.CaseInsensitive : StringCaseMode.CaseSensitive; _fullSetCache = new FullSetEntityCache(_app, Settings, _dataStore, caseMode); _timeService = _app.GetService<ITimeService>(); _logService = _app.GetService<IOperationLogService>(); _errorLog = _app.GetService<IErrorLogService>(); MarkCachedEntities(); _app.AppEvents.SavedChanges += Events_SavedChanges; }
public EntityCache(EntityApp app, CacheSettings settings, Database database) { _app = app; Settings = settings; _dataStore = database; _sparseCache = new SparseEntityCache(Settings); var dbIsCaseInsensitive = database.Settings.Driver.Features.IsSet(Data.Driver.DbFeatures.DefaultCaseInsensitive); var caseMode = dbIsCaseInsensitive ? StringCaseMode.CaseInsensitive : StringCaseMode.CaseSensitive; _fullSetCache = new FullSetEntityCache(_app, Settings, _dataStore, caseMode); _timeService = _app.GetService <ITimeService>(); _logService = _app.GetService <IOperationLogService>(); _errorLog = _app.GetService <IErrorLogService>(); MarkCachedEntities(); _app.AppEvents.SavedChanges += Events_SavedChanges; }
public LoggingEntityApp(string schema = "log", UserSessionSettings sessionSettings = null) : base("LoggingApp", CurrentVersion) { var area = base.AddArea(schema); var errorLog = new ErrorLogModule(area); OperationLog = new OperationLogModule(area); IncidentLog = new IncidentLogModule(area); TransactionLog = _transactionLogModule = new TransactionLogModule(area); WebCallLog = new WebCallLogModule(area); NotificationLog = new NotificationLogModule(area); LoginLog = new LoginLogModule(area); DbModelChangeLog = new DbUpgradeLogModule(area); SessionService = new UserSessionModule(area, sessionSettings); DbInfoService = new DbInfoModule(area); EventLogService = new EventLogModule(area); }
public JsonResult DeleteShop(long Id) { ServiceHelper.Create <IShopService>().DeleteShop(Id); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("删除店铺,Id=", Id), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/Shop/Edit/", Id), UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); return(Json(new { Successful = true })); }
public JsonResult Auditing(long shopId, int status, string comment = "") { ServiceHelper.Create <IShopService>().UpdateShopStatus(shopId, (ShopInfo.ShopAuditStatus)status, comment); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Format("开店审核页面,店铺Id={0},状态为:{1}, 说明是:{2}", shopId, (ShopInfo.ShopAuditStatus)status, comment), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/Shop/Auditing/", shopId), UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); return(Json(new { Successful = true })); }
public JsonResult DeleteCategoryById(long id) { ServiceHelper.Create <ICategoryService>().DeleteCategory(id); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("删除平台分类,Id=", id), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/Category/DeleteCategoryById/", id), UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); return(Json(new { Successful = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateName(string name, long id) { ServiceHelper.Create <IShopCategoryService>().UpdateCategoryName(id, name); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now }; object[] objArray = new object[] { "修改供应商分类名称,Id=", id, ",名称=", name }; logInfo.Description = string.Concat(objArray); logInfo.IPAddress = base.Request.UserHostAddress; logInfo.PageUrl = "/Category/UpdateName"; logInfo.UserName = base.CurrentSellerManager.UserName; logInfo.ShopId = base.CurrentSellerManager.ShopId; operationLogService.AddSellerOperationLog(logInfo); return(Json(new { Successful = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult Receing(long Id, int status, string comment = "") { /*状态*/ ServiceHelper.Create <ICertification>().UpdateStatus(Id, (FieldCertification.CertificationStatus)status, DateTime.Now, comment); /*日志*/ IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Format("实地认证接收页面,供应商Id={0},状态为:{1}, 说明是:{2}", Id, (FieldCertification.CertificationStatus)status, comment), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/FieldCertification/Receing/", Id), UserName = base.CurrentManager.UserName, Id = 0 }; operationLogService.AddPlatformOperationLog(logInfo); return(Json(new { Successful = true })); }
public ActionResult Edit(CategoryModel category) { if (base.ModelState.IsValid) { ICategoryService categoryService = ServiceHelper.Create <ICategoryService>(); ProcessingIcon(category, categoryService); categoryService.UpdateCategory(category); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("修改平台分类,Id=", category.Id), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/Category/Edit/", category.Id), UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); return(RedirectToAction("Management")); } ViewBag.Types = GetTypesList(category.TypeId); ViewBag.Depth = category.Depth; return(View(category)); }
public JsonResult SaveBusinessCategory(long shopId = 0L, string bcategory = "") { Dictionary <long, decimal> nums = new Dictionary <long, decimal>(); string[] strArrays = bcategory.Split(new char[] { ',' }); for (int i = 0; i < strArrays.Length; i++) { string str = strArrays[i]; if (!string.IsNullOrWhiteSpace(str)) { char[] chrArray = new char[] { '|' }; if (!nums.ContainsKey(int.Parse(str.Split(chrArray)[0]))) { char[] chrArray1 = new char[] { '|' }; long num = int.Parse(str.Split(chrArray1)[0]); char[] chrArray2 = new char[] { '|' }; nums.Add(num, decimal.Parse(str.Split(chrArray2)[1])); } } } ServiceHelper.Create <IShopService>().SaveBusinessCategory(shopId, nums); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("修改店铺经营类目,店铺Id=", shopId), IPAddress = base.Request.UserHostAddress }; object[] objArray = new object[] { "/Shop/SaveBusinessCategory?shopId=", shopId, "&bcategory=", bcategory }; logInfo.PageUrl = string.Concat(objArray); logInfo.UserName = base.CurrentManager.UserName; logInfo.ShopId = 0; operationLogService.AddPlatformOperationLog(logInfo); return(Json(new { Successful = true })); }
public ActionResult SaveModel(TypeInfoModel type) { if (0 != type.Id) { ServiceHelper.Create <ITypeService>().UpdateType(type); } else if (0 == type.Id) { ServiceHelper.Create <ITypeService>().AddType(type); } IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("修改平台类目,Id=", type.Id), IPAddress = base.Request.UserHostAddress, PageUrl = "/ProductType/SaveModel", UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); return(RedirectToAction("Management")); }
public Task Invoke(HttpContext httpContext) { User user = httpContext.Session.Get <User>("user"); if (user != null) { OperationLog log = new OperationLog(); log.Method = httpContext.Request.Method; log.Ip = httpContext.GetUserIp(); log.Path = httpContext.Request.Path; if (httpContext.Request.Form != null) { Dictionary <string, string> form = httpContext.Request.Form.ToDictionary(x => x.Key, x => x.Value.ToString()); log.Input = JsonConvert.SerializeObject(form); } log.Username = user.Username; log.CreateAt = new DateTime(); IOperationLogService operationLogService = (IOperationLogService)httpContext.RequestServices.GetService(typeof(IOperationLogService)); operationLogService.Record(log); } return(_next(httpContext)); }
public OperationLogController(IOperationLogService operationLogService) { this.operationLogService = operationLogService; }
public OperationLogController(IOperationLogService iOperationLogService, IManagerService iManagerService) { _iOperationLogService = iOperationLogService; _iManagerService = iManagerService; }
public JsonResult Edit(ShopModel shop) { IShopService shopService = ServiceHelper.Create <IShopService>(); ShopInfo companyName = shopService.GetShop(shop.Id, false); if (!CheckShopGrade(shop.Id, Convert.ToInt64(shop.ShopGrade))) { throw new HimallException("该店铺已使用空间数或已添加商品数大于该套餐"); } if (shopService.ExistShop(companyName.ShopName, shop.Id)) { throw new HimallException("该店铺已存在"); } if (!base.ModelState.IsValid) { List <string> strs = new List <string>(); foreach (string list in base.ModelState.Keys.ToList()) { foreach (ModelError modelError in base.ModelState[list].Errors.ToList()) { strs.Add(modelError.ErrorMessage); } } Result result = new Result() { success = false, msg = strs[0].ToString() }; return(Json(result)); } companyName.CompanyName = shop.CompanyName; companyName.CompanyAddress = shop.CompanyAddress; companyName.CompanyPhone = shop.CompanyPhone; companyName.CompanyEmployeeCount = shop.CompanyEmployeeCount; companyName.CompanyRegisteredCapital = shop.CompanyRegisteredCapital; companyName.ContactsName = shop.ContactsName; companyName.ContactsEmail = shop.ContactsEmail; companyName.ContactsPhone = shop.ContactsPhone; companyName.BankAccountName = shop.BankAccountName; companyName.BankAccountNumber = shop.BankAccountNumber; companyName.BankCode = shop.BankCode; companyName.BankName = shop.BankName; companyName.BankPhoto = shop.BankPhoto; companyName.ShopName = shop.Name; companyName.GradeId = Convert.ToInt64(shop.ShopGrade); companyName.EndDate = new DateTime?(Convert.ToDateTime(shop.EndDate)); companyName.CompanyRegionId = shop.NewCompanyRegionId; companyName.BankRegionId = shop.NewBankRegionId; companyName.ShopStatus = (ShopInfo.ShopAuditStatus)Convert.ToInt32(shop.Status); ServiceHelper.Create <IShopService>().UpdateShop(companyName); IOperationLogService operationLogService = ServiceHelper.Create <IOperationLogService>(); LogInfo logInfo = new LogInfo() { Date = DateTime.Now, Description = string.Concat("修改店铺信息,Id=", shop.Id), IPAddress = base.Request.UserHostAddress, PageUrl = string.Concat("/Shop/Edit/", shop.Id), UserName = base.CurrentManager.UserName, ShopId = 0 }; operationLogService.AddPlatformOperationLog(logInfo); Result result1 = new Result() { success = true, msg = "保存成功!" }; return(Json(result1)); }
public SystemLogController() { _operationLogService = new OperationLogService(); }