private void but_edit_Click(object sender, EventArgs e) { if (dgv_01.Rows.Count == 0 || dgv_01.SelectedRows.Count == 0) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("choicechange", EnumPromptMessage.warning, new string[] { "修改的", "设备维修记录" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); SortedList UpDataService = new SortedList(); UpDataService.Add("remark", dgv_01.SelectedRows[0].Cells["remark"].Value); UpDataService.Add("equipment_name", dgv_01.SelectedRows[0].Cells["equipment_name"].Value); UpDataService.Add("existing_problem", dgv_01.SelectedRows[0].Cells["existing_problem"].Value); UpDataService.Add("cssd_solution", dgv_01.SelectedRows[0].Cells["cssd_solution"].Value); UpDataService.Add("reporter", dgv_01.SelectedRows[0].Cells["reporter"].Value); UpDataService.Add("auditor", dgv_01.SelectedRows[0].Cells["auditor"].Value); UpDataService.Add("service_penple", dgv_01.SelectedRows[0].Cells["service_penple"].Value); UpDataService.Add("change_accessories", dgv_01.SelectedRows[0].Cells["change_accessories"].Value); UpDataService.Add("service_condition", dgv_01.SelectedRows[0].Cells["service_condition"].Value); UpDataService.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value); UpDataService.Add("type", dgv_01.SelectedRows[0].Cells["type"].Value); HCSRM_equipment_service_new HCRM = new HCSRM_equipment_service_new(UpDataService); HCRM.ShowInTaskbar = false; HCRM.ShowDialog(); GetData(); if (dgv_01.Rows.Count > 0) { dgv_01.CurrentRow = dgv_01.Rows[selectedIndex]; } }
private void but_new_Click(object sender, EventArgs e) { HCSRM_equipment_service_new HCRM = new HCSRM_equipment_service_new(null); HCRM.ShowInTaskbar = false; HCRM.ShowDialog(); GetData(); if (dgv_01.Rows.Count > 0) { dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1]; } }