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()); } }
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(); } } }
private void _doProcessRecord(JsonStoreMetadata metadata, JsonStoreRow row) { var conn = this.dbSess.GetConnection(); try { var vCmd = new CJSCursor(conn, this._exec_ds, this._request.ExecBioCode); vCmd.DoExecuteSQL(metadata, row, this._request.BioParams, 120); } finally { if (conn != null) conn.Close(); } }