예제 #1
0
파일: FormLabel.cs 프로젝트: wjn99wjn/CTDB
        /// <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());
            }
        }
예제 #2
0
파일: FormLabel.cs 프로젝트: wjn99wjn/CTDB
        private void bsmAddBatch_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fd = new FolderBrowserDialog();

            if (fd.ShowDialog() == DialogResult.OK)
            {
                string[] fds = Directory.GetDirectories(fd.SelectedPath);
                for (int i = 0; i < fds.Length; i++)
                {
                    //clbNote.Text = fds[i];
                    clbSrcFolder.Text = fds[i];
                    fds[i]            = fds[i].Replace(fd.SelectedPath + "\\", "");
                    clbTitle.Text     = fds[i];

                    var s = new tbLabel();
                    setDBValue(s);

                    s.label_structure = ParseStructure(s.label_title);
                    CTDBEntities ct = new CTDBEntities();
                    ct.tbLabel.Add(s);
                    ct.SaveChanges();   //将修改保存到数据库中
                }

                MessageBox.Show(fds.Length + " OK");
                refreshdata(sender, e);
            }
        }
예제 #3
0
파일: FormLabel.cs 프로젝트: wjn99wjn/CTDB
        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 ArrayList)[rid] as tbLabel).label_id;
                using (CTDBEntities ct = new CTDBEntities())
                {
                    tbLabel s = ct.tbLabel.Where <tbLabel>(c => c.label_id == id).Single();

                    clbID.Text = s.label_id.ToString();

                    // CTHelper.setControl(clbSlice, s.slice_id);

                    clbAuthor.Text = s.label_author;
                    //clbFileType.Text = s.label_file_type;
                    //clbNumberSlice.Text = s.label_file_number.ToString();
                    clbStructure.Text = s.label_structure;
                    clbMethod.Text    = s.label_method;
                    clbTitle.Text     = s.label_title;
                    clbSrcFolder.Text = s.label_srcfolder;

                    CTHelper.setControl(clbOpenStatus, s.open_status);


                    ucFileInfo1.ParaDatasetID = s.label_id;
                    clbNote.Text      = s.label_note;
                    mitDelete.Enabled = dataGridView1.Rows.Count > 0;
                }
            }
        }
예제 #4
0
파일: FormLabel.cs 프로젝트: wjn99wjn/CTDB
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var s = new tbLabel();

            setDBValue(s);
            CTDBEntities ct = new CTDBEntities();

            ct.tbLabel.Add(s);
            ct.SaveChanges();   //将修改保存到数据库中
            refreshdata(null, null);
        }
예제 #5
0
파일: FormLabel.cs 프로젝트: wjn99wjn/CTDB
        void setDBValue(tbLabel s)
        {
            s.slice_id = sliceID;
            s.scan_id  = (clbSilceID.Tag as tbSlice).scan_id;
            s.sp_id    = (clbSilceID.Tag as tbSlice).sp_id;

            s.label_author      = clbAuthor.Text;
            s.label_file_type   = "-";
            s.label_file_number = ucFileInfo1.ValueFileCount;
            s.label_structure   = clbStructure.Text;
            s.label_method      = clbMethod.Text;
            s.label_title       = clbTitle.Text;
            s.label_srcfolder   = clbSrcFolder.Text;

            s.label_note  = clbNote.Text;
            s.open_status = int.Parse(clbOpenStatus.SelectedValue.ToString());
            s.date_in     = DateTime.Now;
            s.UserId      = Guid.Parse(CTHelper.GetConfig("userid"));
        }
예제 #6
0
파일: FormLabel.cs 프로젝트: wjn99wjn/CTDB
        private void mitExportZipFileForServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ArrayList sl = dataGridView1.DataSource as ArrayList;

            if (sl.Count > 0)
            {
                if (MessageBox.Show("确认打包" + sl.Count + " records?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string fd = CTHelper.CommonPath() + "\\ctdbr";
                    if (!Directory.Exists(fd))
                    {
                        Directory.CreateDirectory(fd);
                    }
                    progressBar1.Visible = true;
                    progressBar1.Maximum = sl.Count;
                    progressBar1.Value   = 0;
                    using (var db = new CTDBEntities())
                        foreach (tbLabel ts in sl)
                        {
                            progressBar1.Value++;
                            try
                            {
                                //MessageBox.Show(ts.label_id.ToString());
                                tbLabel lb  = db.tbLabel.FirstOrDefault(s => s.label_id == ts.label_id);
                                string  src = lb.label_srcfolder;
                                string  des = fd + "\\" + lb.label_id + ".zip";

                                if (File.Exists(des))
                                {
                                    continue;
                                }
                                CTHelper.ZipDirectory(src, des);
                                System.Threading.Thread.Sleep(500);
                            }
                            catch { }
                        }
                    progressBar1.Visible = false;
                    System.Diagnostics.Process.Start(fd);
                }
            }
        }
예제 #7
0
파일: FormUpload.cs 프로젝트: wjn99wjn/CTDB
        private void FormUpload_Load(object sender, EventArgs e)
        {
            lbDataset.Text = ParaDatasetID.ToString();
            UserID         = CTHelper.GetConfig("userid");

            CTDBEntities ct = new CTDBEntities();

            if (ParaTable == "ctdb-slice")
            {
                this.Text        = "CTDB - Slice File";
                lbTableName.Text = "SliceID";
                tbSlice s = ct.tbSlice.Where(c => c.slice_id == ParaDatasetID).Single();
                lbDSName.Text               = s.Abstract;
                lbSpecimenID.Text           = s.tbScan.tbSpecimen.sp_id.ToString();
                mitCreatedFromSlice.Visible = true;
                cdFileRef.Visible           = false;
            }
            else if (ParaTable == "ctdb-scan")
            {
                this.Text        = "CTDB - Scan Source File";
                lbTableName.Text = "ScanID";
                tbScan s = ct.tbScan.Where(c => c.scan_id == ParaDatasetID).Single();
                lbDSName.Text     = s.Abstract;
                lbSpecimenID.Text = s.tbSpecimen.sp_id.ToString();
                cdFileRef.Visible = false;
            }
            else if (ParaTable == "ctdb-label")
            {
                this.Text        = "CTDB - Tissue Label File";
                lbTableName.Text = "LabelID";
                tbLabel s = ct.tbLabel.Where(c => c.label_id == ParaDatasetID).Single();
                lbDSName.Text               = s.label_id.ToString();
                lbSpecimenID.Text           = s.tbSlice.tbScan.tbSpecimen.sp_id.ToString();
                mitCreatedFromLabel.Visible = true;
                cdFileRef.Visible           = false;
            }
            else if (ParaTable == "ctdb-specimen")
            {
                this.Text        = "CTDB - Specimen's Demo File";
                lbTableName.Text = "SpecimenID";
                tbSpecimen s = ct.tbSpecimen.Where(c => c.sp_id == ParaDatasetID).Single();
                lbSpecimenID.Text = s.sp_id.ToString();
                lbDSName.Text     = s.Abstract;
                // cdFileRef.Enabled = true;
            }
            else if (ParaTable == "ctdb-scanpara")
            {
                this.Text        = "CTDB - scan parameter's picture file";
                lbTableName.Text = "";
                tbScan s = ct.tbScan.Where(c => c.scan_id == ParaDatasetID).Single();
                lbDSName.Text     = s.Abstract;
                lbSpecimenID.Text = s.tbSpecimen.sp_id.ToString();
                cdFileRef.Visible = false;
            }
            else
            {
                this.Close();
            }


            CTHelper.setControlTag(cdFileType, 14, ParaFileType); // 14 filetype, 指定的Image
            CTHelper.setControlTag(cdFileOpenStatus, 31, 30);     //31 share method, 30 share in group
            CTHelper.LoadControl(cdFileRef, "tbRef", 4);          // 14 filetype, 11 image
            cdFileAuthor.Text = CTHelper.GetConfig("username");

            refreshdb();
        }