Beispiel #1
0
        private bool OccupyCheck(string strC1, string strC2, string strCL1, string strCL2)
        {
            string[] sql   = new string[8];
            int      state = 0;

            sql[0] = "select *from z_tmp_teacherinfo where CClass1='" + strCL1 + "'and Course1_='" + strC1 + "'or  CClass1='" + strCL1 + "'and Course2_='" + strC2 + "'";
            sql[1] = "select *from z_tmp_teacherinfo where CClass1='" + strCL2 + "'and Course1_='" + strC1 + "'or  CClass1='" + strCL2 + "'and Course2_='" + strC2 + "'";
            sql[2] = "select *from z_tmp_teacherinfo where CClass2='" + strCL1 + "'and Course1_='" + strC1 + "'or  CClass2='" + strCL1 + "'and Course2_='" + strC2 + "'";
            sql[3] = "select *from z_tmp_teacherinfo where CClass2='" + strCL2 + "'and Course1_='" + strC1 + "'or  CClass2='" + strCL2 + "'and Course2_='" + strC2 + "'";

            //object obj0 = dao.ExecuteScale(sql[0]);
            //object obj1 = dao.ExecuteScale(sql[1]);
            //object obj2 = dao.ExecuteScale(sql[2]);
            //object obj3 = dao.ExecuteScale(sql[3]);

            for (int i = 0; i < 4; i++)
            {
                if (dao.ExecuteScale(sql[i]) != null)
                {
                    state = 1;
                }
            }
            if (state == 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string       Confirm = "删除课程需要重新生成课表,确认继续删除?";
            DialogResult dr      = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (dr == DialogResult.OK)
            {
                truncateTable();
                string sql = "select * from Z_tmp_CourseSum";
                object obj = dao.ExecuteScale(sql);
                if (obj == null)
                {
                    MessageBox.Show("当前数据库没有数据!");
                }
                else
                {
                    if (grdView.DataSource == null)
                    {
                        MessageBox.Show("请选中要删除的数据!");
                    }
                    else
                    {
                        string       Confirm1 = string.Format("确认删除课程{0},编号{1}?", grdView[1, grdView.SelectedCells[1].RowIndex].Value.ToString(), grdView[0, grdView.SelectedCells[0].RowIndex].Value.ToString());
                        DialogResult dr1      = MessageBox.Show(Confirm1, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (dr1 == DialogResult.OK)
                        {
                            string tmp = "delete from z_tmp_CourseSum where CID_='" + grdView[0, grdView.SelectedCells[0].RowIndex].Value.ToString() + "'";

                            dao.ExecuteNonQuery(tmp);
                            string id_  = grdView[0, grdView.SelectedCells[0].RowIndex].Value.ToString();
                            string name = grdView[1, grdView.SelectedCells[1].RowIndex].Value.ToString();
                            log.InfoFormat("删除:{0},名称{1}", id_, name);
                        }
                    }
                }
            }

            query();
        }
Beispiel #3
0
        private void btnAlter_Click(object sender, EventArgs e)
        {
            string       Confirm = "修改教师需要重新生成课表,确认继续修改?";
            DialogResult dr      = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (dr == DialogResult.OK)
            {
                truncateTable();
                string sql = "select * from Z_tmp_teacherinfo";
                object obj = dao.ExecuteScale(sql);
                if (obj == null)
                {
                    MessageBox.Show("当前数据库没有数据!");
                }
                else
                {
                    if (grdview.DataSource == null)
                    {
                        MessageBox.Show("请选中要修改的行!");
                        query();
                    }
                    else
                    {
                        string[] arr = new string[7];
                        for (int i = 0; i < 7; i++)
                        {
                            arr[i] = grdview[i, grdview.SelectedCells[i].RowIndex].Value.ToString();
                        }
                        SubTeacher alter = new SubTeacher();
                        alter.getState(2);
                        alter.getArry(arr);
                        alter.ShowDialog();
                    }
                }
                query();
            }
        }