コード例 #1
0
    public static int maxPage = 0;                            //定义显示页面的最大页数,初始化为0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie usercookie = Request.Cookies["nowloginuser"];
        string     url        = PublicClass.CheckLogin(usercookie, "main");

        if (url != "")
        {
            Response.Write(url);
            return;
        }
        if (!IsPostBack)
        {
            string zyid = Request["ZyID"];
            if (zyid != null)
            {
                //判断是否存在科目信息,存在则提示不能删除专业信息,不存在则执行删除操作
                if (TbSubjectManager.QuerySubjectInfo(int.Parse(zyid)) <= 0)
                {
                    //根据专业ID删除班级、老师信息表以及专业信息表对应的信息
                    TbClassManager.DeleteClassByZyID(int.Parse(zyid));
                    TbTeacherManager.DeleteTeaByZyID(int.Parse(zyid));
                    TbSpecialityManager.DeleteSpecByZyID(int.Parse(zyid));
                }
                else
                {
                    Page.RegisterStartupScript("", "<script>alert('存在专业对应的科目信息,如需继续执行删除操作,请先删除科目信息!')</script>");
                }
            }
            GetAllSpenIntoCount();
        }
    }
コード例 #2
0
    public static DataTable studentList = new DataTable(); //定义一个Table表格,初始化为null.
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie usercookie = Request.Cookies["nowloginuser"];
        string     url        = PublicClass.CheckLogin(usercookie, "main");

        if (url != "")
        {
            Response.Write(url);
            return;
        }
        if (!IsPostBack)
        {
            this.BjName.Items.Clear();
            this.BjName.Items.Add("请选择...");
            List <TbClass> TbClass = TbClassManager.GetAllClassList();
            foreach (TbClass TbClassRow in TbClass)
            {
                string AddList = TbClassRow.Nj + TbClassRow.BjName;
                this.BjName.Items.Add(AddList);
            }
            string yhid = Request["userid"];
            if (yhid != null)
            {
                TbStudentManager.DeleteStuByYuID(int.Parse(yhid));
            }
            Load_Student();
        }
    }
コード例 #3
0
    protected void ButtonOK_Click(object sender, EventArgs e)
    {
        TbClass Class = new TbClass();

        Class.BjName = this.textName.Text;
        Class.Nj     = this.textNj.Text;
        Class.ZyID   = int.Parse(this.textZy.SelectedValue);//专业
        DataTable table = TbClassManager.Sel_Bj(Class.BjName, Class.Nj);
        int       Count = table.Rows.Count;

        if (hidClassID.Value != "")
        {
            Class.BjID = int.Parse(this.hidClassID.Value);
            TbClassManager.EditClassByID(Class);
            this.hidClassID.Value = "";
            this.textName.Text    = "";
            this.textNj.Text      = "";
        }
        else
        {
            TbClassManager.AddClass(Class.BjName, Class.Nj, Class.ZyID);
            textName.Text = "";
            textNj.Text   = "";
        }
        GetPageInfo();
    }
コード例 #4
0
    static int FirstSxNum = 0;/*声明变量,初始化为0,用于判断筛选条件是否改变*/

    /// <summary>
    /// 获取页面信息
    /// </summary>
    public void GetPageInfo()
    {
        if (classList != null)
        {
            string ClassNameOrNj = txtClassName.Value.Trim() == "按班级名、年级或专业名模糊查找" ? "" : txtClassName.Value.Trim();
            if (ClassNameOrNj != "按班级名、年级或专业名模糊查找" && ClassNameOrNj != "" && FirstSxNum == 0)
            {
                nowPage    = 1;
                FirstSxNum = 1;
            }
            Record    = TbClassManager.GetAllClassInfo(ClassNameOrNj).Rows.Count;/*记录总数*/
            classList = TbClassManager.GetAllClassInfoPage(len, nowPage, ClassNameOrNj);
            if (Record % len == 0)
            {
                if (Record > 0)
                {
                    Pages = (Record / len);
                }
                else
                {
                    Pages = 1;
                }
            }
            else
            {
                Pages = (Record / len) + 1;
            }
        }
    }
コード例 #5
0
    public static int Record  = 0;  //定义当前符号查询的记录总数,初始化为0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie usercookie = Request.Cookies["nowloginuser"];
        string     url        = PublicClass.CheckLogin(usercookie, "main");

        if (url != "")
        {
            Response.Write(url);
            return;
        }

        if (!IsPostBack)
        {
            string bjid = Request["BjID"];
            if (bjid != null)
            {
                TbClassManager.DeleteClassInfo(int.Parse(bjid));
            }
            GetPageInfo();
            //绑定专业名称
            DataTable dt = TbSpecialityManager.BangdingZy();
            textZy.DataSource     = dt;
            textZy.DataTextField  = "ZyName";
            textZy.DataValueField = "ZyID";
            textZy.DataBind();
            textZy.Items.Insert(0, new ListItem("请选择..", "0"));
        }
    }
コード例 #6
0
ファイル: ajax.aspx.cs プロジェクト: BigGoodLoong/Examination
    /// <summary>
    /// 根据班级ID查询对应详细详细
    /// </summary>
    /// <param name="BjID">班级ID</param>
    private void GetClass(int BjID)
    {
        TbClass Class   = TbClassManager.GetClassByID(BjID);
        string  ZyName  = TbSpecialityManager.GetSpecialityName(Class.ZyID);//获取专业ID对应的专业名称
        string  message = Class.BjID + "|" + Class.BjName + "|" + Class.Nj + "|" + ZyName;

        Response.Write(message);
    }
コード例 #7
0
ファイル: ajax.aspx.cs プロジェクト: BigGoodLoong/Examination
    /// <summary>
    /// 判断班级是否存在
    /// </summary>
    /// <param name="BjName">班级名称</param>
    /// <param name="Nj">年级</param>
    private void CheckClassNameIsExist(string BjName, string Nj)
    {
        string    bjid  = Request["BjID"];
        DataTable dt    = TbClassManager.Sel_Bj(BjName, Nj);
        int       Class = 0;

        foreach (DataRow item in dt.Rows)
        {
            Class = int.Parse(item["BjID"].ToString());
        }
        if (Class > 0 && Class.ToString() != bjid)
        {
            Response.Write("已存在");
        }
        else
        {
            Response.Write("不存在");
        }
    }