Exemple #1
0
    private void GetMySub()
    {
        string id = Request.Cookies["id"].Value.ToString();

        Fannie.Subjects s  = new Fannie.Subjects();
        DataSet         ds = s.GetMyUnChosenSub(id);
        DataTable       dt = new DataTable();
        DataColumn      dc = new DataColumn();

        dc.ColumnName = "PId";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["Pid"]         = (i + 1).ToString();
            ds.Tables[0].Rows[i]["SubjectName"] = SubStr(Convert.ToString(ds.Tables[0].Rows[i]["SubjectName"]), 40);
            ds.Tables[0].Rows[i]["Memo"]        = SubStr(Convert.ToString(ds.Tables[0].Rows[i]["Memo"]), 50);
        }
        gvSub.DataKeyNames = new string [] { "SubjectID" };
        gvSub.DataSource   = ds;
        gvSub.DataBind();
        dt = ds.Tables[0];
        if (dt.Rows.Count == 0)
        {
            Label1.Visible = true;
        }
        else
        {
            Label1.Visible = false;
        }
    }
Exemple #2
0
    protected void btnCheck_Click(object sender, EventArgs e)
    {
        int  count    = 0;
        bool IsSelect = true;

        Fannie.Subjects sub = new Fannie.Subjects();
        for (int i = 0; i < gvSub.Rows.Count; i++)
        {
            if (((CheckBox)(gvSub.Rows[i].Cells[0].Controls[0])).Checked)
            {
                //((CheckBox)(gvSub.Rows[i].FindControl("cbCheck"))).Checked = IsSelect;
                //bool state = ((CheckBox)(gvSub.Rows[i].Cells[9].Controls[0])).Checked;
                //int key = Convert.ToInt32(gvSub.DataKeys[i].Value.ToString());
                //sub.MpdifyChecked(key, state);
                int key = Convert.ToInt32(gvSub.DataKeys[i].Value.ToString());
                sub.MpdifyChecked(key, IsSelect);
            }
            else
            {
                count++;
            }
        }
        if (count == gvSub.Rows.Count)
        {
            Response.Write("<script>alert('请选择需要审核的课题')</script>");
        }
        else
        {
            GetAllSub();
        }
    }
Exemple #3
0
//******************************************************************

    private void GetSubInfo()
    {
        if (Request.QueryString["id"] != null)
        {
            int             id  = Convert.ToInt32(Request.QueryString["id"].ToString());
            Fannie.Subjects sub = new Fannie.Subjects();
            DataTable       dt  = sub.GetOneSub(id).Tables[0];
            tbSubName.Text = dt.Rows[0]["SubjectName"].ToString();
            tbAbout.Text   = dt.Rows[0]["Memo"].ToString();
            tbMajor.Text   = dt.Rows[0]["SuitProfession"].ToString();
            tbT1Name.Text  = dt.Rows[0]["n1"].ToString();
            tbPost1.Text   = dt.Rows[0]["p1"].ToString();
            //tbLevel.Text = dt.Rows[0]["SuitLevel"].ToString();
            ddlLevel.Text = dt.Rows[0]["SuitLevel"].ToString();
            // tbT2Name.Text = dt.Rows[0]["n2"].ToString();
            ddlT2Name.Text   = dt.Rows[0]["n2"].ToString();
            tbPost2.Text     = dt.Rows[0]["p2"].ToString();
            ddlMax.Text      = dt.Rows[0]["MaxPeople"].ToString();
            ddlSuitYear.Text = dt.Rows[0]["SuitYear"].ToString();
            for (int i = 0; i < rblType.Items.Count; i++)
            {
                if (rblType.Items[i].Text == dt.Rows[0]["SubjectType"].ToString())
                {
                    rblType.Items[i].Selected = true;
                }
            }
            for (int i = 0; i < rblOrigin.Items.Count; i++)
            {
                if (rblOrigin.Items[i].Text == dt.Rows[0]["SubjectOrigin"].ToString())
                {
                    rblOrigin.Items[i].Selected = true;
                }
            }
            for (int i = 0; i < rblIsNew.Items.Count; i++)
            {
                if (rblIsNew.Items[i].Text == dt.Rows[0]["SubjectNewOld"].ToString())
                {
                    rblIsNew.Items[i].Selected = true;
                }
            }

            if (dt.Rows[0]["SubjectWorkLoad"].ToString() == "True")
            {
                rblWorkLoad.Items[0].Selected = true;
            }
            else
            {
                rblWorkLoad.Items[1].Selected = true;
            }

            if (dt.Rows[0]["SubjectRequire"].ToString() == "True")
            {
                rblIsOK.Items[0].Selected = true;
            }
            else
            {
                rblIsOK.Items[1].Selected = true;
            }
        }
    }
Exemple #4
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        btnDelete.Attributes.Add("onclick", "return confirm('确定要删除这些课题的记录吗?')");
        int count = 0;

        Fannie.Subjects sub = new Fannie.Subjects();
        int             key;

        for (int i = 0; i < gvSub.Rows.Count; i++)
        {
            if (((CheckBox)(gvSub.Rows[i].Cells[0].Controls[0])).Checked)
            {
                key = Convert.ToInt32(gvSub.DataKeys[i].Value.ToString());
                sub.DeleteOneSub(key);
            }
            else
            {
                count++;
            }
        }
        if (count == gvSub.Rows.Count)
        {
            Response.Write("<script>alert('请选择需要删除的记录')</script>");
        }
        else
        {
            GetAllSub();
        }
    }
    protected void ChangeChecked(object sender, EventArgs e)
    {
        Fannie.Subjects sub   = new Fannie.Subjects();
        bool            state = ((CheckBox)(dvSub.Rows[0].FindControl("cb"))).Checked;

        sub.MpdifyChecked(id, state);
    }
Exemple #6
0
 private void GetSubDetail()
 {
     SubjectDetail1.DataKeyNames = new string[] { "SubjectID" };
     Fannie.Subjects getsub = new Fannie.Subjects();
     SubjectDetail1.DataSource = getsub.GetOneSub(subid);
     SubjectDetail1.DataBind();
 }
    private void GetOneSub()
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        DataSet         ds  = sub.GetOneSub(id);

        dvSub.DataSource = ds;
        dvSub.DataBind();
    }
Exemple #8
0
    protected void gvSub_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        int             id  = Convert.ToInt32(gvSub.DataKeys[e.RowIndex].Value.ToString());

        sub.DeleteOneSub(id);
        GetMySub();
    }
Exemple #9
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (IsTime())
     {
         string title  = tbSubName.Text.Trim();          //课题名称
         string level  = ddlLevel.Text;
         string major  = tbMajor.Text.Trim();            //专业
         string type   = rblType.SelectedValue.Trim();   //课题类型
         string origin = rblOrigin.SelectedValue.Trim(); //课题来源
         string isNew  = rblIsNew.SelectedValue.Trim();  //课题的新旧等等
         int    isRight;                                 //是否适中
         if (rblWorkLoad.SelectedValue == "是")
         {
             isRight = 1;
         }
         else
         {
             isRight = 0;
         }
         int isOk;//是否能达到训练要求
         if (rblIsOK.SelectedValue == "是")
         {
             isOk = 1;
         }
         else
         {
             isOk = 0;
         }
         string   t1        = Request.Cookies["id"].Value.ToString(); //教师编号1
         string   t2        = t2ID;
         string   about     = tbAbout.Text.Trim();                    //课题内容
         int      maxPeople = Convert.ToInt32(ddlMax.Text);           //最大人数
         string   year      = ddlSuitYear.Text.Trim();
         object[] pt        = new object[13] {
             title, major, level, type, origin, isNew, isRight, isOk, t1, t2, about, maxPeople, year
         };
         if (ddlLevel.SelectedIndex == 0 || ddlSuitYear.SelectedIndex == 0)
         {
             Response.Write("<script>alert('请检查是否选择了正确的适用层次或适用年份!')</script>");
         }
         else
         {
             Fannie.Subjects sub = new Fannie.Subjects();
             if (sub.InsertSubject(pt) > 0)
             {
                 Response.Write("<script>alert('课题申报成功!');location='PublicSub.aspx'</script>");
             }
             else
             {
                 Response.Write("<script>alert('课题申报失败,请重新申报!')</script>");
             }
         }
     }
     else
     {
         Response.Write("<script> alert('不在申报课题有效时间内,不能申报!');history.go(-1)</script>");
     }
 }
Exemple #10
0
    protected void ChangeChecked(object sender, EventArgs e)
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        int             key;

        for (int i = 0; i < gvSub.Rows.Count; i++)
        {
            bool state = ((CheckBox)(gvSub.Rows[i].Cells[9].Controls[0])).Checked;
            key = Convert.ToInt32(gvSub.DataKeys[i].Value.ToString());
            sub.MpdifyChecked(key, state);
        }
        // GetAllSub();
    }
Exemple #11
0
    private void GetProfession()            //获取专业名称
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        DataTable       dt  = sub.GetProfession();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ListItem li = new ListItem();
            li.Text = dt.Rows[i][0].ToString();
            ddlMajor.Items.Add(li);
            li = null;
        }
    }
Exemple #12
0
    //***************************************************
    private void GetAnotherTeacher()
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        DataTable       dt  = sub.GetAnotherTeacher(Request.Cookies["id"].Value.ToString());

        dtTea = dt;
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ListItem li = new ListItem();
            li.Text = dt.Rows[i][1].ToString();
            ddlT2Name.Items.Add(li);
            li = null;
        }
    }
Exemple #13
0
    private void GetAllSub()
    {
        Fannie.Subjects s  = new Fannie.Subjects();
        DataSet         ds = s.AllStuSub();
        DataColumn      dc = new DataColumn();

        dc.ColumnName = "PId";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["PId"] = (i + 1).ToString();
        }
        gvStu.DataSource = ds;
        gvStu.DataBind();
    }
    private void GetHasChooosenSub()
    {
        Fannie.Subjects s  = new Fannie.Subjects();
        DataSet         ds = s.GetHasChoosenSub();
        DataColumn      dc = new DataColumn();

        dc.ColumnName = "PId";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["Pid"] = (i + 1).ToString();
        }
        gvSub.DataKeyNames = new string[] { "SubjectID" };
        gvSub.DataSource   = ds;
        gvSub.DataBind();
    }
    private void GetOneSubStu()
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        DataSet         ds  = sub.GetOneSubStu(id);

        gvStu.DataSource = ds;
        gvStu.DataBind();
        if (ds.Tables[0].Rows.Count == 0)
        {
            btnDown.Enabled = false;
            title.InnerText = "该课题还未被学生选";
        }
        else
        {
            title.InnerText = ds.Tables[0].Rows[0][0].ToString();
            btnDown.Enabled = true;
        }
    }
    private void GetAllSub()
    {
        Fannie.Subjects s  = new Fannie.Subjects();
        DataSet         ds = s.GetAllSub();
        //DataTable dt = new DataTable();
        DataColumn dc = new DataColumn();

        dc.ColumnName = "PId";
        ds.Tables[0].Columns.Add(dc);
        //dt=ds.Tables[0];
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["Pid"]         = (i + 1).ToString();
            ds.Tables[0].Rows[i]["SubjectName"] = SubStr(Convert.ToString(ds.Tables[0].Rows[i]["SubjectName"]), 40);
            ds.Tables[0].Rows[i]["Memo"]        = SubStr(Convert.ToString(ds.Tables[0].Rows[i]["Memo"]), 50);
            //dt.Rows[i]["SubjectName"] = SubStr(Convert.ToString(dt.Rows[i]["SubjectName"]), 40);
            //dt.Rows[i]["Memo"] = SubStr(Convert.ToString(dt.Rows[i]["Memo"]), 50);
        }
        gvSub.DataKeyNames = new string [] { "SubjectID" };
        gvSub.DataSource   = ds;
        gvSub.DataBind();
    }
Exemple #17
0
    private void GetStuSubByMajor(string major)
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        DataSet         ds  = sub.GetStuSubByMajor(major);
        DataColumn      dc  = new DataColumn();

        dc.ColumnName = "PId";
        ds.Tables[0].Columns.Add(dc);
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["PId"] = (i + 1).ToString();
        }
        gvStu.DataSource = ds;
        gvStu.DataBind();
        if (ds.Tables[0].Rows.Count == 0)
        {
            btnDown.Enabled = false;
        }
        else
        {
            btnDown.Enabled = true;
        }
    }
Exemple #18
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         subId = Convert.ToInt32(Request.QueryString["id"].ToString());
     }
     if (!IsChosenTime())
     {
         Fannie.Subjects sub = new Fannie.Subjects();
         //删除课题
         if (sub.DeleteOneSub(subId) > 0)
         {
             Response.Write("<script>alert('成功删除该课题!');location='MySubjects.aspx'</script>");
         }
         else
         {
             Response.Write("<script>alert('删除该课题失败!');history.go(-1)</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('学生选题中,无法删除!')</script>");
     }
 }
    private void GetAllStu()
    {
        Fannie.Subjects sub = new Fannie.Subjects();
        DataSet         ds  = sub.GetStuNoChoose();
        DataColumn      dc  = new DataColumn();

        dc.ColumnName = "AutoId";
        ds.Tables[0].Columns.Add(dc);
        gvStu.DataKeyNames = new string[] { "StudentID" };
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ds.Tables[0].Rows[i]["AutoId"] = (i + 1).ToString();
        }
        gvStu.DataSource = ds;
        gvStu.DataBind();
        if (ds.Tables[0].Rows.Count == 0)
        {
            btnDown.Enabled = false;
        }
        else
        {
            btnDown.Enabled = true;
        }
    }
Exemple #20
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (btnEdit.Text == "编 辑")
        {
            btnEdit.Text = "更 新";
            SetEnable(true);
        }
        else if (btnEdit.Text == "更 新")
        {
            if (IsTime())
            {
                if (Request.QueryString["id"] != null)
                {
                    subId = Convert.ToInt32(Request.QueryString["id"].ToString());
                }
                string title  = tbSubName.Text.Trim();          //课题名称
                string level  = ddlLevel.Text;
                string major  = tbMajor.Text.Trim();            //专业
                string type   = rblType.SelectedValue.Trim();   //课题类型
                string origin = rblOrigin.SelectedValue.Trim(); //课题来源
                string isNew  = rblIsNew.SelectedValue.Trim();  //课题的新旧等等
                int    isRight;                                 //是否适中
                if (rblWorkLoad.SelectedValue == "是")
                {
                    isRight = 1;
                }
                else
                {
                    isRight = 0;
                }
                int isOk;//是否能达到训练要求
                if (rblIsOK.SelectedValue == "是")
                {
                    isOk = 1;
                }
                else
                {
                    isOk = 0;
                }
                string   t1        = Request.Cookies["id"].Value.ToString(); //教师编号1
                string   t2        = t2ID;
                string   about     = tbAbout.Text.Trim();                    //课题内容
                int      maxPeople = Convert.ToInt32(ddlMax.Text);           //最大人数
                string   year      = ddlSuitYear.Text.Trim();
                int      id        = subId;
                string   tid       = t1ID;
                object[] pt        = new object[15] {
                    title, major, level, type, origin, isNew, isRight, isOk, t1, t2, about, maxPeople, year, id, tid
                };
                if (ddlLevel.SelectedIndex == 0 || ddlSuitYear.SelectedIndex == 0)
                {
                    Response.Write("<script>alert('请检查是否选择了正确的适用层次或适用年份!');history.go(-1)</script>");
                }
                else
                {
                    Fannie.Subjects sub = new Fannie.Subjects();
                    if (sub.UpdateSubject(pt) > 0)
                    {
                        Response.Write("<script>alert('课题更新成功!');location='MySubjects.aspx'</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('非本人自拟课题,无权修改!');history.go(-1)</script>");
                    }
                }
            }
            else
            {
                Response.Write("<script> alert('不在申报课题有效时间内,不能更新!');history.go(-1)</script>");
            }

            btnEdit.Text = "编 辑";
            SetEnable(false);
        }
    }