public async Task GetSystemSettings_Should_Return_Right_Data() { ISystemSettingService sut = new SystemSettingService(_systemSettingRepository, _systemSettingMapper); var result = await sut.GetSystemSettingsAsync(); result.ShouldNotBeNull(); }
public async Task GetSystemSetting_Should_Return_Right_Data(string guid) { ISystemSettingService sut = new SystemSettingService(_systemSettingRepository, _systemSettingMapper); var result = await sut.GetSystemSettingAsync(new GetSystemSettingRequest { CustomerId = guid }); result.CustomerId.ShouldBe(guid); }
/// <summary> /// 获取当前心跳 /// </summary> /// <returns></returns> public static HeartbeatRequest GetHeartBeatByCurrent() { HeartbeatRequest sendHeartBeat = new HeartbeatRequest(); SystemSettingService systemSettingService = new SystemSettingService(); var result = systemSettingService.GetSystemSetting(); if (result == null) { return(null); } //机器码mac地址从数据库取 sendHeartBeat.UniqueId = result.Set_Unique_Id; //bdl_system_setting表装换成json,赋值 sendHeartBeat.SettingJSON = JsonTools.Obj2JSONStrNew <SystemSettingEntity>(result); //项目名 智能健身赋值 sendHeartBeat.ProductName = "智能健身"; //使用期限 sendHeartBeat.UseDeadTime = result.Auth_OfflineTime.ToString().Replace("/", "-"); //冻结 if (result.User_Status == SystemSettingEntity.USER_STATUS_FREEZE) { //是否为冻结状态的心跳,这里不能从数据库取,否则,云通知本地锁死,本地改状态后,会再次通知云锁死本机,陷入死循环 //状态 正常0和锁定1 sendHeartBeat.Status = 1.ToString(); } //正常 else if (result.User_Status == SystemSettingEntity.USER_STATUS_GENERAL) { //状态 正常0和锁定1 //默认为正常心跳 sendHeartBeat.Status = 0.ToString(); } return(sendHeartBeat); }
public ActionResult Index() { ISystemSettingService ss = new SystemSettingService(Settings.Default.db); SystemSetting setting = ss.Find(); return(View(setting)); }
public void GetSystemSetting_Should_Thrown_Exception_With_Null_Id() { ISystemSettingService sut = new SystemSettingService(_systemSettingRepository, _systemSettingMapper); sut.GetSystemSettingAsync(new GetSystemSettingRequest { CustomerId = null }).ShouldThrow <ArgumentNullException>(); }
/// <summary> /// 获取设置信息 /// </summary> /// <returns></returns> public ActionResult GetSettings() { var list = SystemSettingService.GetAll().Select(s => new { s.Name, s.Value }).ToList(); return(ResultData(list)); }
/// <summary> /// 保存设置 /// </summary> /// <param name="sets"></param> /// <returns></returns> public async Task <ActionResult> Save(string sets) { var settings = JsonConvert.DeserializeObject <List <SystemSetting> >(sets).ToArray(); var b = await SystemSettingService.AddOrUpdateSavedAsync(s => s.Name, settings) > 0; var dic = settings.ToDictionary(s => s.Name, s => s.Value); //同步设置 foreach (var(key, value) in dic) { CommonHelper.SystemSettings.AddOrUpdate(key, value); } return(ResultData(null, b, b ? "设置保存成功!" : "设置保存失败!")); }
public AppService(AppDbContext db) { Phone = new PhoneService(db, this); Company = new CompanyService(db, this); CallRecord = new CallRecordService(db, this); State = new StateService(db, this); SystemSetting = new SystemSettingService(db, this); CostingTemplate = new CostingTemplateService(db, this); QuoteTemplate = new QuoteTemplateService(db, this); Quote = new QuoteService(db, this); Costing = new CostingService(db, this); CallScript = new CallScriptService(db, this); CallQuestion = new CallQuestionService(db, this); CallAnswer = new CallAnswerService(db, this); _appDbContext = db; }
public ActionResult UpdateBasic([Bind(Include = "daysBeforeAlertStaffGoFull ,goFullAlertMails ,unCertifacteAlertMails,attendanceExceptionAlertMails,repeatAttendanceRecordTime,validAttendanceRecordTime,lateExceptionTime,earlyLeaveExceptionTime,systemHost,emaiSMTPHost,emailUser,emailPwd,emailAddress")] SystemSetting setting) { ResultMessage msg = new ResultMessage(); try { ISystemSettingService cs = new SystemSettingService(Settings.Default.db); bool isSucceed = cs.Update(setting); msg.Success = isSucceed; msg.Content = isSucceed ? "" : "保存成功"; return(Json(msg, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResultMessage() { Success = false, Content = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task EditSystemSetting_Should_Add_Right_Entity() { var testSystemSetting = new EditSystemSettingRequest { AccountId = Guid.NewGuid().ToString(), Active = false, ClientId = Guid.NewGuid().ToString(), CustomerId = "b5b055349263448ca69e0bbd8b3eb90u", PaymentGatewayUrl = "http://vmdataprueba.cloudapp.net/WebApi/APaymentTokenApi/", Secret = "AgilisaTechnologies", StoreUrl = "https://localhost:44358/payment/confirmation/" }; ISystemSettingService sut = new SystemSettingService(_systemSettingRepository, _systemSettingMapper); var result = await sut.EditSystemSettingAsync(testSystemSetting); result.AccountId.ShouldBe(testSystemSetting.AccountId); result.Active.ShouldBe(testSystemSetting.Active); result.ClientId.ShouldBe(testSystemSetting.ClientId); result.CustomerId.ShouldBe(testSystemSetting.CustomerId); result.PaymentGatewayUrl.ShouldBe(testSystemSetting.PaymentGatewayUrl); result.Secret.ShouldBe(testSystemSetting.Secret); result.StoreUrl.ShouldBe(testSystemSetting.StoreUrl); }
public async Task AddSystemSetting_Should_Add_Right_Entity() { var testSystemSetting = new AddSystemSettingRequest { AccountId = "12345", Active = true, ClientId = "1234", CustomerId = "123456", PaymentGatewayUrl = "http://vmdataprueba.cloudapp.net/WebApi/APaymentTokenApi/", Secret = "AgilisaTechnologies", StoreUrl = "https://localhost:44358/payment/confirmation/" }; ISystemSettingService sut = new SystemSettingService(_systemSettingRepository, _systemSettingMapper); var result = await sut.AddSystemSettingAsync(testSystemSetting); result.AccountId.ShouldBe(testSystemSetting.AccountId); result.Active.ShouldBe(testSystemSetting.Active); result.ClientId.ShouldBe(testSystemSetting.ClientId); result.CustomerId.ShouldBe(testSystemSetting.CustomerId); result.PaymentGatewayUrl.ShouldBe(testSystemSetting.PaymentGatewayUrl); result.Secret.ShouldBe(testSystemSetting.Secret); result.StoreUrl.ShouldBe(testSystemSetting.StoreUrl); }
public AdminSystemSettingsController(SystemSettingService systemSettingsService, UserStatuService userStatuService) : base(userStatuService) { this._systemSettingsService = systemSettingsService; }
public ActionResult GetSetting(string name) { var entity = SystemSettingService.Get(s => s.Name.Equals(name)); return(ResultData(entity)); }
static SystemSetting() { Service = ServiceLocator.Current.GetInstance <SystemSettingService>(); }
public void Init() { #region client var defaultHost = ConfigurationManager.AppSettings["DefaultHost"]; var host = !string.IsNullOrEmpty(defaultHost) ? defaultHost : RouteHelper.HostName(); IsLocal = !string.IsNullOrEmpty(defaultHost); IsApiHtml = false; IsHttps = false; DefaultLanguage = LanguageType.Chinese; AdminLoginImage = "default"; MemberIndex = "Index"; ProfileWithEmail = false; ProfileWithPhone = false; LoginStyle = LoginStyle.Normal; switch (host) { case "cms.xnet.world": //Demo中 // ClientID = new Guid("00000000-1111-2222-3333-123456789999"); // ClientCode = "000"; // SystemName = "Demo"; ClientID = new Guid("a4dde220-30e5-490b-bb5b-3c39c3abbe4f"); ClientCode = "003"; SystemName = "Demo"; break; //拙八郎 case "www.eightgeman.com": ClientID = new Guid("82092779-8fc9-47d3-adb1-7574bcddc00d"); //ClientCode = "001"; //SystemName = "8GeMan"; SiteName = "eightgeman"; IsHttps = true; MemberIndex = "Profile"; ProfileWithEmail = true; ProfileWithPhone = true; break; //滑輪 case "www.rollersports.org.tw": ClientID = new Guid("524dde74-fdef-481a-b9ed-49bab41f7964"); //ClientCode = "002"; //SystemName = "RollerSport"; SiteName = "rollersports"; IsHttps = true; MemberIndex = "Profile"; ProfileWithEmail = true; ProfileWithPhone = true; LoginStyle = LoginStyle.Popup; break; //迷你足球 case "soccer.ai-sportthings.com": case "www.ai-sportthings.com": ClientID = new Guid("a4dde220-30e5-490b-bb5b-3c39c3abbe4f"); //ClientCode = "003"; //SystemName = "MiniSoccer"; //SiteName = "ai-sportthings"; IsHttps = true; AdminLoginImage = "003"; MemberIndex = "Profile"; break; default: break; } #endregion ClientService clientService = new ClientService(); if (ClientID != Guid.Empty) { var client = clientService.Get(ClientID); ClientCode = client.ClientCode; SystemName = client.SystemName; ClientSettings = client.ClientSetting.ToContainList <ClientSetting>(); } clientService.Dispose(); _Log.CreateText("Application init " + SystemName); #region SetSystemSetting SystemSettingService service = new SystemSettingService(); service.ClientID = ClientID; //SiteInfo var resultSiteInfo = service.Get <SiteInfoViewModel>(SystemSettingType.SiteInfo); if (resultSiteInfo.IsSuccess) { // Html Decode resultSiteInfo.Data.Footer = HttpUtility.HtmlDecode(resultSiteInfo.Data.Footer); SiteInfo = resultSiteInfo.Data; } //ApiKey var resultApiKey = service.Get <ApiKeyViewModel>(SystemSettingType.ApiKey); if (resultApiKey.IsSuccess) { ApiKey = resultApiKey.Data; } service.Dispose(); #endregion }