Exemplo n.º 1
0
        //scan
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var s = new tbScan();

            setDBValue(s);
            using (CTDBEntities ct = new CTDBEntities())
            {
                ct.tbScan.Add(s);
                ct.SaveChanges();   //将修改保存到数据库中
            }

            //refreshDatagridview(dataGridView1.Rows.Count.ToString());
            int rowid = dataGridView1.Rows.Count;

            refreshdata(null, null);
            dataGridView1.Rows[rowid].Selected = true;
            //return;


            //级联添加一个slice
            using (CTDBEntities ct = new CTDBEntities())
            {
                tbSlice sl = new tbSlice();
                sl.scan_id = int.Parse(cscID.Text);
                sl.slice_para_ReconstructionProgram = "NRecon";
                sl.slice_para_ResultFileType        = "BMP";
                sl.slice_para_SliceNumber           = 0;
                sl.slice_para_PixelSize             = s.scan_para_ImagePixelSize;
                sl.open_status = 30;
                sl.UserId      = Guid.Parse(CTHelper.GetConfig("userid"));
                sl.Abstract    = FormSpecimen.CutString(cscSpecimen.Text, 40) + "-" + FormSpecimen.CutString(cscTagSpecimenParty.Text, 7);
                ct.tbSlice.Add(sl);
                ct.SaveChanges();   //将修改保存到数据库中
            }
        }
Exemplo n.º 2
0
        //添加标本
        private void btnAddSpecimen_Click(object sender, EventArgs e)
        {
            FormSpecimen dlg = new FormSpecimen();

            dlg.ShowDialog();
            CTDBEntities ct = new CTDBEntities();

            cscSpecimen.DataSource    = ct.tbSpecimen.ToList <tbSpecimen>();
            cscSpecimen.DisplayMember = "Abstract";
            cscSpecimen.SelectedIndex = cscSpecimen.Items.Count - 1;
        }