private void dgv_01_DoubleClick(object sender, EventArgs e) { if (dgv_01.SelectedRows[0].Cells["current_count"].Value.ToString() == "0") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("ReSelection", EnumPromptMessage.warning, new string[] { }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); HCSCM_department_equipment_manager_issue hcscm = new HCSCM_department_equipment_manager_issue(dgv_01.CurrentRow); hcscm.ShowDialog(); LoadData(); if (dgv_01.Rows.Count > 0 && dgv_01.Rows.Count > selectedIndex) { dgv_01.CurrentRow = dgv_01.Rows[selectedIndex]; } }
/// <summary> /// 入库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_theLibrary_Click(object sender, EventArgs e) { #region 出入库旧数据 //int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); //SortedList slindata = new SortedList(); //try //{ // slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value); // slindata.Add("in_name", dgv_01.SelectedRows[0].Cells["in_name"].Value); // slindata.Add("base_id", dgv_01.SelectedRows[0].Cells["base_id"].Value); // slindata.Add("in_customer", dgv_01.SelectedRows[0].Cells["in_customer"].Value); // slindata.Add("in_costcenter", dgv_01.SelectedRows[0].Cells["in_costcenter"].Value); // slindata.Add("in_costcenterID", dgv_01.SelectedRows[0].Cells["in_costcenterID"].Value); // slindata.Add("cre_date", dgv_01.SelectedRows[0].Cells["cre_date"].Value); // slindata.Add("mod_date", dgv_01.SelectedRows[0].Cells["mod_date"].Value); // slindata.Add("total_count", dgv_01.SelectedRows[0].Cells["total_count"].Value); // slindata.Add("current_count", dgv_01.SelectedRows[0].Cells["current_count"].Value); // slindata.Add("set_count", dgv_01.SelectedRows[0].Cells["set_count"].Value); //} //catch (Exception ex) //{ // MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.warning, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} //HCSCM_department_equipment_manager_output hcscm = new HCSCM_department_equipment_manager_output(slindata, 1); //hcscm.ShowDialog(); //LoadData(); //if (dgv_01.Rows.Count > selectedIndex) //{ // dgv_01.CurrentRow = dgv_01.Rows[selectedIndex]; //} #endregion //HCSCM_department_equipment_manager_new hcscm = new HCSCM_department_equipment_manager_new(false); HCSCM_department_equipment_manager_issue hcscm = new HCSCM_department_equipment_manager_issue(null); hcscm.ShowDialog(); LoadData(); if (dgv_01.Rows.Count > 0) { dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1]; } }