예제 #1
0
        //equipment
        private void beAdd_Click(object sender, EventArgs e)
        {
            var s = new tbEquipment();

            s.e_nameA       = ceNameA.Text;
            s.e_name        = ceName.Text;
            s.e_note        = ceNote.Text;
            s.e_location    = ceLocation.Text;
            s.e_type        = ceType.Text;
            s.e_description = ceDescription.Text;
            s.date_in       = DateTime.Now;
            s.e_contact     = ceContact.Text;

            s.UserId = Guid.Parse(CTHelper.GetConfig("userid"));

            CTDBEntities ct = new CTDBEntities();

            ct.tbEquipment.Add(s);
            ct.SaveChanges();   //将修改保存到数据库中
            refrashDataGridview(null, null);
        }
예제 #2
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                //int id = (int)dataGridView1.SelectedRows[0].Cells[0].Value;

                int rid = dataGridView1.SelectedRows[0].Index;
                int id  = ((dataGridView1.DataSource as List <tbEquipment>)[rid] as tbEquipment).e_id;

                CTDBEntities ct = new CTDBEntities();
                var          q  = from c in ct.tbEquipment where c.e_id == id select c;
                tbEquipment  s  = q.ToList <tbEquipment>()[0];
                ceID.Text          = s.e_id.ToString();
                ceNameA.Text       = s.e_nameA;
                ceName.Text        = s.e_name;
                ceNote.Text        = s.e_note;
                ceLocation.Text    = s.e_location;
                ceType.Text        = s.e_type;
                ceContact.Text     = s.e_contact;
                ceDescription.Text = s.e_description;
            }
        }
예제 #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());
            }
        }