Ejemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void but_edit_Click(object sender, EventArgs e)
        {
            if (dgv_01.SelectedRows.Count == 0)
            {
                return;
            }
            int        selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]);
            SortedList slindata      = new SortedList();

            try
            {
                //部门ID
                slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value);
                //部门名称
                slindata.Add("ca_name", dgv_01.SelectedRows[0].Cells["ca_name"].Value);
                //部门描述
                slindata.Add("ca_remarks", dgv_01.SelectedRows[0].Cells["ca_remarks"].Value);
                HCSCM_department_manage_new hcsm = new HCSCM_department_manage_new(SLvalue, slindata);
                //获取一个值,指是否在Windows任务栏中显示窗体。
                hcsm.ShowInTaskbar = false;
                hcsm.ShowDialog();
                Loaddata();
                // dgv_01.Rows.RemoveAt(selectedIndex);//移除选择的dgv的数据
                if (dgv_01.Rows.Count > selectedIndex)
                {
                    dgv_01.CurrentRow = dgv_01.Rows[selectedIndex];
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.error, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void but_new_Click(object sender, EventArgs e)
        {
            HCSCM_department_manage_new hcsm = new HCSCM_department_manage_new(SLvalue, null);

            //获取一个值,指是否在Windows任务栏中显示窗体。
            hcsm.ShowInTaskbar = false;
            hcsm.ShowDialog();
            Loaddata();
            if (dgv_01.Rows.Count > 0)
            {
                dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1];
            }
        }