/// <summary> /// Tests if a format exists /// </summary> /// <param name="format"></param> /// <returns></returns> internal bool Exists(Format_DTO_Read format) { var adoFormat = new Format_ADO(); var result = adoFormat.Read(ado, format ?? new Format_DTO_Read()); return(result.hasData); }
/// <summary> /// Read the Formats. If either parameter is null then all data for the other parameter is returned /// If both parameters are null then all data is returned /// </summary> /// <param name="ado"></param> /// <param name="format"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, Format_DTO_Read format) { ADO_readerOutput output = new ADO_readerOutput(); var paramList = new List <ADO_inputParams>(); if (!string.IsNullOrEmpty(format.FrmType)) { paramList.Add(new ADO_inputParams() { name = "@FrmType", value = format.FrmType }); } if (!string.IsNullOrEmpty(format.FrmVersion)) { paramList.Add(new ADO_inputParams() { name = "@FrmVersion", value = format.FrmVersion }); } if (!string.IsNullOrEmpty(format.FrmDirection)) { paramList.Add(new ADO_inputParams() { name = "@FrmDirection", value = format.FrmDirection }); } //Call the stored procedure output = ado.ExecuteReaderProcedure("System_Settings_Format_Read", paramList); //Read the result of the call to the database if (output.hasData) { Log.Instance.Debug("Data found"); } else { //No data found Log.Instance.Debug("No data found"); } //return the list of entities that have been found return(output); }
internal List <Format_DTO_Read> Read(Format_DTO_Read format = null) { var adoFormat = new Format_ADO(); List <Format_DTO_Read> list = new List <Format_DTO_Read>(); var result = adoFormat.Read(ado, format ?? new Format_DTO_Read()); foreach (dynamic d in result.data) { list.Add(new Format_DTO_Read() { FrmType = d.FrmType, FrmVersion = d.FrmVersion, FrmDirection = d.FrmDirection, FrmMimetype = GetMimetypeForFormat(new Format_DTO_Read() { FrmType = d.FrmType }) }); } return(list); }
internal string GetFileSuffixForFormat(Format_DTO_Read format) { if (format.FrmType == Constants.C_SYSTEM_XLSX_NAME) { return(Utility.GetCustomConfig("APP_XLSX_FILE_SUFFIX")); } if (format.FrmType == Constants.C_SYSTEM_CSV_NAME) { return(Utility.GetCustomConfig("APP_CSV_FILE_SUFFIX")); } if (format.FrmType == Constants.C_SYSTEM_PX_NAME) { return(Utility.GetCustomConfig("APP_PX_FILE_SUFFIX")); } if (format.FrmType == Constants.C_SYSTEM_SDMX_NAME) { return(Utility.GetCustomConfig("APP_SDMX_FILE_SUFFIX")); } return(null); }
internal string GetMimetypeForFormat(Format_DTO_Read format) { if (format.FrmType == Constants.C_SYSTEM_JSON_STAT_NAME) { return(Utility.GetCustomConfig("APP_JSON_MIMETYPE")); } if (format.FrmType == Constants.C_SYSTEM_XLSX_NAME) { return(Utility.GetCustomConfig("APP_XLSX_MIMETYPE")); } if (format.FrmType == Constants.C_SYSTEM_CSV_NAME) { return(Utility.GetCustomConfig("APP_CSV_MIMETYPE")); } if (format.FrmType == Constants.C_SYSTEM_PX_NAME) { return(Utility.GetCustomConfig("APP_PX_MIMETYPE")); } if (format.FrmType == Constants.C_SYSTEM_SDMX_NAME) { return(Utility.GetCustomConfig("APP_XML_MIMETYPE")); } return(null); }