예제 #1
0
        private void txtartcourse_Enter(object sender, EventArgs e)
        {
            classes   cl  = new classes();
            DataTable tmp = cl.Search("select artcourse from classes where (stdname=N'" + txtname.Text + "' and (payan_date=N'' or payan_date is null))");

            if (tmp.Rows.Count > 0)
            {
                txtartcourse.Text = tmp.Rows[0][0].ToString();
            }
        }
예제 #2
0
        private void btnfilter_Click(object sender, EventArgs e)
        {
            Boolean check = false;

            string SQL = "select * from classes where ";

            check = false;

            if (txtartcourse.Text != "")
            {
                SQL   = SQL + "artcourse = N'" + txtartcourse.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtteacher.Text != "")
            {
                SQL   = SQL + "teacher like N'%" + txtteacher.Text.Trim() + "%'AND ";
                check = true;
            }

            if (txtstdname.Text != "")
            {
                SQL   = SQL + "stdname = N'" + txtstdname.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtday.Text != "")
            {
                SQL   = SQL + "clday = N'" + txtday.Text.Trim() + "'AND ";
                check = true;
            }

            if (txttimeFrom.MaskCompleted)
            {
                SQL   = SQL + "clFromTime >= N'" + txttimeFrom.Text.Trim() + "'AND ";
                check = true;
            }

            if (txttimeTo.MaskCompleted)
            {
                SQL   = SQL + "clfromtime <=N'" + txttimeTo.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtdateFrom.MaskCompleted)
            {
                SQL   = SQL + "open_date >= N'" + txtdateFrom.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtdateTo.MaskCompleted)
            {
                SQL   = SQL + "open_date <=N'" + txtdateTo.Text.Trim() + "'AND ";
                check = true;
            }

            if (checkBox1.Checked)
            {
                SQL   = SQL + "(payan_date is null OR payan_date=N'')AND ";
                check = true;
            }


            if (check == true)
            {
                SQL = SQL.Remove(SQL.Length - 4) + " order by payan_date, artcourse";
            }

            classes   cl = new classes();
            DataTable dt = new DataTable();

            dt = cl.Search(SQL);
            dataGridView1.DataSource = dt;
        }