/// <summary>
 /// Получить список входных параметров типов запросов
 /// </summary>
 /// <param name="ID"></param>
 /// <returns></returns>
 public JsonResult GetQueryInParamsList(int ID)
 {
     try
     {
         RequestPackage req = new RequestPackage() { requestID = ID };
         ResponseObjectPackage<List<QueryInParameterModel>> response = new QueryEditorLogic().GetQueryInParamsList(req).GetSelfOrExceptionIfError();
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 /// <summary>
 /// Получить тип запроса с параметрами
 /// </summary>
 /// <returns></returns>
 public JsonResult GetFullQueryType(int ID)
 {
     try
     {
         RequestPackage req = new RequestPackage() { requestID = ID };
         ResponseObjectPackage<FullQueryType> response = new QueryEditorLogic().GetFullQueryType(req).GetSelfOrExceptionIfError();
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 public JsonResult SaveQueryType(QueryTypeModel queryType, List<QueryInParameterModel> queryInParameters, List<QueryOutParameterModel> queryOutParameters)
 {
     try
     {
         RequestObjectPackage<QueryTypeModel> reqType = new RequestObjectPackage<QueryTypeModel>() { requestData = queryType };
         ResponsePackage responseType = new QueryEditorLogic().SaveQueryType(reqType).GetSelfOrExceptionIfError();
         int typeID = responseType.GetIdOrExceptionIfError();
         if (queryInParameters != null && queryInParameters.Count > 0)
         {
             foreach (QueryInParameterModel param in queryInParameters)
             {
                 param.queryTypeID = typeID;
                 RequestObjectPackage<QueryInParameterModel> reqIn = new RequestObjectPackage<QueryInParameterModel>() { requestData = param };
                 ResponsePackage responseIn = new QueryEditorLogic().SaveQueryInParameter(reqIn).GetSelfOrExceptionIfError();
             }
         }
         if (queryOutParameters != null && queryOutParameters.Count > 0)
         {
             foreach (QueryOutParameterModel param in queryOutParameters)
             {
                 param.queryTypeID = typeID;
                 RequestObjectPackage<QueryOutParameterModel> reqOut = new RequestObjectPackage<QueryOutParameterModel>() { requestData = param };
                 ResponsePackage responseOut = new QueryEditorLogic().SaveQueryOutParameter(reqOut).GetSelfOrExceptionIfError();
             }
         }
         return Json(responseType);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 /// <summary>
 /// Получить список типов запросов
 /// </summary>
 /// <returns></returns>
 public JsonResult GetQueryTypeList()
 {
     try
     {
         RequestPackage req = new RequestPackage();
         ResponseObjectPackage<List<QueryTypeModel>> response = new QueryEditorLogic().GetQueryTypeList(req).GetSelfOrExceptionIfError();
         response.resultData.ForEach(x => {
             x.sqlText = x.sqlText.Replace(System.Environment.NewLine, "");
             x.sqlText = x.sqlText.Replace("\n", "");
         });
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }