Пример #1
0
        //从数据库里检测相关数据,看网页是否可以访问
        private void btnCheckDB_Click(object sender, EventArgs e)
        {
            CTDBEntities ct = new CTDBEntities();
            var          q  = from c in ct.tbFile
                              where c.f_pid == ParaDatasetID && c.f_table == ParaTable
                              orderby c.f_path
                              select c;
            List <tbFile> l    = q.ToList <tbFile>();
            string        flog = CTHelper.CommonPath("app") + "\\UrlTestlog.txt";

            if (File.Exists(flog))
            {
                File.Delete(flog);
            }

            note(l.Count);
            this.Enabled = false;
            foreach (tbFile f in l)
            {
                string url = CTHelper.GetConfig("downloadurl") + f.f_table + "/" + f.f_pid.ToString() + "/" + f.f_md5 + ".jpg";
                if (CTHelper.IsUrlExist(url))
                {
                    CTHelper.AddLog("1\t" + url, flog);
                }
                else
                {
                    CTHelper.AddLog("0\t" + url, flog);
                }
                notep();
            }

            refreshdb();
            this.Enabled = true;
        }
Пример #2
0
        /// <summary>导出元数据方法</summary>
        /// <param name="id">slice表的 slice_id </param>
        static public void ExportMeta(int id)
        {
            try
            {
                List <Tuple <string, string> > ht = new List <Tuple <string, string> >();
                CTDBEntities ct = new CTDBEntities();

                tbLabel lb = ct.tbLabel.FirstOrDefault(s => s.label_id == id);
                ht.Add(new Tuple <string, string>("Label ID", lb.label_id.ToString()));
                ht.Add(new Tuple <string, string>("Slice ID", lb.slice_id.ToString()));
                ht.Add(new Tuple <string, string>("Title", lb.label_title.ToString()));
                ht.Add(new Tuple <string, string>("Author", lb.label_author.ToString()));
                ht.Add(new Tuple <string, string>("Structure", lb.label_structure.ToString()));
                ht.Add(new Tuple <string, string>("Method", lb.label_method.ToString()));
                //ht.Add(new Tuple<string, string>("Note", lb.label_note.ToString()));

                string f = Application.StartupPath + "\\meta.txt";
                if (File.Exists(f))
                {
                    File.Delete(f);
                }
                //foreach (System.Collections.DictionaryEntry item in ht)
                foreach (Tuple <string, string> item in ht)
                {
                    string s = item.Item1 + "\t:\t" + item.Item2;
                    CTHelper.AddLog(s, f);
                }

                System.Diagnostics.Process.Start(f);
            }
            catch (Exception ee)
            {
                MessageBox.Show("记录有问题,导出失败\r\n" + ee.ToString());
            }
        }
Пример #3
0
        /// <summary>导出元数据方法</summary>
        /// <param name="id">slice表的 slice_id </param>
        static public void ExportMeta(int id)
        {
            try
            {
                List <Tuple <string, string> > ht = new List <Tuple <string, string> >();
                CTDBEntities ct = new CTDBEntities();

                tbSlice slice = ct.tbSlice.FirstOrDefault(s => s.slice_id == id);
                ht.Add(new Tuple <string, string>("URL", "http://ct.especies.cn/slice/info/" + slice.slice_id.ToString()));
                ht.Add(new Tuple <string, string>("Slice ID", slice.slice_id.ToString()));
                ht.Add(new Tuple <string, string>("Slice Number", slice.slice_para_SliceNumber.ToString()));
                ht.Add(new Tuple <string, string>("Slice File Type", slice.slice_para_ResultFileType.ToString()));
                ht.Add(new Tuple <string, string>("Slice Resolution", slice.slice_para_PixelSize.ToString()));


                tbScan scan = ct.tbScan.FirstOrDefault(s => s.scan_id == slice.scan_id);
                //ht.Add(new Tuple<string, string>("Scan ID", scan.scan_id.ToString()));
                ht.Add(new Tuple <string, string>("Scan Voltage", scan.scan_para_SourceVoltage.ToString()));
                ht.Add(new Tuple <string, string>("Scan Power", scan.scan_para_SourcePower.ToString()));
                ht.Add(new Tuple <string, string>("Scan Binning", scan.scan_para_CameraBinning.ToString()));
                ht.Add(new Tuple <string, string>("Scan Lens", scan.scan_para_LensMultiple.ToString()));
                ht.Add(new Tuple <string, string>("Scan Exposure", scan.scan_para_Exposure.ToString()));
                ht.Add(new Tuple <string, string>("Scan Time", scan.scan_date));
                ht.Add(new Tuple <string, string>("Scan Operator", scan.scan_operator));
                ht.Add(new Tuple <string, string>("Scan Part", scan.scan_specimen_Body));

                //tbTag ttag = ct.tbTag.FirstOrDefault(s => s.tag_id == scan.scan_tag_SpecimenAlive);
                //ht.Add(new Tuple<string, string>("Specimen Status", ttag.tag_tag));
                ht.Add(new Tuple <string, string>("Specimen Status", FormTag.GetTagTag(scan.scan_tag_SpecimenAlive)));

                tbEquipment equip = ct.tbEquipment.FirstOrDefault(s => s.e_id == scan.e_id);
                ht.Add(new Tuple <string, string>("Equipment", equip.e_name));

                tbSpecimen sp = ct.tbSpecimen.FirstOrDefault(s => s.sp_id == slice.sp_id);
                ht.Add(new Tuple <string, string>("Specimen ID", sp.sp_spid));
                ht.Add(new Tuple <string, string>("Specimen Collector", sp.sp_collector));
                ht.Add(new Tuple <string, string>("Specimen Time", sp.sp_collect_time));
                ht.Add(new Tuple <string, string>("Specimen Place", sp.sp_collect_place));
                ht.Add(new Tuple <string, string>("Specimen Identifier", sp.sp_identifier));

                ht.Add(new Tuple <string, string>("Preprocess", sp.sp_dehydrant));


                tbSpecies species = ct.tbSpecies.FirstOrDefault(s => s.species_id == sp.species_id);
                ht.Add(new Tuple <string, string>("Specie Name", species.species_latin));
                ht.Add(new Tuple <string, string>("Specie Genus", species.species_Genus));
                ht.Add(new Tuple <string, string>("Specie Family", species.species_Family));


                string f = Application.StartupPath + "\\meta.txt";
                if (File.Exists(f))
                {
                    File.Delete(f);
                }
                //foreach (System.Collections.DictionaryEntry item in ht)
                foreach (Tuple <string, string> item in ht)
                {
                    string s = item.Item1 + "\t:\t" + item.Item2;
                    CTHelper.AddLog(s, f);
                }

                System.Diagnostics.Process.Start(f);
            }
            catch (Exception ee)
            {
                MessageBox.Show("记录有问题,导出失败\r\n" + ee.ToString());
            }
        }