/// <summary> /// Выводит окно сообщения об ошибке /// </summary> /// <param name="pError">Класс ошибки</param> /// <param name="pTitle">Заголовок</param> /// <param name="pOwner">Ссылка на окно-родитель</param> public static void showError(EBioException pError, String pTitle, Control pOwner) { if(pError != null) { StringWriter vS = new StringWriter(); if(pError.ApplicationErrorMessage != null) { vS.WriteLine("Ошибка приложения:"); vS.WriteLine("\t" + pError.ApplicationErrorMessage); vS.WriteLine(new String('*', 280)); } #if DEBUG if(pError.Message != null) { vS.WriteLine("Ошибка системы:"); vS.WriteLine("\t" + pError.Message); vS.WriteLine(new String('*', 280)); } if(pError.StackTrace != null) { vS.WriteLine("Trace:"); vS.WriteLine("\t" + pError.StackTrace); vS.WriteLine(new String('*', 280)); } if(pError.ServerTrace != null) { vS.WriteLine("ServerTrace:"); vS.WriteLine("\t" + pError.ServerTrace); vS.WriteLine(new String('*', 280)); } #endif showModal(vS.ToString(), pTitle, pOwner); } }
private void doProc() { if (this._conn != null) { try { this._state = RemoteProcState.Running; this.Started = DateTime.Now; this.doOnStarted(); this._doProcessCursor(); } catch (ThreadAbortException) { } catch (EBioSQLBreaked) { this._state = RemoteProcState.Breaked; } catch (Exception ex) { this._state = RemoteProcState.Error; this._lastError = EBioException.CreateIfNotEBio(ex); } finally { if (this._conn != null) { this._conn.Close(); this._conn = null; } if (this.State == RemoteProcState.Breaking) this._state = RemoteProcState.Breaked; else if (this.State == RemoteProcState.Running) this._state = RemoteProcState.Done; if (this.State == RemoteProcState.Breaked) this.doOnBreaked(); else if (this.State == RemoteProcState.Error) this.doOnError(); this.doOnFinished(); } } }
public virtual void ProcessRequest(HttpContext context) { var curRqtp = RequestType.Unassigned; try { this.FLocalPath = context.Request.PhysicalApplicationPath; this.FAppURL = context.Request.ApplicationPath; context.Response.ContentType = SrvConst.HTML_CONTENT_TYPE; context.Response.BufferOutput = true; context.Response.ContentEncoding = Encoding.GetEncoding(Utl.SYS_ENCODING); var ar = AjaxRequest.ExtractFromQParams(context.Request.Params) as AjaxRequest; if (ar is BioRequestTyped) curRqtp = (ar as BioRequestTyped).RequestType; if (ar == null) { var rqType = context.Request.Params[csRequestTypeParamName]; var bioCode = context.Request.Params[csBioCodeParamName]; if (String.IsNullOrEmpty(rqType) || String.IsNullOrEmpty(bioCode)) ar = new AjaxRequest(); else { ar = new BioRequest { RequestType = enumHelper.GetFieldValueByValueName<RequestType>(rqType, StringComparison.CurrentCulture), BioCode = bioCode, BioParams = new Params(context.Request.Params) }; (ar as BioRequest).BioParams.Remove(csRequestTypeParamName); (ar as BioRequest).BioParams.Remove(csBioCodeParamName); } } ar.Prms = new Params(context.Request.Params); this.processAjaxRequest(context, ar); } catch (ThreadAbortException) { } catch (EBioUnknownRequest bex) { context.Response.Write(new BioResponse { Success = true, Ex = bex }.Encode()); context.Session.Abandon(); } catch (EBioLoggedOut bex) { context.Response.Write(new BioResponse { Success = true, Ex = bex }.Encode()); context.Session.Abandon(); } catch (EBioRestartApp bex) { context.Response.Write(new BioResponse { Success = true, Ex = bex }.Encode()); } catch (EBioException bex) { context.Response.Write(new BioResponse { Success = false, Ex = bex }.Encode()); } catch (Exception bex) { var ebioex = new EBioException("Непредвиденная ошибка на сервере.\nСообщение: " + bex.Message, bex); context.Response.Write(new BioResponse { Success = false, Ex = ebioex }.Encode()); } }
private void _loadDocFromCursor(XmlElement ds, StringBuilder doc, ref EBioException v_ex) { using (var vConn = this.BioSession.Cfg.dbSession.GetConnection()) { try { var vCursor = new CJSCursor(vConn, ds, this.bioCode); var v_request = this.BioRequest<JsonStoreRequestGet>(); vCursor.Init(v_request); try { this.processData(vCursor, doc, ref v_ex); } finally { vCursor.Close(); } } catch (Exception ex) { v_ex = EBioException.CreateIfNotEBio(ex); } finally { if (vConn != null) vConn.Close(); } } }
protected override void doExecute() { base.doExecute(); EBioException ebioex = null; if (this.FBioDesc == null) throw new EBioException(String.Format("Описание объекта {0} не найдено на сервере.", this.bioCode)); var vDS = this.FBioDesc.DocumentElement; if (vDS != null) { var rqst = this.BioRequest<BioSQLRequest>(); var vConn = this.AssignTransaction(vDS, rqst); try { var vCursor = new CJSCursor(vConn, vDS, this.bioCode); var vAjaxRequestTimeOut = Utl.Convert2Type<int>(Params.FindParamValue(this.QParams, "ajaxrqtimeout")); var vMon = SQLGarbageMonitor.GetSQLGarbageMonitor(this.Context); vMon.RegisterSQLCmd(vCursor, (SQLCmd vSQLCmd, ref Boolean killQuery, ref Boolean killSession, Boolean vAjaxTimeoutExceeded) => { if (Equals(vCursor, vSQLCmd)) { killQuery = !this.Context.Response.IsClientConnected || vAjaxTimeoutExceeded; killSession = killQuery; } }, vAjaxRequestTimeOut); try { vCursor.DoExecuteSQL(this.bioParams, rqst.Timeout); this.Context.Response.Write( new BioResponse { Success = true, TransactionID = !this.AutoCommitTransaction ? this.TransactionID : null, BioParams = this.bioParams }.Encode()); } finally { vMon.RemoveItem(vCursor); } } catch (Exception ex) { this.FinishTransaction(vConn, true, SQLTransactionCmd.Rollback); ebioex = new EBioException("Ошибка выполнения на сервере. Сообщение: " + ex.Message, ex); } finally { this.FinishTransaction(vConn, true, rqst.transactionCmd); } } else ebioex = new EBioException("В описании объекта [" + this.bioCode + "] не найден раздел <store>."); if (ebioex != null) { this.Context.Response.Write(new BioResponse { Success = false, BioParams = this.bioParams, Ex = ebioex }.Encode()); } }
private void _loadDocFromProc(XmlElement ds, StringBuilder doc, ref EBioException v_ex) { using (var vConn = this.BioSession.Cfg.dbSession.GetConnection()) { try { var vCursor = new CJSCursor(vConn, ds, this.bioCode); var v_request = this.BioRequest<JsonStoreRequestGet>(); vCursor.DoExecuteSQL(v_request.BioParams, 120); var v_out_prm = v_request.BioParams.Where((p) => { return (p.ParamDir == ParamDirection.InputOutput) || (p.ParamDir == ParamDirection.Output) || (p.ParamDir == ParamDirection.Return); }).FirstOrDefault(); if (v_out_prm != null) doc.Append(v_out_prm.Value); } catch (Exception ex) { v_ex = EBioException.CreateIfNotEBio(ex); } finally { if (vConn != null) vConn.Close(); } } }
public static String FormatError(EBioException error) { if (error != null) { var showDebug = BioGlobal.Debug || BioGlobal.CurUsrIsDebugger || !BioGlobal.CurSessionIsLoggedOn; var stringWriter = new StringWriter(); var msg = error.ApplicationErrorMessage; if (String.IsNullOrEmpty(msg)) msg = "Произошла непредвиденная ошибка! Просим извинения за причиненные неудобства.\n" + "Попробуйте перезапустить браузер и повторить операцию через несколько минут."; else msg = "Ошибка приложения:\n\t" + msg; stringWriter.WriteLine(msg); stringWriter.WriteLine(new String('*', 280)); //#if DEBUG if (showDebug || CB_FORCE_DEBUG_MODE) { if (error.Message != null) { stringWriter.WriteLine("Ошибка системы [" + error.GetType().FullName + ((error.InnerException != null) ? "("+error.InnerException.GetType().FullName+")" : null) + "]:"); stringWriter.WriteLine("\t" + error.Message); if(error.InnerException != null) stringWriter.WriteLine("\t\t" + error.InnerException.Message); stringWriter.WriteLine(new String('*', 280)); } if (error.StackTrace != null) { stringWriter.WriteLine("Trace:"); stringWriter.WriteLine("\t" + error.StackTrace); stringWriter.WriteLine(new String('*', 280)); } if (error.ServerTrace != null) { stringWriter.WriteLine("ServerTrace:"); stringWriter.WriteLine("\t" + error.ServerTrace); stringWriter.WriteLine(new String('*', 280)); } } //#endif return stringWriter.ToString(); } return null; }
private void processData(CJSCursor pCursor, StringBuilder vDoc, ref EBioException vEx) { try { var needClose = false; if(!pCursor.IsActive && (pCursor.Connection != null)) { pCursor.Open(120); needClose = true; } // перебираем все записи в курсоре while(pCursor.Next()) { // перебираем все поля одной записи var fRow = new StringBuilder(); foreach(DictionaryEntry vCur in pCursor.RowValues) { fRow.Append(SQLUtils.ObjectAsString(vCur.Value)); } vDoc.Append(fRow); } if(needClose) pCursor.Close(); } catch(Exception ex) { vEx = EBioException.CreateIfNotEBio(ex); } }
private void doProc() { if (this._conn != null) { try { this._state = RemoteProcState.Running; this.Started = DateTime.Now; this.DoOnStarted(); if (this._prepareCmdProc != null) { String vCurrentSQL = null; Params vCurrentParams = null; this._currentCmd = this._prepareCmdProc(this._conn, ref vCurrentSQL, ref vCurrentParams); SQLCmd.ExecuteScript(this._currentCmd, vCurrentSQL, vCurrentParams); } Thread.Sleep(100); } catch (ThreadAbortException) { } catch (EBioSQLBreaked) { this._state = RemoteProcState.Breaked; } catch (Exception ex) { this._state = RemoteProcState.Error; this._lastError = EBioException.CreateIfNotEBio(ex); } finally { if (this._conn != null) { this._conn.Close(); this._conn = null; } if (this.State == RemoteProcState.Breaking) this._state = RemoteProcState.Breaked; else if (this.State == RemoteProcState.Running) this._state = RemoteProcState.Done; if (this.State == RemoteProcState.Breaked) this.doOnBreaked(); else if (this.State == RemoteProcState.Error) this.doOnError(); this.doOnFinished(); } } }
/// <summary> /// Выполняет синхронный запрос к серверу /// </summary> /// <param name="url">URL</param> /// <param name="proxy"></param> /// <param name="prms">Дополнительные параметры запроса</param> /// <param name="userAgentName">Название клиента</param> /// <param name="responseText">Ответ сервера</param> /// <param name="requestException">Ошибка, которая произошла при запросе</param> /// <param name="onLogLine">Метод пишущий лог</param> /// <param name="timeOut">Сек</param> public static void getDataFromSrv(String url, WebProxy proxy, Params prms, String userAgentName, ref String responseText, ref EBioException requestException, DOnLogLine onLogLine, int timeOut) { syncObj4WebRequest.WaitOne(); try { responseText = null; Uri vUri = null; try { vUri = new Uri(url); } catch (Exception ex) { requestException = new EBioException("Строка URL [" + url + "] имеет некорректный формат. Сообщение: " + ex.Message, ex); responseText = ex.ToString(); return; } FCli = (HttpWebRequest)WebRequest.Create(vUri); FCli.Timeout = (timeOut <= 0) ? RequestTimeout : timeOut; if (proxy != null) FCli.Proxy = proxy; FCli.CookieContainer = new CookieContainer(); if (sessionID != null) { FCli.CookieContainer.Add(sessionID); } AddLogLine("<request>: Host: " + vUri.Host, onLogLine); AddLogLine("<request>: URL: " + url, onLogLine); FCli.Method = "POST"; FCli.UserAgent = userAgentName; AddLogLine("<request>: Method: " + FCli.Method, onLogLine); var vParams = (prms == null) ? new Params() : prms; vParams.Add("ajaxrqtimeout", ""+FCli.Timeout); var vParamsToPost = vParams.bldUrlParams(); //String vParamsToPost = ((pParams == null) || (pParams.Count == 0)) ? "emptypost=yes" : pParams.bldUrlParams(); AddLogLine("<request>: Params: " + vParamsToPost, onLogLine); AddLogLine("<request>: " + CS_SESSION_ID_NAME + ": " + ((sessionID != null) ? sessionID.Value : "<null>"), onLogLine); //if(vParamsToPost != null) { byte[] postArray = Encoding.UTF8.GetBytes(vParamsToPost); FCli.ContentType = "application/x-www-form-urlencoded"; FCli.ContentLength = postArray.Length; try { Stream postStream = FCli.GetRequestStream(); try { postStream.Write(postArray, 0, postArray.Length); } finally { if (postStream != null) postStream.Close(); } } catch (Exception ex) { requestException = new EBioException("Ошибка при обрщении к серверу. Сообщение: " + ex.Message, ex); responseText = ex.ToString(); } //} DateTime vStartTimeRequest = DateTime.Now; HttpWebResponse vRsp = null; if (requestException == null) { try { vRsp = (HttpWebResponse)FCli.GetResponse(); } catch (Exception ex) { requestException = new EBioException("Ошибка при получении ответа с сервера. Сообщение: " + ex.Message + "\n" + "Параметры: " + vUri.AbsoluteUri + "?" + vParamsToPost, ex); responseText = ex.ToString(); } } if((vRsp != null) && FCli.HaveResponse) { Cookie vSessIdCoo = vRsp.Cookies[CS_SESSION_ID_NAME]; if (vSessIdCoo != null) { sessionID = vSessIdCoo; } String vSessionID = null; String vCooDom = null; String vCooPath = null; if (vSessIdCoo != null) { vSessionID = (sessionID != null) ? sessionID.Value : null; vCooDom = (sessionID != null) ? sessionID.Domain : "<null>"; vCooPath = (sessionID != null) ? sessionID.Path : "<null>"; } AddLogLine("<recived>: " + CS_SESSION_ID_NAME + ": " + vSessionID, onLogLine); AddLogLine("<recived>: Domain: " + vCooDom, onLogLine); AddLogLine("<recived>: Path: " + vCooPath, onLogLine); var data = vRsp.GetResponseStream(); var reader = new StreamReader(data, Encoding.UTF8); try { responseText = reader.ReadToEnd(); AddLogLine("<recived>: " + responseText, onLogLine); } catch (Exception ex) { requestException = new EBioException("Ошибка при получении ответа с сервера. Сообщение: " + ex.Message + "\n" + "Параметры: " + vUri.AbsoluteUri + "?" + vParamsToPost, ex); responseText = ex.ToString(); } finally { if (data != null) data.Close(); reader.Close(); } if (String.IsNullOrEmpty(responseText)) requestException = new EBioException("Сервер вернул пустой ответ!"); } } finally { FCli = null; syncObj4WebRequest.ReleaseMutex(); } }
/// <summary> /// Строит строку запроса URL /// </summary> /// <param name="requestException"></param> /// <param name="responseText"></param> /// <param name="converters"></param> /// <returns></returns> public static AjaxResponse CreResponseObject(EBioException requestException, String responseText, JsonConverter[] converters) { AjaxResponse response; if (requestException == null) { try { response = AjaxResponse.Decode(responseText, converters); response.ResponseText = responseText; } catch (Exception e) { response = new AjaxResponse { Ex = new EBioException("Ошибка при восстановлении объекта Response. Сообщение: " + e.Message + "\nResponseText: " + responseText, e), ResponseText = responseText, Success = false }; } } else { response = new AjaxResponse { Ex = requestException, ResponseText = responseText, //request = pRequest, Success = false }; } return response; }
protected override void doExecute() { base.doExecute(); EBioException ebioex = null; if (this.FBioDesc == null) throw new EBioException(String.Format("Описание объекта {0} не найдено на сервере.", this.bioCode)); var vDS = this.FBioDesc.DocumentElement; if (vDS == null) throw new EBioException(String.Format("В описании объекта {0} не найден раздел <store>.", this.bioCode)); var v_hashCodeOfFile = Params.FindParamValue(this.QParams, CS_HASH_CODE_WEB_PARAM) as String; if (String.IsNullOrEmpty(v_hashCodeOfFile)) throw new EBioException(String.Format("В параметрах запроса должен присутствовать параметр {0}.", CS_HASH_CODE_WEB_PARAM)); var rqst = this.BioRequest<BioRequest>(); var vConn = this.BioSession.Cfg.dbSession.GetConnection(); try { try { var cursor = new CJSCursor(vConn, vDS, this.bioCode); var ajaxRequestTimeOut = Utl.Convert2Type<int>(Params.FindParamValue(this.QParams, "ajaxrqtimeout")); var vMon = SQLGarbageMonitor.GetSQLGarbageMonitor(this.Context); vMon.RegisterSQLCmd(cursor, (SQLCmd vSQLCmd, ref Boolean killQuery, ref Boolean killSession, Boolean vAjaxTimeoutExceeded) => { if (Equals(cursor, vSQLCmd)) { killQuery = !this.Context.Response.IsClientConnected || vAjaxTimeoutExceeded; killSession = killQuery; } }, ajaxRequestTimeOut); try { var prms = new Params(); prms.Add("p_hash_code", v_hashCodeOfFile); prms.Add(new Param(CS_FILE_NAME_PARAM, null, typeof(String), ParamDirection.Output)); prms.Add(new Param(CS_FILE_PARAM, null, typeof(Byte[]), ParamDirection.Output)); cursor.DoExecuteSQL(prms, 120); this._sendFileToClient(prms); } catch (Exception ex) { throw EBioException.CreateIfNotEBio(ex); } finally { vMon.RemoveItem(cursor); } } catch (Exception ex) { vConn.Close(); vConn.Dispose(); throw EBioException.CreateIfNotEBio(ex); } } catch (Exception ex) { ebioex = new EBioException("Ошибка выполнения на сервере. Сообщение: " + ex.Message, ex); } if (ebioex != null) { this.Context.Response.Write(new BioResponse() { Success = false, BioParams = this.bioParams, Ex = ebioex }.Encode()); } }
public void PrepareData(Int32 timeout) { if (this.Owner.OuterDSTable == null) { /* Создание DataFactory */ this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Создание DataFactory..."); CXLRDataFactory v_dataFactory = this.Owner.Owner.DataFactory;//CXLRDataFactory.createDataFactory(this.Owner.Cfg, this.Owner.DataFactoryTypeName); this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Создание DataFactory - OK."); try { /* Инициализация набора данных */ this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Инициализация набора данных DataFactory..."); if (this.Owner.Owner.RptDefinition.DBConnEnabled) { this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Параметры: " + this.Owner.Owner.RptDefinition.InParams); v_dataFactory.Open(this.Owner.Owner.currentDbConnection, this.Owner.Cfg, timeout); } else return; this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Инициализация набора данных DataFactory - ОК."); this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Заполнение структуры отчета из DataFactory..."); long rnum = 0; while (v_dataFactory.Next()) { rnum++; this.RootGroup.DoOnFetch(rnum, v_dataFactory.CurentRowExt); if ((this.Owner.Cfg.maxExpRows > 0) && (rnum >= this.Owner.Cfg.maxExpRows)) { throw new EBioTooManyRows("... Внимание! Достигнут максимальный размер набора данных для экспорта в MS Excel - " + this.Owner.Cfg.maxExpRows + " записей."); } } this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Заполнение структуры отчета из DataFactory - ОК."); } catch(EBioTooManyRows ex){ this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Заполнение структуры отчета из DataFactory - "+ex.Message); this.PrepareDataError = ex; } finally { if (v_dataFactory != null) v_dataFactory.Dispose(); v_dataFactory = null; } } else { this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Заполнение структуры отчета из OuterDSTable..."); for (int i = 0; i < this.Owner.OuterDSTable.Rows.Count; i++) { this.RootGroup.DoOnFetch(i, convertDataRow(this.Owner.OuterDSTable.Rows[i])); } this.Owner.Owner.writeLogLine("\tds:(" + this.Owner.Cfg.alias + ") : Заполнение структуры отчета из OuterDSTable - ОК."); } }
private void _processLogin(EBioLogin bioLoginExcp, Action<EBioException> callback) { if(bioLoginExcp is EBioLoggedOut) { this.CurUsr = null; if (callback != null) callback(bioLoginExcp); } else { // Запрашиваем ввод логина this._getLogin((newLogin) => { if (newLogin == null) { // Если пользователь не ввел логин, тогда отбой if (callback != null) callback(new EBioCancel()); } else { // Пользователь ввел логин String vCurUsrName = Utl.ExtractUsrNameFromLogin(newLogin); String vCurUsrPwd = Utl.ExtractUsrPwdFromLogin(newLogin); // Запускаем процедуру проверки логина postLogin(newLogin, (r) => { EBioException vExcp = decBioLoginExcp(r.Ex); if (vExcp != null) { if (vExcp is EBioOk) { this.assignCurUser(((EBioOk)vExcp).Usr); this.FOwner.Env.ConfigRoot.LastLoggedInUserName = vCurUsrName; this.FOwner.Env.LastSuccessPwd = vCurUsrPwd; if (this.FOwner.Env.ConfigRoot.SavePassword) this.FOwner.Env.ConfigRoot.LastLoggedInUserPwd = vCurUsrPwd; else this.FOwner.Env.ConfigRoot.LastLoggedInUserPwd = String.Empty; ((IConfigurable<ConfigRoot>)this.FOwner.Env.PluginRoot).Cfg.Store(); if (callback != null) callback(vExcp); } else if (vExcp is EBioAutenticationError) { String v_errMsg = null; if (vExcp is EBioBadUser) v_errMsg = "Не верное имя пользователя [" + vCurUsrName + "] или пароль."; else if (vExcp is EBioUncnfrmdUser) v_errMsg = "Пользователь [" + vCurUsrName + "] не активирован."; else if (vExcp is EBioBlockedUser) v_errMsg = "Пользователь [" + vCurUsrName + "] заблокирован."; else if (vExcp is EBioBadPwd) v_errMsg = "Не верный пароль."; this.showLoginError(v_errMsg, () => { this._processLogin(bioLoginExcp, callback); }); } else { vExcp = new EBioException("Непредвиденная ошибка: " + r.Ex.Message); if (callback != null) callback(vExcp); } } else { vExcp = EBioException.CreateIfNotEBio(r.Ex); if (callback != null) callback(vExcp); } }); } }); } }
private void _processLogin(EBioLogin bioLoginExcp, Action<EBioException> callback) { if(bioLoginExcp is EBioLoggedOut) { this.CurUsr = null; if (callback != null) callback(bioLoginExcp); } else { // Запрашиваем ввод логина this._getLogin(newLogin => { if (newLogin == null) { // Если пользователь не ввел логин, тогда отбой if (callback != null) callback(new EBioCancel()); } else { // Пользователь ввел логин var curUsrName = Utl.ExtractUsrNameFromLogin(newLogin); var curUsrPwd = Utl.ExtractUsrPwdFromLogin(newLogin); // Запускаем процедуру проверки логина _postLogin(newLogin, r => { EBioException excp = DecBioLoginExcp(r.Ex); if (excp != null) { var bioOk = excp as EBioOk; if (bioOk != null) { this.AssignCurUser(bioOk.Usr); BioEnvironment.Instance.ConfigRoot.LastLoggedInUserName = curUsrName; BioEnvironment.Instance.LastSuccessPwd = curUsrPwd; if (BioEnvironment.Instance.ConfigRoot.SavePassword) BioEnvironment.Instance.ConfigRoot.LastLoggedInUserPwd = curUsrPwd; else BioEnvironment.Instance.ConfigRoot.LastLoggedInUserPwd = String.Empty; BioEnvironment.Instance.PluginRoot.Cfg.Store(); if (callback != null) callback(bioOk); } else if (excp is EBioAutenticationError) { String errMsg = null; if (excp is EBioBadUser) errMsg = "Не верное имя пользователя [" + curUsrName + "] или пароль."; else if (excp is EBioUncnfrmdUser) errMsg = "Пользователь [" + curUsrName + "] не активирован."; else if (excp is EBioBlockedUser) errMsg = "Пользователь [" + curUsrName + "] заблокирован."; else if (excp is EBioBadPwd) errMsg = "Не верный пароль."; _showLoginError(errMsg, () => { this._processLogin(bioLoginExcp, callback); }); } else { excp = new EBioException("Непредвиденная ошибка: " + r.Ex.Message); if (callback != null) callback(excp); } } else { excp = EBioException.CreateIfNotEBio(r.Ex); if (callback != null) callback(excp); } }); } }); } }
protected override void doExecute() { base.doExecute(); EBioException vEx = null; var vDoc = new StringBuilder(); try { var vDS = this.FBioDesc.DocumentElement; if(vDS != null) { if (vDS.SelectSingleNode("SQL[@action='select']") != null) this._loadDocFromCursor(vDS, vDoc, ref vEx); else if (vDS.SelectSingleNode("SQL[@action='execute']") != null) this._loadDocFromProc(vDS, vDoc, ref vEx); } else vEx = new EBioException("В описании объекта [" + this.bioCode + "] не найден раздел <store>."); } finally { if(vEx == null) { var iofn = SrvUtl.bldiniFileName(this.BioSession.Cfg.IniPath, this.bioCode); var xslfn = iofn.ToLower().Replace(".xml", ".xsl"); var cssfn = iofn.ToLower().Replace(".xml", ".css"); if(File.Exists(xslfn)) { var rsltDoc = new dom4cs(); rsltDoc.XmlDoc = dom4cs.CreXmlDocument(vDoc.ToString()); var vElem = rsltDoc.XmlDoc.CreateElement("appurl"); vElem.InnerText = this.BioSession.Cfg.AppURL; rsltDoc.XmlDoc.DocumentElement.AppendChild(vElem); vElem = rsltDoc.XmlDoc.CreateElement("biourl"); vElem.InnerText = SrvUtl.bldIOPathUrl(this.BioSession.Cfg.AppURL, this.bioCode); rsltDoc.XmlDoc.DocumentElement.AppendChild(vElem); rsltDoc.WriteToStream(this.Context.Response.OutputStream, xslfn); } else { this.Context.Response.Write(vDoc.ToString()); } } else { var vAgent = this.BioSession.CurSessionRemoteAgent; if(vAgent.ToUpper().StartsWith("DALPHA")) throw vEx; this.Context.Response.Write(vEx.ToString()); } this.Context.Response.Flush(); } }
/// <summary> /// Выводит окно сообщения об ошибке /// </summary> /// <param name="error">Класс ошибки</param> /// <param name="title">Заголовок</param> /// <param name="callback"></param> public static void ShowError(EBioException error, String title, Action callback) { var s = FormatError(error); _showMsg(s, title, callback); }
private void _doOnLocation(CRTObject row, EBioException exception, EventHandler<OnSelectEventArgs> callback) { if (callback != null) { callback(this, new OnSelectEventArgs { ex = exception, selection = new VSingleSelection { ValueRow = row } }); } }