Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dgvDetail.SelectedRows.Count == 1)
            {
                double statusNum = 0;
                try
                {
                    if (dgvDetail.SelectedRows[0].Index + 1 == dgvDetail.Rows.Count)
                    {
                        statusNum = ((TiJiaoYaoQiuBiao)dgvDetail.SelectedRows[0].Tag).ZhuangTai + 1;
                    }
                    else
                    {
                        double a = ((TiJiaoYaoQiuBiao)dgvDetail.SelectedRows[0].Tag).ZhuangTai;
                        double b = ((TiJiaoYaoQiuBiao)dgvDetail.Rows[dgvDetail.SelectedRows[0].Index + 1].Tag).ZhuangTai;

                        statusNum = (a + b) / 2;
                    }
                }
                catch (Exception ex) { }

                //显示编辑窗体
                FrmAddOrSubmitQuestion form = new FrmAddOrSubmitQuestion(null, statusNum);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    //刷新列表
                    RefreshView();
                }
            }
            else
            {
                MessageBox.Show("请选中需要一条数据,新数据将在其后插入");
                return;
            }
        }
Beispiel #2
0
        private void dgvDetail_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvDetail.Rows.Count >= 1 && e.RowIndex >= 0)
            {
                if (e.ColumnIndex == dgvDetail.Columns.Count - 1)
                {
                    //编辑

                    //显示编辑窗体
                    FrmAddOrSubmitQuestion form = new FrmAddOrSubmitQuestion((TiJiaoYaoQiuBiao)dgvDetail.Rows[e.RowIndex].Tag);
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        //刷新列表
                        RefreshView();
                    }
                }
                else if (e.ColumnIndex == dgvDetail.Columns.Count - 2)
                {
                    //删除
                    if (MessageBox.Show("真的要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //删除数据
                        ConnectionManager.Context.table("TiJiaoYaoQiuBiao").where ("BianHao='" + ((TiJiaoYaoQiuBiao)dgvDetail.Rows[e.RowIndex].Tag).BianHao + "'").delete();

                        //刷新
                        RefreshView();
                    }
                }
            }
        }
Beispiel #3
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            //显示编辑窗体
            FrmAddOrSubmitQuestion form = new FrmAddOrSubmitQuestion(null, list.Count);

            if (form.ShowDialog() == DialogResult.OK)
            {
                //刷新列表
                RefreshView();
            }
        }
Beispiel #4
0
        private void dgvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvDetail.Rows.Count >= 1 && e.RowIndex >= 0)
            {
                //编辑

                //显示编辑窗体
                FrmAddOrSubmitQuestion form = new FrmAddOrSubmitQuestion((TiJiaoYaoQiuBiao)dgvDetail.Rows[e.RowIndex].Tag);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    //刷新列表
                    RefreshView();
                }
            }
        }