Пример #1
0
 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();
   }
 }
Пример #2
0
 /// <summary>
 /// Преобразует строку со значениями первичного ключа в параметры.
 /// </summary>
 /// <param name="data"></param>
 /// <param name="row"></param>
 /// <returns></returns>
 public Params getPK(JsonStoreData data, JsonStoreRow row) {
   Params vParams = new Params();
   var v_pkDef = this.GetPKFields();
   for (int i = 0; i < v_pkDef.Length; i++) {
     var vType = v_pkDef[i].GetDotNetType();
     var vValue = data.GetValue(row, v_pkDef[i].Name);
     vParams.Add(new Param(v_pkDef[i].Name, vValue, vType, ParamDirection.Input));
   }
   return vParams;
 }
Пример #3
0
 public static JsonStoreRow CreateNewRow(JsonStoreMetadata metadata) {
   var newRow = new JsonStoreRow { InternalROWUID = Guid.NewGuid().ToString("N"), ChangeType = JsonStoreRowChangeType.Unchanged };
   if (metadata != null) {
     foreach (var fd in metadata.Fields)
       newRow.Values.Add(null);
   }
   return newRow;
 }
Пример #4
0
 private JsonStoreRow _rowAsJSRow(JSChangedRow row) {
   if (row != null) {
     var intRowUID = TypeFactory.GetValueOfPropertyOfObject(row.CurRow, CS_INTERNAL_ROWUID_FIELD_NAME) as String;
     var v_rslt = new JsonStoreRow { InternalROWUID = intRowUID, ChangeType = row.State };
     foreach (var fd in this._metadata.Fields) {
       var v_value = TypeFactory.GetValueOfPropertyOfObject(row.CurRow, fd.Name);
       v_rslt.Values.Add(v_value);
     }
     return v_rslt;
   }
   return null;
 }
Пример #5
0
 /// <summary>
 /// Выполняет скрипт с параметрами из строки
 /// </summary>
 /// <param name="metadata"></param>
 /// <param name="row"></param>
 /// <param name="bioParams"></param>
 /// <param name="timeout"/>
 public void DoExecuteSQL(JsonStoreMetadata metadata, JsonStoreRow row, Params bioParams, Int32 timeout) {
   var v_params = this._buildPostParams(metadata, row, bioParams);
   this._doExecute(v_params, "execute", timeout);
 }
Пример #6
0
 /// <summary>
 /// Обрабатывает изменения в данных
 /// </summary>
 /// <param name="metadata"></param>
 /// <param name="row"></param>
 /// <param name="bioParams"></param>
 /// <param name="timeout"/>
 public void DoProcessRowPost(JsonStoreMetadata metadata, JsonStoreRow row, Params bioParams, Int32 timeout) {
   var v_params = this._buildPostParams(metadata, row, bioParams);
   if ((row.ChangeType == JsonStoreRowChangeType.Added) ||
       (row.ChangeType == JsonStoreRowChangeType.Modified)) {
         this._doExecute(v_params, "insertupdate", timeout);
     this._returnParamsToRow(metadata, row, v_params);
   } else if (row.ChangeType == JsonStoreRowChangeType.Deleted)
     this._doExecute(v_params, "delete", timeout);
 }
Пример #7
0
 private void _returnParamsToRow(JsonStoreMetadata metadata, JsonStoreRow row, Params bioParams) {
   var v_out_params = bioParams.Where(p => { return (p.ParamDir != ParamDirection.Input)/* || String.Equals(p.Name, CJsonStoreMetadata.csPKFieldName)*/; });
   foreach (var p in v_out_params)
     row.Values[metadata.IndexOf(p.Name)] = p.Value;
 }
Пример #8
0
    /*
    /// <summary>
    /// Удаляет запись по признаку первичного ключа.
    /// </summary>
    /// <exception cref="EBioException">Возбуждается, когда операция завершилась с ошибкой.</exception>
    public void DoDelete(Params @params) {
      this.doExecute(@params, "delete");
    }

    /// <summary>
    /// Добавляет/Изменяет запись по признаку первичного ключа.
    /// </summary>
    /// <exception cref="EBioException">Возбуждается, когда операция завершилась с ошибкой.</exception>
    public void DoInsertUpdate(Params @params) {
      this.doExecute(@params, "insertupdate");
    }
    */

    private Params _buildPostParams(JsonStoreMetadata metadata, JsonStoreRow row, Params bioParams) {
      Params v_rslt = new Params();
      for (int i = 0; i < metadata.Fields.Count; i++)
        v_rslt.Add(metadata.Fields[i].Name.ToLower(), row.Values[i]);
      v_rslt = v_rslt.Merge(bioParams, false);
      return v_rslt;

    }