Пример #1
0
 private void dgvShiJuan_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         int            shiJuanId      = Convert.ToInt32(this.dgvShiJuan.CurrentRow.Cells["id"].Value);
         string         shiJuanName    = this.dgvShiJuan.CurrentRow.Cells["shiJuanName"].Value.ToString();
         FrmShiJuanEdit frmShiJuanEdit = new FrmShiJuanEdit();
         frmShiJuanEdit.Owner              = this;
         frmShiJuanEdit.CurrentShiJuanId   = shiJuanId;
         frmShiJuanEdit.CurrentShiJuanName = shiJuanName;
         frmShiJuanEdit.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show("导航到试卷详情异常," + ex.Message);
     }
 }
Пример #2
0
        private void dgvShiJuan_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                int    shiJuanId   = Convert.ToInt32(this.dgvShiJuan.CurrentRow.Cells["id"].Value);
                string shiJuanName = this.dgvShiJuan.CurrentRow.Cells["shiJuanName"].Value.ToString();
                string action      = dgvShiJuan.Columns[e.ColumnIndex].Name;//操作类型

                switch (action)
                {
                case "goToShiTi":
                    FrmShiTiManager frmShiTiManager = new FrmShiTiManager();
                    frmShiTiManager.CurrentShiJuanId   = shiJuanId;
                    frmShiTiManager.CurrentShiJuanName = shiJuanName;
                    frmShiTiManager.ShowDialog();
                    break;

                case "edit":
                    FrmShiJuanEdit frmShiJuanEdit = new FrmShiJuanEdit();
                    frmShiJuanEdit.Owner              = this;
                    frmShiJuanEdit.CurrentShiJuanId   = shiJuanId;
                    frmShiJuanEdit.CurrentShiJuanName = shiJuanName;
                    frmShiJuanEdit.ShowDialog();
                    break;

                case "delete":
                    if (MessageBox.Show("确定删除吗?", "删除提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        string        realUrl       = ConfigHelper.ConfigHelper.GetApiRootUrl() + urlPart_Delete;
                        ShiJuanEntity shiJuanEntity = new ShiJuanEntity();
                        shiJuanEntity.id = shiJuanId;
                        string jsonPar = "{\"id\":" + shiJuanId + "}";
                        doDelete(realUrl, jsonPar);
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("点击异常," + ex.Message);
            }
        }