Пример #1
0
        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);
        }
Пример #2
0
        public string getFilesFromBytes(IConnectToDB _Connect, string object_id, string object_type)
        {
            ER_Query             er_query  = new ER_Query();
            ObjectPropSetModels  opsm      = new ObjectPropSetModels();
            ObjectPropSetsHelper opsHelper = new ObjectPropSetsHelper();

            List <ViewObjectPropFile> _FilesList = opsHelper.FindFiles(_Connect, new List <ViewObjectPropFile>(), object_id, object_type);

            char[] chars = new char[0];
            foreach (ViewObjectPropFile e in _FilesList)
            {
                if (e != null)
                {
                    byte[] bytes = e.value;
                    chars = new char[bytes.Length / sizeof(char)];
                    System.Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length);
                }
            }
            return(new string(chars));
        }