コード例 #1
0
ファイル: FormLabel.cs プロジェクト: wjn99wjn/CTDB
        /// <summary>load/ refresh </summary>
        private void refreshdata(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            mitDelete.Enabled        = false;

            //if (sliceID != -1)
            //    CTHelper.setControl(clbSlice, sliceID);


            dataGridView1.DataSource = LoadLabelByID();
            FormLogin.SetColumn(dataGridView1, "label_id|label_title|label_structure|label_note|label_author");
            //FormLogin.LoadData(dataGridView1, "tbLabel", "label_id|slice_id|label_structure|label_note|label_file_number|Abstract|UserId");
        }
コード例 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FormLogin f = new FormLogin();

            if (f.ShowDialog() == DialogResult.OK)
            {
                CTHelper.SetConfig("userid", f.userid);
                Application.Run(new CTDBForm1());
            }
        }
コード例 #3
0
ファイル: FormRef.cs プロジェクト: wjn99wjn/CTDB
        //load/browser
        private void refreshdata(object sender, EventArgs e, int rowid = -1)
        {
            dataGridView1.DataSource = null;

            dataGridView1.DataSource = FormLogin.LoadDataF("tbRef");
            FormLogin.SetColumn(dataGridView1, "ref_id|year|cite|url");

            CTHelper.SetRowIndex(dataGridView1, rowid);

            if (dataGridView1.Rows.Count > 0)
            {
                dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1;
            }
        }
コード例 #4
0
ファイル: CTHelper.cs プロジェクト: wjn99wjn/CTDB
        /// <summary>set value for combbox </summary>
        /// <param name="cb"></param>
        /// <param name="text"></param>
        static public void LoadControl(ComboBox cb, string table, int id)
        {
            CTDBEntities ct = new CTDBEntities();

            if (table == "tbEquipment")
            {
                cb.DataSource    = ct.tbEquipment.ToList <tbEquipment>();
                cb.DisplayMember = "e_nameA";
            }
            else if (table == "tbSpecimen")
            {
                cb.DataSource    = FormLogin.LoadDataA("tbSpecimen");
                cb.DisplayMember = "Abstract";
            }
            else if (table == "tbRef")
            {
                cb.DataSource    = ct.tbRef.ToList <tbRef>();
                cb.DisplayMember = "cite";
                setControl(cb, id);
            }
        }
コード例 #5
0
        /// <summary>load/ refresh </summary>
        private void refreshdata(int rowIndex = -1)
        {
            dataGridView1.DataSource = null;
            mitDelete.Enabled        = false;
            CTDBEntities ct = new CTDBEntities();

            //dataGridView1.DataSource = ct.tbSpecimen.ToList<tbSpecimen>();
            //dataGridView1.DataSource = FormLogin.LoadDataA("tbSpecimen");
            //SetColumn(dataGridView1, "sp_id|species_id");
            FormLogin.LoadData(dataGridView1, "tbSpecimen", "sp_id|species_id|sp_collector|Abstract|UserId");
            //dg.DataSource = FormLogin.LoadDataA(table);
            //SetColumn(dg, showcol);

            if (dataGridView1.DataSource != null)
            {
                if (rowIndex > 0)
                {
                    dataGridView1.Rows[rowIndex].Selected = true;
                }
            }
        }
コード例 #6
0
        private void CTDBFormSpecimen_Load(object sender, EventArgs e)
        {
            //load controls
            ucFileInfo1.ParaTable = "ctdb-specimen";
            CTHelper.setControlTag(csmSex, 43, 42);
            CTHelper.setControlTag(csmAge, 45, 144);
            CTHelper.setControlTag(csmDehydrant, 63, 64);
            CTHelper.setControlTag(csmPS, 95, 96);
            //load gridview-specimen information


            //this.dataGridView1.AutoGenerateColumns = false;

            CTDBEntities ct = new CTDBEntities();

            csmSpecies.DataSource    = FormLogin.LoadDataF("tbSpecies");
            csmSpecies.DisplayMember = "species_note";
            //csmSpecies.DisplayMember = "species_latin";

            refreshdata();
        }
コード例 #7
0
        /// <summary>load/ refresh </summary>
        private void refreshdata(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            mitDelete.Enabled        = false;

            CTDBEntities ct = new CTDBEntities();

            //clScan.DataSource = ct.tbScan.ToList<tbScan>();
            clScan.DataSource    = FormLogin.LoadDataA("tbScan");
            clScan.DisplayMember = "Abstract";

            CTHelper.setControlTag(clOpenStatus, 31, 30);
            CTHelper.setControlTag(clFileType, 51, 55);
            CTHelper.setControlTag(clCutMethod, 37, 35);

            cscRef.DataSource    = FormLogin.LoadDataF("tbRef");
            cscRef.DisplayMember = "cite";
            cscRef.SelectedIndex = 3;

            //dataGridView1.DataSource = ct.tbSlice.ToList<tbSlice>();
            //dataGridView1.DataSource = FormLogin.LoadDataA("tbSlice");
            FormLogin.LoadData(dataGridView1, "tbSlice", "slice_id|scan_id|slice_para_PixelSize|slice_para_CutMethod|Abstract|date_in|open_status|slice_para_SliceNumber");
        }
コード例 #8
0
ファイル: CTDBForm1.cs プロジェクト: wjn99wjn/CTDB
        /// <summary>record user information if the user first login, else update </summary>
        void updateUserInfo()
        {
            Guid         uid      = Guid.Parse(CTHelper.GetConfig("userid"));
            string       username = CTHelper.GetConfig("username");
            string       mail     = CTHelper.GetConfig("mail");
            CTDBEntities ct       = new CTDBEntities();
            tbUser       tu       = null;

            try { tu = ct.tbUser.Where(c => c.UserId == uid).Single(); }
            catch (Exception ex) { Console.Write(ex.ToString()); }
            if (tu == null)
            {
                tu         = ct.tbUser.Create();
                tu.UserId  = uid;
                tu.date_in = DateTime.Now;
                ct.tbUser.Add(tu);
            }
            tu.UserName = username;
            tu.mail     = mail;
            tu.date_up  = DateTime.Now;
            ct.SaveChanges();
            this.Text        = "Insect 3D Database Clicent -- " + username;
            btnMDTag.Enabled = FormLogin.HasAuthorty("");
        }
コード例 #9
0
 /// <summary>获得加权数据</summary>
 /// <param name="table">table name</param>
 /// <returns></returns>
 static public void LoadData(DataGridView dg, string table, string showcol)
 {
     dg.DataSource = FormLogin.LoadDataA(table);
     SetColumn(dg, showcol);
 }