/// <summary> /// Sets up HTTP methods mappings. /// </summary> /// <param name="service">Service handling requests</param> public CustomModule(CustomService service) : base("/") { Get["/system/health"] = parameters => { var tags = Parameters.ValueOf <string>(parameters, Context.Request, "tags", ParameterType.Query); var combineTagsOr = Parameters.ValueOf <bool?>(parameters, Context.Request, "combineTagsOr", ParameterType.Query); return(service.GetAemHealthCheck(Context, tags, combineTagsOr)); }; Post["/apps/system/config/com.shinesolutions.healthcheck.hc.impl.ActiveBundleHealthCheck"] = parameters => { var bundlesIgnored = Parameters.ValueOf <List <string> >(parameters, Context.Request, "bundlesIgnored", ParameterType.Query); var bundlesIgnoredTypeHint = Parameters.ValueOf <string>(parameters, Context.Request, "bundlesIgnoredTypeHint", ParameterType.Query); service.PostConfigAemHealthCheckServlet(Context, bundlesIgnored, bundlesIgnoredTypeHint); return(new Response { ContentType = "" }); }; Post["/apps/system/config/com.shinesolutions.aem.passwordreset.Activator"] = parameters => { var pwdresetAuthorizables = Parameters.ValueOf <List <string> >(parameters, Context.Request, "pwdresetAuthorizables", ParameterType.Query); var pwdresetAuthorizablesTypeHint = Parameters.ValueOf <string>(parameters, Context.Request, "pwdresetAuthorizablesTypeHint", ParameterType.Query); service.PostConfigAemPasswordReset(Context, pwdresetAuthorizables, pwdresetAuthorizablesTypeHint); return(new Response { ContentType = "" }); }; }
public Service() { //log4net.Util.LogLog.InternalDebugging = true; ODws = new CustomService(this.Context);//INFO we can extend this for other service types try { useODForValues = Boolean.Parse(ConfigurationManager.AppSettings["UseODForValues"]); } catch (Exception e) { String error = "Missing or invalid value for UseODForValues. Must be true or false"; log.Fatal(error); throw new SoapException("Invalid Server Configuration. " + error, new XmlQualifiedName(SoapExceptionGenerator.ServerError)); } try { requireAuthToken = Boolean.Parse(ConfigurationManager.AppSettings["requireAuthToken"]); } catch (Exception e) { String error = "Missing or invalid value for requireAuthToken. Must be true or false"; log.Fatal(error); throw new SoapException(error, new XmlQualifiedName(SoapExceptionGenerator.ServerError)); } }
public HomeController(UniqueIdentifierService uniqueIdentifierService, IdentityService identityService, CustomService customService) { this._customService = customService; this._identityService = identityService; this._uniqueIdentifierService = uniqueIdentifierService; }
public void GetRecordTest() { var openId = "o3IHxjkke04__4n1kFeXpfMjjRBc"; var accessToken = AccessTokenContainer.GetToken(_appId); var result = CustomService.GetRecord(accessToken, DateTime.Today, DateTime.Now, null, 10, 1); Assert.IsTrue(result.recordlist.Count > 0); }
public void CustomizationTest() { var entity = new SimpleEntity { Name = "CustomizedSimpleEntity" }; CustomService.Execute(entity); Assert.Equal("Custom event was handled", _message3); }
public static void InitApp(String applicationId, String apiKey) { if (String.IsNullOrEmpty(applicationId)) { throw new ArgumentNullException(ExceptionMessage.NULL_APPLICATION_ID); } if (String.IsNullOrEmpty(apiKey)) { throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY); } Log.addLogger(Log.DEFAULTLOGGER, new ConsoleLogger()); Log.startLogging(BACKENDLESSLOG); #if WITHRT Quobject.EngineIoClientDotNet.Modules.LogManager.Enabled = !DeviceCheck.IsMobile; #endif AppId = applicationId; APIKey = apiKey; Persistence = new PersistenceService(); Data = Persistence; Geo = new GeoService(); Messaging = new MessagingService(); Files = new FileService(); UserService = new UserService(); Events = Events.GetInstance(); Cache = Cache.GetInstance(); Counters = CounterService.GetInstance(); Logging = new LoggingService(); CustomService = new CustomService(); #if WITHRT RT = new RTServiceImpl(); #endif MessageWriter.DefaultWriter = new UnderflowWriter(); MessageWriter.AddAdditionalTypeWriter(typeof(BackendlessUser), new BackendlessUserWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(Geometry), new BackendlessGeometryWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(Point), new BackendlessGeometryWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(LineString), new BackendlessGeometryWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(Polygon), new BackendlessGeometryWriter()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(BackendlessUser).FullName, new BackendlessUserFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(GeometryDTO).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(Geometry).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(Point).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(LineString).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(Polygon).FullName, new BackendlessGeometryFactory()); HeadersManager.CleanHeaders(); LoginStorage loginStorage = new LoginStorage(); if (loginStorage.HasData) { HeadersManager.GetInstance().AddHeader(HeadersEnum.USER_TOKEN_KEY, loginStorage.UserToken); } }
protected override void OnSessionChange(SessionChangeDescription desc) { switch (desc.Reason) { case SessionChangeReason.SessionLogon: var user = CustomService.UserInformation(desc.SessionId); CustomService.DoWhatEverYouWant(user); break; } }
public void Subscribe(WX_EventQueue info) { var app = appBLL.GetByPK(info.AppId); if (app != null) { CustomService customSvr = new CustomService(app.AppId, app.AppSecret); customSvr.SendText(info.OpenID, "欢迎您关注公众号"); GetUserInfo(info.OpenID, app.AppId, app.AppSecret); } }
/////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// MCVS LIFECYCLE /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// <summary> /// Actor is added to MCVS /// </summary> public void onRegister() { //STORE STRONG TYPED REFERENCE - ITS 'OK' FOR CONTROLLER TO CALL ON MODEL model = UMVCS.Instance.model as CustomModel; service = UMVCS.Instance.service as CustomService; //LISTEN UMVCS.Instance.controller.eventDispatcher.addEventListener(CustomServiceEvent.FAVORITE_VIDEOGAMES_LOADED, onFavoriteVideogamesLoaded); UMVCS.Instance.controller.eventDispatcher.addEventListener(CustomViewUIEvent.RELOAD_BUTTON_CLICK, onReloadButtonClick); UMVCS.Instance.controller.eventDispatcher.addEventListener(CustomViewUIEvent.CLEAR_BUTTON_CLICK, onClearButtonClick); }
/// <summary> /// 初始化接口服务 /// </summary> private void InitializeWeChatService() { CommonService = new CommonService(_client, _config.AppId, _config.AppSecret); CommentService = new CommentService(_client); CustomService = new CustomService(_client); FileService = new FileService(_client); MenuService = new MenuService(_client); MessageAllService = new MessageAllService(_client); TemplateMessageService = new TemplateMessageService(_client); UserService = new UserService(_client); PayService = new PayService(_client, _config); }
static void Main(string[] args) { CustomService custom = new CustomService(new CreatorSqlRepository()); custom.DoSomething(); #region //CustomService custom = // new CustomService(RepositoryEnum.SqlRepository); //custom.DoSomething(); #endregion Console.ReadLine(); }
/// <summary> /// 发送消息给用户 /// </summary> /// <param name="msg"></param> /// <returns></returns> public ActionResult TaleToUser(WX_CustomMsg msg) { msg.MsgId = Guid.NewGuid().ToString(); msg.CreateTime = DateTime.Now; msg.MsgSource = "客服"; var Ap = new WX_AppManager().GetByPK(msg.AppId); //发送到微信 CustomService customSvr = new CustomService(Ap.AppId, Ap.AppSecret); customSvr.SendText(msg.OpenID, msg.Content); bool IsTrue = new WX_CustomMsgManager().Add(msg); return(Json(IsTrue, JsonRequestBehavior.AllowGet)); }
static void Main(string[] args) { var serviceProp = typeof(CustomService).GetProperty("srv"); var idProp = serviceProp.PropertyType.GetProperty("ID"); var service = new CustomService { srv = new Service { ID = 5 } }; var srvValue = serviceProp.GetValue(service, null); var idValue = (int)idProp.GetValue(srvValue, null); Console.WriteLine(idValue); }
/// <summary> /// 订阅(关注)事件 如果用户还未关注公众号,则用户可以关注公众号,关注后微信会将带场景值关注事件推送给开发者 /// </summary> /// <returns></returns> public override IResponseMessageBase OnEvent_SubscribeRequest(RequestMessageEvent_Subscribe requestMessage) { var responseMessage = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageText>(requestMessage); responseMessage.Content = "欢迎您加入五福商城大家庭"; //新关注用户的openId var openId = requestMessage.FromUserName; var userInfo = new UserOAuthService().UserInfo(openId); var parentOpenId = ""; //如果是场景关注 if (!string.IsNullOrEmpty(requestMessage.EventKey) && requestMessage.EventKey.StartsWith("qrscene_")) { parentOpenId = requestMessage.EventKey.Replace("qrscene_", "");//推荐人的openid if (openId != parentOpenId) { //给推荐人发送推荐成功消息 string notifyMsg = string.Format(@"用户【{0}】,通过您的二维码加入了商城,加入时间:{1}", userInfo.nickname, DateTime.Now.ToString()); var customService = new CustomService(); customService.SendText(parentOpenId, notifyMsg); } } //将新关注的用户添加到数据库保存 Task.Factory.StartNew(() => { //用户信息保存到数据库 var userGenerator = new UserGenerator(); userGenerator.CreateUser(new Models.UserInfo { OpenId = openId, UnionId = userInfo.unionid, NickName = userInfo.nickname, Province = userInfo.province, City = userInfo.city, County = userInfo.country, Gender = userInfo.sex.ToString(), Portrait = userInfo.headimgurl, ParentOpenId = parentOpenId }); }); return(responseMessage); }
public ActionResult TaleToUser(WX_CustomMsg msg) { SYS_User SYSUSER = Session["SYSUSER"] as SYS_User; msg.UserId = SYSUSER.UserId; msg.MsgId = Guid.NewGuid().ToString(); msg.CreateTime = DateTime.Now; msg.MsgSource = "客服"; msg.AppId = SYSUSER.AppId; //发送到微信 CustomService customSvr = new CustomService(SYSUSER.AppId, SYSUSER.WX_App.AppSecret); customSvr.SendText(msg.OpenID, msg.Content); bool IsTrue = new WXDataBLL.WXCustom.WX_CustomMsgManager().Add(msg); return(Json(IsTrue, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 发送图片/语音给用户 /// </summary> /// <param name="AppId"></param> /// <param name="OpenId"></param> /// <param name="fileName"></param> /// <param name="fileType"></param> /// <returns></returns> public ActionResult SendImageUser(string AppId, string OpenId, string fileName, string fileType) { var Ap = new WX_AppManager().GetByPK(AppId); MediaService ser = new MediaService(Ap.AppId, Ap.AppSecret); JObject jo = ser.UploadTemp(fileName, fileType); //返回一个mediaid和url var result = ""; if (jo != null)//新增成功 { CustomService CS = new CustomService(Ap.AppId, Ap.AppSecret); if (fileType == "image") { result = CS.SendImage(OpenId, jo["media_id"].ToString()); } else if (fileType == "voice") { result = CS.SendVoice(OpenId, jo["media_id"].ToString()); } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public static void InitApp(string applicationId, string apiKey) { if (string.IsNullOrEmpty(applicationId)) { throw new ArgumentNullException(ExceptionMessage.NULL_APPLICATION_ID); } if (string.IsNullOrEmpty(apiKey)) { throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY); } AppId = applicationId; APIKey = apiKey; Persistence = new PersistenceService(); Data = Persistence; Geo = new GeoService(); Messaging = new MessagingService(); Files = new FileService(); UserService = new UserService(); Events = Events.GetInstance(); Cache = Cache.GetInstance(); Counters = CounterService.GetInstance(); Logging = new LoggingService(); CustomService = new CustomService(); MessageWriter.DefaultWriter = new UnderflowWriter(); MessageWriter.AddAdditionalTypeWriter(typeof(BackendlessUser), new BackendlessUserWriter()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(BackendlessUser).FullName, new BackendlessUserFactory()); HeadersManager.CleanHeaders(); LoginStorage loginStorage = new LoginStorage(); if (loginStorage.HasData) { HeadersManager.GetInstance().AddHeader(HeadersEnum.USER_TOKEN_KEY, loginStorage.UserToken); } }
public static void InitApp( string applicationId, string secretKey, string version ) { if( string.IsNullOrEmpty( applicationId ) ) throw new ArgumentNullException( ExceptionMessage.NULL_APPLICATION_ID ); if( string.IsNullOrEmpty( secretKey ) ) throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY); if( string.IsNullOrEmpty( version ) ) throw new ArgumentNullException(ExceptionMessage.NULL_VERSION); AppId = applicationId; SecretKey = secretKey; VersionNum = version; Persistence = new PersistenceService(); Data = Persistence; Geo = new GeoService(); Messaging = new MessagingService(); Files = new FileService(); UserService = new UserService(); Events = Events.GetInstance(); Cache = Cache.GetInstance(); Counters = CounterService.GetInstance(); Logging = new LoggingService(); CustomService = new CustomService(); MessageWriter.DefaultWriter = new UnderflowWriter(); MessageWriter.AddAdditionalTypeWriter( typeof( BackendlessUser ), new BackendlessUserWriter() ); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory( typeof( BackendlessUser ).FullName, new BackendlessUserFactory() ); HeadersManager.CleanHeaders(); LoginStorage loginStorage = new LoginStorage(); if( loginStorage.HasData ) HeadersManager.GetInstance().AddHeader( HeadersEnum.USER_TOKEN_KEY, loginStorage.UserToken ); }
public async Task <bool> UpdateCustomServiceRuleAsync(CustomServiceTechnologies technology, string id, CustomService body = null, CancellationToken cancellationToken = default) { var response = await GetCustomServicesUrl(technology) .AppendPathSegment(id) .PutJsonAsync(body, cancellationToken) .ConfigureAwait(false); return(response.IsSuccessStatusCode); }
public async Task <EntityShortRepresentation> CreateCustomServiceRuleAsync(CustomServiceTechnologies technology, Positions?position = null, CustomService body = null, CancellationToken cancellationToken = default) { var response = await GetCustomServicesUrl(technology) .SetQueryParam(nameof(position), s_positionsConverter.ConvertToString(position)) .PostJsonAsync(body, cancellationToken) .ReceiveJsonWithErrorChecking <EntityShortRepresentation>() .ConfigureAwait(false); return(response); }
public bool Handle(HostArguments args, HandleAsWindowsService service) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (service == null) { throw new ArgumentNullException(nameof(service)); } if (!args.CommandArgs.TryGetValue(Command, out string action)) { return(false); } bool ActionIs(KeyValuePair <string, string> command) => string.Equals(command.Value, action, StringComparison.OrdinalIgnoreCase); if (ActionIs(InstallCommand)) { var configuration = new WindowsServiceConfiguration(GetServiceName(service), ExePath, ExeArgs(args)) .DisplayName(Prefix(service.DisplayName)) .Description(service.Description); args.CommandArgs.TryGetValue(ServiceStartMode, out string startMode); if (Enum.TryParse(startMode, true, out ServiceStartMode serviceStartMode)) { configuration.StartMode(serviceStartMode); } if (args.CommandArgs.TryGetValue(ServiceAccountCommand, out string account)) { if (Enum.TryParse(account, true, out ServiceAccount serviceAccount)) { configuration.RunAs(serviceAccount); } } else { args.CommandArgs.TryGetValue(ServiceAccountUsernameCommand, out string username); args.CommandArgs.TryGetValue(ServiceAccountPasswordCommand, out string password); if (!string.IsNullOrWhiteSpace(username) && !string.IsNullOrWhiteSpace(password)) { configuration.RunAsUser(username, password); } } _windowsServices.Install(configuration); } else if (ActionIs(UninstallCommand)) { _windowsServices.Uninstall(GetServiceName(service)); } else { using (var serviceBase = new CustomService(GetServiceName(service), service.OnStartFactory)) { ServiceBase.Run(serviceBase); } } return(true); }
public CustomController(CustomService customService) { _customService = customService; }
public void CustomButtonInit(CustomService cs) { cs.Btn1Event += Bnt1EventImp1; }
protected override void OnSessionChange(SessionChangeDescription desc) { CustomService.UserInformation(desc.SessionId); }