Ejemplo n.º 1
0
        /// <summary>
        /// 添加事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsAdd_Click(object sender, EventArgs e)
        {
            frmUsersDetail frm = new frmUsersDetail();

            frm.OpType = "Add";//操作类型
            if (DialogResult.OK == frm.ShowDialog())
            {
                BindGridViewData();//重新绑定数据
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 编辑事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsEdit_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgUsers.SelectedRows;

            if (rows.Count == 0)
            {
                TXMessageBoxExtensions.Info(SystemTips.MSG_ATLAST_SELECTROW_OP, SystemTips.MSG_TITLE); //至少要选择一行记录才能够操作
                return;
            }
            else
            {
                frmUsersDetail frm = new frmUsersDetail();
                frm.OpType = "Edit";                                                //操作类型
                int id = Convert.ToInt16(rows[0].Cells["userid"].Value.ToString()); //要编辑的主键
                frm.UserId = id;                                                    //主键值
                if (DialogResult.OK == frm.ShowDialog())
                {
                    BindGridViewData(); //重新绑定数据
                }
            }
        }