示例#1
0
        private void cmdedit_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                int    col = 0;
                int    row = dataGridView1.CurrentRow.Index;
                string val = dataGridView1[col, row].Value.ToString();

                std       st    = new std();
                DataTable datat = new DataTable();
                st.stdno = val;
                datat    = st.Selectforedit();

                editstd es = new editstd();
                es.txtstdno.Text = val;
                es.Search_Click();
                es.ShowDialog();

                if (btnfilter.Enabled == true)
                {
                    btnfilter.PerformClick();
                }
                else
                {
                    DataTable dt = new DataTable();
                    dt = st.SelectForView();
                    dataGridView1.DataSource = dt;
                }
            }
        }
示例#2
0
        private void cmddel_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                DialogResult dr;
                dr = MessageBox.Show("با حذف هنرجو تمامی کلاس های متعلق به ایشان نیز حذف می شوند، آیا از حذف هنرجو اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr == DialogResult.Yes)
                {
                    int    icol = 0;
                    int    irow = dataGridView1.CurrentRow.Index;
                    string val  = dataGridView1[icol, irow].Value.ToString();

                    std st = new std();
                    st.stdno = val;
                    st.Delete();
                    if (btnfilter.Enabled == true)
                    {
                        btnfilter.PerformClick();
                    }
                    else
                    {
                        DataTable dt = new DataTable();
                        dt = st.SelectForView();
                        dataGridView1.DataSource = dt;
                    }
                }
            }
        }
示例#3
0
        private void txtstdname_TextChanged(object sender, EventArgs e)
        {
            if (txtstdname.Text == "" && !checkBox1.Checked)
            {
                btnfilter.Enabled = false;

                std       pm = new std();
                DataTable dt = new DataTable();
                dt = pm.SelectForView();
                dataGridView1.DataSource = dt;
            }
            else
            {
                btnfilter.Enabled = true;
            }
        }
示例#4
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            addstd as2 = new addstd();

            //as2.cur_date = currentDate;
            as2.ShowDialog();

            if (btnfilter.Enabled == true)
            {
                btnfilter.PerformClick();
            }
            else
            {
                std       st = new std();
                DataTable dt = new DataTable();
                dt = st.SelectForView();
                dataGridView1.DataSource = dt;
            }
        }