日期:2014-05-20 浏览次数:21176 次
/// <summary> /// 上一一条数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_up_Click(object sender, EventArgs e) { if (dgvCaseStateManage.SelectedRows.Count == 0) { CommonApp.FormMessageBox.Show(CommonApp.LoadMode.Prompt, "请选择要移动的数据"); this.Focus(); return; } int rowindex = dgvCaseStateManage.SelectedRows[0].Index; if (rowindex > 0) { mo.Csm_ID = dgvCaseStateManage.SelectedRows[0].Cells[0].Value.ToString(); mo.Csm_Oderid = int.Parse(dgvCaseStateManage.SelectedRows[0].Cells[2].Value.ToString()); model.Csm_ID = this.dgvCaseStateManage.Rows[rowindex - 1].Cells[0].Value.ToString(); model.Csm_Oderid = int.Parse(this.dgvCaseStateManage.Rows[rowindex - 1].Cells[2].Value.ToString()); opCaseState.Move(mo, model); GetAllWorkInfo(); foreach (DataGridViewRow dgvr in dgvCaseStateManage.SelectedRows) { dgvr.Selected = false; } dgvCaseStateManage.Rows[rowindex - 1].Selected = true; dgvCaseStateManage.CurrentCell = dgvCaseStateManage.Rows[rowindex - 1].Cells[1]; } } /// <summary> /// 下一一条数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_down_Click(object sender, EventArgs e) { DataTable dt = (DataTable)dgvCaseStateManage.DataSource; if (dgvCaseStateManage.SelectedRows.Count == 0) { CommonApp.FormMessageBox.Show(CommonApp.LoadMode.Prompt, "请选择要移动的数据"); this.Focus(); return; } int rowindex = dgvCaseStateManage.SelectedRows[0].Index; if (rowindex < dt.Rows.Count - 1) { mo.Csm_ID = dgvCaseStateManage.SelectedRows[0].Cells[0].Value.ToString(); mo.Csm_Name = dgvCaseStateManage.SelectedRows[0].Cells[1].Value.ToString(); mo.Csm_Oderid = int.Parse(dgvCaseStateManage.SelectedRows[0].Cells[2].Value.ToString()); model.Csm_ID = this.dgvCaseStateManage.Rows[rowindex + 1].Cells[0].Value.ToString(); model.Csm_Oderid = int.Parse(this.dgvCaseStateManage.Rows[rowindex + 1].Cells[2].Value.ToString()); opCaseState.Move(mo, model); GetAllWorkInfo(); foreach (DataGridViewRow dgvr in dgvCaseStateManage.SelectedRows) { dgvr.Selected = false; } dgvCaseStateManage.Rows[rowindex + 1].Selected = true; dgvCaseStateManage.CurrentCell = dgvCaseStateManage.Rows[rowindex + 1].Cells[1]; } } "update CaseStateManage set Csm_Oderid='{0}' where Csm_ID= '{1}'";