Beispiel #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        bool flag1 = true;

        if (txtPacPro.Text == "" || txtMidPro.Text == "" || txtEndPro.Text == "")
        {
            Response.Write("<script>alert('请输入比例')</script>");
        }
        else
        {
            V_打分表TableAdapter ta = new V_打分表TableAdapter();
            int n = ta.GetGradeByTCID(Convert.ToInt32(lblCourse.Text)).Rows.Count;

            for (int i = 0; i < n; i++)
            {
                if (Convert.ToString((ta.GetGradeByTCID(Convert.ToInt32(lblCourse.Text)).Rows[i][6])) == "")
                {
                    flag1 = false;
                }
            }

            if (flag1)
            {
                bool flag = true;
                hjyTableAdapters.课表TableAdapter ta2 = new hjyTableAdapters.课表TableAdapter();
                int n2 = ta.GetGradeByTCID(Convert.ToInt32(lblCourse.Text)).Rows.Count;

                for (int i = 0; i < n2; i++)
                {
                    if (Convert.ToString((ta2.GetGradeByTCID(Convert.ToInt32(lblCourse.Text)).Rows[i][2])) != "")
                    {
                        flag = false;  //有成绩,即提交过
                    }
                }
                if (flag)
                {
                    QueriesTableAdapter qs = new QueriesTableAdapter();
                    qs.insertGrade(Convert.ToInt32(lblCourse.Text));
                    Response.Write("<script>alert('提交成功!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('该门课程已经提交过,无法再次提交!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('打分未完成暂无法提交,请继续打分!')</script>");
            }
        }
    }
Beispiel #2
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (ddlTCID.SelectedIndex == 0)
        {
            Response.Write("<script>alert('请选择课程!')</script>");
        }
        else
        {
            gvCourse.Visible = true;
            if (txtPacPro.Text == "" || txtMidPro.Text == "" || txtEndPro.Text == "")
            {
                Response.Write("<script>alert('请输入比例')</script>");
                gvCourse.Visible  = false;
                btnSave.Visible   = false;
                btnSubmit.Visible = false;
            }
            else
            {
                bool flag = true;
                hjyTableAdapters.课表TableAdapter ta = new hjyTableAdapters.课表TableAdapter();
                int n = ta.GetGradeByTCID(Convert.ToInt32(lblCourse.Text)).Rows.Count;

                for (int i = 0; i < n; i++)
                {
                    if (Convert.ToString((ta.GetGradeByTCID(Convert.ToInt32(lblCourse.Text)).Rows[i][2])) != "")
                    {
                        flag = false;  //有成绩,即提交过
                    }
                }
                if (flag)
                {
                    double tmp = Convert.ToDouble(txtPacPro.Text) + Convert.ToDouble(txtMidPro.Text) + Convert.ToDouble(txtEndPro.Text);
                    if (tmp != 100)
                    {
                        Response.Write("<script>alert('请输入正确的比例')</script>");
                        gvCourse.Visible  = false;
                        btnSave.Visible   = false;
                        btnSubmit.Visible = false;
                    }
                    else
                    {
                        Label1.Visible      = false;
                        Label2.Visible      = false;
                        Label3.Visible      = false;
                        txtPacPro.Visible   = false;
                        txtMidPro.Visible   = false;
                        txtEndPro.Visible   = false;
                        gvCourse.DataSource = odsCourseDDL;
                        gvCourse.DataBind();
                        btnSave.Visible   = true;
                        btnSubmit.Visible = true;
                        btnDc.Visible     = true;
                    }
                }
                else
                {
                    Response.Write("<script>alert('该门课程已经提交过,无法再次提交!')</script>");
                    gvCourse.Visible  = false;
                    btnSave.Visible   = false;
                    btnSubmit.Visible = false;
                    btnDc.Visible     = false;
                }
            }
        }
    }