예제 #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_del_Click(object sender, EventArgs e)
        {
            int          rowIndex = dataGridView1.CurrentRow.Index;
            DialogResult result;

            result = MessageBox.Show("确定要删除数据吗? \r\n确定:删除数据  \r\n取消:取消本次操作", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (result == DialogResult.Cancel)
            {
                return;
            }

            try
            {
                DataTable     dtupdate = (DataTable)dataGridView1.DataSource;
                Form_gzzRyBll SjzdBll  = new Form_gzzRyBll();

                if (dtupdate != null && dtupdate.Rows.Count > 0 && dtupdate.Rows.Count > rowIndex)
                {
                    SjzdBll.Del(dtupdate, rowIndex);
                }
                dataSelect();
                MessageBox.Show("删除成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("删除失败!" + ex.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// 检索
        /// </summary>
        private void dataSelect()
        {
            Form_gzzRyBll xmfl     = new Form_gzzRyBll();
            string        strWhere = "";

            if (UserInfo.Yybm != null && UserInfo.Yybm.Trim().Length > 0)
            {
                strWhere = strWhere + string.Format(" and  T_JK_GZZ_CZY.YLJGBM ='{0}' ", UserInfo.Yybm);
            }

            if (mc.Text.Trim().Length > 0)
            {
                strWhere = strWhere + string.Format("  and T_JK_GZZ.GZZMC like '%{0}%' ", mc.Text.Trim());
            }
            DataTable dt = xmfl.GetMoHuList(strWhere);

            showDataGrid(dt);
        }
예제 #3
0
        //保存
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable     dtupdate = (DataTable)dataGridView1.DataSource;
                Form_gzzRyBll SjzdBll  = new Form_gzzRyBll();

                if (dtupdate != null && dtupdate.Rows.Count > 0)
                {
                    SjzdBll.Add(dtupdate);
                    SjzdBll.Upd(dtupdate);
                }
                dataSelect();
                MessageBox.Show("保存成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败!" + ex.Message);
            }
        }