public string UserModify(string username, string strRealName, string strphoneNumber, string strAddress, string strProvince, string strCity, string strTelephone, string strOtherContact, string strFax, string strEmail, string Brno, string iRole, int?status) { if (username == null || iRole == null || Brno == null) { return(Global.RETURN_ERROR("信息不完整!")); } if (RegisterServer.CheckUserName(username)) { return(Global.RETURN_ERROR("用户名不存在!")); } if (RegisterServer.UserModify(username, strRealName, strphoneNumber, strAddress, strProvince, strCity, strTelephone, strOtherContact, strFax, strEmail, Brno, iRole, status)) { return(Global.RETURN_SUCESS); } else { return(Global.RETURN_ERROR("添加失败!")); } }
protected override async Task Initialize() { RegisterServer msg = new RegisterServer { Id = ServerId, Name = "PlayerServer " + ServerId, Key = "TestKey" }; await SendPacketAsync(0x00, msg); }
public ConsulDiscovery(ILogger logger, ISerializer serializer, RegisterServer registerServer, ServerAddress address, IConfigurationRoot configuration = null) { _logger = logger; _serializer = serializer; _address = address; _configuration = configuration; _routes = new List <ServiceRoute>(); _consulClient = new ConsulClient(config => { config.Address = new Uri($"http://{registerServer.Ip}:{registerServer.Port}"); }); }
//密码修改 //测试 /Register/RoleChange?username=2222&strCompanyId=1&strCompanyName=第二车间&iRole=04 public string PwdChange(string username, string oldpwd, string newpwd) { if (username == null || oldpwd == null || newpwd == null) { return(Global.RETURN_ERROR("输入参数不完整")); } if (RegisterServer.CheckUserName(username)) { return(Global.RETURN_ERROR("用户名不存在")); } string rst = RegisterServer.PwdChange(username, oldpwd, newpwd); return(rst); }
public string UserDelete(string username) { if (username == null) { return(Global.RETURN_ERROR("输入参数不完整")); } if (RegisterServer.CheckUserName(username)) { return(Global.RETURN_ERROR("用户名不存在")); } string rst = RegisterServer.DleteUser(username); return(rst); }
//角色修改 //测试 /Register/RoleChange?username=2222&strCompanyId=1&strCompanyName=第二车间&iRole=04 public string RoleChange(string username, string Brno, string iRole) { if (username == null || Brno == null || iRole == null) { return(Global.RETURN_ERROR("输入参数不完整")); } if (RegisterServer.CheckUserName(username)) { return(Global.RETURN_ERROR("用户名不存在")); } string rst = RegisterServer.RoleChange(username, Brno, iRole); return(rst); }
//角色修改 //测试 /Register/GetDepartList public string GetDepartList() { string role = "01"; string departid = ""; if (HttpContext.Session["user"] != null) { role = (HttpContext.Session["user"] as SessionUser).roleid; departid = (HttpContext.Session["user"] as SessionUser).departid; } string rst = RegisterServer.GetDepartList(role, departid); return(rst); }
/// <summary> /// Registeres the server on the master /// </summary> protected void Register() { var serverInfo = application.ServerConfig.SubServer; var operationData = new RegisterServer { ServerId = this.application.ServerId, SubServerId = this.application.SubServerId, ServerType = (byte)this.application.ServerType, Address = serverInfo.PublicIP, TcpPort = serverInfo.TcpPort, UdpPort = serverInfo.UdpPort, }; var request = new OperationRequest((byte)ServerOperationCode.RegisterServer, operationData); this.SendOperationRequest(request, new SendParameters()); }
protected OperationResponse HandleOperationRegisterServer(OperationRequest operationRequest) { var operation = new RegisterServer(this.Protocol, operationRequest); if (!operation.IsValid) { return(operation.GetResponse((short)ResultCode.InvalidOperationParameter, operation.GetErrorMessage())); } this.ServerId = operation.ServerId; this.ServerType = (SubServerType)operation.ServerType; this.SubServerId = operation.SubServerId; this.ServerAddress = operation.Address; this.TcpPort = operation.TcpPort; this.UdpPort = operation.UdpPort; this.Application.MasterLobby.OnServerConnected(this); return(operation.GetResponse((short)ResultCode.Ok)); }
private async Task RegisterServer(RegisterServer msg) { RegisterResponse response = new RegisterResponse(); ServerId = msg.Id; ServerName = msg.Id; if (ServerService.Instance.RegisterServer(ServerId, this)) { response.Id = msg.Id; response.Result = 1; } else { response.Id = 0; response.Result = 0; } await SendPacketAsync(0x00, response); }
public async Task <ActionResult> Register(string name, string ip, string contactEmail, Times verificationTime) { var loggedUser = UsersUtilities.GetLoggedUser(); if (loggedUser == null) { return(Redirect("~/User/Login")); } RegisterServer ServerToRegister = new RegisterServer(); try { ServerToRegister.Setup(name, ip, contactEmail, verificationTime, loggedUser); RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper(); if (String.IsNullOrEmpty(recaptchaHelper.Response)) { throw new CustomException.EmptyRecaptcha(); } RecaptchaVerificationResult recaptchaResult = await recaptchaHelper.VerifyRecaptchaResponseTaskAsync(); if (recaptchaResult != RecaptchaVerificationResult.Success) { throw new CustomException.Recaptcha(); } ServerToRegister.Save(); return(View(ServerToRegister)); } catch (Exception ex) { if (ex is CustomException.EmptyRecaptcha || ex is CustomException.Recaptcha) { ServerToRegister.Error = ex.Message; } return(View(ServerToRegister)); } }
public static IServiceHostServerBuilder UseConsulCheckHealth(this IServiceHostServerBuilder serviceHostBuilder, RegisterServer registerServer) { serviceHostBuilder.RegisterService(containerBuilder => { List <NamedParameter> ListNamedParameter = new List <NamedParameter>() { new NamedParameter("registerServer", registerServer), new NamedParameter("address", serviceHostBuilder.Address), }; containerBuilder.RegisterType <ConsulDiscovery>().As <IServiceDiscovery>().As <IHealthCheck>().WithParameters(ListNamedParameter).SingleInstance(); }); serviceHostBuilder.AddInitializer(container => { while (!container.IsRegistered <IServer>()) { //default(SpinWait).SpinOnce(); Thread.Sleep(200); } ILogger logger = container.Resolve <ILogger>(); logger.Info($"[config]use consul for services discovery, consul ip: {registerServer.Ip}:{registerServer.Port}"); IServer server = container.Resolve <IServer>(); List <ServiceRoute> routes = server.GetServiceRoutes(); logger.Debug("running consul found routes count: " + routes.Count); try { IServiceDiscovery discovery = container.Resolve <IServiceDiscovery>(); discovery.ClearAsync().Wait(); discovery.SetRoutesAsync(routes).Wait(); } catch (Exception ex) { logger.Error($"error occurred while connecting with consul, ensure consul is running.\r\n", ex); } }); serviceHostBuilder.AddRunner(container => { IServer server = container.Resolve <IServer>(); IHealthCheck check = container.Resolve <IHealthCheck>(); check.RunAsync(); }); return(serviceHostBuilder); }
//角色修改 //测试 /Register/GetRoleList public string GetRoleList() { string rst = RegisterServer.GetRoleList(); return(rst); }
//角色修改 //测试 /Register/GetUserList?LineId=1&keyword=04 public string GetUserList(string keyword, int?GroupId, int?CompanyId, int?FoundryId) { string rst = RegisterServer.GetUserList(keyword, GroupId, CompanyId, FoundryId); return(rst); }