public override Task <LogonResponse> Logon(LogonRequest request, ServerCallContext context) { var contracts = new List <CustomerContract>() { new CustomerContract() { Contract = "Contrac" + (++contactCounter), Created = Timestamp.FromDateTime(DateTime.UtcNow) }, new CustomerContract() { Contract = "Contract" + (++contactCounter), Created = Timestamp.FromDateTime(DateTime.UtcNow) }, }; var response = new LogonResponse() { Token = Convert.ToBase64String(Guid.NewGuid().ToByteArray()), CustomerInfo = new CustomerInfo() { Detail = "Detail Text", LastUpdateDate = Timestamp.FromDateTime(DateTime.UtcNow) } }; response.CustomerInfo.Contacts.AddRange(contracts.ToArray()); return(Task.FromResult(response)); }
public void Test_CheckLoginCredentials_BadPassword() { DBAccessor dba = new DBAccessor(); LogonResponse response = dba.CheckLoginCredentials(TestConstants.CHECKLOGINCREDENTIALS_VALIDEMAIL, TestConstants.CHECKLOGINCREDENTIALS_INVALIDPASS); Assert.AreEqual((int)LogonResults.PASSWORDMISMATCH, response.success); }
public Updater(string serverIP, int serverPort) { this.UpdateStarted += new CbGeneric(Updater_UpdateStarted); this.UpdateDisruptted += new CbGeneric <string>(Updater_UpdateDisruptted); this.UpdateCompleted += new CbGeneric(Updater_UpdateCompleted); DirectoryInfo dir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); this.appDirPath = dir.FullName + "\\"; this.rapidPassiveEngine = RapidEngineFactory.CreatePassiveEngine(); this.rapidPassiveEngine.AutoReconnect = true; Random random = new Random(); //初始化引擎并登录,返回登录结果 bool canLogon = false; for (int i = 0; i < 100; i++) { string userid = random.Next(1000000).ToString("00000"); LogonResponse logonResponse = rapidPassiveEngine.Initialize(userid, "", serverIP, serverPort, null); if (logonResponse.LogonResult == LogonResult.Succeed) { canLogon = true; break; } } if (!canLogon) { throw new Exception("连接自动更新服务器失败 !"); } this.rapidPassiveEngine.ConnectionInterrupted += new CbGeneric(rapidPassiveEngine_ConnectionInterrupted); this.rapidPassiveEngine.RelogonCompleted += new CbGeneric <LogonResponse>(rapidPassiveEngine_RelogonCompleted); }
public override void Logon(Google.ProtocolBuffers.IRpcController controller, LogonRequest request, Action <LogonResponse> done) { /*var client_auth = client.GetImportedService<bnet.protocol.authentication.AuthenticationClient>(); * var mod_load_req = ModuleLoadRequest.CreateBuilder(); * var mod_handle = ContentHandle.CreateBuilder(); * mod_handle.SetRegion(0x00005553); * mod_handle.SetUsage(0x61757468); * var password_hash = new byte[] { 0x8f, 0x52, 0x90, 0x6a, 0x2c, 0x85, 0xb4, 0x16, 0xa5, 0x95, 0x70, 0x22, 0x51, 0x57, 0xf, 0x96, 0xd3, 0x52, 0x2f, 0x39, 0x23, 0x76, 0x3, 0x11, 0x5f, 0x2f, 0x1a, 0xb2, 0x49, 0x62, 0x4, 0x3c }; * mod_handle.SetHash(ByteString.CopyFrom(password_hash)); * mod_load_req.SetModuleHandle(mod_handle); * * client_auth.ModuleLoad(null, mod_load_req.Build(), res => { * Console.WriteLine(res); * });*/ var response = LogonResponse.CreateBuilder(); var account = bnet.protocol.EntityId.CreateBuilder(); var game_account = bnet.protocol.EntityId.CreateBuilder(); account.SetHigh(0x100000000000000).SetLow(1234); game_account.SetHigh(0x200006200004433).SetLow(1234); response.SetAccount(account).SetGameAccount(game_account); done(response.Build()); }
public void Test_CheckLoginCredentials_BadUsername() { DBAccessor dba = new DBAccessor(); LogonResponse response = dba.CheckLoginCredentials(TestConstants.CHECKLOGINCREDENTIALS_INVALIDEMAIL, "Don't Care"); Assert.AreEqual((int)LogonResults.USERNOTFOUND, response.success); }
public async Task <string> LoginOld(Guid userId, User usuario, int IdEscritorio) { _logger.Information("LoginOld Iniciado : userId -> {@Guid} | usuario -> {@User}", userId, usuario); UserContextData userData = await SetUpSessionWebService(usuario); SessionServiceSoapClient ws = new SessionServiceSoapClient(_sessionServiceSoap, userData.UrlServico + ServicesUrlConstants.SESSION); _logger.Information("LoginOld passo 4: userData -> {@SessionServiceSoapClient} ", ws); LogonResponse result = await ws.LogonAsync(userData.ContextHeader, usuario.UserID, CryptoHelper.GetMD5Hash(usuario.Password), usuario.Dominio, Constants.APP_VERSION, Constants.WORKSTATION, true); _logger.Information("LoginOld passo 5: ResultadoLogin -> {@LogonResponse} ", result); if (result.LogonResult.AuthCode == Guid.Empty) { throw new UnauthorizedAccessException(result.LogonResult.UserMessage); } userData.RegistrarDadosLogin(result.LogonResult); userData.GuidUsuario = userId; userData.GuidSessao = result.LogonResult.AuthCode; userData.IdEscritorioIdentity = IdEscritorio; RegistrarContextoDoUsuario(userData); var context = Helpers.RemuneracaoFake.AssemblerLawOfficeContextDataLogon.ToDTO(result.LogonResult, IdEscritorio); var retorno = JsonConvert.SerializeObject(context); return(retorno); }
////******** Navitaire API Integration ************************ public static string Login() { ISessionManager sessionManager = new SessionManagerClient(); LogonRequest logonRequest = new LogonRequest(); string username = "******"; //ConfigurationManager.AppSettings["userid_fapi"].ToString(); string password = "******"; //ConfigurationManager.AppSettings["password_fapi"].ToString(); string domain = "WWW"; logonRequest.logonRequestData = new LogonRequestData(); logonRequest.logonRequestData.DomainCode = domain; logonRequest.logonRequestData.AgentName = username; logonRequest.logonRequestData.Password = password; LogonResponse logonResponse = sessionManager.Logon(logonRequest); string signature = ""; if (logonResponse != null && logonResponse.Signature != null && logonResponse.Signature != string.Empty) { signature = logonResponse.Signature; } else { //Response.Write("Agent Authentication Failed."); //ScriptManager.RegisterStartupScript(Page, GetType(), "ab", "alert('Agent Authentication Failed.');", true); } return(signature); }
public ActionResult ChangePassword(ChangePasswordModel model) { if (ModelState.IsValid) { String email = User.Identity.Name; DBAccessor dba = new DBAccessor(); LogonResponse result = dba.CheckLoginCredentials(email, model.OldPassword); if (result.success == (int)LogonResults.SUCCESS) { if (dba.UpdateUserPassword(email, model.NewPassword)) { return(RedirectToAction("ChangePasswordSuccess")); } else { ModelState.AddModelError("", "Password update failed, try again."); } } else { ModelState.AddModelError("", result.errorMessage); } } return(View(model)); }
public ActionResult Edit(EditModel model) { if (ModelState.IsValid) { // Update the user in the MySQL DB String oldEmail = User.Identity.Name; DBAccessor dba = new DBAccessor(); LogonResponse result = dba.CheckLoginCredentials(oldEmail, model.Password); if (result.success == (int)LogonResults.SUCCESS) { Person updateUser = new Person(model.FirstName, model.LastName, model.Email, model.ImageURL, "", model.Birthday, model.Height, model.Weight); dba.UpdateUserInformation(oldEmail, updateUser); // Set the appropriate cookies FormsAuthentication.SetAuthCookie(model.Email, false /* createPersistentCookie */); HttpCookie cookie = new HttpCookie(AppConstants.COOKIE_NAME, model.FirstName + " " + model.LastName); cookie.Expires = DateTime.Now.AddDays(1000); this.ControllerContext.HttpContext.Response.Cookies.Add(cookie); } else { ModelState.AddModelError("", result.errorMessage); } } return(View(model)); }
/// <summary> /// проверка маркера /// </summary> /// <param name="login"></param> /// <param name="password"></param> /// <returns>статус, Id мастера</returns> public JsonResult Logon(string login, string password) { LogonModel model = new LogonModel(); Guid token = CheckSessionAuthState(CurrentUser, _authService); if (token == Guid.Empty) { model.Status = MainStatus.Failed; model.SystemLogoff = true; return(Json(model, JsonRequestBehavior.AllowGet)); } LogonResponse response = _markerService.LogOn(login, password, token); model.MarkerStatus = response.MarkerStatus; if (response.Error != null) { model.Error = response.Error; return(Json(model, JsonRequestBehavior.AllowGet)); } MarkerActivationBase markerActivationBase = new MarkerActivationBase(response.SessionData); Session[markerActivationBase.Id.ToString()] = markerActivationBase; model.CurrentMarkerId = markerActivationBase.Id; model.Status = response.Status; return(Json(model, JsonRequestBehavior.AllowGet)); }
private void buttonLogin_Click(object sender, EventArgs e) { string id = this.textBoxId.SkinTxt.Text; string pwd = this.textBoxPwd.SkinTxt.Text; if (id.Length == 0) { return; } this.Cursor = Cursors.WaitCursor; this.buttonLogin.Enabled = false; try { this.rapidPassiveEngine.SecurityLogEnabled = false; if (!this.pwdIsMD5) { pwdMD5 = SecurityHelper.MD5String2(pwd); } LogonResponse response = this.rapidPassiveEngine.Initialize(id, pwdMD5, ConfigurationManager.AppSettings["ServerIP"], int.Parse(ConfigurationManager.AppSettings["ServerPort"]), this.customizeHandler); if (response.LogonResult == LogonResult.Failed) { MessageBoxEx.Show(response.FailureCause); return; } //0923 if (response.LogonResult == LogonResult.VersionMismatched) { MessageBoxEx.Show("客户端与服务器的ESFramework版本不一致!"); return; } if (response.LogonResult == LogonResult.HadLoggedOn) { MessageBoxEx.Show("该帐号已经在其它地方登录!"); return; } SystemSettings.Singleton.LastLoginUserID = id; SystemSettings.Singleton.RememberPwd = this.checkBoxRememberPwd.Checked; SystemSettings.Singleton.LastLoginPwdMD5 = pwdMD5; SystemSettings.Singleton.AutoLogin = this.checkBoxAutoLogin.Checked; SystemSettings.Singleton.Save(); } catch (Exception ee) { this.toolShow.Show(ee.Message, this.buttonLogin, new Point(this.buttonLogin.Width / 2, -this.buttonLogin.Height), 3000); return; } finally { this.Cursor = Cursors.Default; this.buttonLogin.Enabled = true; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public void Test_CheckLoginCredentials_Valid() { DBAccessor dba = new DBAccessor(); LogonResponse response = dba.CheckLoginCredentials(TestConstants.CHECKLOGINCREDENTIALS_VALIDEMAIL, TestConstants.CHECKLOGINCREDENTIALS_VALIDPASS); Assert.AreEqual((int)LogonResults.SUCCESS, response.success); Assert.AreEqual(TestConstants.CHECKLOGINCREDENTIALS_VALIDEMAIL, response.user.email); Assert.AreEqual(TestConstants.CHECKLOGINCREDENTIALS_FIRSTNAME, response.user.firstName); Assert.AreEqual(TestConstants.CHECKLOGINCREDENTIALS_LASTNAME, response.user.lastName); }
public LogonResponse Logon(LogonRequest request) { AuthenticationActions.LogonAction action = PolicyInjection.Create <AuthenticationActions.LogonAction>(); AuthenticationEntities.LogonResult resultParams = action.Execute(Translators.LogonTranslator.TranslateFromServiceToBusiness(request.LogonParameters)); LogonResponse response = new LogonResponse(); response.LogonResult = Translators.LogonTranslator.TranslateFromBusinessToService(resultParams); return(response); }
/// <summary> /// Validates username and password provided match a user record in the system /// </summary> /// <param name="request">The request containing the username and password</param> /// <returns>A response indicating success or failure of the operation</returns> public LogonResponse Logon(LogonRequest request) { //find the user first by the email provided var user = UserRepository.FindByEmail(request.Email); //if found continue if (user != null) { if (user.Password.Equals(Encryption.EncryptString(request.Password))) { if (user.Status == Constants.UserOTPStatus) { var response = new LogonResponse { Success = false, Message = "Account activation required. Please activate your account.", HasOpenBooking = false }; return(response); } //if the password check passes, check if the user has an active status else if (user.Status == Constants.UserActiveStatus || user.Status == Constants.UserPartialStatus) { var response = new LogonResponse { Id = user.AccountID, Success = true, Message = "Logon was successful.", HasOpenBooking = false }; var openBooking = BookingRepository.FindByAccountId(user.AccountID) .FirstOrDefault(x => x.BookingStatus == Constants.BookingOpenStatus); if (openBooking != null) { response.HasOpenBooking = true; response.OpenBookingId = openBooking.BookingID; } return(response); } } } return(new LogonResponse { Success = false, Message = "Invalid email or password.", HasOpenBooking = false }); }
/// <summary> /// /// </summary> /// <param name="response"></param> void RapidPassiveEngine_RelogonCompleted(LogonResponse response) { if (response.LogonResult == LogonResult.Succeed) { DownloadNextFile(); Event_RelogonCompleted?.Invoke(); mLogger.LogWithTime(Resources.Retransmitting); return; } mLogger.LogWithTime(Resources.ReconnectionFailed); Event_UpdateDisruptted?.Invoke(FileTransDisrupttedType.SelfOffline.ToString()); }
/// <summary> /// Start. /// </summary> /// <param name="serverIP">server ip</param> /// <param name="serverPort">server port</param> /// <param name="callerExe">callerExe</param> public void Start(string serverIP, int serverPort, string callerExe) { try { Random random = new Random(); for (int i = 0; i < 100; i++) { string userID = random.Next(1000000).ToString("00000"); string logonPassword = string.Empty; LogonResponse logonResponse = mRapidPassiveEngine.Initialize(userID, logonPassword, serverIP, serverPort, null); if (logonResponse.LogonResult == LogonResult.Succeed) { break; } } if (!File.Exists(UpdateConfiguration.ConfigurationPath)) { mUpdateConfiguration.Save(); } else { mUpdateConfiguration = (UpdateConfiguration)AgileConfiguration.Load(UpdateConfiguration.ConfigurationPath); } GetUpdateInfo(out mFileRelativePathListNeedDownloaded, out mFileListNeedRemoved); mFileCountNeedUpdated = mFileRelativePathListNeedDownloaded.Count; Event_FileCountNeedUpdated?.Invoke(mFileCountNeedUpdated); if (mFileCountNeedUpdated == 0 && mFileListNeedRemoved.Count == 0) { return; } Event_UpdateStarted?.Invoke(); Process[] processes = Process.GetProcessesByName(callerExe.Substring(0, callerExe.Length - 4)); foreach (Process process in processes) { process.Kill(); } CbGeneric cbGeneric = new CbGeneric(UdpateThread); cbGeneric.BeginInvoke(null, null); } catch (Exception e) { Console.WriteLine(e.ToString()); Event_UpdateDisruptted?.Invoke(Resources.ConnectionFailed); } }
public async Task <string> LogonAndGetTokenNavitaire(string userName = null, string password = null) { string result = default(string); LogonRequest request = GetRequestLogon(userName, password); string responseJson = await _integration.RequestAsync(HttpMethod.Post, _uri, request); LogonResponse responseObject = JsonConvert.DeserializeObject <LogonResponse>(responseJson); if (!string.IsNullOrEmpty(responseObject?.Data?.Token)) { result = responseObject.Data.Token; } return(result); }
public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { // This should be a DB check instead of Membership.ValidateUser DBAccessor dba = new DBAccessor(); LogonResponse result = dba.CheckLoginCredentials(model.Email, model.Password); if (result.success == (int)LogonResults.SUCCESS) { Person user = dba.GetPersonInformation(model.Email); FormsAuthentication.SetAuthCookie(model.Email, model.RememberMe); // Add a name cookie HttpCookie cookie = new HttpCookie(AppConstants.COOKIE_NAME, result.user.firstName + " " + result.user.lastName); cookie.Expires = DateTime.Now.AddDays(1000); this.ControllerContext.HttpContext.Response.Cookies.Add(cookie); // Add a coach permission cookie string permission = "false"; if (user.permissions.coachEnabled) { permission = "true"; } cookie = new HttpCookie(AppConstants.COOKIE_COACH_PERMISSION, permission); cookie.Expires = DateTime.Now.AddDays(1000); this.ControllerContext.HttpContext.Response.Cookies.Add(cookie); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", result.errorMessage); } } // If we got this far, something failed, redisplay form return(View(model)); }
void do_rapidPassiveEngine_RelogonCompleted(LogonResponse logonResponse) { if (logonResponse.LogonResult != LogonResult.Succeed) { this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:离线,请重新登录。", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID)); MessageBoxEx.Show("自动重登录失败,可能是密码已经被修改。请重启程序,手动登录!", GlobalResourceManager.SoftwareName); return; } this.globalUserCache.CurrentUser.UserStatus = this.myStatus; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser); this.skinButton_State.Enabled = true; this.skinButton_State.Image = GlobalResourceManager.GetStatusImage(this.globalUserCache.CurrentUser.UserStatus); this.skinButton_State.Tag = (int)this.globalUserCache.CurrentUser.UserStatus; this.globalUserCache.StartRefreshFriendInfo(); this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus))); this.notifyIcon.ChangeMyStatus(this.globalUserCache.CurrentUser.UserStatus); }
void rapidPassiveEngine_RelogonCompleted(LogonResponse relogonResult) { //如果在 重新登录的时候,数据库的密码 修改了,则这里relogonResult会返回登录失败 if (this.InvokeRequired) { this.Invoke(new CbGeneric <LogonResponse>(this.rapidPassiveEngine_RelogonCompleted), relogonResult); } else { if (relogonResult.LogonResult != LogonResult.Succeed) { return; } this.toolStripLabel_state.Text = "连接状态:正常(重连成功)"; this.toolStripLabel_state.ForeColor = Color.Black; this.InitializeFriends(); } }
void rapidPassiveEngine_RelogonCompleted(LogonResponse res) { if (res.LogonResult == LogonResult.Succeed) { this.DownloadNextFile(); this.logger.LogWithTime("重连成功,开始续传!"); if (this.UpdateContinued != null) { this.UpdateContinued(); } return; } this.logger.LogWithTime("重连失败!"); if (this.UpdateDisruptted != null) { this.UpdateDisruptted(FileTransDisrupttedType.SelfOffline.ToString()); } }
private void method_4() { try { LogonResponse response = this.class113_0.method_7(this.systemToken, this.string_0); if (response.LogonResult == LogonResult.Succeed) { this.object_0.imethod_27(); this.class71_0.method_0(); this.class113_0.SendHeartBeatMessage(); } else { this.object_0.AutoReconnect = false; } this.eventSafeTrigger_0.Action <LogonResponse>("RelogonCompleted", this.RelogonCompleted, response); } catch (Exception exception) { LogonFullResponse response2 = new LogonFullResponse(LogonResult.Failed, exception.Message, false, false, false); this.eventSafeTrigger_0.Action <LogonResponse>("RelogonCompleted", this.RelogonCompleted, response2); } }
void rapidPassiveEngine_RelogonCompleted(LogonResponse logonResponse) { GlobalResourceManager.UiSafeInvoker.ActionOnUI <LogonResponse>(this.do_rapidPassiveEngine_RelogonCompleted, logonResponse); }
void rapidPassiveEngine_RelogonCompleted(LogonResponse logonResponse) { GlobalResourceManager.UiSafeInvoker.ActionOnUI<LogonResponse>(this.do_rapidPassiveEngine_RelogonCompleted, logonResponse); }
public void SelectAndClose(UserWarehouse selectedWarehouse, UserCompany selectedCompany) { if ((selectedWarehouse != null) && (selectedCompany != null)) { try { UserSettingsChangedEventArgs args = new UserSettingsChangedEventArgs(); EventTopic userSettingsTopic = WorkItem.EventTopics.Get(Imi.SupplyChain.UX.UXEventTopicNames.UserSettingsChangedTopic); if (userSettingsTopic != null) { userSettingsTopic.Fire(this, args, WorkItem, PublicationScope.Descendants); if (args.OpenDialogs.Count > 0) { if (ShellInteractionService.ShowMessageBox(this.View.Title, string.Format(LocalResources.ChangeUserSettings_CloseAll, string.Join("\n", args.OpenDialogs)), null, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { Close(false); return; } } } ShellInteractionService.ShowProgress(); // Get the application IShellModule module = WorkItem.Items.FindByType <IShellModule>().First(); LogonParameters logonParameters = new LogonParameters(); logonParameters.UserIdentity = UserSessionService.UserId; logonParameters.CompanyIdentity = selectedCompany.CompanyIdentity; logonParameters.WarehouseIdentity = selectedCompany.WarehouseIdentity; logonParameters.TerminalIdentity = UserSessionService.TerminalId; logonParameters.ApplicationIdentity = module.Id; LogonRequest logonRequest = new LogonRequest(); logonRequest.LogonParameters = logonParameters; LogonResponse response = Service.Logon(logonRequest); // Set the selected Warehouse and ClientId on statusrow in container ShellInteractionService.ContextInfo = string.Format(LocalResources.STATUSBAR_WH_CLIENT, selectedWarehouse.WarehouseIdentity, selectedWarehouse.WarehouseName, selectedCompany.CompanyIdentity, selectedCompany.CompanyName); Close(true); } catch (Exception ex) { ShellInteractionService.HideProgress(); ShellInteractionService.ShowMessageBox(StringResources.ActionException_Text, ex.Message, ex.ToString(), MessageBoxButton.Ok, MessageBoxImage.Error); } finally { ShellInteractionService.HideProgress(); } } }
public override IResponse DoPost(IRequest iRequest) { string service = SetMockParameters(iRequest); try { if (iRequest is LogonRequest) { LogonRequest request = iRequest as LogonRequest; var client = ServiceFactory.CreateSessionServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if(string.IsNullOrEmpty(service)) service = "JET:SessionService"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "Logon"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<LogonResult>OK</LogonResult>"); string logonResult = client.Logon(ref request.MessageHeader, ref request.Security); LogonResponse response = new LogonResponse() { MessageHeader = request.MessageHeader, LogonResult = logonResult, Security = request.Security }; return response; } } if (iRequest is LogoffRequest) { LogoffRequest request = iRequest as LogoffRequest; var client = ServiceFactory.CreateSessionCloseServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if (string.IsNullOrEmpty(service)) service = "JET:SessionClose"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "Logoff"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<LogoffResponse"); client.Logoff(ref request.MessageHeader, ref request.Security); LogoffResponse response = new LogoffResponse() { MessageHeader = request.MessageHeader, Security = request.Security }; return response; } } if (iRequest is FlightMatrixRequestRequest) { FlightMatrixRequestRequest request = iRequest as FlightMatrixRequestRequest; var client = ServiceFactory.CreateFlightMatrixServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if (string.IsNullOrEmpty(service)) service = "JET:FlightMatrixService"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "FlightMatrixRequest"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<Errors/>"); FlightMatrixRS response = client.FlightMatrixRequest(ref request.MessageHeader, ref request.Security, request.FlightMatrixRQ); return new FlightMatrixRequestResponse() { MessageHeader = request.MessageHeader, Security = request.Security, FlightMatrixRS = response }; } } if (iRequest is AirSellRQRequest) { AirSellRQRequest request = iRequest as AirSellRQRequest; var client = ServiceFactory.CreateAirSellServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if (string.IsNullOrEmpty(service)) service = "JET:AirSellService"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "AirSellRQ"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<Errors/>"); OTA_AirPriceRS response = client.AirSellRQ(ref request.MessageHeader, ref request.Security, request.OTA_AirPriceRQ); return new AirSellRQResponse() { MessageHeader = request.MessageHeader, Security = request.Security, OTA_AirPriceRS = response }; } } if (iRequest is IgnoreRQRequest) { IgnoreRQRequest request = iRequest as IgnoreRQRequest; var client = ServiceFactory.CreateIgnoreTransactionServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if (string.IsNullOrEmpty(service)) service = "JET:IgnoreService"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "IgnoreRQ"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<Errors/>"); IgnoreRS response = client.IgnoreRQ(ref request.MessageHeader, ref request.Security, request.IgnoreRQ); return new IgnoreRQResponse() { MessageHeader = request.MessageHeader, Security = request.Security, IgnoreRS = response }; } } if (iRequest is OTA_AirBookRQRequest) { OTA_AirBookRQRequest request = iRequest as OTA_AirBookRQRequest; var client = ServiceFactory.CreateAirBookServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if (string.IsNullOrEmpty(service)) service = "JET:AirBookService"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "OTA_AirBookRQ"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<Errors/>"); OTA_AirBookRS response = client.OTA_AirBookRQ(ref request.MessageHeader, ref request.Security, request.OTA_AirBookRQ); return new OTA_AirBookRQResponse() { MessageHeader = request.MessageHeader, Security = request.Security, OTA_AirBookRS = response }; } } if (iRequest is AirTicketRQRequest) { AirTicketRQRequest request = iRequest as AirTicketRQRequest; var client = ServiceFactory.CreateTicketServiceClient(_url); using (new OperationContextScope(client.InnerChannel)) { if (string.IsNullOrEmpty(service)) service = "JET:SessionClose"; WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "AirTicketRQ"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-ServiceName", service); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-DisableHeaderLog", "true"); WebOperationContext.Current.OutgoingRequest.Headers.Add("X-SuccessElement", "<Errors/>"); OTA_AirBookRS response = client.AirTicketRQ(ref request.MessageHeader, ref request.Security, request.OTA_AirBookRQ); return new AirTicketRQResponse() { MessageHeader = request.MessageHeader, Security = request.Security, OTA_AirBookRS = response }; } } } catch (Exception ex) { Logger.LogException(ex, Source, "DoPost", Severity.Major); return null; } return null; }
private bool Login(bool isVisitor) { //业务逻辑服务器 this.rapidPassiveEngine.WaitResponseTimeoutInSecs = 30; this.rapidPassiveEngine.HeartBeatSpanInSecs = 5; this.rapidPassiveEngine.SecurityLogEnabled = false; groupOutter.TryP2PWhenGroupmateConnected = false; groupOutter.RapidPassiveEngine = this.rapidPassiveEngine; DynamicGroupPassiveHandler groupPassiveHandler = new DynamicGroupPassiveHandler(); groupPassiveHandler.Initialize(groupOutter); ComplexCustomizeHandler handler = new ComplexCustomizeHandler(this.customizeHandler, groupPassiveHandler); this.rapidPassiveEngine.SystemToken = isVisitor ? "visitor" : "member"; LogonResponse result = this.rapidPassiveEngine.Initialize(this.userID, this.password, ConfigurationManager.AppSettings["ServerIP"], int.Parse(ConfigurationManager.AppSettings["ServerPort"]), handler); if (result.LogonResult != LogonResult.Succeed) { if (result.LogonResult == LogonResult.HadLoggedOn) { MessageBox.Show("已经在其它地方登录!"); } else { MessageBox.Show("用户或者密码错误!"); } return(false); } this.rapidPassiveEngine.P2PController.P2PChannelMode = ESPlus.Application.P2PSession.Passive.P2PChannelMode.Udp; groupOutter.Initialize(this.rapidPassiveEngine.CurrentUserID); //OMCS multimediaManager.ChannelMode = (OMCS.Passive.ChannelMode)Enum.Parse(typeof(OMCS.Passive.ChannelMode), ConfigurationManager.AppSettings["ChannelMode"]); multimediaManager.CameraDeviceIndex = 0; multimediaManager.MicrophoneDeviceIndex = int.Parse(ConfigurationManager.AppSettings["MicrophoneIndex"]); multimediaManager.SpeakerIndex = int.Parse(ConfigurationManager.AppSettings["SpeakerIndex"]); multimediaManager.VolumeAmplifyFactor = 3; multimediaManager.AutoAdjustCameraEncodeQuality = false; multimediaManager.CameraEncodeQuality = 3; multimediaManager.AutoReconnect = false; IList <CameraInformation> cameras = Camera.GetCameras(); if (cameras.Count == 0 || cameras.Count < UserConfiguration.Singleton.WebcamIndex + 1) { UserConfiguration.Singleton.WebcamIndex = 0; } this.multimediaManager.CameraDeviceIndex = UserConfiguration.Singleton.WebcamIndex; try { string[] cameraSizeStr = ConfigurationManager.AppSettings["CameraVideoSize"].Split(','); multimediaManager.CameraVideoSize = new System.Drawing.Size(int.Parse(cameraSizeStr[0]), int.Parse(cameraSizeStr[1])); } catch { } this.multimediaManager.SecurityLogEnabled = true; multimediaManager.Initialize(userID, "", ConfigurationManager.AppSettings["ServerIP"], int.Parse(ConfigurationManager.AppSettings["OmcsPort"])); multimediaManager.OutputAudio = true; return(true); }
private Boolean ConnectToServer(Boolean isFirstTime) { try { this.ShowConnectingMessage("验证登录中……"); //如果连不上?重新获取服务器连接 passiveEngine.SystemToken = SystemToken.Manage + "#" + this.skinTextBoxBusinessAccount.Text + "#" + skinLabelVersion.Text; //if (!GlobalUtil.IPAndPort(new IPEndPoint(IPAddress.Parse(config.BusinessAccount.ServerIP), config.BusinessAccount.ServerPort))) //{ // GlobalMessageBox.Show("连接不到服务地址,请联系客服!"); // return false; //} // CommonGlobalUtil.WriteLog(this.skinTextBoxUser.Text + "," + skinTextBoxPwd.Text + "," + config.BusinessAccount.ServerIP + "," + config.BusinessAccount.ServerPort); String pwdMd5 = SecurityHelper.MD5String2(this.skinTextBoxPwd.Text); LogonResponse result = this.passiveEngine.Initialize(this.skinTextBoxUser.Text.ToLower(), pwdMd5, config.BusinessAccount.ServerIP, config.BusinessAccount.ServerPort, new CustomizeHandler()); switch (result.LogonResult) { case LogonResult.Succeed: LoginInfo info = new LoginInfo(); info.LastLoginID = this.skinTextBoxUser.Text.ToLower(); info.SavePassword = this.skinCheckBoxSavePwd.Checked; if (info.SavePassword) { info.Password = this.skinTextBoxPwd.Text; } else { info.Password = null; } info.loginTime = DateTime.Now; LoginInfo orgInfo = config.LoginInfos.Find(t => t.LastLoginID.ToLower() == info.LastLoginID.ToLower()); if (orgInfo != null) { config.LoginInfos.Remove(orgInfo); } config.LoginInfos.Insert(0, info); config.Save(CONFIG_PATH); CommonGlobalCache.SetBusinessAccount(config.BusinessAccount); this.UpdateDialogResult(); if (!String.IsNullOrEmpty(result.FailureCause)) { ShowDialogMessage(result.FailureCause); CommonGlobalCache.SystemUpdateMessage = result.FailureCause; } break; case LogonResult.Failed: this.ShowConnectingMessage(result.FailureCause, true); break; case LogonResult.HadLoggedOn: this.ShowConnectingMessage("该帐号已经在其它地方登录!", true); break; case LogonResult.VersionMismatched: this.ShowConnectingMessage("客户端与服务器的CJFramework版本不一致!", true); break; default: break; } } catch (SocketException ex) { if (!isFirstTime) { GlobalUtil.WriteLog(ex + "!isFirstTime1 ERROR Message=" + ex.Message + "Exception StackTrace=" + ex.StackTrace); this.ShowConnectingMessage("连接不到服务端,请联系客服!", true); } else { GlobalUtil.WriteLog(ex + "1ERROR Message=" + ex.Message + "Exception StackTrace=" + ex.StackTrace); return(false); } } catch (Exception ex) { if (!isFirstTime) { this.ShowConnectingMessage("系统异常" + ex.Message, true); GlobalUtil.WriteLog(ex + "!isFirstTime2 ERROR Message=" + ex.Message + "Exception StackTrace=" + ex.StackTrace); } else { GlobalUtil.WriteLog(ex + "2ERROR Message=" + ex.Message + "Exception StackTrace=" + ex.StackTrace); return(false); } } return(true); }