Ejemplo n.º 1
0
        void IAddItemScanTask.AssignScanWithRegistryItem(string fileName, int ownerID, int registryID, int itemNumber, string documentName,
                                                         string documentDescription, string elementDescription, bool isMain, bool isRF)
        {
            IItemStorage storage  = ItemStorageFactory.Create();
            TypMime      mimeType = MimeHelper.PobierzTypDlaRozszerzenia(Path.GetExtension(fileName));
            Guid         scanGuid = Guid.Empty;

            using (FileStream fs = File.OpenRead(fileName))
            {
                scanGuid = storage.Save(fs);
            }
            XPathDocument  xpd = new XPathDocument(File.OpenRead(Path.GetDirectoryName(fileName) + "\\" + Path.GetFileNameWithoutExtension(fileName) + ".xml"));
            XPathNavigator xpn = xpd.CreateNavigator();
            Metadata       md  = new Metadata();

            md.Add("dataPobrania", xpn.SelectSingleNode("/dokument/dataPobrania").Value);
            md.Add("nazwaPlikuSkanu", xpn.SelectSingleNode("/dokument/nazwaPlikuDokumentu").Value);
            md.Add("liczbaStron", xpn.SelectSingleNode("/dokument/liczbaStron").Value);
            md.Add("lokalizacjaSkanu", xpn.SelectSingleNode("/dokument/pochodzenie/lokalizacja").Value);
            md.Add("urzadzenie", xpn.SelectSingleNode("/dokument/pochodzenie/urzadzenie").Value);
            md.Add("rodzajSkanu", xpn.SelectSingleNode("/dokument/pochodzenie/rodzaj").Value);
            md.Add("zrodloSkanu", xpn.SelectSingleNode("/dokument/pochodzenie/zrodlo").Value);

            rdao.AddNewScan(ownerID, registryID, itemNumber, documentName, documentDescription, scanGuid, Path.GetFileName(fileName), elementDescription, mimeType.Nazwa, isMain, mimeType.Browsable, md.GetXml(), isRF);
        }
Ejemplo n.º 2
0
        private void getFileFromTemporarDirectory()
        {
            string fileName = string.Format("{0}\\{1}", Configuration.PhysicalTemporaryDirectory, Path.GetFileName(view.FileName));

            if (fileName.Length < 5)
            {
                return;
            }
            Stream s = service.GetTempFile(fileName);            // File.OpenRead(fileName);

            view.MimeType           = MimeHelper.PobierzTypDlaRozszerzenia(Path.GetExtension(fileName)).Nazwa;
            view.DownloadedFileName = string.Format("obraz_{0}", DateTime.Now.ToString("yyyyMMddmmss"));
            s.Seek(0, 0);
            copyStream(s, view.ContentStream);
            s.Close();
        }
Ejemplo n.º 3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            imageID = Request["id"].ToString();
            if (Request["type"] != null && Request["type"].ToString().ToLower() == "preview")
            {
                Width  = 450;
                Height = 600;
            }
            if (Request["w"] != null)
            {
                int width;
                if (int.TryParse(Request["w"], out width))
                {
                    Width  = width;
                    Height = Width * 133 / 100;
                }
            }
            if (Request["mt"] != null)
            {
                mimeType = MimeHelper.PobierzTypDlaRozszerzenia(Request["mt"].ToString()).Nazwa;
            }
            if (Request["pn"] != null)
            {
                int pn;
                if (!int.TryParse(Request["pn"].ToString(), out pn))
                {
                    PageNumber = 0;
                }
                else
                {
                    PageNumber = pn;
                }
            }
            GetImagePresenter presenter = new GetImagePresenter(this);

            presenter.Initialize();
        }