Exemple #1
0
 private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex < 2 && e.RowIndex > -1)
     {
         ProjectBll proBll = new ProjectBll();
         //点击删除
         if (e.ColumnIndex == 0)
         {
             if (MessageBox.Show(DELETED_AND_NO_RECOVERY, "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
             {
                 int    row = e.RowIndex;
                 string id  = dataGridView1.Rows[row].Cells["Id"].Value.ToString();
                 proBll.DeletePro(id);
                 dataGridView1.DataSource = null;
                 dataGridView1.DataSource = proBll.QueryAll();
             }
         }
         //点击更新
         if (e.ColumnIndex == 1)
         {
             Project pro = new Project();
             int     row = e.RowIndex;
             pro.Id     = (int)dataGridView1.Rows[row].Cells["Id"].Value;
             pro.PName  = dataGridView1.Rows[row].Cells["PName"].Value.ToString();
             pro.PLId   = dataGridView1.Rows[row].Cells["PLId"].Value.ToString();
             pro.PMId   = dataGridView1.Rows[row].Cells["PMId"].Value.ToString();
             pro.Status = dataGridView1.Rows[row].Cells["Status"].Value.ToString();
             FrmProAddOrUpdate frmUpdate = new FrmProAddOrUpdate(pro);
             frmUpdate.ShowDialog();
             dataGridView1.DataSource = null;
             dataGridView1.DataSource = proBll.QueryAll();
             return;
         }
     }
 }
Exemple #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            ProjectBll proBll = new ProjectBll();

            dataGridView1.DataSource = null;
            dataGridView1.DataSource = proBll.QueryAll();
        }
Exemple #3
0
        private void FrmRelation_Load(object sender, EventArgs e)
        {
            ProjectBll proBll  = new ProjectBll();
            var        proData = proBll.QueryAll();

            foreach (var item in proData)
            {
                listBoxPro.Items.Add(item.PName);
            }
        }
Exemple #4
0
        private void FrmProject_Load(object sender, EventArgs e)
        {
            cmboxIdorName.SelectedIndex = 0;
            ProjectBll proBll = new ProjectBll();
            var        all    = proBll.QueryAll();

            if (all != null)
            {
                dataGridView1.DataSource = all;
            }
            cmboxIdorName.Visible = false;
        }