private void postLogin(String pLogin, Action<BioResponse> callback) { try { String[] vLgnArr = Utl.SplitString(pLogin, '/'); if (vLgnArr.Length != 2) throw new EBioBadLogin("Не верный формат данных аутентификации!"); if (String.IsNullOrEmpty(vLgnArr[0])) throw new EBioBadUser("Имя пользователя не может быть пустым!"); if (String.IsNullOrEmpty(vLgnArr[1])) throw new EBioBadPwd("Пароль не может быть пустым!"); } catch (EBioException e) { BioResponse vRslt = new BioResponse { Ex = e, Success = false }; if (callback != null) callback(vRslt); return; } BioLoginRequest rq = new BioLoginRequest() { URL = this.FOwner.Env.ServerUrl, RequestType = RequestType.doPostLoginForm, login = pLogin, Timeout = this.FOwner.Env.ConfigRoot.RequestTimeout, //this.FOwner.AjaxCli.RequestTimeout, Callback = (s, a) => { if (callback != null) callback(a.Response as BioResponse); } }; ajaxUTL.GetDataFromSrv(rq); }
protected override void doExecute() { try { base.doExecute(); } catch (EBioOk bex) { var rsp = new BioResponse() { Success = true, GCfg = new GlobalCfgPack { Debug = this.BioSession.Cfg.Debug }, Ex = bex }; this.Context.Response.Write(rsp.Encode()); } }
public void DoExecute(RmtClientRequestCmd cmd, Params bioParams) { if (bioParams != null) this.BioParams = bioParams; if (this.BioParams == null) this.BioParams = new Params(); try { switch (cmd) { case RmtClientRequestCmd.Run: { // запусить this._run(); this.Context.Response.Write(new BioResponse { Success = true, BioParams = this.BioParams, RmtStatePacket = this.getCurrentStatePack() }.Encode()); } break; case RmtClientRequestCmd.GetState: { // проверить состояния var rspns = new BioResponse { Success = true, BioParams = this.BioParams, RmtStatePacket = this.getCurrentStatePack() }; this.Context.Response.Write(rspns.Encode()); } break; case RmtClientRequestCmd.Break: { // остановить var vRptInst = this.Instance; if (vRptInst != null) { vRptInst.Abort(null); } this.Context.Response.Write(new BioResponse { Success = true, BioParams = this.BioParams }.Encode()); } break; case RmtClientRequestCmd.GetResult: { // отдать результат this._sendFileToClient(); } break; case RmtClientRequestCmd.Kill: { var vRptInst = this.Instance; if (vRptInst != null) { this.removeInstance(); } } break; } } catch(Exception ex) { var ebioex = EBioException.CreateIfNotEBio(ex); this.Context.Response.Write(new BioResponse { Success = false, BioParams = this.BioParams, Ex = ebioex }.Encode()); } }