public ViewObjectPropFile getFileBytesFromPropID(IConnectToDB _Connect, string objectpropsetid) { byte[] bytes = new byte[0]; ViewObjectPropFile _File = new ViewObjectPropFile(); int n; bool isNumeric = int.TryParse(objectpropsetid, out n); if (isNumeric) { ER_Query er_query = new ER_Query(); ObjectPropSetModels opsm = new ObjectPropSetModels(); ObjectPropSetsHelper opsHelper = new ObjectPropSetsHelper(); List <ViewObjectPropFile> _FilesList = opsHelper.FindFiles(_Connect, new List <ViewObjectPropFile>(), objectpropsetid, "object_prop_set"); foreach (ViewObjectPropFile e in _FilesList) { if (e != null) { _File.file_name = e.file_name; _File.value = e.value; _File.content_type = e.content_type; //bytes = (byte[])e.file_data; } } } return(_File); }
public ViewObjectPropFile GetFileByID(IConnectToDB _Connect, Guid?FileID) { byte[] bytes = new byte[0]; ViewObjectPropFile _File = new ViewObjectPropFile(); _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures(); List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>(); Filters.Add(new DynamicModels.RootReportFilter { FilterName = "OBJ_PROP_SETS_DAT_FILE_ID_", DBType = SqlDbType.UniqueIdentifier, ParamValue = FileID }); DataTable _DT = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__OBJ_PROP_SETS_DAT_FILE_SEARCH", new DataTableDotNetModelMetaData { columns = "DT_CREATED, CONTENT_TYPE, FILE_NAME", length = -1, order = "1 asc", start = 0, verify = "T" }, Filters); DataColumnCollection DCC = _DT.Columns; if (DCC.Contains("FILE_NAME") && _DT.Rows.Count > 0) { string thisFileRow = new JObject(_DT.Columns.Cast <DataColumn>() .Select(c => new JProperty(c.ColumnName, JToken.FromObject(_DT.Rows[0][c]))) ).ToString(Formatting.None); _File = Newtonsoft.Json.JsonConvert.DeserializeObject <ViewObjectPropFile>(thisFileRow); } return(_File); }
public ViewObjectPropFile PropFile(ViewObjectPropFile PropSet, DataRow _DR) { DataTable thisAppDT = new DataRow[] { _DR }.CopyToDataTable(); string thisAppRow = new JObject(thisAppDT.Columns.Cast <DataColumn>() .Select(c => new JProperty(c.ColumnName, JToken.FromObject(thisAppDT.Rows[0][c]))) ).ToString(Formatting.None); PropSet = JsonConvert.DeserializeObject <ViewObjectPropFile>(thisAppRow); return(PropSet); }
public Byte[] GetBytesViaStoredBase64(ViewObjectPropFile Base64File) { IOHelper IO = new IOHelper(); string contentType = IO.GetContentTypeViaExt(Base64File.content_type); byte[] _DBBytes = Base64File.value; char[] chars = new char[0]; chars = new char[_DBBytes.Length / sizeof(char)]; System.Buffer.BlockCopy(_DBBytes, 0, chars, 0, _DBBytes.Length); string FileString = new string(chars); string[] tokens = FileString.Split(','); byte[] FileBytes = Convert.FromBase64String(tokens[1]); return(FileBytes); }