protected static bool DoReturnCompressedResult(ByIndexOrNameDictionary <string> parameters) { if (parameters != null) { bool doCompress = false; for (int i = 0; i < parameters.Count; ++i) { if (parameters.IsByName) { switch (parameters.KeyAtIndex(i).ToLower()) { case "stringparameter": { if (parameters[i].ToLower() == "zipped") { doCompress = true; } } break; case "xmlparameter": { XmlDocument doc = new XmlDocument(); doc.LoadXml(parameters[i]); if (doc.DocumentElement.InnerText.ToLower() == "zipped") { doCompress = true; } } break; } } else { if (parameters[i] == "zipped") { doCompress = true; } } } return(doCompress); } return(false); }
/// <summary> /// Create a new data request according to the input parameters and return the /// data request id. /// </summary> public string CreateDataRequest(string transactionId, string serviceId, int rowIndex, int maxRowCount, RequestType type, string userCreatorId, ByIndexOrNameDictionary <string> parameters) { string requestId = IdProvider.Get(); TransactionTemplate.Execute(delegate { DoInsert(TABLE_NAME, "Id;TransactionId;ServiceId;RowIndex;MaxRowCount;RequestType;ModifiedBy;ModifiedOn;ParamsByName", requestId, transactionId, serviceId, rowIndex, maxRowCount, type.ToString(), userCreatorId, DateTime.Now, DbUtils.ToDbBool((parameters == null) ? true : parameters.IsByName)); if (!CollectionUtils.IsNullOrEmpty(parameters)) { object[] insertValues = new object[4]; DoBulkInsert(ARGS_TABLE_NAME, "Id;RequestId;ArgName;ArgValue", delegate(int currentInsertIndex) { if (currentInsertIndex < parameters.Count) { insertValues[0] = IdProvider.Get(); insertValues[1] = requestId; if (parameters.IsByName) { insertValues[2] = parameters.KeyAtIndex(currentInsertIndex); } else { insertValues[2] = currentInsertIndex.ToString("D3"); } insertValues[3] = parameters[currentInsertIndex]; return(insertValues); } return(null); }); } return(null); }); return(requestId); }
private static ParameterType[] ParameterTypeArrayFromArguments(ByIndexOrNameDictionary <string> arguments) { if ((arguments != null) && (arguments.Count > 0)) { if (!arguments.IsByName) { throw new ArgumentException("Input arguments must be \"by name.\""); } ParameterType[] parameters = new ParameterType[arguments.Count]; for (int i = 0; i < arguments.Count; ++i) { ParameterType parameter = new ParameterType(); parameter.parameterName = arguments.KeyAtIndex(i); parameter.Value = arguments[i]; parameters[i] = parameter; } return(parameters); } else { return(new ParameterType[0]); } }
private void SaveScheduleSourceArgs(string scheduleId, ByIndexOrNameDictionary <string> args) { TransactionTemplate.Execute(delegate { DoSimpleDelete(SOURCE_ARGS_TABLE_NAME, "ScheduleId", new object[] { scheduleId }); if (CollectionUtils.IsNullOrEmpty(args)) { return(null); } object[] insertValues = new object[4]; DoBulkInsert(SOURCE_ARGS_TABLE_NAME, "Id;ScheduleId;Name;Value", delegate(int currentInsertIndex) { if (currentInsertIndex < args.Count) { insertValues[0] = IdProvider.Get(); insertValues[1] = scheduleId; if (args.IsByName) { insertValues[2] = currentInsertIndex.ToString(cIndexFormatString) + args.KeyAtIndex(currentInsertIndex); } else { insertValues[2] = currentInsertIndex.ToString(cIndexFormatString); } insertValues[3] = string.IsNullOrEmpty(args[currentInsertIndex]) ? (object)DBNull.Value : (object)args[currentInsertIndex]; return(insertValues); } else { return(null); } }); return(null); }); }